function detectBrowser()//判斷是否用IE瀏覽器
{ 
  var sAgent = navigator.userAgent.toLowerCase();
  this.isIE = (sAgent.indexOf('msie')!=-1); //IE6.0-7
  this.isFF = (sAgent.indexOf('firefox')!=-1);//firefox
  this.isSa = (sAgent.indexOf('safari')!=-1);//safari
  this.isOp = (sAgent.indexOf('opera')!=-1);//opera
  this.isNN = (sAgent.indexOf('netscape')!=-1);//netscape
  this.isMa = this.isIE;//marthon
  this.isOther = (!this.isIE && !this.isFF && !this.isSa && !this.isOp && !this.isNN && !this.isSa);//unknown Browser
}
var oBrowser = new detectBrowser();
  

function addImage(parent,id,u,w,h)
{
	var elem = null;
  	if(oBrowser.isIE==false){
  		elem = addImg(parent,id,u,w,h);
  	}else if(oBrowser.isIE){
  		elem = addDiv(parent,id,w,h);
  		elem.style.filter= "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,src='"+ u +"',sizingMethod='scale')";
  	}	
  	return elem;
}

function addImg(parent,id,u,w,h)
{
  	var elem = document.createElement("IMG");
	$(parent).appendChild(elem);
    elem.setAttribute("id",id);
    elem.src = u;
    editPosition(elem,w,h);
  	return elem;
}
function addDiv(parent,id,w,h)
{
	var elem = document.createElement("DIV");	
	$(parent).appendChild(elem);
	editPosition(elem,w,h);
    elem.setAttribute("id",id);
  	return elem;
}
function editPosition(elem,w,h){
  	elem.style.height = h*1 + 'px';
  	elem.height = h*1;
  	elem.style.width = w*1 + 'px';
  	elem.width = w*1;
}

if(locale=="zh_TW" && color=="brown"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',110,20); 
}else if(locale=="en" && color=="brown"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,18); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,18); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',167,18); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',109,18); 
}else if(locale=="zh_CN" && color=="brown"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',110,20); 
}else if(locale=="zh_TW" && color=="default"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',113,20); 
}else if(locale=="en" && color=="default"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,18); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,18); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,18); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',112,18); 
}else if(locale=="zh_CN" && color=="default"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',113,20); 
}else if(locale=="zh_TW" && color=="white"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',110,20); 
}else if(locale=="zh_TW" && color=="hrj"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',111,52); 
	//addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,18); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',129,52); 
	//addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,18); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',114,52); 
	//addImage('step3_2','imgstep3_2',imgDir+'step-03.png',167,18); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',104,52); 
	//addImage('step4_2','imgstep4_2',imgDir+'step-04.png',109,18);
}else if(locale=="zh_CN" && color=="hrj"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',111,52); 
	//addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,18); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',129,52); 
	//addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,18); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',114,52); 
	//addImage('step3_2','imgstep3_2',imgDir+'step-03.png',167,18); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',104,52); 
	//addImage('step4_2','imgstep4_2',imgDir+'step-04.png',109,18);
}else if(locale=="zh_CN" && color=="white"){
	addImage('step1_1','imgstep1_1',imgDir+'step1.png',38,13); 
	addImage('step1_2','imgstep1_2',imgDir+'step-01.png',130,20); 
	
	addImage('step2_1','imgstep2_1',imgDir+'step2.png',38,13); 
	addImage('step2_2','imgstep2_2',imgDir+'step-02.png',190,20); 
	
	addImage('step3_1','imgstep3_1',imgDir+'step3.png',38,13); 
	addImage('step3_2','imgstep3_2',imgDir+'step-03.png',170,20); 
	
	addImage('step4_1','imgstep4_1',imgDir+'step4.png',38,13); 
	addImage('step4_2','imgstep4_2',imgDir+'step-04.png',110,20); 
}


function Array2DVar(x,y) { // 定義二維陣列原型
	for(var i = 0; i < x; i++) // 初始各元素值為 null
		this[i] = new Array(y); // this 代表物件本身
	return this;
} 
function Selector() {
	this.dayZones = Array2DVar(6,7);
	this.kind = 1;//0:day主 1:房主
	this.orderNum = 0;
	this.previousMonth = "";
	this.nextMonth = "";	
	this.products = new Array(0);	
	this.orders = new Array(0);	
	this.systemMaxOrderQnt = 1;
}
Selector.prototype.clearProduct = function() {
	this.products = new Array(0);
}
Selector.prototype.addProduct = function(productNos,productNam,roomCod,minStayDay,lowPrice) {
	var product = new Product(this,productNos,productNam,roomCod,minStayDay,lowPrice);
	this.products[this.products.length] = product;
}
Selector.prototype.getProduct = function(productNos) {
	for(var i=0;i< this.products.length;i++){
		if(this.products[i].productNos==productNos){
			return this.products[i];
		}
	}
	return null;
}
Selector.prototype.clearOrder = function() {
	this.orders = new Array(0);
}
Selector.prototype.addOrder = function(productNos,hotelCod,roomCod,productName,unitAmt,price,orderRooms,orderDays,maxOrderQnt,waitingFlag) {
	var order = new Order(this,productNos,hotelCod,roomCod,productName,unitAmt,price,orderRooms,orderDays,maxOrderQnt,waitingFlag);
	this.orders[this.orders.length] = order;
	return order;
}
Selector.prototype.getOrder = function(productNos) {
	for(var i=0;i< this.orders.length;i++){
		if(this.orders[i].productNos==productNos){
			return this.orders[i];
		}
	}
	return null;
}
Selector.prototype.showDay = function() {
	for(var i=0;i< 6;i++){
		for(var j=0;j< 7;j++){
			this.dayZones[i][j].show();
		}
	}
}
Selector.prototype.get = function(id) {
	for(var i=0;i< 6;i++){
		for(var j=0;j< 7;j++){
			if(this.dayZones[i][j].id==id){
				return this.dayZones[i][j];
			}
		}
	}
	return null;
}

