﻿$(document).ready(function(){	
	$("#slider").easySlider({
		auto: true,
		speed: 500,
		pause: 7000,
		prevId: 'homePageSliderPrev',
		prevText: '&#160;',
		nextId: 'homePageSliderNext',	
		nextText: '&#160;',
		continuous: true 
	});	
});	

$(document).ready(function(){
	$("a[rel^='photo']").prettyPhoto({
		animationSpeed: 'fast', /* fast/slow/normal */
		padding: 0, /* padding for each side of the picture */
		opacity: 0.8, /* Value betwee 0 and 1 */
		showTitle: true, /* true/false */
		allowresize: true, /* true/false */
		counter_separator_label: ' ze ' /* The separator for the gallery counter 1 "of" 2 */
	});
});


$(document).ready(function(){
    
	$('.jcarousel-skin-tango').jcarousel({
        scroll: 2
    });
    
    $('#goodSliderUL').jcarousel({
        scroll: 2
    });
	
});




$(document).ready(function(){

	$('#thumbsBottomContent a').click(function() {
				
		$('.photoContentBottom').html('<img src="' + $(this).attr('href') + '" width="673" alt="" />');
		
	});

});


//* TABS HEADER *//
//* urcuje odsazeni zahlavi u zalozek z leva *//
$(document).ready(function(){

	var tabsHeader1 = $('#tabsHeader1').width();
	var tabsHeader2 = $('#tabsHeader2').width();
	var tabsHeader3 = $('#tabsHeader3').width();
	var tabsHeader4 = $('#tabsHeader4').width();
	var tabsHeader5 = $('#tabsHeader5').width();

	$('#tabsHeader1').css('left','20px');
	$('#tabsHeader2').css('left',tabsHeader1 + 19 + 'px');
	$('#tabsHeader3').css('left',tabsHeader1 + tabsHeader2 + 19 + 'px');
	$('#tabsHeader4').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + 19 + 'px');
	$('#tabsHeader5').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + tabsHeader4 + 19 + 'px');
	$('#tabsHeader6').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + tabsHeader4 + tabsHeader5 + 19 + 'px');
	
	
	var tabsHeadersale1 = $('#tabsHeadersale1').width();
	var tabsHeadersale2 = $('#tabsHeadersale2').width();
	var tabsHeadersale3 = $('#tabsHeadersale3').width();

	$('#tabsHeadersale1').css('left','20px');
	$('#tabsHeadersale2').css('left',tabsHeadersale1 + 19 + 'px');
	$('#tabsHeadersale3').css('left',tabsHeadersale1 + tabsHeadersale2 + 19 + 'px');
	
	
	
	$('#tabsHeader1').click(function () {
		$('.tabsHeader').removeClass("tabsHeaderAct");
		$(this).addClass("tabsHeaderAct");
		$('.tabsContent').removeClass("tabsContentAct");
		$('#tabsContent1').addClass("tabsContentAct");
		
		resizeTabsHeader()
		
		$(document).ready(function() { load1(); });
		$(window).unload(function() { GUnload(); });
		
	});
	
	$('#tabsHeader2').click(function () {
		$('.tabsHeader').removeClass("tabsHeaderAct");
		$(this).addClass("tabsHeaderAct");
		$('.tabsContent').removeClass("tabsContentAct");
		$('#tabsContent2').addClass("tabsContentAct");
		
		resizeTabsHeader()
		
		$(document).ready(function() { load2(); });	
		$(window).unload(function() { GUnload(); });
		
	});
	
	$('#tabsHeader3').click(function () {
		$('.tabsHeader').removeClass("tabsHeaderAct");
		$(this).addClass("tabsHeaderAct");
		$('.tabsContent').removeClass("tabsContentAct");
		$('#tabsContent3').addClass("tabsContentAct");
			
		resizeTabsHeader()
				
	});
	
	$('#tabsHeader4').click(function () {
		$('.tabsHeader').removeClass("tabsHeaderAct");
		$(this).addClass("tabsHeaderAct");
		$('.tabsContent').removeClass("tabsContentAct");
		$('#tabsContent4').addClass("tabsContentAct");
			
		resizeTabsHeader()
				
	});
	
	$('#tabsHeader5').click(function () {
		$('.tabsHeader').removeClass("tabsHeaderAct");
		$(this).addClass("tabsHeaderAct");
		$('.tabsContent').removeClass("tabsContentAct");
		$('#tabsContent5').addClass("tabsContentAct");
			
		resizeTabsHeader()
				
	});
	
	
});



function resizeTabsHeader() {

	var tabsHeader1 = $('#tabsHeader1').width();
	var tabsHeader2 = $('#tabsHeader2').width();
	var tabsHeader3 = $('#tabsHeader3').width();
	var tabsHeader4 = $('#tabsHeader4').width();
	var tabsHeader5 = $('#tabsHeader5').width();
	
	$('#tabsHeader1').css('left','20px');
	$('#tabsHeader2').css('left',tabsHeader1 + 19 + 'px');
	$('#tabsHeader3').css('left',tabsHeader1 + tabsHeader2 + 19 + 'px');
	$('#tabsHeader4').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + 19 + 'px');
	$('#tabsHeader5').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + tabsHeader4 + 19 + 'px');
	$('#tabsHeader6').css('left',tabsHeader1 + tabsHeader2 + tabsHeader3 + tabsHeader4 + tabsHeader5 + 19 + 'px');
	

}


