$(document).ready(function() {
						   
						   
	$('#menu a:last-child').css("background-image","none");
	
	$(".scroll").scrollable({size:2,clickable: false}).autoscroll({steps:1,interval: 3000}).navigator(".sliden"); 

	//$(".newsslide").slideshow({autoplay:true,interval: 4000});

	$(".newsn").tabs(".newss .item", {
		effect: 'fade',
		fadeOutSpeed: "slow",
        rotate: true ,
		onBeforeClick:function(event, index) { }
	}).slideshow({autoplay:true,interval: 4000,clickable: false });
	
	$("#slidel .sliden").tabs("#slidel .slides", {
		effect: 'fade',
		fadeOutSpeed: "slow",
        rotate: true ,
		onBeforeClick:function(event, index) { }
	}).slideshow({autoplay:true,interval: 4000,clickable: false });

	
	//city select
	$('#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(){});
	$('#city2').selectbox({className:selectclass}).bind('change', function(){ yer_getir(2);});
	$('#local2').selectbox({className:selectclass}).bind('change', function(){});
	$('#cartype').selectbox({className:selectdclass}).bind('change', function(){});
	$('#age').selectbox({className:selectdclass}).bind('change', function(){});
	$('#pricetype').selectbox({className:selectdclass}).bind('change', function(){});
	$('#distance1').selectbox({className:selectclass,listboxMaxSize: 7}).bind('change', function(){});
	$('#distance2').selectbox({className:selectclass,listboxMaxSize: 7}).bind('change', function(){});
	$('#country').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(){});
	$('#weatherid').selectbox({className:'jquery-selboxw',listboxMaxSize: 7}).bind('change', function(){});
	
	$('#return').selectbox().bind('change', function(){ 
		if($(this).val()=="2"){$('#returndiv').show();}
		if($(this).val()=="1"){$('#returndiv').hide();}
	});

	
	$(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
	$.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){
			$(".weimg").attr("src",root+"php/weather/icons/"+jsonObj[0].image+".png");
			$(".wecity").html(jsonObj[0].place);
			$(".wedegre").html(jsonObj[0].degree);
			$(".wedegree").html(jsonObj[1].high);
			$('.weimg').ifixpng();
			$('.weimg2').ifixpng();
		});
	};weather('TUXX0015');
	
	
	
	$('#search1').css("visibility","visible");
	
	
	if ($.browser.msie && $.browser.version.substr(0,1)<7) {
		$("#year1").prev().css("font-size","0.8em");
		$("#year2").prev().css("font-size","0.8em");

		//pngfix
		$('#esinti').ifixpng();
		$('#carpriceb').ifixpng();
		$('.ui-datepicker-trigger').ifixpng();
		$('.slide').next().find("img").ifixpng();
		
		$('.slide').ifixpng();
		$('a.hover').ifixpng();
		$('.millf').ifixpng();
	}
	
	$('.foomenu a:last-child').find('span:last-child').text('');
	
	$('.sdw_obj').each(function(){
		$(this).css("position","relative").clone().css({"position":"absolute","left":"1px","top":"1px","color":"#fff"
		}).prependTo($(this).parent().css("position",$(this).parent().css("position")=="absolute"?"absolute":"relative"));
	});
	
	
	

});

//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/dabrentacar.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)+'');
}