function Product(parent,productNos,productNam,roomCod,minStayDay,lowPrice) {
	this.productNos = productNos;
	this.productNam = productNam;
	this.roomCod = roomCod;
	this.minStayDay = minStayDay;
	this.lowPrice = lowPrice;
	this.parent = parent;	
	return this;
}
function Order(parent,productNos,hotelCod,roomCod,productName,ciDate,unitAmt,price,orderRooms,orderDays,maxOrderQnt,waitingFlag) {
	this.productNos = productNos;
	this.hotelCod = hotelCod;
	this.roomCod = roomCod;
	this.productName = productName;
	this.ciDate = ciDate;
	this.unitAmt = unitAmt;
	this.price = price;
	this.orderRooms = orderRooms;
	this.orderDays = orderDays;
	this.maxOrderQnt = maxOrderQnt;
	this.waitingFlag = waitingFlag;
	this.parent = parent;
	return this;
}
Order.prototype.toString = function() {
	return "productNos:"+this.productNos+",hotelCod:"+this.hotelCod+",roomCod:"+this.roomCod
		+",productName:"+this.productName+",unitAmt:"+this.unitAmt+",price:"+this.price;
}		
		
function DayZone(parent,x,y,productNos,day,date,status,money,quotaQnt,remark) {
	this.x = x;
	this.y = y;
	this.productNos = productNos;
	this.id = x + "" + y;
	this.day = "" + day;
	if(this.day.length==1){
		this.day = "0" + this.day;
	}
	this.date = date;
	this.status = status*1;//0:候補,1:可訂房,2:客滿
	this.money = money*1;
	this.quotaQnt = quotaQnt*1;
	this.parent = parent;	
	this.remark = remark;
	return this;
}
DayZone.prototype.show = function() {
	if(this.parent.kind==1){
		//以房型專案為主
		if(this.status < 0 && (this.day == "00" || this.day == "0")){
			$("day"+this.id).innerHTML = "";
			//$("day"+this.id).setAttribute("background",imgDir+"day-000.jpg");
			//$("day"+this.id).setAttribute("background","");
			//$("day"+this.id).setAttribute("bgColor","#eee9d6");
			$("day"+this.id).className = "day_bg"
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;
			return;
		}
		if(this.y==0 || this.y==6){
			//$("day"+this.id).setAttribute("background",imgDir+"day-0"+this.day+"-3.jpg");
			//$("day"+this.id).setAttribute("background","");
			//$("day"+this.id).setAttribute("bgColor","#eed6d6");
			$("day"+this.id).className = "cal_day_bg";			
		}else{
			//$("day"+this.id).setAttribute("background",imgDir+"day-0"+this.day+".jpg");
			//$("day"+this.id).setAttribute("background","");
			//$("day"+this.id).setAttribute("bgColor","#eee9d6");	
			$("day"+this.id).className = "day_bg";		
		}
		$("day"+this.id).dayId = this.id;
		//$("day"+this.id).setAttribute("dayId",this.id);
		$("day"+this.id).setAttribute("align","center");
		$("day"+this.id).setAttribute("valign","top");
		$("day"+this.id).setAttribute("height","58");
		$("day"+this.id).innerHTML = this.day;
		if(this.remark !=null && this.remark!=""){
			$("day"+this.id).remark = this.remark;
			$("day"+this.id).onmouseover = function(event){ 	Tip(this.remark);	}	
		}else{
			$("day"+this.id).onmouseover = null;
		}		
		
		if(this.money<=0){
			$("day"+this.id).innerHTML +="<br><br><br>";
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;	
			$("day"+this.id).innerHTML += "</div>";
			return;
		}
		$("day"+this.id).innerHTML +="<br><font color='red'>NT$"+this.money+"</font>";
		if(this.status==0){
			$("day"+this.id).innerHTML += "<br><font color='blue'>"+jl_wait+"</font>";
			$("day"+this.id).style.cursor="pointer"; 	
			$("day"+this.id).onclick = function(event){
				putCar(this.dayId);
			}			
		}else if(this.status==1){
			$("day"+this.id).innerHTML += "<br><font color='blue'>"+this.quotaQnt+jl_room+"</font>";//<img align='middle' height='20' src='"+imgDir+"icon-1.gif'>";
			$("day"+this.id).style.cursor="pointer"; 	
			$("day"+this.id).onclick = function(event){
				putCar(this.dayId);
			}
		}else if(this.status==2){
			$("day"+this.id).innerHTML += "<br><font color='#6e7071'>"+jl_full+"</font>";
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;
		 }else if(this.status==3){
			$("day"+this.id).innerHTML += "<br><font color='#6e7071'>"+jl_full2+"</font>";
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;
		}else if(this.status==4){
			$("day"+this.id).innerHTML += "<br><font color='blue'>"+jl_offerRoom+"</font>";//<img align='middle' height='20' src='"+imgDir+"icon-1.gif'>";
			$("day"+this.id).style.cursor="pointer"; 	
			$("day"+this.id).onclick = function(event){
				putCar(this.dayId);
			}			
		}else{
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;	
		}
	}else if(this.parent.kind==0){
		//以日期為主
		if(this.status < 0 && (this.day == "00" || this.day == "0")){
			$("day"+this.id).innerHTML = "";
			$("day"+this.id).setAttribute("background",imgDir+"day-000.jpg");
			$("day"+this.id).style.cursor="";
			$("day"+this.id).onclick = null;
			return;
		}
		if(this.y==0){
			$("day"+this.id).setAttribute("background",imgDir+"day-0"+this.day+"-3.jpg");
		}else{
			$("day"+this.id).setAttribute("background",imgDir+"day-0"+this.day+".jpg");
		}		
		$("day"+this.id).innerHTML = this.day;
		$("day"+this.id).dayId = this.id;
		$("day"+this.id).onclick = function(event){
			selectDay(this.dayId);
		}		
	}
	if($("day"+this.id).innerHTML !="" )
  	  $("day"+this.id).innerHTML = "<B>"+$("day"+this.id).innerHTML+"</B>";
}
DayZone.prototype.clear = function() {
	$("day"+this.id).innerHTML = "";
	$("day"+this.id).className = "day_bg"
	$("day"+this.id).style.cursor="";
	$("day"+this.id).onclick = null;
}
Selector.prototype.clearDay = function() {
	for(var i=0;i< 6;i++){
		for(var j=0;j< 7;j++){
			this.dayZones[i][j].clear();
		}
	}
}
var selector = new Selector();
for(var i=0;i< 6;i++){
	for(var j=0;j< 7;j++){
		selector.dayZones[i][j] = new DayZone(selector,i,j,"","0","",-1,0,0);
	}
}
selector.showDay();
function removeAllChild(parent){
	if (parent != null){
		while(parent.childNodes.length > 0){ 
			parent.removeChild(parent.childNodes[0]); 
		} 
	}
}
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
function toChangeWay(kind){
	selector.kind = kind;
	if(selector.kind==1){
		$('imgPos1_1').src = imgDir+"step-01.jpg";
		$('imgPos1_2').src = imgDir+"st1.gif";
		$('imgPos2_1').src = imgDir+"step-02.jpg";
		$('imgPos2_2').src = imgDir+"st2.gif";		
		$('imgPos3_1').src = imgDir+"step-03.jpg";
		$('imgPos3_2').src = imgDir+"st3.gif";	
		queryRvrmcodRfs(drmproductTyp);		
	}else{
		$('imgPos1_1').src = imgDir+"step-02.jpg";
		$('imgPos1_2').src = imgDir+"st2.gif";
		$('imgPos2_1').src = imgDir+"step-03.jpg";
		$('imgPos2_2').src = imgDir+"st3.gif";		
		$('imgPos3_1').src = imgDir+"step-01.jpg";
		$('imgPos3_2').src = imgDir+"st1.gif";		
		getCalendar();
	}
}
function changeRoom(index){
	var newRooms = $("ddlOrderRooms"+index).value;
	loadAjaxData(ajaxPath,
		'&method=changeRoom'+
		'&index='+index+
		'&newRooms='+newRooms
		,on_putCar,on_putCar); 
	showWait();
}

