// JavaScript Document
//推荐给朋友邮件
function mailtofriend(linkurl){   
//   var linkurl=location.href;
   window.location.href = "/forms/send-friend.asp?linkurl=" + linkurl;
}
function reporterror(){   
   var linkurl=location.href;
   window.location.href = "/forms/report-error.asp?linkurl=" + linkurl;
}
//问一个问题
function askquestion(){
   var linkurl=location.href;
   window.location.href = "/forms/ask.htm";
}
//弹出一个小窗口
function OpenWindow(htmurl,tops,lefts,widths,heights)
{
   var paramet = 'toolbar=no,resizable=yes,scrollbars=yes,top='+ tops + ',left='+ lefts + ',width='+ widths + ',height=' + heights;
   newWindow = window.open(htmurl,"viewfilm",paramet);
   newWindow.focus();
}

//切换显示搜索框
function changeContent(str) {
	
	document.getElementById(str).style.display = "";
	if (str=="div_tour"){
		document.getElementById("div_hotel").style.display = "none";
		document.getElementById("div_flight").style.display = "none";
		document.getElementById("li_tour").className = "tabPrev";
		document.getElementById("li_hotel").className = "tabAfter";
		document.getElementById("li_flight").className = "tabAfter";
	}
	else if (str=="div_hotel"){
		document.getElementById("div_tour").style.display = "none";
		document.getElementById("div_flight").style.display = "none";
		document.getElementById("li_tour").className = "tabPrev2";
		document.getElementById("li_hotel").className = "tabAfter2";
		document.getElementById("li_flight").className = "tabAfter";
	}
	else if (str=="div_flight"){
		document.getElementById("div_hotel").style.display = "none";
		document.getElementById("div_tour").style.display = "none";
		document.getElementById("li_tour").className = "tabPrev2";
		document.getElementById("li_hotel").className = "tabAfter";
		document.getElementById("li_flight").className = "tabAfter2";
	}
}

//初始化inpute对象的日期值，theDay为偏移当前多少天
function setdateobj(objID,theDay){		
	today=new Date();
	today.setDate(today.getDate()+theDay);
	yeart = today.getFullYear();
	montht = today.getMonth()+1;
	dayt = today.getDate();
	var obj=document.getElementById(objID);
	obj.value=montht+"/"+dayt+"/"+yeart;
}

//给Javascript数组添加一个indexOf方法
[].indexOf || (Array.prototype.indexOf = function(v){
	for(var i = this.length; i-- && this[i] !== v;);
		return i;
});

function setCookie(c_name,value,expiredays,domian,pth)
{
	var exdate=new Date(),ckstr; 
	exdate.setDate(exdate.getDate()+expiredays)
	ckstr = c_name+ "=" +escape(value)+";";
	if(typeof expiredays != "undefined"   )ckstr+="expires="+exdate.toGMTString()+";"; 
	if(typeof domian== "string")ckstr+="domain="+ domian+";";  
	if(typeof pth == "string")
	{
		ckstr+="patch="+ pth+";"; 
	}
	else
	{
		ckstr+="patch=/;"; //http:// 
	}
 
	 //alert(ckstr);
	document.cookie = ckstr;
}
//��ȡcookie
function getCookie(c_name,domian)
{  
	 var tcookie = document.cookie,reg = "/"+c_name+"=(\\d+)/";   
	 // alert(tcookie);
	 if(tcookie.length <1)return false; 
	 result = tcookie.match(eval(reg)); 
	  if(result)
	 {
		 if(result.length > 1)
		 {
			 return unescape(result[1]);
		 }
	 }
 
  return false;

}

function Obj_Disabled(obj)
{
	obj.attr("disabled",true);
}

$(function(){

//切换选项卡
	$(".js_Choose_Tag li").mouseover(function(){
		$(this).parents(".js_Choose_Tag").children("li").removeClass("prevTab");
		$(this).addClass("prevTab");
		
		var id = $(this).attr("id");
		id_Split = id.split("_");
		var thisP = $(this).parents(".promoTabs");
		
		//索引值
		var indexI = $(this).parents(".js_Choose_Tag").children("li").index($(this));
		if (id_Split[2] == "ajax")
		{
			$(".js_hotel_div").hide();
			$("#loading").show();
			if ($(".js_hotel_div[id=js_num_"+indexI+"]").html() == null)
			{
				js_Choose_Tag_Ajax_Data(thisP,id_Split[0],id_Split[1],indexI)
			}
			else
			{
				thisP.children(".js_hotel_div[id=js_num_"+indexI+"]:first").show();
				$("#loading").hide();
			}
		}
		else
			thisP.children(".js_flight_div").hide().eq(indexI).show();
	});

});