$(document).ready(function() {
	setTimeout(function(){
	//city select
	/*
	$('#city1').selectbox().bind('change', function(){ 
		if($(this).val()==""){
			set_select('city2', "");
			set_select('local2', "");
			yer_getir(0); 
		}else{
			set_select('city2', $(this).val());
			yer_getir(1);
			yer_getir(2);
		}
	});*/
	/*$('#city2').selectbox().bind('change', function(){yer_getir(2);});*/
	$('#local1').selectbox({className:selectclass}).bind('change', function(){set_select('local2', $(this).val());});
	$('#local2').selectbox({className:selectclass}).bind('change', function(){});
	
	$('#tlocal1').selectbox({className:selectclass}).bind('change', function(){yer_getir2()});
	$('#tlocal2').selectbox({className:selectclass}).bind('change', function(){});
	
	set=function(){$("#change_form").attr("action",""); setTimeout('$("#change_form").submit();',500);}
	$('#local1'	).bind('change', function(){set();});
	$('#local2'	).bind('change', function(){set();});
	$('#day1'	).bind('change', function(){set();});
	$('#month1'	).bind('change', function(){set();});
	$('#year1'	).bind('change', function(){set();});
	$('#hour1'	).bind('change', function(){set();});
	$('#min1'	).bind('change', function(){set();});
	$('#date1'	).bind('change', function(){set();});
	$('#day2'	).bind('change', function(){set();});
	$('#month2'	).bind('change', function(){set();});
	$('#year2'	).bind('change', function(){set();});
	$('#hour2'	).bind('change', function(){set();});
	$('#min2'	).bind('change', function(){set();});
	$('#date2'	).bind('change', function(){set();});
	
	$('.payment').bind('check', function(){
		$(this).val()=="0"?
		  $('.indirim').css("visibility","visible"):
		  $('.indirim').css("visibility","hidden");
		 
		$('.priinf').css("display","none");
		$('.priinf'+$(this).val()).css("display","block");
		$('.priinf'+$(this).val()+' div').hide().fadeIn();
	});
	
	$('#return').selectbox({className:selectclass}).bind('change', function(){
		$(this).val()=="tekyon"?$("#returndiv").css("visibility","hidden"):$("#returndiv").css("visibility","visible");});
	
	$('#cartype').selectbox({className:selectclass}).bind('change', function(){});
	$('#pricetype').selectbox({className:selbox3}).bind('change', function(){});
	$('#age').selectbox({className: 'jquery-selectbox3'}).bind('change', function(){});
	$('#country').selectbox({className:selectclass}).bind('change', function(){});
	
	$('#distance1').selectbox({className: 'jquery-selectbox3'}).bind('change', function(){});
	$('#distance2').selectbox({className: 'jquery-selectbox3'}).bind('change', function(){});
	},($.browser.msie?200:0));
	
	//lang select
	$("#lang").click(function () {
      $("#langs").slideToggle();
	});
	$(document).bind('click', function(e) {
	  var trgt = e.target;
	  var currentListElements = jQuery('#langs div img').parent().parent().parent().find('*').andSelf();
	  if(jQuery.inArray(trgt, currentListElements)<0) {$('#langs').slideUp(); }	  
	});
	/*
	//tooltips
	$(".tooltip").tooltip({
		track: true,
		delay: 0,
		showURL: false,
		showBody: " - ",
		fade: 250
	});
	
	//fancy checkbox
	$('input[safari]:checkbox').checkbox({cls:'jquery-safari-checkbox'});
	*/
	//exchange
	$.getJSON(root+'php/infos.php?infos=exchange', {},
	function(jsonObj){
		$("#dollar").html(jsonObj[0]);
		$("#euro").html(jsonObj[2]);
		$("#pound").html(jsonObj[4]);
	});	
	//weather
	$.getJSON(root+'php/infos.php?infos=weather&weather=TUXX0060', {},
	function(jsonObj){
		$("#weather_img").attr("src",root+"php/weather/weather_icons/"+jsonObj.image+".png");
		$("#weather").html(jsonObj.place+" "+jsonObj.degree);
		$('#weather_img').ifixpng();
	});
	
	//preload
	jQuery.preloadImages = function(){
	  for(var i = 0; i<arguments.length; i++){
		jQuery("<img>").attr("src", arguments[i]);//.appendTo("body");
	  }
	};
	/*
	$.preloadImages(
		theme+"/images/langs_bg.png", 
		theme+"/images/chek.png", 
		theme+"/images/cheked.png", 
		theme+"/images/pollbarl.png", 
		theme+"/images/pollbarr.png", 
		theme+"/css/images/ui-bg_highlight-soft_44_444444_1x100.png", 
		theme+"/css/images/ui-icons_ffffff_256x240.png", 
		theme+"/images/info.png",
		theme+"/images/+.png",
		theme+"/images/-.png"
	);
	*/
	
	$('#logo img').ifixpng();
	$('.footer').ifixpng();
	$('#weather_img').ifixpng();
	$('#blocks').ifixpng();
	$('#first').ifixpng();
	$('#news').ifixpng();
	$('#menu').ifixpng();
	setTimeout(function(){
	$('.ad-prev-image').ifixpng();
	$('.ad-next-image').ifixpng();},100);
	$('.contact img').ifixpng();
	$('.sinfo img').ifixpng();
	$('.ad-gallery').next().ifixpng();
	if($.browser.msie && $.browser.version < 7){
		$('.cchange').css("margin-right","0");
		$('.morepic').css("left","190px");
		setTimeout(function(){
		  $('.search1').css("visibility","visible")
		  $('.ttable').css("visibility","visible")
		},1000);
		
	};
	
	$('body').css("visibility","visible");
	
	$(window).scroll(function(){
		$(window).scrollTop(); 
	});
	
	var galleries = $('.ad-gallery').adGallery();
	
	$("a[rel^='lightbox']").prettyPhoto({theme:'facebook'});

	$('#leftmenu').parent().parent().height()<411?$('#leftmenu').parent().parent().css("height","411px"):"";
	
		$('.subm').hover(function(){
		$(this).find('.subh').fadeIn();},function(){
		$(this).find('.subh').fadeOut();});
	
});

//News - developer: misima
$(document).ready(function() {
	news_slider();
});
news_current = 0;
news_heads	 = ".news_heads div"
news_conts	 = ".news_conts .row"
function news_slider() {
	$(news_heads).css({opacity: 0.0});
	$(news_heads+':first').css({opacity: 1.0});
	$(news_conts).css({opacity: 0.0});
	$(news_conts+':first').css({opacity: 1.0});
	$(news_conts).parent().hide();
	$(news_heads).parent().click(function(){$(news_conts).parent().slideToggle();});
	newssetint = setInterval('news_next()',6000);
}
function news_next() {
	news_old=news_current;news_current=news_current+1;news_current==$(news_heads).length?news_current=0:"";
	$(news_heads).eq(news_old).animate({opacity: 0.0}, 1000).removeClass('show');
	$(news_heads).eq(news_current).css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
	$(news_conts).eq(news_old).animate({opacity: 0.0}, 1000).removeClass('show');
	$(news_conts).eq(news_current).css({opacity: 0.0}).addClass('show').animate({opacity: 1.0}, 1000);
}
 
 
 
 
 
 
 
 

//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,
		//backgroundColor	:	'#FFFFFF',
		position	:	'absolute',
		left		:	'50%',
		top		:	$(document).scrollTop(),
		zIndex		:	101,
		marginLeft	:	-(Math.ceil((width ? width : 800)/2)),
		marginTop	:	Math.ceil(($(window).height()-height)/2)
	}).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()
		});
	});
};