function changeDay(index){
	var newDays = $("ddlOrderDays"+index).value;
	loadAjaxData(ajaxPath,
		'&method=changeDay'+
		'&index='+index+
		'&newDays='+newDays
		,on_putCar,on_putCar); 
	showWait();	
}

function confirm_deleteProduct(index){
	YAHOO.example.container.wait.hide();
	loadAjaxData(ajaxPath,
    		'&method=deleteProduct'+
    		'&index='+index
    		,on_putCar,on_putCar); 
	showWait();
}
function deleteProduct(index){
	YAHOO.example.container.wait.setHeader("");
   	YAHOO.example.container.wait.setBody("<font color='red'><b>"+jl_sysMsg+"</b></font><br><br><font color='red'>"
   		+jl_Msg2+"</font><Br><Br><input type='button' name='btnOk' value='"+jl_confirm+"' onclick='confirm_deleteProduct(\""+index+"\");'>&nbsp;"+
   		"<input type='button' name='btnCancel' value='"+jl_cancel+"' onclick='YAHOO.example.container.wait.hide();'>");
   	YAHOO.example.container.wait.show();
}
  	
function addTd(trObj,colspan,width,className,text){
	var td1Obj = document.createElement("TD");
	td1Obj.setAttribute("width",width);
	td1Obj.setAttribute("colSpan",colspan);
	td1Obj.setAttribute("height","20");
	//td1Obj.setAttribute("bgColor",bgColor);	 
	//td1Obj.bgColor = bgColor;
	td1Obj.className = className;
	//td1Obj.className = "word";
	td1Obj.setAttribute("align","center");
	td1Obj.setAttribute("scope","row");
	if(text!=""){
		td1Obj.appendChild(document.createTextNode(text));
	}
	trObj.appendChild(td1Obj);
	return td1Obj;
}
function confirm_on_putCar(){
	showWait();
	getCar();
}
function on_putCar_4_addBuy(oj){
	var res  =  oj.responseXML;
	YAHOO.example.container.wait.hide();
	//alert(oj.responseText);
	var result = getColumnValue(res,"result");
	//var showAddBuy=getColumnValue(res,"showAddBuy");
	//if(showAddBuy=="")
	//  res.setColumnValue(res);
	if(result=="1"){
		selector.clearOrder();
		var productTag = res.getElementsByTagName("product");
		carIndex = productTag.length-1;
		var hotelCod = getColumnValue(productTag[carIndex],"hotelCod");
		var productNos = getColumnValue(productTag[carIndex],"productNos");
		var showAddBuy=getColumnValue(productTag[carIndex],"showAddBuy");
		//-----可加價購的商品 list------
		//alert('hotelCod='+hotelCod);
		//alert('productNos='+productNos);
		//alert('carIndex='+carIndex);
		//alert(carIndex);
		//alert(showAddBuy);
		if(showAddBuy=="1")
		  listAddBuyProduct(carIndex,hotelCod,productNos);
		else {
		  selector.clearOrder();
  		  createCarTable(res);
		}
	}else if(result=="2"){
		YAHOO.example.container.wait.hide();
		ajax2select("checkIns",oj,"select","key","value");
		$j("#plCross").dialog({ width: 500,height: 300, modal: true });
		$j("#plCross").dialog('open');
		window.location.href = "#top";
	}else{
		YAHOO.example.container.wait.setHeader("");
    	YAHOO.example.container.wait.setBody("<font color='red'><b>"+jl_sysMsg+"</b></font><br><br><font color='red'>"+
    	getColumnValue(res,"message")+"</font><Br><Br><input type='button' name='btnOk' value='"+jl_confirm+"' onclick='confirm_on_putCar();'>");
    	YAHOO.example.container.wait.render(document.body);
    	YAHOO.example.container.wait.show();
	}
}
function on_putCar(oj){
	//alert(oj.responseText);
	var res  =  oj.responseXML;
	YAHOO.example.container.wait.hide();
	//alert(oj.responseText);
	var result = getColumnValue(res,"result");
	if(result=="1"){
		selector.clearOrder();
  		createCarTable(res);
	}else{
		YAHOO.example.container.wait.setHeader("");
    	YAHOO.example.container.wait.setBody("<font color='red'><b>"+jl_sysMsg+"</b></font><br><br><font color='red'>"+
    	getColumnValue(res,"message")+"</font><Br><Br><input type='button' name='btnOk' value='"+jl_confirm+"' onclick='confirm_on_putCar();'>");
    	YAHOO.example.container.wait.render(document.body);
    	YAHOO.example.container.wait.show();
	}
}

