$(document).ready(function() {
			
	$('.sdw').each(function(){ t=$(this).parent().css('padding-top').replace("px","");l=$(this).parent().css('padding-left').replace("px","");
		$(this).css("position","relative").clone().css({"position":"absolute","left":(parseInt(l)+1)+"px","top":(parseInt(t)+1)+"px","color":"#"+$(this).attr('lang')
		}).prependTo($(this).parent().css("position",$(this).parent().css("position")=="absolute"?"absolute":"relative"));
	});			   
	if ($.browser.msie && $.browser.version.substr(0,1)>7){}
	else{
		Cufon.replace('.menu a');
		Cufon.replace('.slide .h');
		Cufon.replace('.infos .he');
		Cufon.now();
	}			   
	$('.menu a:last-child').css("background-image","none");
	
	$(".scroll").scrollable({size:1,clickable: false,easing: 'easeInOutCirc',speed:500,circular:true}).autoscroll({steps:1,interval: 5000}).navigator(".snav"); 

	$(".weater .wnav").tabs(".weaters", {effect: 'fade',fadeOutSpeed: "slow",rotate: true }).slideshow({autoplay:true,interval: 6000,clickable: false });
	
	$(".info .inav").tabs(".info .item", {effect: 'fade',fadeOutSpeed: "slow",rotate: true }).slideshow({autoplay:true,interval: 6000,clickable: false });
	
	$(".news .nnav").tabs(".news .item", {effect: 'fade',fadeOutSpeed: "slow",rotate: true }).slideshow({autoplay:true,interval: 6000,clickable: false });

	
	//city select
	if(mod=='rent')
	$('#city1')		.selectbox({className:selectclass }).bind('change', function(){ yer_getir(1); set_select('city2', $(this).val()); yer_getir(2);});
	$('#local1')	.selectbox({className:selectclass }).bind('change', function(){ if(mod=='trans')yer_getir2(); else set_select('local2', $(this).val());});
	if(mod=='rent')
	$('#city2')		.selectbox({className:selectclass }).bind('change', function(){ yer_getir(2);});
	$('#local2')	.selectbox({className:selectclass }).bind('change', function(){});
	$('#cartype')	.selectbox({className:selectclass }).bind('change', function(){});
	$('#age')		.selectbox({className:selectdclass}).bind('change', function(){});
	$('#pricetype')	.selectbox({className:selectclass }).bind('change', function(){});
	$('#distance1')	.selectbox({className:selectclass,listboxMaxSize: 7}).bind('change', function(){});
	$('#distance2')	.selectbox({className:selectclass,listboxMaxSize: 7}).bind('change', function(){});
	$('#country2')	.selectbox({className:selectclass,listboxMaxSize: 7,width: 219}).bind('change', function(){});
	$('#transcat')	.selectbox({className:selectclass,listboxMaxSize: 7,width: 100}).bind('change', function(){});
	$('#transcity')	.selectbox({className:selectclass,listboxMaxSize: 7,width: 100}).bind('change', function(){});
	
	$('#cartype2')	.selectbox({className:'jquery-selboxm' ,width: 100}).bind('change', function(){});
	$('#country')	.selectbox({className:'jquery-selboxm',listboxMaxSize: 7}).bind('change', function(){});
	$('#weatherid')	.selectbox({className:'jquery-selboxl',listboxMaxSize: 7}).bind('change', function(){});
	
	$('#sezno')	.selectbox({className:'jquery-selboxm' ,width: 250}).bind('change', function(){});
	
	$('#return').selectbox({className:selectclass}).bind('change', function(){ 
		if($(this).val()=="1"){$('.returndiv').animate({'opacity':'0'});}
		if($(this).val()=="2"){$('.returndiv').animate({'opacity':'1'});}
	});

	
	$(document).bind('click', function(e) {
	  var trgt = e.target;
	  var currentListElements = jQuery('#lang_button').parent().parent().find('*').andSelf();
	  if(jQuery.inArray(trgt, currentListElements)<0 ) {$('#lang_cont').slideUp(); }	  
	});

	//exchange
	if(false)
	$.getJSON(root+'php/infos.php?infos=exchange', {},
	function(jsonObj){
		$("#dollar").html(jsonObj[0]);
		$("#euro").html(jsonObj[2]);
	});	
	//weather
	weather = function(w){
		$.getJSON(root+'php/infos.php?infos=weathers&weather='+w, {},
		function(jsonObj){
			if(typeof(jsonObj[0].degree)!="undefined"){
			$(".weimg1").attr("src",root+"php/weather/icons/"+jsonObj[0].image+".png");
			$(".weimg2").attr("src",root+"php/weather/icons/"+jsonObj[1].image+".png");
			$(".wecity").html(jsonObj[0].place);
			$(".wedeg1").html(jsonObj[0].degree.replace('C',''));
			$(".wedeg2").html(jsonObj[1].high.replace('C',''));
			DD_belatedPNG.fix('.weimg1');
			DD_belatedPNG.fix('.weimg2');
			}
		});
	}
	weather($('#weatherid').val());
	
	
	
	$('#search1').css("visibility","visible");
	$('#search2').css("visibility","visible");
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		$("#year1").prev().css("position","absolute");
		$("#year2").prev().css("position","absolute");

		//pngfix
		DD_belatedPNG.fix('.badget');
		DD_belatedPNG.fix('.banner .text');
		DD_belatedPNG.fix('#search1');
		DD_belatedPNG.fix('.foo');
		DD_belatedPNG.fix('.crow');
		DD_belatedPNG.fix('.crow img');
		DD_belatedPNG.fix('.crow .cprice');
		DD_belatedPNG.fix('.fea');
		DD_belatedPNG.fix('.fea .prices');
		
		$('#search2').css("overflow","hidden");
	}
	
	$('.bmenu a:last-child').find('span:last-child').text('');

	$('.leftblockcont.pagem').height()<200?$('.leftblockcont.pagem').css('height','300px'):"";
	

	$.fn.ezpz_tooltip.positions.topLeft = function(contentInfo, mouseX, mouseY, offset, targetInfo) {
		contentInfo['top'] = offset.top;
		contentInfo['left'] = offset.left;
	
		return contentInfo;
	};
	

	$(".exdecr").ezpz_tooltip({
		contentPosition: 'topLeft',
		showContent: function(content) {
			content.fadeIn('slow');
		},
		hideContent: function(content) {
			// if the showing animation is still running, be sure to stop it
			// and clear the animation queue. otherwise, repeatedly hovering will
			// cause the content to blink.
			content.stop(true, true).fadeOut('slow');
		}
	});
	
	
	$('.absmiddle').attr('align','absmiddle');
	if($.browser.msie)$('.absmiddle').css('vertical-align','middle');
	else $('.absmiddle').css('vertical-align','sub');
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7){}
	//else $('#search2').css("overflow","visible");

	if(page=='iletisim' || page=='contact' || page=='kontakt'){
		plugo_head = $('.plugo_head').html();
		plugo = $('.plugo').html();
		plugo_html = '\
		<div class="leftblock">\
		  <div class="leftblockcont pagem" >\
			  <h2 class="head">'+plugo_head+'</h2>\
			  '+plugo+'\
			  <div style="clear:both"></div>\
		  </div>\
		  <div class="leftblockbot"></div>\
		</div>';
		div = $('<div class="fl"></div>');
		
		$('.leftblock').replaceWith(div).appendTo(div);
		$('.leftblock').after(plugo_html);
	}
	
});

