// JavaScript Document

function  shows(Sid,Url,ShowDiv)
	{
    Shopshows(Url,ShowDiv);
	$("span#"+Sid).find('a').click( function() {
			var answer = $(this).parent().find("div");
			$(this).parent().css("zIndex","2");
			answer.css("left","-246px");
			answer.css("top","0px");
			answer.show();
		},function() {
			var answer = $(this).parent().find("div");
			$(this).parent().css("zIndex","1");
			answer.hide();
		});
		
      $("span#"+Sid).find('div').hover( function() {
			$(this).show();
			$(this).parent().css("zIndex","5");
		},function() {
			//$(this).hide();
			$(this).parent().css("zIndex","1");
		});
	}
function FClose(Sid){document.getElementById(Sid).style.display="none";}
function FD(Rid,Hotel_id)
{
Url="/Hotel/Ajax_Hotel_Rooms_Date_Price.Asp?tm3="+ document.getElementById('tm3'+Rid).value +"&tm4="+document.getElementById('tm4'+Rid).value+"&Hotel_id="+Hotel_id+"&Rooms_id="+Rid;
Sid="Dates"+Rid;
Shopshows(Url,Sid);
}

function FFD(Rid,Url,Uid)//重新返回查询
{
if (Uid=="")
{
Vid='Dates'+Rid;
}else{
Vid='Datesa'+Rid;
}
Shopshows(Url,Vid);
}

function FDD(Rid,Uid,Hotel_id)
{
Url="/Hotel/Ajax_Hotel_Rooms_Date_Price.Asp?tm3="+ document.getElementById('tm3'+Rid+Uid).value +"&tm4="+document.getElementById('tm4'+Rid+Uid).value+"&Hotel_id="+Hotel_id+"&Rooms_id="+Rid+"&Numberid="+Uid;
Sid="Datesa"+Rid;
Shopshows(Url,Sid);
}
//ajax调用
function Shopshows(Url,Sid)
{

var xmlhttp;
   if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)  {
      xmlhttp=new XMLHttpRequest();
   }
   if (xmlhttp) {
        xmlhttp.onreadystatechange=function () {
		  if(xmlhttp.readyState==4)  {
		   // document.getElementById("shop_count").innerHTML="载入.";
			//document.getElementById("price").innerHTML="载入.";
             if(xmlhttp.status==200)  {
	            var yy=unescape(xmlhttp.responseText);
			   
                
				 document.getElementById(Sid).innerHTML=yy;
             
	         }else {
		     //  alert("error");
	         }
          }
		}  
	    xmlhttp.open("get",Url);
		xmlhttp.send(null);
    }		
}


function Showss(Sid,DivS,Url)
{
showRoom(Sid,DivS,Url,0);
$(".Hotel_List .DDS"+Sid).slideToggle();
$("#Hotel_Rooms"+Sid).hide();   

$("#mostrar"+Sid).html()=='更多房型/价格'?$("#mostrar"+Sid).html('隐藏房型列表'):$("#mostrar"+Sid).html('更多房型/价格');

if ($("#mostrar"+Sid).html()=='更多房型/价格')
{
//showRoom(Sid,DivS,Url,2);
document.getElementById(DivS).innerHTML="";
$(".Hotel_List .DDS"+Sid).slideUp();
$("#Hotel_Rooms"+Sid).show();
}
}

function showRoom(Sid,DivS,Url,List_count)
{
var xmlhttp;
   if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)  {
      xmlhttp=new XMLHttpRequest();
   }
   if (xmlhttp) {
        xmlhttp.onreadystatechange=function () {
		  if(xmlhttp.readyState==4)  {
		   // document.getElementById("shop_count").innerHTML="载入.";

             if(xmlhttp.status==200)  {

	            var yy=unescape(xmlhttp.responseText);
				    document.getElementById(DivS).innerHTML=yy;
	         }else {
		     //  alert("error");
	         }
          }
		}  
    //alert(List_count);
	    xmlhttp.open("get",Url +'&Lists='+ List_count);
		xmlhttp.send(null);
    }		
}

function SS(Sid,Wth)
{
 $("a.RoomList"+Sid+":eq(0)").cluetip({
      cluetipClass: 'jtip001', 
	  /*activation: 'click',*/
	  width:Wth,
      arrows: true, 
      dropShadow: true,
      hoverIntent: true,
      sticky: true,
      mouseOutClose: false,
      closePosition: 'title',
      closeText: '<img src="/Skin/UU/Template/images/cross.png" alt="close" />'
    });
}