function putCar4Cross(){
	$j("#plCross").dialog('close');
	YAHOO.example.container.wait.hide();
	var day =selector.get(sdayId);
	if(day!=null && selector.getProduct(day.productNos)!=null){
  		loadAjaxData(ajaxPath,
	  			'&checkIns='+$j('#checkIns').val()+
	       		'&method=putCar4Cross'+
	       		'&productCod='+day.productNos+
	       		'&hotelCod='+hotelCod+
	        	'&rmproductTyp='+drmproductTyp+       		
	       		'&orderDays=1'+
	       		'&orderRooms=1'+
	       		'&strCiDate='+day.date+
	       		'&roomCod='+droomCod
	       		,on_putCar_4_addBuy,on_putCar_4_addBuy);
        showWait();		
     }
}
var sdayId;
function confirm_putCar(dayId){
	YAHOO.example.container.wait.hide();
	var day =selector.get(dayId);
	if(day!=null && selector.getProduct(day.productNos)!=null){
		sdayId = dayId;
  			loadAjaxData(ajaxPath,
       		'&method=putCar'+
       		'&productCod='+day.productNos+
       		'&hotelCod='+hotelCod+
        	'&rmproductTyp='+drmproductTyp+       		
       		'&orderDays=1'+
       		'&orderRooms=1'+
       		'&strCiDate='+day.date+
       		'&roomCod='+droomCod
       		,on_putCar_4_addBuy,on_putCar_4_addBuy);
           showWait();		
     }
}

function putCar(dayId){
	YAHOO.example.container.wait.setHeader("");
   	YAHOO.example.container.wait.setBody("<font color='red'><b>"+jl_sysMsg+"</b></font><br><br><font color='red'>"
   		+jl_Msg1+"</font><Br><Br><input type='button' name='btnOk' value='"+jl_confirm+"' onclick='confirm_putCar(\""+dayId+"\");'>&nbsp;"+
   		"<input type='button' name='btnCancel' value='"+jl_cancel+"' onclick='YAHOO.example.container.wait.hide();'>");
   	YAHOO.example.container.wait.show();
}	
function getCar(){
	loadAjaxData(ajaxPath,
		'&method=getCar'
		,on_putCar,on_putCar); 
}
function nextMonthGo()
{
	window.status = "下一月份!";
	if(selector.nextMonth==""){
		window.status = "無下一月份資料!";
	 	return;
	}
	var showYearMonth = selector.nextMonth;
  	selector.nextMonth = "";
  	selector.previousMonth = "";    
  	loadAjaxData(ajaxPath,
        '&method=product_content&showYearMonth='+showYearMonth+'&productNos='+dproductNos+'&hotelCod='+hotelCod+'&roomCod='+droomCod+'&rmproductTyp='+drmproductTyp,on_product_content,on_product_content);
    showWait();
}
        	
function previousMonthGo()
{
	window.status = "上一月份!";
	if(selector.previousMonth==""){ 
		window.status = "無上一月份資料!";	
		return;
	}
	var showYearMonth = selector.previousMonth;
  	selector.nextMonth = "";
  	selector.previousMonth = "";   
  	loadAjaxData(ajaxPath,
        '&method=product_content&showYearMonth='+showYearMonth+'&productNos='+dproductNos+'&hotelCod='+hotelCod+'&roomCod='+droomCod+'&rmproductTyp='+drmproductTyp,on_product_content,on_product_content);
    showWait();
}

function toChangeCalendar(){
  	loadAjaxData(ajaxPath,
        '&method=product_content&showYearMonth='+$('yearMonth').value+'&productNos='+dproductNos+'&hotelCod='+hotelCod+'&roomCod='+droomCod+'&rmproductTyp='+drmproductTyp,on_product_content,on_product_content);
	showWait();
}

