function newslist(num){
	if(num==1){
		onum=2;
	}else{
		onum=1;
	}
		//交换显示
		$("#newslist"+onum).css("display","none");
		$("#newslist"+num).css("display","block");
		//文字样式改变
		$("#newstitle"+num).css("color","#f5821f");
		$("#newstitle"+num).css("font-weight","bold");
		$("#newstitle"+num).css("font-size","14px");
		$("#newstitle"+onum).css("color","#636363");
		$("#newstitle"+onum).css("font-weight","normal");
		$("#newstitle"+onum).css("font-size","12px");
		
	//}
}

function getDestProvince(citystr){
	$.ajax({
		type:"POST",
		url:"/cn/Public/getDestProvince",
		data:"DestDis="+$("select.#DestDistrict").val(),
		success:function(msg){
			cityArr = msg.split("|");
			document.getElementById(citystr).options.length=0;
			for(i=0;i<cityArr.length;i++){
				cityInfo = cityArr[i].split("#");
				document.getElementById(citystr).options.add(new Option(cityInfo[1],cityInfo[0],false,false));
			}
		}
	})
}

function hyshow(dir){
	dis = $("#hytitle1").css("display");
	if(dis=="block"){
		$("#hytitle1").fadeOut("fast",function(){
			$("#hytitle2").fadeIn("fast");
		});
	}else{
		$("#hytitle2").fadeOut("fast",function(){
			$("#hytitle1").fadeIn("fast");
		});
	}
}

function getMoreMessage(dir){
	for(i=1;i<=3;i++){
		dotstr = $("#dot"+i).attr("src");
		if(dotstr.indexOf("huangdian")>=0){
			num = i;
			break;
		}
	}
	if(dir=="left"){
		num = num-1;
		if(num<=0){num=1;}
	}else{
		num = num+1;
		if(num>3){num=3;}
	}
	nowdot = dotstr.replace("huangdian","heidian");
	$("#dot"+i).attr("src",nowdot);
	$("#dot"+num).attr("src",dotstr);
	$("#usermessage"+i).fadeOut("fast",function(){
		$("#usermessage"+num).fadeIn("fast");
	})
}

function checkMessage(obj){
	emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if(obj.username.value=="" || obj.email.value=="" || obj.content.value==""){
		alert("请完整填写表单");
		return false;
	}else if(!emailReg.test(obj.email.value)){
		alert("Email格式不正确");
		return false;
	}else{
		return true;
	}
}

function showinfo(objstr,info){
	$("#"+objstr).css("display",info);
}

function getSearch(str){
	if(str=="showDest"){
		$(".showDest").css("display","block");
		if($(".showDest2").html()!=""){
			$(".showDest2").css("display","block");
		}
	}else if(str=="showDepart"){
		$(".showDepart").css("display","block");
		if($(".showDepart2").html()!=""){
			$(".showDepart2").css("display","block");
		}
	}else{
		$("."+str).css("display","block");
	}
}
function hideSearch(str){
	if(str=="showDest"){
		$(".showDest").css("display","none");
		$(".showDest2").css("display","none");
	}else if(str=="showDepart"){
		$(".showDepart").css("display","none");
		$(".showDepart2").css("display","none");
	}else{
		$("."+str).css("display","none");
	}
}

function sregion(idstr,title,objstr){
	if(objstr=="departarea"){
		$("#departcityTxt").html(title);
		$("#departcity").val(idstr);
		getSregion(idstr,"showDepart2","departcity");
	}else if(objstr=="departcity"){
		$("#departcityTxt").html(title);
		$("#departcity").val(idstr);
	}else if(objstr=="destarea"){
		$("#destcityTxt").html(title);
		$("#DestArea").val(idstr);
		$("#DestDistrict").val("0");
		$("#DestProvince").val("0");
	}else if(objstr=="destdistinct"){
		$("#destcityTxt").html(title);
		$("#DestDistrict").val(idstr);
		$("#DestProvince").val("0");
		getSregion(idstr,"showDest2","DestDis");
	}else if(objstr=="destprovince"){
		$("#destcityTxt").html(title);
		$("#DestProvince").val(idstr);
	}else if(objstr=="category"){
		$("#categoryTxt").html(title);
		$("#category").val(idstr);
	}
}

function getSregion(citystr,objstr,parastr){
	$("."+objstr).css("display","block");
	$("."+objstr).html("<img src='/Tpl/default/webcn/images/loading.jpg' />");
	$.ajax({
		type:"POST",
		url:"/cn/Public/getSregion",
		data:parastr+"="+citystr,
		success:function(msg){
			$("."+objstr).html(msg);
		}
	})
}

function travelSearch(url)
{
	var temp=$('.bgOrderby').text();
	//去除空格符
	var orderby=temp.replace(/(^\s*)|(\s*$)/g, ""); 
	var order="";
	if(orderby=="价格从高到低")
	{
		order="price_d";
	}
	else if(orderby=="价格从低到高")
	{
		order="price_a";
	}
	else if(orderby=="行程从短到长")
	{
		order="linedays_a";
	}
	else if(orderby=="行程从长到短")
	{
		order="linedays_d";
	}
	var url=url+"/index/{$url}/orderstr/"+order;
	form1.action=url;
	form1.submit();
}


function showFreeTool(isshow){
	if(isshow==1){
		$(".freeTool").css("display","block");
	}else if(isshow==0){
		$(".freeTool").css("display","none");
	}
}

function searchTravel(utype){
	if(utype==1){
		$("#utype").val("1");
		$("#keyword").val("请输入批发商关键字");
	}else if(utype==2){
		$("#utype").val("2");
		$("#keyword").val("请输入零售商关键字");
	}
}