function SSS(Sid,Wth)
{
//alert(Sid);
 $("a.RoomLista"+Sid+":eq(0)").cluetip({
      cluetipClass: 'jtip001', 
	  /*activation: 'click',*/
	  width:Wth,
      arrows: true, 
      dropShadow: true,
      hoverIntent: true,
      sticky: true,
      mouseOutClose: false,
      closePosition: 'title',
      closeText: '<img src="/Skin/UU/Template/images/cross.png" alt="close" />'
    });
}


function oS(str,n)
{
if(n==1)
{document.getElementById(str+"_Str").innerHTML="很糟糕(1分)";}
else if(n==2)
{document.getElementById(str+"_Str").innerHTML="需要改进(2分)";}
else if(n==3)
{document.getElementById(str+"_Str").innerHTML="马马虎虎(3分)";}
else if(n==4)
{document.getElementById(str+"_Str").innerHTML="还不错(4分)";}
else if(n==5)
{document.getElementById(str+"_Str").innerHTML="非常满意(5分)";}
}

function om(str,n){

oS(n,str);
  for (var i=1;i<6;i++)    {
    document.all(n+i).src = "/images/icon_star_1.gif";
   }
  for (var i=1;i<str+1;i++)    {
    document.all(n+i).src = "/images/icon_star_2.gif";
   }
}
function oo(str,n){
oS(n,str);
  for (var i=1;i<6;i++)    {
    document.all(n+i).src = "/images/icon_star_1.gif";
   }
  for (var i=1;i<parseInt(str)+1;i++)    {
    document.all(n+i).src = "/images/icon_star_2.gif";
   }
}
function od(str,input,n){

  for (var i=1;i<6;i++)    {
    document.all(n+i).src = "/images/icon_star_1.gif";
   }
  document.myform[input].value=str;
  for (var i=1;i<str+1;i++)    {
    document.all(n+i).src = "/images/icon_star_2.gif";
   }
}

function checkLength(which) {  
var maxChars = 380;  
if (which.value.length > maxChars)  
which.value = which.value.substring(0,maxChars);  
var curr = maxChars - which.value.length;  
document.getElementById("chLeft").innerHTML = "<font color=#ff3300>"+curr.toString()+"</font>";  
}  

function  Order_RoomsList_Show(Url,ShowDiv){Shopshows(Url,ShowDiv);}
function  Order_RoomsList_Price(Url,ShowDiv){
var xmlhttp;
   if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)  {
      xmlhttp=new XMLHttpRequest();
   }
   if (xmlhttp) {
        xmlhttp.onreadystatechange=function () {
		  if(xmlhttp.readyState==4)  {
		   // document.getElementById("shop_count").innerHTML="载入.";
			//document.getElementById("price").innerHTML="载入.";
             if(xmlhttp.status==200)  {
	            var yy=unescape(xmlhttp.responseText);
				 document.getElementById(ShowDiv).innerHTML=yy;
                 //document.getElementById("Price_Counta").innerHTML=yy;//容器总价
                 
                 document.getElementById("Rooms_Price").value=yy;//房型总价格
                 document.getElementById("Price_Count").value=yy;//表单总价
                 ASS();

	         }else {
		     //  alert("error");
	         }
          }
		}  
	    xmlhttp.open("get",Url);
		xmlhttp.send(null);
    }		
}
function Order_RoomsS(Rid,Hotel_id)
{

Url="/Hotel/Ajax_Hotel_Rooms_Date_Price_Order.Asp?tm3="+ document.getElementById('tm3'+Rid).value +"&tm4="+document.getElementById('tm4'+Rid).value+"&Hotel_id="+Hotel_id+"&Rooms_id="+Rid;
Urla="/Hotel/Hotel_Price_Count.asp?tm3="+ document.getElementById('tm3'+Rid).value +"&tm4="+document.getElementById('tm4'+Rid).value+"&Hotel_id="+Hotel_id+"&Rooms_id="+Rid;
Urlb="/Hotel/Hotel_Tianshu_Count.asp?tm3="+ document.getElementById('tm3'+Rid).value +"&tm4="+document.getElementById('tm4'+Rid).value+"&Hotel_id="+Hotel_id+"&Rooms_id="+Rid;

Sid="Order_Roomlist";
Sida="Rooms_Price_Counta";
Sidb="Tianshu";
Order_RoomsList_Price(Urla,Sida);
Shopshows(Url,Sid);
Order_Tianshu(Urlb,Sidb);
ASS();
}
function FFDD(Rid,Url)//重新返回查询
{
Sid="Order_Roomlist";
Shopshows(Url,Sid);

}