function on_product_content(oj){
	//alert(oj.responseText);
	defaults=0;
	var res  =  oj.responseXML;
	var month = getColumnValue(res,"month");
	if(month.length==1){
		month = "0" + month;
	}
	$('yearMonth').value = getColumnValue(res,"year")+"/"+month;
	var column = 0;
	var row = 0;
	for(row =0;row <6;row++){
		for(column =0;column <=6;column++){
			var d = "date"+row+column;
			if(res.getElementsByTagName(d)[0]==null){
				selector.dayZones[row][column] = new DayZone(selector,row,column,"","0","",-1,0,0,"");
			}else{
				var date = getColumnValue(res,"date"+row+column);
				var status = getColumnValue(res,"status"+row+column)*1;
				var price = getColumnValue(res,"price"+row+column)*1;
				var day = getColumnValue(res,"day"+row+column);
				var quotaQnt = getColumnValue(res,"quotaQnt"+row+column)*1;
				var remark = getColumnValue(res,"remark"+row+column);
				var productNos = getColumnValue(res,"productNos");
				selector.dayZones[row][column] = new DayZone(selector,row,column,productNos,day,date,status,price,quotaQnt,remark);
				
			}
		    
		}
	}
	var showYearMonth = getColumnValue(res,"showYearMonth");
	selector.previousMonth = getColumnValue(res,"previousMonth");
	selector.nextMonth = getColumnValue(res,"nextMonth");
	if(showYearMonth != selector.previousMonth){
		//$('th_previousMonth').setAttribute("className","red_word");
		$('th_previousMonth').className = "red_word";
		$('th_previousMonth').style.cursor="pointer";
		//$('th_previousMonth').setAttribute("onclick","javascript:previousMonthGo();");
		$('th_previousMonth').onclick = function(event){
			previousMonthGo();
		}	
		$('img_previousMonth').src = imgDir + "calender_03.gif";	
	}else{
		//$('th_previousMonth').setAttribute("className","word");
		$('th_previousMonth').className = "word";
		$('th_previousMonth').style.cursor="";
		$('th_previousMonth').setAttribute("onclick","");
		$('img_previousMonth').src = imgDir + "calender_03_1.gif";	
	}
	
	if(showYearMonth != selector.nextMonth){
		//$('th_nextMonth').setAttribute("className","red_word");
		$('th_nextMonth').className = "red_word";
		$('th_nextMonth').style.cursor="pointer";
		$('th_nextMonth').onclick = function(event){
			nextMonthGo();
		}	
		$('img_nextMonth').src = imgDir + "calender_05.gif";		
	}else{
		//$('th_nextMonth').setAttribute("className","word");
		$('th_nextMonth').className = "word";
		$('th_nextMonth').style.cursor="";
		$('th_nextMonth').setAttribute("onclick","");
		$('img_nextMonth').src = imgDir + "calender_05_1.gif";
	}
	defaultYearMonth = "";	
	selector.showDay();
	window.status = "載入完成!";
	YAHOO.example.container.wait.hide();
}
function product_content(productNos)
{
	window.status = "product_content:"+productNos;
	for(var i=0;i<productNoss.length;i++){
		//$("productNos_1_"+productNoss[i]).setAttribute("className","word");
		//$("productNos_2_"+productNoss[i]).setAttribute("className","word");
		//$("productNos_3_"+productNoss[i]).setAttribute("className","word");
		$("productNos_1_"+productNoss[i]).className="word";
		$("productNos_2_"+productNoss[i]).className="word";
		$("productNos_3_"+productNoss[i]).className="word";
		
		$("img_productNos_1_"+productNoss[i]).style.visibility = "hidden";
	}
	dproductNos = productNos;
	//$("productNos_1_"+dproductNos).setAttribute("className","red_word");
	//$("productNos_2_"+dproductNos).setAttribute("className","red_word");
	//$("productNos_3_"+dproductNos).setAttribute("className","red_word");
	
	$("productNos_1_"+dproductNos).className="red_word";
	$("productNos_2_"+dproductNos).className="red_word";
	$("productNos_3_"+dproductNos).className="red_word";
		
	$("img_productNos_1_"+dproductNos).style.visibility = "visible";
	
   	loadAjaxData(ajaxPath,
        	'&method=product_content'+
        	'&rmproductTyp='+drmproductTyp+
        	'&roomCod='+droomCod+
        	'&productNos='+dproductNos+
        	'&hotelCod='+hotelCod
        	,on_product_content,on_product_content); 
    showWait();
}
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
function selectDay(dayId){
	var day =selector.get(dayId);
	if(day!=null && selector.getProduct(day.productNos)!=null){
		loadAjaxData(ajaxPath,
    		'&method=selectDay'+
    		'&productCod='+day.productNos+
    		'&hotelCod='+hotelCod+
    		'&orderDays=1'+
    		'&orderRooms=1'+
    		'&strCiDate='+day.date+
    		'&roomCod='+droomCod
    		,on_putCar,on_putCar); 
		showWait();			
	}
}

function on_getCalendar(oj){
	//alert(oj.responseText);
	var res  =  oj.responseXML;
	var month = getColumnValue(res,"month");
	if(month.length==1){
		month = "0" + month;
	}
	$('yearMonth').value = getColumnValue(res,"year")+"/"+month;
	var column = 0;
	var row = 0;
	for(row =0;row <6;row++){
		for(column =0;column <=6;column++){
			var d = "date"+row+column;
			if(res.getElementsByTagName(d)[0]==null){
				selector.dayZones[row][column] = new DayZone(selector,row,column,"","0","",-1,0,0);
			}else{
				var date = getColumnValue(res,"date"+row+column);
				var day = getColumnValue(res,"day"+row+column);
				selector.dayZones[row][column] = new DayZone(selector,row,column,"",day,date,-1,0,0);
			}
		}
	}
	selector.previousMonth = getColumnValue(res,"previousMonth");
	selector.nextMonth = getColumnValue(res,"nextMonth");
	selector.showDay();
	window.status = "載入完成!!";
	YAHOO.example.container.wait.hide();
}
function getCalendar()
{
   	loadAjaxData(ajaxPath,
        	'&method=getCalendar'+
        	'&hotelCod='+hotelCod
        	,on_getCalendar,on_getCalendar); 
    showWait();
}
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
	function showRoomDetail(roomCod, hotelCod,productNos){
		if(drmproductTyp=="C                   "){
			var url = encodeURI(basePath+"hotel/showRoomDetail.action?roomCod=" + roomCod + "&hotelCod=" + hotelCod+"&crossNos="+productNos+"&locale="+locale);
			window.open(url, "detail", "width=600px, height=680px, scrollbars=Yes, resizable=Yes, status=no, top=10, left=200");			
		}else{
			var url = encodeURI(basePath+"hotel/showRoomDetail.action?roomCod=" + roomCod + "&hotelCod=" + hotelCod+"&productNos="+productNos+"&locale="+locale);
			window.open(url, "detail", "width=600px, height=680px, scrollbars=Yes, resizable=Yes, status=no, top=10, left=200");	
		}
	}