$(document).ready(function() {

	$('.tabulka-parametry tr').mouseover(function() {
			
		if ($(this).attr('class') == '') {
		
			var trHeight = $(this).height()
					
			if (trHeight < 25) {
			
				$(this).addClass('tabulka-parametry-hover-1');
			
			} else if (trHeight > 25 && trHeight < 50) {
			
				$(this).addClass('tabulka-parametry-hover-2');
			
			} else if (trHeight > 50){
			
				$(this).addClass('tabulka-parametry-hover-3');
			
			}			
		}
		
	});
	
	$('.tabulka-parametry tr').mouseout(function() {
	
		$(this).removeClass('tabulka-parametry-hover-1');
		$(this).removeClass('tabulka-parametry-hover-2');
		$(this).removeClass('tabulka-parametry-hover-3');
		
	});
	
	if ($('.tabulka-parametry tr:last')) {
		$('.tabulka-parametry tr:last td').css('background', 'white')
	}
	
});



$(document).ready(function() {

	$('.showDistrict').click(function(){
		
		thisHref = $(this).attr('href') + "&layout=ajax"
		
		$.get(
			thisHref,
			function(data) {			
				$('#detailCountryItemContent').html(data);
			}
		);
		
		return false;
		
	});

});


$(document).ready(function() {	
	
	var languageAbbreviation = $("meta[http-equiv='Content-Language']").attr('content')
	
	$('.otherMapInformation').click(function() {
		
		data = '<div class="itemDistrictTop">'
		data += '<div class="itemDistrictBottom">'
		data += '<a href="javascript:void(0)" class="closeDistrict closeOtherMapInformation">&nbsp;</a>'
		data += '<div class="itemDistrict">'
		data += '<div class="itemDistrictContent">'
		//data += '<strong class="strongHeader">Other</strong>'
		data += '<ul>'	
		if (languageAbbreviation == 'cs') {
			data += '<li>Pro více informací nás kontaktujte na <a href="mailto:marketing@zetor.com">marketing@zetor.com</a></li>'
		} else {
			data += '<li>For more information you can contact us on e-mail address <a href="mailto:marketing@zetor.com">marketing@zetor.com</a></li>'
			data += '<li>Для получения более подробной информации напишите нам: <a href="mailto:marketing@zetor.com">marketing@zetor.com</a></li>'
			data += '<li>Pour plus d´informations contactez-nous sur <a href="mailto:marketing@zetor.com">marketing@zetor.com</a></li>'
			data += '<li>Para más información contactar: <a href="mailto:marketing@zetor.com">marketing@zetor.com</a></li>'
			data += '<li><a href="mailto:marketing@zetor.com">marketing@zetor.com</a> للمزيد من المعلومات يرجى الاتصال بنا على العنوان </li>'
		}
		data += '</ul>'
		data += '</div>'
		data += '</div>'
		data += '</div>'
		data += '</div>'
				
		$('#otherMapInformation').html(data)		
		$('#otherMapInformation').css('display', 'block')
		
		$('.closeOtherMapInformation').click(function() {		
			$('#otherMapInformation').html('')		
			$('#otherMapInformation').css('display', 'none')		
		});
	
	});
	
	$('#mapsOtherInformation a').click(function() {
		
		thisRel = $(this).attr('rel')
		
		data = '<div class="itemDistrictTop">'
		data += '<div class="itemDistrictBottom">'
		data += '<a href="javascript:void(0)" class="closeDistrict closeOtherMapInformation">&nbsp;</a>'
		data += '<div class="itemDistrict">'
		data += '<div class="itemDistrictContent">'
		data += thisRel
		data += '</div>'
		data += '</div>'
		data += '</div>'
		data += '</div>'
				
		$('#mapsOtherInformationContent').html(data)	
		$('.itemDistrictContent span').replaceWith('<a href="mailto:marketing@zetor.com">marketing@zetor.com</a>')
		$('#mapsOtherInformationContent').css('display', 'block')
		
		$('.closeOtherMapInformation').click(function() {		
			$('#mapsOtherInformationContent').html('')		
			$('#mapsOtherInformationContent').css('display', 'none')		
		});	
				
		return false;
	
	});
	
	
	
});


function listContainsHeaderShow(goodsID) {
	
	showlistContainsHeader = "#listContainsHeader" + goodsID
	showlistContainsContent = "#listContainsContent" + goodsID
	
	$('.listContainsHeader').removeClass("listContainsHeaderAct")
	$(showlistContainsHeader).addClass("listContainsHeaderAct");
				
	$('.listContainsContent').css("display", "none");
	$(showlistContainsContent).css("display", "block");
	
}


function closeDistrict() {
		
	$('#detailCountryItemContent').html("");

}


function showInMap(strongName, thisDivGPS) {
	
	thisgps = thisDivGPS.indexOf(",")
	thisgpslength = thisDivGPS.length
	
	thisgpsxPos = thisDivGPS.substring(0, thisgps)
	thisgpsxFinal = Math.abs(thisgpsxPos)
	
	thisgpsyPos = thisDivGPS.substring(thisgps + 1, thisgpslength)
	thisgpsyFinal = Math.abs(thisgpsyPos)
	
	$('.maps').css('display', 'block')
	$('.list').css('display', 'none')
			
	ViewCompanyInMap(thisgpsxFinal, thisgpsyFinal, strongName)
	
	$('#chooseSalesTyp1').attr('checked', 'checked')
		
}


function changeDivInformation(input) {
	
	$('.maps').css('display', 'none')
	$('.list').css('display', 'none')
	
	showDiv = "." + input + ""
		
	$(showDiv).css('display', 'block')

}


$(document).ready(function() {
	
	$("#selectCountry").change(function () {
		
		openHref = $(this).attr('value')
		window.open(openHref, "_blank")
		
	});
	
	
	$(".uploadfile").change(function () {
		$('#fileName').attr('value', $(this).attr('value'))
	});
});