function RoomsCount(Sid)
{
document.Form_Order.Rooms_chuang_Count.options[0].selected=true;
document.Form_Order.Price_Count.value=document.getElementById("Rooms_Price").value*parseInt(Sid);
document.Form_Order.jiachuang_Count.value=0;
ASS();
}
function ZaocanCount(Sid)
{

var Zaocan_Name=document.Form_Order.Zaocan_Name.value;
var Zaocan_Lei=document.Form_Order.Zaocan_Lei.options[document.Form_Order.Zaocan_Lei.selectedIndex].value;
var Zaocan_values=Zaocan_Name.split("|");
//alert(Zaocan_values[1]);
var Temps=Zaocan_values[0].split(","); 

if (Zaocan_Lei==0)
{
//成人价
document.Form_Order.Zaocan_Price_Count.value=parseInt(Temps[0])*parseInt(Sid);
}
else if(Zaocan_Lei==1)
{
//儿童价
document.Form_Order.Zaocan_Price_Count.value=parseInt(Temps[1])*parseInt(Sid);
}
ASS();
}
function Jiachuang_List(Sid)
{
 document.Form_Order.Rooms_chuang_Count.length = 0;

var i;
    for (i=0;i<Sid;i++)
        {
                document.Form_Order.Rooms_chuang_Count.options[document.Form_Order.Rooms_chuang_Count.length] = new Option(i, i);       
        }
  
}

function  Order_Tianshu(Url,ShowDiv){
var xmlhttp;
   if (window.ActiveXObject) {
      xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }else if(window.XMLHttpRequest)  {
      xmlhttp=new XMLHttpRequest();
   }
   if (xmlhttp) {
        xmlhttp.onreadystatechange=function () {
		  if(xmlhttp.readyState==4)  {
		   // document.getElementById("shop_count").innerHTML="载入.";
			//document.getElementById("price").innerHTML="载入.";
             if(xmlhttp.status==200)  {
	            var yy=unescape(xmlhttp.responseText);
                 document.getElementById("Tianshu").value=yy-1;
                 Jiachuang_List(yy);
	         }else {
		     //  alert("error");
	         }
          }
		}  
	    xmlhttp.open("get",Url);
		xmlhttp.send(null);
    }		
}
function Jiachuangprice(Sid)
{
document.Form_Order.jiachuang_Count.value=parseInt(document.Form_Order.jiachuang.value)*parseInt(Sid);
ASS();
}
function ZaocanList(Str)
{
var Zaocan_values=Str.split("|");
Url="/Hotel/Hotel_Zaocan_Text.asp?Hotel_Id="+document.Form_Order.Hotel_id.value+"&Zaocan_Id="+Zaocan_values[1];
Zaocan_Div="Zaocan_Text";
Shopshows(Url,Zaocan_Div);
var Temps=Zaocan_values[0].split(","); 
var Zaocan_Lei=document.Form_Order.Zaocan_Lei.options[document.Form_Order.Zaocan_Lei.selectedIndex].value;
if (Zaocan_Lei==0)
{
//成人价
document.Form_Order.Zaocan_Price_Count.value=parseInt(Temps[0])*parseInt(document.Form_Order.Zaocan_Count.value);
}
else if(Zaocan_Lei==1)
{
//儿童价
document.Form_Order.Zaocan_Price_Count.value=parseInt(Temps[1])*parseInt(document.Form_Order.Zaocan_Count.value);
}
ASS();
}



//早餐数组处理


function ZaocanLista(Str,Zaocan_Div,Vid)
{

var Zaocan_values=Str.split("|");
Url="/Hotel/Hotel_Zaocan_Text.asp?Hotel_Id="+document.Form_Order.Hotel_id.value+"&Zaocan_Id="+Zaocan_values[1];
Shopshows(Url,Zaocan_Div);
var Temps=Zaocan_values[0].split(","); 
//var Zaocan_Lei=document.Form_Order.Zaocan_Lei.options[document.Form_Order.Zaocan_Lei.selectedIndex].value;
var Zaocan_Lei=document.getElementById("Zaocan_Lei"+Vid).value;
if (Zaocan_Lei==0)
{
//成人价
document.getElementById("Zaocan_PriceCount"+Vid).value=parseInt(Temps[0])*parseInt(document.getElementById("Zaocan_Count"+Vid).value);

}
else if(Zaocan_Lei==1)
{
//儿童价
document.getElementById("Zaocan_PriceCount"+Vid).value=parseInt(Temps[1])*parseInt(document.getElementById("Zaocan_Count"+Vid).value);
}
pricearray();
ASS();
}