//查產品
function queryWrsRoomProduct(roomCod,beginDat)
{
	droomCod = roomCod;
	for(var i=0;i<roomCods.length;i++){
		$("roomCod"+roomCods[i]).setAttribute("background", imgDir+"007.jpg");
		$("roomCod"+roomCods[i]).className = "tab_unselect";
	}
	$("roomCod"+droomCod).setAttribute("background", imgDir+"006.jpg");
	$("roomCod"+droomCod).className = "tab_select";
	var tableObj = $('tableWrsRoomProduct');
	removeAllChild(tableObj);	
   	loadAjaxData(ajaxPath,
        	'&method=queryWrsRoomProduct'+
        	'&rmproductTyp='+drmproductTyp+
        	'&roomCod='+droomCod+
        	'&hotelCod='+hotelCod+
	        '&beginDat='+beginDat
        	,on_queryWrsRoomProduct,on_queryWrsRoomProduct); 
    showWait();
}

//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------------------------------------------------------
function on_queryRvrmcodRfs1(oj){
	//alert(oj.responseText);
	var res  =  oj.responseXML;
	var tableObj = $('tableRvrmcodRf');
	removeAllChild(tableObj);
	var tmp = new Array(0);
	var tbody = document.createElement("tbody"); 
	tableObj.appendChild(tbody);	
	var trObj = document.createElement("TR");
	//tbody.appendChild(trObj);
	tmp[tmp.length] = trObj;
  	var RvrmcodRfTag = res.getElementsByTagName("RvrmcodRf");
  	
  	var count = 0;
  	roomCods = new Array(0);
  	$('webDesc').style.overflow = "hidden";
  	$('webDesc').style.display = "none";
  	var onlyRoomCod = true;
  	for(var i = 0 ; i < RvrmcodRfTag.length ; i++ ){
  		var roomCod = getColumnValue(RvrmcodRfTag[i],"roomCod");
  		var beginDat = getColumnValue(RvrmcodRfTag[i],"beginDat");
  		if(droomCod==roomCod && dbeginDat == beginDat){
  			onlyRoomCod = false;
  		}
  	}
  	for(var i = 0 ; i < RvrmcodRfTag.length ; i++ ){
  		if(count == 3){
  			count = 0;
  			trObj = document.createElement("TR");
  			tmp[tmp.length] = trObj;
  		}
  		
  	  	var roomCod = getColumnValue(RvrmcodRfTag[i],"roomCod");
  		var hotelCod = getColumnValue(RvrmcodRfTag[i],"hotelCod");
  		var roomNam = getColumnValue(RvrmcodRfTag[i],"roomNam");
  		var beginDat = getColumnValue(RvrmcodRfTag[i],"beginDat");
  		var endDat = getColumnValue(RvrmcodRfTag[i],"endDat");
  		//$('beginDat').innerHTML = "";//beginDat+"~"+endDat;
  		//$('webDesc').innerHTML = drmproductTyp;
  		roomCods[roomCods.length] = roomCod;
  		
    	var tdObj = document.createElement("TD");
		//tdObj.setAttribute("id","roomCod"+roomCod);
		tdObj.id = "roomCod"+roomCod;
		//tdObj.setAttribute("className","tab_unselect");
		tdObj.className = "tab_unselect";
		tdObj.setAttribute("align","center");
		tdObj.setAttribute("scope","col");
		tdObj.setAttribute("width","160");
		tdObj.setAttribute("height","22");
		tdObj.roomCod = roomCod;
		tdObj.beginDat = beginDat;
		//tdObj.setAttribute("roomCod",roomCod);
		//tdObj.setAttribute("beginDat",beginDat);
		tdObj.style.cursor="pointer"; 
		tdObj.setAttribute("background",imgDir+"007.jpg");
		tdObj.onclick = function(event){
			droomCod = "";
			dproductNos = "";
			queryWrsRoomProduct(this.roomCod,this.beginDat);
		}	
    	tdObj.appendChild(document.createTextNode(roomNam));
    	trObj.appendChild(tdObj);
    	if(droomCod==""){
    		droomCod = roomCod;
    		dbeginDat = beginDat;
    	}
    	if(onlyRoomCod){
	    	if(droomCod==roomCod){
	    		tdObj.setAttribute("background",imgDir+"006.jpg");
	    		tdObj.className = "tab_select";
	    	}
		}else{    	
	    	if(droomCod==roomCod && dbeginDat == beginDat){
	    		tdObj.setAttribute("background",imgDir+"006.jpg");
	    		tdObj.className = "tab_select";
	    	}
    	}
    	count++;
    }	
    if(count != 3){
    	count = 3 - count;
    	for(var i=1;i<=count;i++){
	    	var tdObj = document.createElement("TD");
			//tdObj.setAttribute("className","word");
			tdObj.className = "word"; 
			tdObj.setAttribute("align","center");
			tdObj.setAttribute("scope","col");
			tdObj.setAttribute("width","160");
			tdObj.setAttribute("height","22");
			tdObj.setAttribute("background",imgDir+"007.jpg");
	    	trObj.appendChild(tdObj);	
    	}
    }
  	for(var i = tmp.length-1 ; i >=0 ; i-- ){
  		tbody.appendChild(tmp[i]);
 		trObj = document.createElement("TR");
 		tbody.appendChild(trObj);
 			
		var tt = document.createElement("TD");
		tt.setAttribute("colSpan",3);
		tt.setAttribute("height","1");
		tt.setAttribute("bgColor","#FFFFFF");	
		trObj.appendChild(tt);    		
  	}   
    var webDesc = getColumnValue(res,"webDesc");
    $('webDesc').innerHTML = webDesc;  	
  	if(roomCods.length==0){
		YAHOO.example.container.wait.hide();
		var tableObj = $('tableRvrmcodRf');
		removeAllChild(tableObj);
		
		tableObj = $('tableWrsRoomProduct');
		removeAllChild(tableObj);
		
		$('thRoomFacilities').innerHTML = "";
		$('rvrmcodImage').src = imgDir + "day-000.jpg";
		tableObj = $('tableWrsRoomProduct');
		removeAllChild(tableObj);
		
		$('th_nextMonth').className = "word";
		$('th_nextMonth').style.cursor="";
		$('th_nextMonth').setAttribute("onclick","");
		$('img_nextMonth').src = imgDir + "calender_05_1.gif";
		$('th_previousMonth').className = "word";
		$('th_previousMonth').style.cursor="";
		$('th_previousMonth').setAttribute("onclick","");
		$('img_previousMonth').src = imgDir + "calender_03_1.gif";		
		dproductNos = "";
		
		YAHOO.example.container.wait.hide();
		selector.clearDay(); 
		$('webDesc').style.overflow = "auto";
		$('webDesc').style.display = "inline";
		$('webDesc').style.height ="100px" ;
		$('webDesc').style.width ="460px" ;		
		return; 	
  	} 
  	if(droomCod!=""){
  		var c = false;
  		for(var i=0;i<roomCods.length;i++){
  			if(roomCods[i]==droomCod){
  				c =true;
  				break;
  			}
		}
		if(c==false){
			if(roomCods.length>0){
				droomCod = roomCods[0];
				$("roomCod"+droomCod).setAttribute("background", imgDir+"006.jpg");
				$("roomCod"+droomCod).className = "tab_select";				
			}
			else{
				YAHOO.example.container.wait.hide();
				$('webDesc').style.overflow = "auto";
				$('webDesc').style.display = "inline";
				$('webDesc').style.height ="100px" ;
				$('webDesc').style.width ="460px" ;				
				return;
			}
		}
  	}
  	

    YAHOO.example.container.wait.hide();
	    loadAjaxData(ajaxPath,
	        	'&method=queryWrsRoomProduct'+
	        	'&rmproductTyp='+drmproductTyp+
	        	'&roomCod='+droomCod+
	        	'&hotelCod='+hotelCod+
	        	'&beginDat='+dbeginDat
	        	,on_queryWrsRoomProduct,on_queryWrsRoomProduct);
	    showWait();
	$('webDesc').style.overflow = "auto";
	$('webDesc').style.display = "inline";
	$('webDesc').style.height ="100px" ;
	$('webDesc').style.width ="460px" ;
}
//查房型
function queryRvrmcodRfs(rmproductTyp)
{
	//alert(rmproductTyp);
	drmproductTyp = rmproductTyp;
	for(var i=0;i<rmproductTypRfs.length;i++){
		$("rmproductTyp"+rmproductTypRfs[i]).setAttribute("background",imgDir+"007.jpg");
		$("rmproductTyp"+rmproductTypRfs[i]).className = "tab_unselect";
	}
	if($("rmproductTyp"+drmproductTyp)==null){
		YAHOO.example.container.wait.hide();
		var tableObj = $('tableRvrmcodRf');
		removeAllChild(tableObj);
		
		var tableObj = $('tableWrsRoomProduct');
		removeAllChild(tableObj);
		
		YAHOO.example.container.wait.hide();
		
		selector.clearDay();
		return;
	}
	$("rmproductTyp"+drmproductTyp).setAttribute("background",imgDir+"006.jpg");
	$("rmproductTyp"+drmproductTyp).className = "tab_select";
	if(defaults!=1){
		droomCod = "";
		dproductNos = "";
	}	
	var tableObj = $('tableRvrmcodRf');
	removeAllChild(tableObj);
	showWait();
   	loadAjaxData(ajaxPath,
        	'&method=queryRvrmcodRfs'+
        	'&rmproductTyp='+drmproductTyp+
        	'&roomCod='+droomCod+
        	'&hotelCod='+hotelCod
        	,on_queryRvrmcodRfs1,on_queryRvrmcodRfs1);  
}
function queryRvrmcodRfs2(rmproductTyp)
{
	drmproductTyp = rmproductTyp;
	for(var i=0;i<rmproductTypRfs.length;i++){
		$("rmproductTyp"+rmproductTypRfs[i]).setAttribute("background",imgDir+"007.jpg");
		$("rmproductTyp"+rmproductTypRfs[i]).className = "tab_unselect";
	}
	$("rmproductTyp"+drmproductTyp).setAttribute("background",imgDir+"006.jpg");
	$("rmproductTyp"+drmproductTyp).className = "tab_select";
	var tableObj = $('tableRvrmcodRf');
	removeAllChild(tableObj);	
	showWait();
   	loadAjaxData(ajaxPath,
        	'&method=queryRvrmcodRfs'+
        	'&rmproductTyp='+drmproductTyp+
        	'&roomCod='+droomCod+        	
        	'&hotelCod='+hotelCod
        	,on_queryRvrmcodRfs1,on_queryRvrmcodRfs1);  
}