//modalbox
var IE6 = false /*@cc_on || @_jscript_version < 5.7 @*/;
function modalBox(content, width, height, close) {
	if(close){
		$(content).append($('#ntz_modal div:first'));
		$('#ntz_modal').remove();
		$('#ntz_overlay').fadeOut(function(){$(this).remove();});
		try{if(IE6){$('body').find('select.unhideThis').removeClass('unhideThis').visibility('visible');}}catch(err){};
		$('embed.unhideThis, object.unhideThis').removeClass('unhideThis').css('visibility', 'visible');
		return false;
	}
	try{if(IE6){$('body').find('select:visible').addClass('unhideThis').visibility('hidden');}}catch(err){};
	$('embed:visible, object:visible').addClass('unhideThis').css('visibility', 'hidden');
	$('body').append('<div id="ntz_overlay"></div>');
	$('#ntz_overlay').click(function(){modalBox(content, '', '', true)});
	$('#ntz_overlay').css({
		width		:	'100%',
		height		:	$(document).height(),
		position	:	'absolute',
		left		:	0,
		top		:	0,
		backgroundColor	:	'#000',
		zIndex		:	100,
		opacity		:	0
	}).fadeTo(200, 0.5);
	$('body').append('<div id="ntz_modal"></div>');
	$('#ntz_modal').css({
		//border		:	'1px solid #2d7abb',
		width		:	width ? width : 350,
		height		:	height ? height : 350,
		//backgroundColor	:	'#FFFFFF',
		position	:	'absolute',
		left		:	'50%',
		top		:	$(document).scrollTop(),
		zIndex		:	101,
		marginLeft	:	-(Math.ceil((width ? width : 800)/2))+130,
		marginTop	:	Math.ceil(($(window).height()-height)/2)+100
	}).append($(content+' div:first')).show("drop",{direction:'up'},500);//.draggable();
	//$('#ntz_modal a:eq(0), #ntz_modal input, #ntz_modal textarea').focus();
	try{
		callback.call();
	}catch(err){};	
	$(document).bind('scroll', function(){
		$('#ntz_modal').css({
			top:$(document).scrollTop()
		});
	});
};

function openSupport(){
  window.open('https://messenger.providesupport.com/messenger/economicrentacar.html', 'support', 
  'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=835,height=500,left = '+
  ((screen.width-835)/2)+',top = '+((screen.height-500)/2)+'');
}

