var _cityId =1;
var _cityNm = "北京";
$(document).ready(function(){
	

});
	
	function beijing(){ 
		$('.index_content_inside #city_1').show();
		_cityNm = $('.title_tabs ul li a').eq(0).html();
	}
	 // click city list eg: beijing..

function choose(obj,event)
{
    $('#link_city').val($(obj).attr('value').split('_')[1]);   
        
	stopDefault(event);
	//$('.destination_content').find('.on').removeClass('on');	
	$('.title_tabs').find('.on').removeClass('on');	
	$('.index_title .title_tabs').find('a:contains("'+$(obj).html()+'")').parent().addClass('on');
	$('.destination_content .title_tabs').find('a:contains("'+$(obj).html()+'")').addClass('on');
	
	var clickValue = $(obj).attr("value");
	_cityNm = $(obj).html();
	_cityId =  $(obj).attr('value').split('_')[1];
	
	$('.index_content_inside div').hide();
	$('.index_content_inside #'+clickValue).show();
}
// stop href link site...
function stopDefault(e)
     {
        if (e && e.preventDefault) 
        e.preventDefault(); 
        else
        window.event.returnValue=false; 
     }
function clickSearch(obj){
	link = $('#city_from').val();
	
}
function clickPrice(obj,event){
	stopDefault(event);

	checkCityKeyWord(obj);

	var _priceVa = $(obj).attr("value");
	var searchCount = ( getCookie("oyesgofhc") == null || getCookie("oyesgofhc")== "")?1:getCookie("oyesgofhc");
	setCookie("oyesgofhc",parseInt(((searchCount == null || searchCount == "")?1:searchCount)) + 1,'','/',"oyesgo.com");
	
	var _o_phref = $(obj).attr('href');	
	location.href =$('#link_city').val()+'_'+_o_phref;
	//var hrefss = "searchPriceCar.action?city_from="+ _cityId +"&priceVa="+_priceVa+"&bDate="+$("#bDate").val()+"&city_from_str="+_cityNm;
	//location.href = hrefss;

}
function clickChexi(obj,event){
	stopDefault(event);
	// check null
	checkCityKeyWord(obj);
	
	var _chexiVa = $(obj).attr("value");
	var searchCount = ( getCookie("oyesgofhc") == null || getCookie("oyesgofhc")== "")?1:getCookie("oyesgofhc");
	setCookie("oyesgofhc",parseInt(((searchCount == null || searchCount == "")?1:searchCount)) + 1,'','/',"oyesgo.com");
	
	var _o_phref = $(obj).attr('href');	
	location.href =$('#link_city').val()+'_'+_o_phref;
	//var hrefss = "searchChexiCar.action?city_from="+ _cityId +"&chexiVa="+_chexiVa+ "&bDate="+$("#bDate").val()+"&city_from_str="+_cityNm;
	//location.href = hrefss;
}

function clickCarTyp(obj,event){
		//stopDefault(event);		
		var _carTypId = $(obj).attr("ord");
		var searchCount = ( getCookie("oyesgofhc") == null || getCookie("oyesgofhc")== "")?1:getCookie("oyesgofhc");
		setCookie("oyesgofhc",parseInt(((searchCount == null || searchCount == "")?1:searchCount)) + 1,'','/',"oyesgo.com");
		
		//link = $(obj).children("#title").val();
		//alert(link);
		//var hrefss = "searchTypeCar.action?city_from="+ _cityId +"&carTypId="+_carTypId+ "&bDate="+$("#bDate").val();
		
		//location.href = hrefss;
}//

	// clear value id data if null
function checkCityKeyWord(obj){
	if($.trim($('#city_from').val())==''){
		$('#city_fr_va').val('');
	}
	if($.trim($('#city_to').val())==''){
		$('#city_to_va').val('');
	}	
	if($.trim($('#hotKeyStr').val())==''){
		$('#keyWordTyp_va').val('');
		$('#keyWord_va').val('');
		$('#tab_cont_va').val('');
	}	
}