function on_queryRmproductTyps(oj){
	//alert(oj.responseText);
	var res  =  oj.responseXML;
	var tableObj = $('tableRmproductTyp');
	removeAllChild(tableObj);
	var tmp = new Array(0);
	var tbody = document.createElement("tbody"); 
	tableObj.appendChild(tbody);	
	var trObj = document.createElement("TR");
	tmp[tmp.length] = trObj;
  	var RmproductTypRfTag = res.getElementsByTagName("RmproductTypRf");
  	rmproductTypRfs = new Array(0);
  	var count = 0;
  	for(var i = 0 ; i < RmproductTypRfTag.length ; i++ ){
  		if(count == 3){
  			count = 0;
  			trObj = document.createElement("TR");
  			tmp[tmp.length] = trObj;
  		}
  	  	var rmproductTyp = getColumnValue(RmproductTypRfTag[i],"rmproductTyp");
  		var typeNam = getColumnValue(RmproductTypRfTag[i],"typeNam");
    	var tdObj = document.createElement("TD");
		tdObj.id = "rmproductTyp"+rmproductTyp;
		tdObj.className = "tab_unselect";
		tdObj.setAttribute("align","center");
		tdObj.setAttribute("scope","col");
		tdObj.setAttribute("width","160");
		tdObj.setAttribute("height","22");
		tdObj.rmproductTyp = rmproductTyp;
		rmproductTypRfs[rmproductTypRfs.length] = rmproductTyp;
		tdObj.style.cursor="pointer"; 
		tdObj.setAttribute("background",imgDir+"007.jpg");
		tdObj.onclick = function(event){
			queryRvrmcodRfs(this.rmproductTyp);
		}	
    	tdObj.appendChild(document.createTextNode(typeNam));
    	trObj.appendChild(tdObj);
    	if(drmproductTyp==""){
    		drmproductTyp = rmproductTyp;
    	}
	    if(rmproductTyp==drmproductTyp){
	    	tdObj.setAttribute("background",imgDir+"006.jpg");
	    	tdObj.className = "tab_select";
	    }
    	count++;
    }	
    if(rmproductTypRfs.length==0){
		YAHOO.example.container.wait.hide();
		var tableObj = $('tableRmproductTyp');
		removeAllChild(tableObj);
		
		$('webDesc').innerHTML="";
		
		tableObj = $('tableRvrmcodRf');
		removeAllChild(tableObj);
		
		$('thRoomFacilities').innerHTML = "";
		$('rvrmcodImage').src = imgDir + "day-000.jpg";
		tableObj = $('tableWrsRoomProduct');
		removeAllChild(tableObj);
		
		$('th_nextMonth').className = "word";
		$('th_nextMonth').style.cursor="";
		$('th_nextMonth').setAttribute("onclick","");
		$('img_nextMonth').src = imgDir + "calender_05_1.gif";
		$('th_previousMonth').className = "word";
		$('th_previousMonth').style.cursor="";
		$('th_previousMonth').setAttribute("onclick","");
		$('img_previousMonth').src = imgDir + "calender_03_1.gif";		
		dproductNos = "";
		
		YAHOO.example.container.wait.hide();
		selector.clearDay();  	
		return;
  	} 
    if(count != 3){
    	count = 3 - count;
    	for(var i=1;i<=count;i++){
	    	var tdObj = document.createElement("TD");
			tdObj.className = "word"; 
			tdObj.setAttribute("align","center");
			tdObj.setAttribute("scope","col");
			tdObj.setAttribute("width","160");
			tdObj.setAttribute("height","22");
			tdObj.setAttribute("background",imgDir+"007.jpg");
	    	trObj.appendChild(tdObj);	
    	}
    }
  	for(var i = tmp.length-1 ; i >=0 ; i-- ){
  		tbody.appendChild(tmp[i]);
 		trObj = document.createElement("TR");
 		tbody.appendChild(trObj);
 			
		var tt = document.createElement("TD");
		tt.setAttribute("colSpan",3);
		tt.setAttribute("height","1");
		tt.setAttribute("bgColor","#FFFFFF");	
		trObj.appendChild(tt);    		
  	}    
  	if(drmproductTyp==""){
  		drmproductTyp = getColumnValue(res,"drmproductTyp");
  	}
  	else
  	{
  		var c = false;
  		for(var i=0;i<rmproductTypRfs.length;i++){
  			if(rmproductTypRfs[i]==drmproductTyp){
  				c =true;
  				break;
  			}
		}
		if(c==false){
			if(rmproductTypRfs.length>0){
				drmproductTyp = rmproductTypRfs[0];
			}
			else{
				YAHOO.example.container.wait.hide();
				return;
			}
		}
  	}
  	//-------修改下方的copyright---
  	var copyrightTag = res.getElementsByTagName("copyright");
  	var copyRight="";
  	for(var i = 0 ; i < copyrightTag.length ; i++ ){
  	  copyRight=getColumnValue(copyrightTag[i],"hotelName")+"&nbsp;&nbsp;";
  	  copyRight+=jl_tel+getColumnValue(copyrightTag[i],"tel1Nos")+'&nbsp;&nbsp';
  	  copyRight+=jl_fax+getColumnValue(copyrightTag[i],"faxNos")+'&nbsp;&nbsp';
  	  copyRight+=jl_addr+':'+getColumnValue(copyrightTag[i],"addr")+'&nbsp;&nbsp';
  	}
  	document.getElementById('copyrightDiv').innerHTML=copyRight;
    //---------------------------
    showWait();
    queryRvrmcodRfs(drmproductTyp);
}
function showNews(oj) {
        var res  =  oj.responseXML;
        var newsTag = res.getElementsByTagName("news");
        if(newsTag.length<=0)  return;
		creatNewsDialog(res); 
		$j('#showNewsDialog').dialog('open');
}
function readNews(index,opertation){
  var jsessionid = getid();
  loadAjaxData(ajaxPath,
       		'&method=showNews'+
       		'&jsessionid='+jsessionid
       		,showNews,showNews);
}
function toType2(){
	var u = '';
	if($('yearMonth')!=null && $('yearMonth').value.length==7){
		u = '&select_year='+$('yearMonth').value.substr(0,4)+'&select_month='+$('yearMonth').value.substr(5,2);
	}
	if($('brandCod') != null){
	 	window.location.href = encodeURI('showProductRoomList2.action?where=1&brandCod='+$('brandCod').value+'&hotelCod='+$('hotelCod').value+u);
	}else if($('hotelCod')!=null){
		window.location.href = encodeURI('showProductRoomList2.action?where=1&hotelCod='+$('hotelCod').value+u);
	}else{
		window.location.href = encodeURI('showProductRoomList2.action?where=1'+u);
	}
}