function ZaocanCounta(Sid,Vid)
{
var Zaocan_Name=document.getElementById("Zaocan_Name"+Vid).value;
//var Zaocan_Name=document.Form_Order.Zaocan_Name.value;
var Zaocan_Lei=document.getElementById("Zaocan_Lei"+Vid).value;
//var Zaocan_Lei=document.Form_Order.Zaocan_Lei.options[document.Form_Order.Zaocan_Lei.selectedIndex].value;
var Zaocan_values=Zaocan_Name.split("|");
//alert(Zaocan_values[1]);
var Temps=Zaocan_values[0].split(","); 

if (Zaocan_Lei==0)
{
//成人价
document.getElementById("Zaocan_PriceCount"+Vid).value =parseInt(Temps[0])*parseInt(Sid);
}
else if(Zaocan_Lei==1)
{
//儿童价
document.getElementById("Zaocan_PriceCount"+Vid).value =parseInt(Temps[1])*parseInt(Sid);
}
 pricearray();
 ASS();
}

//遍历增订早餐价格数组
function pricearray()
{
var SInt=0;
 var _array = document.Form_Order.Zaocanshu.value;

  for (var i=2;i<_array;i++)
   {
     SInt += parseInt(document.getElementById("Zaocan_PriceCount"+i).value);
   }
 
 document.getElementById("Zaocan_Price").value =SInt;
}


//总价格统计参数
function ASS()
{
 document.getElementById("Price_Counta").innerHTML=parseInt(document.Form_Order.Price_Count.value)+parseInt(document.Form_Order.Zaocan_Price_Count.value)+parseInt(document.Form_Order.jiachuang_Count.value)+parseInt(document.getElementById("Zaocan_Price").value);

}

//度假产品预订价格处理
function TRCount(Sid)//成人
{
document.Form_Order.TR.value=parseInt(document.Form_Order.Price.value)*Sid;
document.Form_Order.Travel_Price.value=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);
document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);
}


function TECount(Sid)//儿童
{
document.Form_Order.TE.value=parseInt(document.Form_Order.EPrice.value)*Sid;
document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);
document.Form_Order.Travel_Price.value=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);
}

function TSCount(Sid)//份数
{
document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);
document.Form_Order.Travel_Price.value=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value))*parseInt(document.Form_Order.Travel_Count.value);

}


function Ajax_Golf_Order(Sid)
{

document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.Golf_Count.value)*parseInt(document.Form_Order.RenShu.value))*parseInt(document.Form_Order.Price.value);
document.Form_Order.Golf_Price.value=(parseInt(document.Form_Order.Golf_Count.value)*parseInt(document.Form_Order.RenShu.value))*parseInt(document.Form_Order.Price.value);

  if (Sid==0)
  {
    Url="/Order/Golf_Order_Ajax.asp?Golf_Count="+document.getElementById("Golf_Count").value;
    Shopshows(Url,"Golf_KS");
  }
}

function Marry_Order()
{

document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.Marry_Count.value)*parseInt(document.Form_Order.Price.value));
document.Form_Order.Marry_Price.value=(parseInt(document.Form_Order.Marry_Count.value)*parseInt(document.Form_Order.Price.value));

}

function Car_Order()
{

document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.Car_Count.value)*parseInt(document.Form_Order.Price.value))*parseInt(document.Form_Order.Tianshu_Count.value);
document.Form_Order.Car_Price.value=(parseInt(document.Form_Order.Car_Count.value)*parseInt(document.Form_Order.Price.value))*parseInt(document.Form_Order.Tianshu_Count.value);

}

function Jingdian_Chengren_Order(Sid)
{

document.Form_Order.TR.value=parseInt(document.Form_Order.Price.value)*Sid;
document.Form_Order.Jingdian_Price.value=parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value);
document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value));

}

function Jingdian_Ertong_Order(Sid)
{

document.Form_Order.TE.value=parseInt(document.Form_Order.EPrice.value)*Sid;
document.Form_Order.Jingdian_Price.value=parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value);
document.getElementById("Price_Counta").innerHTML=(parseInt(document.Form_Order.TR.value)+parseInt(document.Form_Order.TE.value));

}