/*获取数组中最大数
  var k =[3,100,4,7,90],
  	  j = k.Max();//返回100
*/
Array.prototype.Max = function(){
   var i, Max = this[0];
   for (i = 1; i < this.length; i++){
	   if (Max < this[i])
	   Max = this[i];
   }
   return Max;
}

var loadImg = Class($_$,{
	creat:function(){},
	loadImg:function(){
		var J = $("img[lang]").get(),
			_J = J.length,
			K = Math.ceil(_J/5),
			L = [],
			TT = [],
			M,N,O,A;
		for(M = 0;M<K;M++){
			if(M<K){
				N = J.slice(0,5);
				L.push(N);
				J.splice(0,5)
			}
		}
		
		for(O=0;O<K;O++){
			var B;
			for(B=0;B<L[O].length;B++){
				var P = L[O][B].lang;
				/*$.getJSON($_$.D+O_o.E+O_o.I+P+O_o.J, function(json){
					$("img[lang='"+ json.value +"']").attr("src",json.url)
				})*/

				$.getJSON("/Ajax/AjaxImgUrl.aspx?image="+P, function(json){
					$("img[lang='"+ json.value +"']").attr("src",json.url)
				})
			}
		}
	}
}),
carCkeck = Class($_$,{
	creat:function(t){
		this.t = t;
		carCkeck.o_O = this.t;
		carCkeck.people.T = function(){return $("#"+ t)};
		carCkeck.people.mT = function(){return $("#selectAll")};
		carCkeck.people.aT = function(){return $("#"+ t + " td input[disabled!=true]")};
		carCkeck.people.K = function(){return $("#"+ t + " td input[disabled!=true]").length};
		carCkeck.people.J = [];
	},
	ckeck:function(){
		carCkeck.people.mT().click(function(){
			if($(this).attr("checked") == true){
				carCkeck.clearAll(this);
			}
			if($(this).attr("checked") == false){
				carCkeck.selectAll(this);
			}			  
		})
		carCkeck.whosOn();
	},
	whosOn:function(){
		var _aT = carCkeck.people.aT();
		for(var I =0;I < _aT.length;I++){
			(function(){
				var _I = I,C;	
				_aT[_I].onclick = function(){
					C = $("#"+ carCkeck.o_O + " td").find("input[checked=true]").filter("[disabled!=true]").length;
					if(C == carCkeck.people.K()){
						carCkeck.people.mT().attr("checked",true);
					}
					if(C != carCkeck.people.K()){
						carCkeck.people.mT().attr("checked",false);
					}
					carCkeck.whoWillGo();
				}
			})()
		}
		carCkeck.whoWillGo();
	},
	selectAll:function(ps){
		carCkeck.people.aT().removeAttr("checked");
		$(ps).removeAttr("checked");
		carCkeck.whoWillGo();
		
	},
	clearAll:function(ps){
		$(ps).attr("checked","checked");
		carCkeck.people.aT().attr("checked","checked");
		$(ps).attr("checked");
		carCkeck.whoWillGo();
	},
	whoWillGo:function(){
		carCkeck.people.J = [];
		var _ID = $("#"+ carCkeck.o_O + " td").find("input[checked=true]").filter("[disabled!=true]");
		for(var A = 0;A<_ID.length;A++){
			if($(_ID[A]).attr("checked") != false){
				carCkeck.people.J.push($(_ID[A]).attr("id"));
				$("#someGood").val(carCkeck.people.J + ",");
			}
		}
		if(_ID.length==0){$("#someGood").val("");}
	},
	people:{},
	o_O:""
}),
ckeckCarInfo = Class($_$,{//Drip!
	creat:function(n,m,url,fn){
		this.n = n;
		this.m = m;
		this.url = url;
		this.fn = fn;
		ckeckCarInfo.o = {};
		ckeckCarInfo.o.ev = this.n;
		ckeckCarInfo.o.pW = ($("body").outerWidth() -960)/2;
	},
	innt:function(){
		if($("#ajaxTR").html() != ""){
			$("#" + this.m + " tr").removeAttr("class");
			$("#ajaxTR").remove();
		}
		var n = this.n,
			tag = $(n),
			url = this.url,
			fn = this.fn,
			closeBut,
			pU	= url.substring(0,url.indexOf("?")),
			dat	= url.substring(url.indexOf("?")+1,url.length),
			PP = tag.parent().parent(),
			colspanNode=PP.find('td').length,
			M = $("#" + this.m + " tr");
			
		ckeckCarInfo.creatTR(PP,colspanNode);
		PP.addClass("carOn");
		closeBut = $("#carProduct span[close='close']");
		var toClose = function(event){ckeckCarInfo.closeBox(event.data.cId,event.data.pId)},
			ContentBox = $("#carProduct");
		
		closeBut.bind("click", {cId:ContentBox,pId:PP}, toClose);
		ckeckCarInfo.getAJAX(pU,dat,ContentBox,fn);
	},
	creatTR:function(PP,colspanNode){
		var tr = new String;
		tr+="<tr id=\"ajaxTR\">";
		tr+="<td colspan=\""+colspanNode+"\" style=\"background:#eff8ff;\">";
		tr+="<div class=\"productsInfo\" style=\"display:none\" id=\"carProduct\">";
		tr+="<span close=\"close\" class=\"arrowClose\">"+ O_o.Close +"</span>";
		tr+="<p class=\"proInfoArrow\" id=\"carArr\"></p>";
		tr+="<div id=\"contentBox\"></div>";
		tr+="</div>";
		tr+="</td>";
		tr+="</tr>";
		$(tr).insertAfter(PP);
	},
	getAJAX:function(url,dat,ContentBox,fn){
		var nR =Math.ceil($(ckeckCarInfo.o.ev).offset().left - ckeckCarInfo.o.pW -15)
		$.ajax({
			type:"GET",
			url:url,
			data:dat,
			cache:false,
			async:true,
			error:function(){
				ContentBox.animate({
					opacity:"show"
				},900)
				ContentBox.html(O_o.FailMsgC);
			},
			success:function(html){
				$("#contentBox").html(html);
				$("#carArr").css({
					left:nR + "px"
				})
				ContentBox.animate({
					opacity:"show"
				},900,function(){
					eval(fn);
				})
			}
		})
	},
	closeBox:function(ContentBox,PP){
		var atr = $("#ajaxTR");
		ContentBox.animate({
			height:"toggle",
			opacity:"hide"
		},900,function(){
			PP.removeClass("carOn");
			try{
				PP = null;
				ContentBox = null;
			}finally{
				atr.remove();
				art = null;
			}
		})
	}
}),
outterClose = Class(ckeckCarInfo,{
	creat:function(again){
		var __C = $("#carProduct"),
			atr = $("#ajaxTR"),
			_PP = atr.prev();
		__C.animate({
			opacity:"hide"
		},900,function(){
			_PP.removeClass("carOn");
			try{
				__C = null;
				_PP = null;
				atr.find("*").unbind();
			}finally{
				atr.remove();
				atr = null;
			}
		})
	}
}),
searcCity = Class($_$, {
    creat: function(tO) {//基本参数
        //id,et,tagId
        this.tO = tO;
        searcCity.cityOp = tO;
        searcCity.cityOp.b = $("#" + searcCity.cityOp.id);
        searcCity.cityOp.bH = $(searcCity.cityOp.et).height();
        searcCity.cityOp.bW = $(searcCity.cityOp.et).width()
        searcCity.cityOp.bT = $(searcCity.cityOp.et).offset().top;
        searcCity.cityOp.bL = $(searcCity.cityOp.et).offset().left;
        searcCity.cityOp.cB = $("#" + searcCity.cityOp.id + " span[title]");
        searcCity.cityOp.theTag = $("#" + searcCity.cityOp.tagId);
        searcCity.cityOp.theEle = $("#" + searcCity.cityOp.id + " a");
        searcCity.cityOp.cB.click(function() {
            searcCity.hideBox(searcCity.cityOp.id, searcCity.cityOp.bT, searcCity.cityOp.bH)
        });
    },
    showCityBox: function() {
        var theLeft, fix;
        if ($("body div[citybox]").length > 0) {
            $("body div[citybox]").css("display", "none");
            $("#shadow").remove();
        }
        if (searcCity.cityOp.b.css("display") == "block") {
            searcCity.hideBox(searcCity.cityOp.id, searcCity.cityOp.bT, searcCity.cityOp.bH);
            return;
        }

        if (searcCity.cityOp.width != undefined && searcCity.cityOp.width != null) {//宽度设定
            searcCity.cityOp.b.css("width", searcCity.cityOp.width + "px")
        }

        if (searcCity.cityOp.type == "left" || searcCity.cityOp.type == undefined) {//左边打开
            theLeft = searcCity.cityOp.bL - 72;
            fix = 5;
        }
        if (searcCity.cityOp.type == "right") {//右边打开
            theLeft = searcCity.cityOp.bL - searcCity.cityOp.b.outerWidth() + searcCity.cityOp.bW;
            fix = -5;
        }

        searcCity.cityOp.b.css({//弹出层基本设置
            display: "none",
            border: "1px solid #9c9c9c",
            top: searcCity.cityOp.bT + searcCity.cityOp.bH - 5 + "px",
            left: theLeft + "px"
        })

        if ($("div:first").attr("id") != searcCity.cityOp.b.attr("id")) {
            $("body").append(searcCity.cityOp.b);
        }


        searcCity.cityOp.b.animate({//弹出层显示
            top: searcCity.cityOp.bT + searcCity.cityOp.bH - 1 + "px",
            opacity: "show"
        }, 250)

        //阴影创建于显示
        searcCity.shadow(searcCity.cityOp.id, searcCity.cityOp.bT, searcCity.cityOp.bH, theLeft, fix);

        searcCity.cityOp.theEle.click(function() {//弹出层内部元素点击事件绑定
            theV = $(this).html();
            searcCity.cityOp.theTag.val(theV);
            searcCity.hideBox(searcCity.cityOp.id, searcCity.cityOp.bT, searcCity.cityOp.bH);
        })

        searcCity.cityOp.b.attr("cityBox", "on");

        document.documentElement.onclick = function(e) {//点击页面两边空白处关闭弹出层
            //if($("#" + id).css("display") == "none"){return false;}
            var ev = e || window.event;
            var eleSrc = ev.srcElement || ev.target;
            if (eleSrc.tagName.toLowerCase() == "body" || eleSrc.tagName.toLowerCase() == "html" || eleSrc.tagName.toLowerCase() == "form") {
                searcCity.hideBox(searcCity.cityOp.id, searcCity.cityOp.bT, searcCity.cityOp.bH);
            }
        }
    },
    shadow: function(id, bT, bH, bL, fix) {//阴影创建
        var sd = document.createElement("div");
        sd.id = "shadow";
        $("body").append(sd);
        $("#shadow").css({
            display: "none",
            height: $("#" + id).outerHeight(true) + "px",
            width: $("#" + id).outerWidth(true) + "px",
            "background-color": "#000",
            opacity: "0.5",
            position: "absolute",
            "z-index": "1",
            top: bT + bH + "px"
            //left:bL - 5 + "px"
        })
        if (fix) {
            var fNum = parseInt(fix);
            $("#shadow").css("left", bL - fNum + "px")
        }
        $("#shadow").animate({
            top: bT + bH + 5 + "px",
            opacity: "show"
        })
    },
    hideBox: function(id, bT, bH) {//关闭方法
        searcCity.cityOp.b.removeAttr("cityBox");
        searcCity.cityOp.b.animate({
            top: bT + bH - 5 + "px",
            opacity: "hide"
        }, 300)
        $("#shadow").animate({
            top: bT + bH + "px",
            opacity: "hide"
        }, 300)
        $("#shadow").remove();
    },
    cityOp: {}
}),
newPop = Class($_$,{//新弹出层
	creat:function(pp,cbs){
		this.pp = pp;
		newPop.Z = this.pp;
		newPop.x = {};
		if(cbs){
			newPop.x.callBack = cbs;
			newPop.x.cbCtrl = 1;
		}
		newPop.dealOp();
	},
	dealOp:function(){//弹出层参数设定
		if(newPop.Z.oid != null){
			newPop.x.tag = $("#" + newPop.Z.oid);
			newPop.x.id = newPop.Z.oid;
		}
		if(newPop.Z.bPath != "" || newPop.Z.bPath != undefined){
			newPop.x.path = newPop.Z.bPath; 
		}
		if(newPop.Z.evn != "" || newPop.Z.evn != undefined){
			newPop.x.e = newPop.Z.evn;
		}
		newPop.x.showType = newPop.Z.set.showType;
		newPop.x.setBox = newPop.Z.set.type;
		if(newPop.Z.set.popCtrl){
			newPop.x.popCtrl = newPop.Z.set.popCtrl;
		}
		newPop.x.bCls = newPop.Z.set.cls[0];
		newPop.x.aCls = newPop.Z.set.cls[1];
		if(newPop.Z.set.cls[2] == undefined || newPop.Z.set.cls[2] == ""){
			newPop.x.cCls = O_o.closeClass;
		}else{
			newPop.x.cCls = newPop.Z.set.cls[2];
		}
		if(newPop.Z.set.bStyle != "" ||  newPop.Z.bStyle != undefined){
			newPop.x.bStyle = newPop.Z.set.bStyle;
		}
		if(!newPop.x.bStyle || newPop.x.bStyle.indexOf("width") == -1){
			newPop.x.w = 350;
		}
		newPop.x.type = newPop.x.setBox.split("|")[0];
		newPop.x.tSet = newPop.x.setBox.split("|")[1];
		if(newPop.x.e){
			newPop.x.bT = Math.ceil($(newPop.x.e).offset().top);
			newPop.x.bL = Math.ceil($(newPop.x.e).offset().left);
			newPop.x.eH = Math.ceil($(newPop.x.e).outerHeight());
			newPop.x.eW = Math.ceil($(newPop.x.e).outerWidth());
		}
		newPop.defOpSet();
		
	},
	defOpSet:function(){//公用参数设定。派生方法调用时可直接用。
		newPop.x.dW =$("body").width();
		newPop.x.dH = $(document).height();
		newPop.x.ajaxLoading = "<div id=\"newPopAjaxLoading\" style=\"position:absolute;display:none;width:31px;height:31px;\"><img src=\"/images/blueLoad.gif\" alt=\"\" /></div>";
		if(isIE){
			newPop.x.body = "<div id=\"citsPop\"><i close=\"close\"></i><iframe id=\"fixIE6\" style=\"height:0;\"></iframe></div>";
		}else{
			newPop.x.body = "<div id=\"citsPop\"><i close=\"close\"></i></div>";
		}
	},
	popReset:function(){//重置
		if(newPop.x.axBox != undefined && newPop.x.axBox.css("display") == "block"){
			newPop.x.axBox.hide();
			newPop.x.axBox.unbind();
		}
		if(_$("citsPop")){
			$("#citsPop").remove();
		}
		if(_$("calender")){$("#calender").remove();}
		if($("div[pop='pop']") && $("div").attr("id") != "citsPop"){
			$("div[pop='pop']").hide();
		}
		if(newAlert.A != undefined){
			clearTimeout(newAlert.A.timer);
		}
	},
	inntPop:function(){//初始化
	
		newPop.popReset();
		
		document.documentElement.onclick = function(e){
			var ev = e || window.event;
			var eleSrc = ev.srcElement || ev.target;
			if(eleSrc.tagName.toLowerCase() == "body" || eleSrc.tagName.toLowerCase() == "html" || eleSrc.tagName.toLowerCase() == "form"){
				if(newPop.Z.oid != null || newPop.x.tag != null){
					newPop.ppHide();
				}
			}
		}
		if (!newPop.x.tag) {//自动构建流程开始
			$(function(){
				$("body").append(newPop.x.body);
				newPop.x.tag = $("#citsPop");
				newPop.x.tag.addClass(newPop.x.bCls);
				newPop.x.id = "citsPop";
			})
		}
		
		closeBut = newPop.x.tag.find("i[close='close']");
		closeBut.addClass(newPop.x.cCls);
		closeBut.css("z-index","1");
		closeBut.click(function(){
			newPop.ppHide();
		})
		
		if(newPop.x.bStyle){
			if(newPop.x.bStyle.indexOf("height:") != -1){		
				newPop.x.tag.attr("style",newPop.x.bStyle.replace(/height:/g,"sheight:") + "display:none;");//屏蔽外层高度设定
			}else{
				newPop.x.tag.attr("style",newPop.x.bStyle + "display:none;");
			}
		}else{
			newPop.x.tag.css("width",newPop.x.w + "px");
		}
		
		switch(newPop.x.showType){
			case "arrow"://带箭头
				newPop.x.tag.attr("class",newPop.x.bCls);
				if(newPop.x.tag.find("b[arr]").length == 0){
					newPop.x.tag.append("<b arr=\"1\"></b");
				}
				newPop.x.arr = newPop.x.tag.find("b[arr]");
				newPop.x.arr.attr("class",newPop.x.aCls);
				newPop.setArrowBox(newPop.x.tag,newPop.x.eH,newPop.x.bT,newPop.x.bL,newPop.x.dW,newPop.x.eW);
				newPop.ppShow();
				if(!newPop.x.popCtrl){
					newPop.x.tag.attr("pop","pop");
				}
				
			break;
			
			case "whiteMark"://白色遮罩
				newPop.ppShow();
				newPop.creatMark("#fff",newPop.x.dW,newPop.x.dH,0.35);
				if(!newPop.x.popCtrl){
					newPop.x.tag.attr("pop","pop");
				}
				if(newPop.x.cbCtrl == 1){
					newPop.x.callBack();
				}
			break;
			
			case "blackMark"://黑色遮罩
				newPop.ppShow();
				if(newPop.x.type != "ajax"){
					newPop.setNalBox();
				}
				newPop.creatMark("#000",newPop.x.dW,newPop.x.dH,0.60);
				if(!newPop.x.popCtrl){
					newPop.x.tag.attr("pop","pop");
				}
				if(newPop.x.cbCtrl == 1){
					newPop.x.callBack();
				}
			break;
			
			case "noMark"://无遮罩
				newPop.ppShow();
				if(!newPop.x.popCtrl){
					newPop.x.tag.attr("pop","pop");
				}
				if(newPop.x.cbCtrl == 1){
					newPop.x.callBack();
				}
			break;
			
			default:
				return false;
		}	
		
	},
	ppShow:function(){//内容加载方式
	
		switch(newPop.x.type){
			case "ajax"://ajax加载
				if(!newPop.x.axBox){
					$("body").append(newPop.x.ajaxLoading);
					newPop.x.axBox = $("#newPopAjaxLoading");
				}
				newPop.showAjax();
			break;
			
			case "iframe"://iframe加载
				newPop.x.tag.append("<iframe src=\""+ newPop.x.path +"\" width=\"100%\" height=\""+ newPop.x.tSet +"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");
				if(newPop.x.showType == "arrow"){
					//newPop.shadow(newPop.x.id,parseInt(newPop.x.tag.css("top")),newPop.x.bL,0.45,5);
				}else{
					newPop.setNalBox();
				}
				if(isIE){
					$("#fixIE6").css({
						width:newPop.x.tag.outerWidth() + "px",
						height:newPop.x.tag.outerHeight() + "px",
						position:"absolute",
						top:"0",
						left:"0",
						"z-index":"0",
						opacity:"0"
					})	
				}
				newPop.x.tag.animate({
					opacity:"show"
				})
			break;
			
			case "nal"://直接弹出
				if(newPop.x.showType == "arrow"){
					//newPop.shadow(newPop.x.id,parseInt(newPop.x.tag.css("top")),newPop.x.bL,0.45,5);
				}else{
					if(newPop.x.tSet == "popUp"){
						newPop.setPopBox();
					}else{
						newPop.setNalBox();
					}
				}
				if(isIE){
					var iff = _$("fixIE6")?$("#fixIE6"):newPop.x.tag.find("iframe:first");
					iff.css({
						width:"100%",
						height:$("#" + newPop.x.id).innerHeight() + "px",
						position:"absolute",
						top:"0",
						left:"0",
						"z-index":"-1",
						opacity:"0"
					})
				}
				
				if (newPop.x.tSet == "popUp") {
					newPop.x.tag.animate({
						top:newPop.x.lastTop + "px",
						opacity:"show"
					})
				}else{
					newPop.x.tag.animate({
						opacity:"show"
					})
				}
				
				
			break;
			
			case "txt"://文本输入
				newPop.x.tag.append("<div>"+ newPop.x.tSet +"</div>");
				if(newPop.x.showType == "arrow"){
					//newPop.shadow(newPop.x.id,parseInt(newPop.x.tag.css("top")),newPop.x.bL,0.45,5);
				}else{
					newPop.setNalBox();
				}
				if(isIE){
					$("#fixIE6").css({
						width:"100%",
						height:$("#" + newPop.x.id).innerHeight() + "px",
						position:"absolute",
						top:"0",
						left:"0",
						"z-index":"-1",
						opacity:"0"
					})
				}
				newPop.x.tag.animate({
					opacity:"show"
				})
			break;
			
			default://默认为ajax
				newPop.showAjax();
		}
	},
	setPopBox:function(){
		newPop.x.lastTop = document.documentElement.scrollTop + 240;
		var thisT = document.documentElement.scrollTop + document.documentElement.clientHeight/2 - newPop.x.tag.outerHeight();
		newPop.x.tag.css({
			display:"none",
			position:"absolute",
			left:"50%",
			top:thisT + "px",
			"z-index":"100",
			margin:"-" + newPop.x.tag.outerHeight()/2 + "px 0 0 -" + newPop.x.tag.outerWidth()/2 + "px"
		});
	},
	showAjax:function(){//ajax读取方式
		var aArr = newPop.x.path.split("?");
		
		newPop.x.axBox.bind("ajaxStart",function(){
			$(this).css({
				top:Math.ceil(newPop.x.bT - newPop.x.eH/2) + "px",
				left:Math.ceil(newPop.x.bL + newPop.x.eW + 10) + "px"
			})
			$(this).show();
		}).bind("ajaxSuccess",function(){
			$(this).hide();
			newPop.x.axBox.unbind();
		})
		
		$.ajax({
			type:newPop.x.tSet,
			url:aArr[0],
			data:aArr[1],
			cache:false,
			error:function(){
				if(newPop.x.axBox.css("display")=="block"){
					newPop.x.axBox.hide();
					newPop.x.axBox.unbind();
				}
				newPop.x.tag.html(O_o.FailMsgC);
				var ot;
				ot = setTimeout(function(){newPop.ppHide()},2000);
			},
			success:function(html){
				newPop.x.tag.append(html);
				if (newPop.x.showType != "arrow") {
					newPop.setNalBox();
				}
				if(isIE){
					$("#fixIE6").css({
						width:"100%",
						height:$("#" + newPop.x.id).innerHeight() + "px",
						position:"absolute",
						top:"0",
						left:"0",
						"z-index":"-1",
						opacity:"0"
					})	
				}
				
				if(newPop.x.cbCtrl == 1){
					newPop.x.callBack();
				}
				
				newPop.x.tag.animate({
					opacity:"show"
				})
				/*if (newPop.x.showType == "arrow") {
					newPop.shadow(newPop.x.id, parseInt(newPop.x.tag.css("top")), newPop.x.tag.offset().left, 0.45, 5);
				}*/
			}
		});
	},
	ppHide:function(){//关闭方法
		newPop.x.tag.animate({
			opacity:"hide"
		},"fast",function(){
			if (newPop.Z == undefined || newPop.Z.oid == null) {
				try{
					newPop.x.tag.find("*").unbind();
					newPop.x.tag.remove();
					newPop.x.tag = null;
				}catch(e){
					return true;
				}finally{
					return true;
				}
				
			}
			if(newPop.x.tag != null && newPop.Z == undefined){
				newPop.x.tag.find("*").unbind();
			}
			
		})

		$("#shadow").animate({
			opacity:"hide"
		},"fast",function(){
			$("#shadow").remove();
		})
		if(_$("tMark")){
			$("#tMark").remove();
		}
		if(newPop.x.closeCallBack){
			newPop.x.closeCallBack();
		}
		
	},
	creatMark:function(mColor,dW,dH,op){//遮罩创建方法
		var mark = document.createElement("div");
		mark.id = "tMark";
		mark.innerHTML = "<iframe></iframe>";
		mark.style.display = "none";
		mark.style.backgroundColor = mColor;
		$("body").append(mark);
		$("#tMark iframe").css({
			width:dW + "px",
			height:dH + "px",
			opacity:"0"
		})
		$("#tMark").css({
			height:dH + "px",
			width:dW + "px",
			position:"absolute",
			top:"0",
			left:"0",
			"z-index":"99",
			overflow:"hidden",
			opacity:op
		});
		$("#tMark").css("display","block");
	},
	shadow:function(id,aT,aL,op,exc){//阴影创建方法
		
		var sd = document.createElement("div");
		sd.id = "shadow";
		$("body").append(sd);
		$("#shadow").css({
			display:"none",
			height:$("#" + id).outerHeight() + "px",
			width:$("#" + id).outerWidth() + "px",
			"background-color":"#000",
			opacity:op,
			position:"absolute",
			"z-index":"1",
			top:aT + "px",
			left:aL + exc + "px"
		})
		
		$("#shadow").animate({
			top:aT + exc + "px",
			opacity:"show"
		})
	},
	setNalBox:function(){//常规弹出层设定
		newPop.x.tag.css({
			position:"absolute",
			left:"50%",
			top:document.documentElement.scrollTop + document.documentElement.clientHeight/2 + "px",
			"z-index":"100",
			margin:"-" + newPop.x.tag.outerHeight()/2 + "px 0 0 -" + newPop.x.tag.outerWidth()/2 + "px"
		});
		if(isIE){
			$("#fixIE6").css({
				width:newPop.x.tag.outerWidth() + "px",
				height:newPop.x.tag.outerHeight() + "px",
				opacity:"0"
			})	
		}
	},
	setArrowBox:function(tag,bH,bT,bL,dW,bW){//带箭头弹出层设定
		var bh = tag.outerHeight(),
			boxW = tag.outerWidth(),
			whiteSp = Math.ceil((dW -960)/2),
			sT,aT,aR,aB,aL,arrL;
		
		/*if(isIE && $.browser.version == 6.0){
			if(dW%2 !=0){
				$("body").width(Math.ceil(dW)-1)
			}
		}*/
		
		//不是位于页面底部时
		if(bL > dW/2 && bT < $(document).height()*0.9){
			aT = Math.floor(bT + bH + 17);
			//aR = Math.floor(dW - bL - bW);
			aR = Math.floor(bL - boxW);
			aB = "";
			if(newPop.x.tSet == "center"){
				aL = Math.floor(bL - boxW/2);
				if(aL+boxW >= whiteSp+960){
					aL = Math.floor(bL - boxW + bW + 34);
					arrL = Math.ceil(bL -aL + bW/2 - 17);
				}else{
					arrL = Math.ceil(bL -aL + bW/2 - 17*2);
				}
			}else{
				aL = Math.floor(bL - boxW/2 - bW);
				if (aL+boxW >= whiteSp+960) {
					aL = Math.floor(bL - boxW/2 - (whiteSp/2));
				}
				arrL = Math.ceil(bL -aL + bW/2 - 17);
			}

			tag.css({
				position:"absolute",
				top:aT + "px",
				//right:aR + "px",
				"z-index":"2",
				bottom:"",
				left:aL + "px"
			});
			
			newPop.x.arr.css("left",arrL + "px");
		}
		
		if(bL < dW/2 && bT < $(document).height()*0.9){
			aT = Math.floor(bT + bH + 17);
			aR = "";
			aB = "";
			if (newPop.x.tSet == "center") {
				aL = Math.floor(bL - boxW/2);
				arrL = Math.ceil(bL -aL + bW/2 - 17*2);
			}else{
				
				aL = Math.floor(bL - bW);
				if(aL < whiteSp){
					aL = whiteSp +6;
				}
				
				arrL = Math.ceil(bL -aL + bW/2 - 17);
			}
			
			
			tag.css({
				position:"absolute",
				top:aT+ "px",
				right:"",
				"z-index":"2",
				bottom:"",
				left:aL + "px"
			});
			
			newPop.x.arr.css("left",arrL + "px");
		}
		
		//位置超过页面长度的80%时
		if(bL > dW/2 && bT > $(document).height()*0.9){
			aT = Math.floor(bT - tag.height() - bH*2) + 17;
			aR = Math.floor(dW - bL - bW);
			aB = "";
			aL = Math.floor(dW - boxW - aR);
			tag.css({
				position:"absolute",
				top:aT + "px",
				right:aR + "px",
				bottom:"",
				"z-index":"2",
				left:""
			});
		}
		
		if(bL < dW/2 && bT > $(document).height()*0.9){
			aT = Math.floor(bT - tag.height()  - bH*2);
			aR = "";
			aB = "";
			aL = Math.floor(bL);
			tag.css({
				position:"absolute",
				top:aT + "px",
				right:aR,
				bottom:aB,
				"z-index":"2",
				left:aL + "px"
			});
		}
		
		$("#fixIEs").css({
			height:bh + "px",
			width:boxW + "px",
			display:"block",
			opacity:"0"
		})
		
	}
}),
hider = Class(newPop,{
	creat:function(tt,cbs){
		if(tt != undefined){
			this.tt = tt;
			hider.h = this.tt;
			if(cbs){
				hider.h.callBack = cbs;
				hider.h.c = 1;
			}
		}
		
	},
	hidePop:function(){
		newPop.ppHide();
		if(hider.h != undefined && hider.h.c != undefined){
			hider.h.callBack();
		}
	}
}),
newAlert = Class(newPop,{
	creat:function(o,cb){
		this.o = o;
		newAlert.A = this.o;
		if(cb){
			newAlert.A.callBack = cb;
		}
	},
	setAL:function(){//基本参数设定
		newPop.x = {};
		newPop.Z = {};
		newPop.x.showType = "noMark";
		newPop.x.type = "nal";
		if(newAlert.A.set == undefined){
			newAlert.A.set = {type:"popUp",cls:"newPopBox",css:"width:200px;"};
		}
		if(newAlert.A.ot == undefined){
			newAlert.A.ot = 3000;
		}
		newPop.x.bCls = newAlert.A.set.cls == undefined?"newPopBox":newAlert.A.set.cls;
		newPop.x.tSet = newAlert.A.set.type == undefined?"popUp":newAlert.A.set.type;
		newPop.x.bStyle = newAlert.A.set.css == undefined?"width:200px;":newAlert.A.set.css;
		
	},
	inntAlert:function(){
		newAlert.setAL();
		newPop.defOpSet();
		newPop.inntPop();
		newPop.x.tag.append(newAlert.A.msg);
		if(newAlert.A.callBack != undefined){
			newAlert.A.callBack();
		}
		newAlert.oTime();
	},
	oTime:function(){//延迟
		newAlert.A.timer = setTimeout(function(){
			if(newPop.x.tag != null){
				newPop.ppHide();
			}
			clearTimeout(newAlert.A.timer);
		},newAlert.A.ot)
	}
}),
popDiv = Class($_$,{
	creat:function(id,w,aType,aClass,evn,url,title,frameH){
		this.id			= id;
		this.w			= w;
		this.aType		= aType;
		this.aClass		= aClass;
		this.evn		= evn;
		this.closeBut	= $("#" + id + " span[title='close']");
		this.dW			= document.body.scrollWidth;
		this.dH			= $(document).height();
		this.url		= url;
		this.title		= title;
		this.frameH		= frameH;
		//关闭弹出层的中间函数，用来传参的。
		var toClose = function(event){
			//alert(event.data.bId)
			popDiv.hideBox(event.data.bId)
		}
		this.closeBut.bind("click", {bId:this.id}, toClose);
	},
	boxCtrl:function(){
		if($("#tmpFloatBox")){$("#tmpFloatBox").remove();$("#shadow").remove();}
		if($("div[lang='popUp']")){$("div[lang='popUp']").hide()}
		var id		= this.id,
			w		= this.w,
			aType	= this.aType,
			dW		= this.dW,
			dH		= this.dH,
			evn		= this.evn;
			aClass	= this.aClass,
			url		= this.url,
			title	= this.title,
			frameH	= this.frameH;
			var aTc;
			if(url && aType != "arrow"){
				aType	= url.substring(0,url.indexOf(":"));
				aTc	= url.substring(url.indexOf(":")+1,url.length);
			}
		if(aType != "nal"){$("div[lang='popUp']").remove();}
		
		if(document.getElementById(id) == null && aType == "arrow"){
			//根据传入的type判断显示类型，如是带箭头类型则调用另外的函数处理
			var beArrow = CITS(popTypeArrow,[id,w,aClass,evn,url,frameH]);
			beArrow.doArrow();
			return;
		}
		
		if(aType != "ajax" && aType != "iframe" ){
			if(document.getElementById(id) == null){
				alert("找不到目标，请检查目标是否存在或传入id是否正确");
				return;
			}
		}
		var box = $("#" + id),
			rw = w == "auto"?350:w,
			h = box.height();
		box.css({
			//display:"none",
			width:rw + "px"
		})
		if(aType != "arrow"){
			switch(aType){
				case "white"://白色半透明遮罩
					popDiv.whiteMark(dW,dH);
				break;
				
				case "gray"://灰色半透明遮罩
					popDiv.grayMark(dW,dH);
				break;
					
				case "black"://黑色半透明遮罩
					popDiv.blackMark(dW,dH);
				break;
				
				case "noMark":
					//popDiv.noMark()
				break
				
				case "ajax":
				
					var aArr=aTc.split("?"),id="tmpFloatBox";
					popTypeArrow.creatBox(aClass);
					var closeBut = $("#tmpFloatBox span[title='close']");
					var ContentBox = $("#arrContent"),
						toClose = function(event){popDiv.hideBox(event.data.bId)}
					$("#tmpFloatBox").css("width",rw + "px")
					closeBut.bind("click", {bId:id}, toClose);
					if(title){
						$("#floatTitle").html(title);
						$("#floatTitle").css({
							display:"block",
							height:"20px",
							margin:"15px 0 -18px",
							padding:"0 0 0 10px",
							"border-bottom":"1px dotted #8C8A8A",
							font:"bolder 14px Arial,SimSun,sans-serif"
						});
					}
					$.ajax({
						type:aArr[0],
						url:aArr[1],
						data:aArr[2],
						cache:false,
						error:function(){
							ContentBox.html(O_o.FailMsgC);
							var ot;
							ot = setTimeout(function(){popDiv.hideBox(id)},2000);
						},
						success:function(html){
							ContentBox.html(html);
							popDiv.showBox(id,h,rw);
						}
					});
					popDiv.blackMark(dW,dH);
					return;
				break;
				
				default:
					popDiv.grayMark(dW,dH);
			}
			popDiv.showBox(id,h,rw);
		}
	},
	showBox:function(id,h,rw,aClass){
		
		var theBoxs		= $("#" + id),
			eH			= document.documentElement.clientHeight,
			boxH		= theBoxs.outerHeight()/2,
			boxW		= rw/2,
			boxT		= document.documentElement.scrollTop + eH/2,
			bClass		= theBoxs.attr("class");
			
		theBoxs.css({
			position:"absolute",
			left:"50%",
			top:boxT + "px",
			"z-index":"100",
			margin:"-" + boxH + "px 0 0 -" + boxW + "px"
		})
		theBoxs.attr("lang","popUp");
		if(aClass){
			theBoxs.attr("class",bClass + " " + aClass);
		}
		
		//theBoxs.insertBefore($("body div:first"));
		theBoxs.animate({
			opacity:"show"
		})
	},
	hideBox:function(id){
		$("#" + id).removeAttr("lang");
		$("#" + id).animate({
			opacity:"hide"
		},300)
		if($("#tMark")){
			$("#tMark").remove()
			/*$("#tMark").animate({
				opacity:"hide"
			},300,function(){
				$("#tMark").remove();
			})*/
		}
		
		if($("#shadow")){
			$("#shadow").animate({
				opacity:"hide"
			},300,function(){
				$("#shadow").remove();
			})
		}
		
		if(id == "tmpFloatBox"){$("#" + id).remove()}
		
	},
	theShadow:function(id,aT,aL,exc){
		var sd = document.createElement("div");
		sd.id = "shadow";
		$("body").append(sd);
		$("#shadow").css({
			display:"none",
			height:$("#" + id).outerHeight() + "px",
			width:$("#" + id).outerWidth() + "px",
			"background-color":"#000",
			opacity:"0.35",
			position:"absolute",
			"z-index":"1",
			top:aT + "px",
			left:aL + exc + "px"
		})
		
		$("#shadow").animate({
			top:aT + exc + "px",
			opacity:"show"
		})
	},
	creatMark:function(mColor,dW,dH,op){
		var mark = document.createElement("div");
		mark.id = "tMark";
		mark.innerHTML = "<iframe></iframe>";
		mark.style.display = "none";
		mark.style.backgroundColor = mColor;
		$("body").append(mark);
		$("#tMark iframe").css({
			width:dW + "px",
			height:dH + "px",
			opacity:"0"
		})
		$("#tMark").css({
			height:dH + "px",
			width:dW + "px",
			position:"absolute",
			top:"0",
			left:"0",
			"z-index":"99",
			overflow:"hidden",
			opacity:op
		});
		$("#tMark").css("display","block");
	},
	whiteMark:function(dW,dH){
		popDiv.creatMark("#fff",dW,dH,0.8);
	},
	grayMark:function(dW,dH){
		popDiv.creatMark("#000",dW,dH,0.5);
	},
	blackMark:function(dW,dH){
		popDiv.creatMark("#000",dW,dH,0.8);
	},
	noMark:function(){
		//预留
	}
}),
popTypeArrow = Class(popDiv,{
	creat:function(id,w,aClass,evn,url,title,frameH){
		
		//if($("div").attr("lang") == "popUp"){alert($(this).attr("lang"));$(this).remove()}
		popDiv.creat.call(this,id,w,aClass,evn,url);
		this.url	= url;
		this.aClass	= aClass;
		this.evn	= evn;
		this.frameH	= frameH;
		this.title	= title;
	},
	doArrow:function(){
		if($("#tmpFloatBox")){$("#tmpFloatBox").remove();$("#shadow").remove();}
		if($("div[lang='popUp']")){$("div[lang='popUp']").hide()}
		var id		= this.id == null?"tmpFloatBox":this.id,
			rw		= this.w == "auto"?350:this.w,
			aClass	= this.aClass,
			evn		= this.evn,
			dw		= this.dW,
			bH		= $(evn).height(),
			bW		= $(evn).width()
			bT		= $(evn).offset().top,
			bL		= $(evn).offset().left,
			url		= this.url,
			t		= $("#" + id),
			fH		= this.frameH =="auto"?300:this.frameH,
			cType	= url.substring(0,url.indexOf(":")),
			content	= url.substring(url.indexOf(":")+1,url.length),
			title	= this.title;
		if(cType != "nal"){$("div[lang='popUp']").remove();}
		
		
		document.documentElement.onclick = function(e){
			//if($("#" + id).css("display") == "none"){return false;}
			var ev = e || window.event;
			var eleSrc = ev.srcElement || ev.target;
			if(eleSrc.tagName.toLowerCase() == "body" || eleSrc.tagName.toLowerCase() == "html" || eleSrc.tagName.toLowerCase() == "form"){
				popDiv.hideBox(id);
			}
		}
		
		
		if(cType == "nal"){
			popTypeArrow.setContent(id,t,url,cType,content,comtentBox,rw,bH,bT,bL,dw,bW,fH);
		}else{
			popTypeArrow.creatBox(aClass);
		
			var tmpFloat = $("#tmpFloatBox"),
				comtentBox = $("#arrContent"),
				fTitle = $("#floatTitle");
			if(title){
				fTitle.html(title);
				fTitle.css("display","block");
				
			}
			tmpFloat.css({
				display:"none",
				
				width: rw + "px"
			})
			
			this.closeBut = $("#" + id + " span[close='close']");
			var toClose = function(event){popDiv.hideBox(event.data.bId)}
			this.closeBut.bind("click", {bId:id}, toClose);
			popTypeArrow.setContent(id,tmpFloat,url,cType,content,comtentBox,rw,bH,bT,bL,dw,bW,fH);
		}
		
	},
	creatBox:function(aClass){
		var temp_float=new String;
		temp_float+="<div id=\"tmpFloatBox\">";
		temp_float+="<p class=\"\" id=\"floatTitle\" style=\"display:none;\"></p>";
		temp_float+="<span class=\"arrowClose\"  close=\"close\">"+ O_o.Close +"</span>";
		temp_float+="<div class=\"arrowIn\" id=\"arrContent\"></div>";
		temp_float+="<div id=\"arrowType\"></div>";
		temp_float+="<iframe id=\"fixIEs\" style=\"border:0;display:none;position:absolute;top:0;left:0;z-index:-1;\"></iframe>";
		temp_float+="</div>";
		$("body").append(temp_float);
		if(aClass != null){$("#tmpFloatBox").attr("class","popArrowBox " + aClass);}else{$("#tmpFloatBox").attr("class","popArrowBox")}
		//alert($("#tmpFloatBox").html())
	},
	setContent:function(id,tag,url,cType,content,comtentBox,rw,bH,bT,bL,dw,bW,fH){
		tag.attr("lang","popUp");
		tag.css("position","absolute");
		switch(cType){
			case "ajax":
				var aArr=content.split("?");
				$.ajax({
					type:aArr[0],
					url:aArr[1],
					data:aArr[2],
					cache:false,
					error:function(){
						popTypeArrow.showArrowBox(tag,rw,bH,bT,bL,dw,bW);
						comtentBox.html(O_o.FailMsgC);
						var ot;
						ot = setTimeout(function(){popDiv.hideBox(id)},2000);
					},
					success:function(html){
						comtentBox.html(html);
						popTypeArrow.showArrowBox(tag,rw,bH,bT,bL,dw,bW);
					}
				});
				
			break;
			
			case "iframe":
				comtentBox.html("<iframe src=\""+content+"\" width=\"100%\" height=\""+ fH +"\" scrolling=\"auto\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\"></iframe>");
				popTypeArrow.showArrowBox(tag,rw,bH,bT,bL,dw,bW);
			break;
			
			case "nal":
			//alert($("#" + id).outerWidth())
				var aT = Math.ceil(bT + bH*2),
					aL = Math.ceil(bL - tag.outerWidth(true)/4);
				
				if($("body div:first").attr("id")!=id){tag.insertBefore($("body div:first"));}
				
				tag.css({
					top:aT + "px",
					left:aL + "px",
					width:rw + "px",
					"z-index":"2"
				});
				popDiv.theShadow(id,aT,aL,5);
				tag.animate({
					opacity:"show"
				})
			break;
			
			case "txt":
				
			break;
		}
	},
	showArrowBox:function(tag,rw,bH,bT,bL,dW,bW){
		//alert(tag.attr("id"));
		var bh = tag.outerHeight(),boxW = tag.outerWidth(),arrowType = $("#arrowType"),sT,aT,aR,aB,aL;
		
		
		//不是位于页面底部时
		if(bL > dW/2 && bT < $(document).height()*0.9){
			aT = bT + bH*2;
			aR = dW - bL - bW;
			aB = "";
			aL = dW - boxW - aR;
			tag.css({
				position:"absolute",
				top:aT + "px",
				right:aR + "px",
				"z-index":"2",
				bottom:"",
				left:""
			});
			arrowType.css("right",bW/2 + "px");
			popDiv.theShadow(tag.attr("id"),aT,aL,5);
			sT = "rt";
		}
		
		if(bL < dW/2 && bT < $(document).height()*0.9){
			aT = bT + bH*1.5;
			aR = "";
			aB = "";
			aL = bL;
			tag.css({
				position:"absolute",
				top:aT+ "px",
				right:"",
				"z-index":"2",
				bottom:"",
				left:aL + "px"
			});
			arrowType.css("left",bW/2 + "px");
			popDiv.theShadow(tag.attr("id"),aT,aL,5);
			sT = "lt";
		}
		
		//位置超过页面长度的80%时
		if(bL > dW/2 && bT > $(document).height()*0.9){
			aT = bT - tag.height() - bH*2;
			aR = dW - bL - bW;
			aB = "";
			aL = dW - boxW - aR;
			tag.css({
				position:"absolute",
				top:aT + "px",
				right:aR + "px",
				bottom:"",
				"z-index":"2",
				left:""
			});
			arrowType.css("right",bW/2 + "px");
			//popDiv.theShadow("tmpFloatBox",aT,aL,5);
			sT = "rb";
		}
		
		if(bL < dW/2 && bT > $(document).height()*0.9){
			aT = bT - tag.height()  - bH*2;
			aR = "";
			aB = "";
			aL = bL;
			tag.css({
				position:"absolute",
				top:aT + "px",
				right:aR,
				bottom:aB,
				"z-index":"2",
				left:aL + "px"
			});
			arrowType.css("left",bW/2 + "px");
			//popDiv.theShadow("tmpFloatBox",aT,aL,5);
			sT = "lb";
		}
		
		$("#fixIEs").css({
			height:bh + "px",
			width:boxW + "px",
			display:"block",
			opacity:"0"
		})
		arrowType.addClass(sT);
		tag.attr("lang","popUp");
		tag.animate({
			opacity:"show"
		})
	}
}),
picLibShow= Class(popDiv,{

	creat:function(imgClass,url,cc){
	
	
	if($("#picLib").html()==null){
		$("body").append('<div class="picLib" id="picLib"><h4><span id="picTitle"></span><span class="picClose" id="picClose"></span></h4><div class="bigPic" id="bigPic"></div><div class="leftArrBox"><div class="leftArr" id="leftArr"></div></div><div class="smallImgList"><div class="picBox" id="picBox"></div></div> <div class="rightArrBox"><div class="rightArr" id="rightArr"></div></div></div>');
	}
	
	if(url==""){return false;}
	if(_$('picLib').style.display=="block"){return false;}
	
	if(imgClass==""){
		imgClass="null";
	}
	
	
	var picList=$("#"+imgClass+" img"),//页面图片列表ID
	   picId=[],//图片标识
	    picLink=[],//小图链接
   	    smallPic=[],//小图组
	    picTitle=[],//图片标题
	    bigPicUrl=[],//大图链接
	    picHtml="",
	    picBox=$("#picBox"),//小图组层ID
	    move=true,//判定动画效果可否执行
	    max,idNow,//max:图片组数；idNow:移动后所选的默认图片;
	    id="picLib",//图片效果层id
	    w=parseInt($("#picLib").css("width")),//图片效果层宽度
		picNode=true;
		
	if(imgClass !="null" && picList.length ==0 && cc == 0){
		return false;
	}

	$.ajax({
	   type: "GET",
	   url: url,
	   dataType: "json",
	   data: '',
	   error: function(){
		return false;
	   },
	   success: function(json){
		   
	   if (json.pic.length==0){return false;}
	   if (json.pic.length==1){_$('picBox').style.display="none";_$('picLib').style.height="495px";}
	   else{_$('picBox').style.display="inline";_$('picLib').style.height="575px";}
	   for (var i=0;i<json.pic.length;i++ ){
		 picId[i]=json.pic[i].id;
		 picLink[i]=json.pic[i].url;
		 picTitle[i]=json.pic[i].title;
		 bigPicUrl[i]=json.pic[i].bigUrl;
		 picHtml=picHtml+'<img src="../images/loading.gif">';
			
		 }
		 $("#picBox").html(picHtml);
		 smallPic=$("#picBox img");
		
		 if (picList[0]==undefined)
		{	
			picList[0]=picId[0];
		}
		
		 if (picId.length%6==0){
				max=parseInt(picId.length/6-1);
			}
			else{
				max=parseInt(picId.length/6);
			}
		$("#leftArr").unbind();
		$("#rightArr").unbind();
		picLibShow.picLibSet(picList,id,picId,picLink,smallPic,picTitle,bigPicUrl,picBox,move,max,idNow,w,picNode,imgClass,url);
	   }
	});
	},
	//绑定事件
	picLibSet:function(picList,id,picId,picLink,smallPic,picTitle,bigPicUrl,picBox,move,max,idNow,w,picNode,imgClass,url){
		//关闭按钮
		
				
		$("#picClose").click(function(){popDiv.hideBox(id);_$('bigPic').innerHTML="";});
		//左按钮
		$("#leftArr").click(function(){
			if(move)
			{
				if(picBox.css("left")!="0px"){
				   idNow=(-parseInt(picBox.css("left"))/564-1)*6
				   var left =parseInt(picBox.css("left"))+564;
				   picLibShow.changePic(idNow,max,smallPic,bigPicUrl,picTitle,picNode);
				   picLibShow.picLoad(picId[idNow],picId,max,smallPic,bigPicUrl,picTitle,picLink,picNode);
				   move=false;
				   picBox.animate({left:left+'px'}, 1000,function(){move=true;});
				}
			}
		  });
		//右按钮
		$("#rightArr").click(function(){
			if(move)
			{
				 if(picBox.css("left")!="-"+(max*564)+"px"){
					 idNow=(-parseInt(picBox.css("left"))/564+1)*6;
					 var right =parseInt(picBox.css("left"))-564;
					 picLibShow.changePic(idNow,max,smallPic,bigPicUrl,picTitle,picNode);
					 picLibShow.picLoad(picId[idNow],picId,max,smallPic,bigPicUrl,picTitle,picLink,picNode);
					 move=false;
					 picBox.animate({left: right+'px'}, 1000,function(){move=true;});
				 }
			 }
		  });
		//给图片绑定事件

		if (picList.length==0)
		{
			var dW = document.body.scrollWidth,
				dH = $(document).height();
				picLibShow.changePic(picLibShow.picSearch(picList[0],picId)[0],max,smallPic,bigPicUrl,picTitle,picNode);
				picBox.css("left","0px");
				picLibShow.picLoad(picList[0],picId,max,smallPic,bigPicUrl,picTitle,picLink,picNode);
				popDiv.blackMark(dW,dH);
				popDiv.showBox(id,'',w);

		}
		else{
			picList.each(function(i){
				
			   if (picList[i].className!="group")
					{
						picList[i].parentNode.onclick=function(){
							var dW = document.body.scrollWidth,
								dH = $(document).height(),
								leftNow=564*picLibShow.picSearch(picList[i].id,picId)[1];//计算图片所在组的LEFT位置
							
							picLibShow.changePic(picLibShow.picSearch(picList[i].id,picId)[0],max,smallPic,bigPicUrl,picTitle,picNode);
							picBox.css("left","-"+leftNow+"px");
							picLibShow.picLoad(picList[i].id,picId,max,smallPic,bigPicUrl,picTitle,picLink,picNode);
							popDiv.blackMark(dW,dH);
							popDiv.showBox(id,'',w);
						}
					 }
		    
				});
			}
		},
		picLoad:function(id,picId,max,smallPic,bigPicUrl,picTitle,picLink,picNode){
			var idNode=picLibShow.picSearch(id,picId)[1]*6;
			for (var z=0;z<6;z++)
			 {	
				if(idNode+z<picId.length){
					smallPic[idNode+z].src='../images/loading.gif';
					smallPic[idNode+z].src=picLink[idNode+z];
					smallPic[idNode+z].id=picId[idNode+z];
					smallPic[idNode+z].onclick=function(){
						picLibShow.changePic(picLibShow.picSearch(this.id,picId)[0],max,smallPic,bigPicUrl,picTitle,picNode);
					};
				}
			}
		},	

			//查找图片ID位置
		picSearch:function (id,picId){
			
			var actInf=new Array()   
			var actPic;
			for (var i=0;i<picId.length;i++)
			{  	if(id==picId[i]){
					actPic=i;
					break;
					};
			}
			actInf[1]=parseInt(actPic/6); 
			actInf[0]=actPic;
			return actInf;
				
		},

		phototype:function(src){
			var type = /^(.+)\.mp3|wmv|wma/i.test(src)? 'wmv' : 
					   /^\s?mms:\/\/(.+)/i.test(src)? 'mms' : 
					   /^(.+)\.flv/i.test(src)? 'flv' :
					   /^(.+)\.swf/i.test(src)? 'flash' :
					   /^(.+)\.jpg|jpeg|bmp|gif|png/i.test(src)? 'img' : 'img';
			return type;
			},
    
	//大图切换
		changePic:function (act,max,smallPic,bigPicUrl,picTitle,picNode){
			
		
			if(picNode==true){
				
					if (parseInt(act/6)==0)
					{
						$("#leftArr").css("display","none");
					}
					else{
						$("#leftArr").css("display","block");
					}
					if (parseInt(act/6)==max)
					{
						$("#rightArr").css("display","none");
					}
					else{
						$("#rightArr").css("display","block");
					}
					smallPic.removeClass("act");
					smallPic[act].className="act";	
					picNode=false;
					$("#bigPic").animate({
						opacity:"hide"
						},150,function(){
							switch(picLibShow.phototype(bigPicUrl[act])){
								case 'img': _$('bigPic').innerHTML='<img src="../images/loading.gif" />';_$('bigPic').innerHTML='<img src="'+bigPicUrl[act]+'" />';  break;
								case 'flv': _$('bigPic').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="600" height="450"><param name="movie" value="http://www.citsmeeting.com/video/vcastr.swf" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="FlashVars" value="vcastr_file='+bigPicUrl[act]+'" /> <embed src=" http://www.citsmeeting.com/video/vcastr.swf" allowfullscreen="true" flashvars="vcastr_file='+bigPicUrl[act]+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="600" height="450"></embed></object>';  break;
								case 'wmv': alert('wmv');  break;
								case 'flash': _$('bigPic').innerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,2,0" '
																	 + 'width="600" height="450">'
																	 + '<param name="quality" value="high"/>'
																	 + '<param name="movie" value="'+bigPicUrl[act]+'"/>'
																	 + '<embed pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" '
																	 + 'quality="high" src="'+bigPicUrl[act]+'" width="600" height="450"></embed></object>';break;
								case 'mms': alert('mms');  break;
								default: return false;
							}
													
							
								_$("picTitle").innerHTML=picTitle[act];
								$("#bigPic").animate({
								opacity:"show"
							},150,function(){picNode=true})
					});
				}
			}
}),
srcollMan = Class($_$,{
	creat:function(_id, mEle, inEle, num, showNum, _class ,rT,at){		
		srcollMan.Aman = {};
		srcollMan.Aman.id = _id;
		srcollMan.Aman.mEle =mEle;
		srcollMan.Aman.inEle = inEle;
		srcollMan.Aman.num = num;
		srcollMan.Aman.showNum = showNum;
		srcollMan.Aman.cls = _class;
		srcollMan.Aman.tmp = "";
		srcollMan.Aman.type = rT;
		srcollMan.Aman.auto = at;
	},
	setOp:function(){//参数设定
		srcollMan.Aman.defNum = 0;
		srcollMan.Aman.mE = $("#" + srcollMan.Aman.id +" "+ srcollMan.Aman.mEle).eq(0),
		srcollMan.Aman.iEE = $("#" + srcollMan.Aman.id +" "+ srcollMan.Aman.inEle);
		srcollMan.Aman._lBut = $("#" + srcollMan.Aman.id +" *[title='left']");
		srcollMan.Aman._rBut = $("#" + srcollMan.Aman.id +" *[title='right']");
		srcollMan.Aman.mWidth = srcollMan.Aman.mE.find(srcollMan.Aman.inEle).eq(0).outerWidth(true);
		if(srcollMan.Aman.mWidth == null){
			return false;
		}
		srcollMan.Aman.clsArr = [srcollMan.Aman.cls + "Left",srcollMan.Aman.cls + "LeftNone",srcollMan.Aman.cls + "Right",srcollMan.Aman.cls + "RightNone"];
		if(srcollMan.Aman.auto != undefined){
			srcollMan.Aman.ott = 8000;//自动滚动时间
		}
		if(srcollMan.Aman.type != undefined){
			srcollMan.Aman.isMax = Math.ceil(srcollMan.Aman.iEE.length/srcollMan.Aman.showNum);
		}else{
			srcollMan.Aman.isMax = srcollMan.Aman.iEE.length - srcollMan.Aman.showNum + 1;
		}
		
	},
	inntScroll:function(){//初始化
		var nowNum,getLeft,getRight;
			
		srcollMan.setOp()
		
		if(srcollMan.Aman.iEE.length == srcollMan.Aman.showNum){return false;}
			
		if(nowNum == undefined){
			if(srcollMan.Aman.tmp != false){srcollMan.Aman.tmp = false};
			nowNum = srcollMan.Aman.num + srcollMan.Aman.defNum;
			srcollMan.Aman._lBut.attr("sN",nowNum);
			srcollMan.Aman._rBut.attr("sN",nowNum);
		}		

		try{
			if(srcollMan.Aman.mE.attr("style")=="" || srcollMan.Aman.mE.attr("style") == undefined){
				srcollMan.Aman.mE.css({
					width:srcollMan.Aman.mWidth * srcollMan.Aman.iEE.length + "px",
					position:"absolute",
					left:"0"
				});
			}
			
			srcollMan.bindEvent()
			
		}catch(e){
		}
	},
	bindEvent:function(){//事件绑定
		srcollMan.Aman._lBut.bind("click",srcollMan.getLeft);
		srcollMan.Aman._rBut.bind("click",srcollMan.getRight);

		if(srcollMan.Aman.auto!= undefined){
			if(srcollMan.Aman.ss == undefined){
				srcollMan.Aman._lBut.bind("mouseover",srcollMan.clearOt);
				srcollMan.Aman._lBut.bind("mouseout",srcollMan.reSetOt);
				srcollMan.Aman._rBut.bind("mouseover",srcollMan.clearOt);
				srcollMan.Aman._rBut.bind("mouseout",srcollMan.reSetOt);
			}
			srcollMan.Aman.ot = setInterval(function(){
				srcollMan.autoScroll();
			},srcollMan.Aman.ott);
		}
		$(document).unload(function(){
			if(srcollMan.Aman.ot){
				clearInterval(srcollMan.Aman.ot);
			}
			srcollMan.Aman.tmp = null;
			srcollMan.Aman.ss = null;
		})
	},
	getRight:function(){
		if(srcollMan.Aman.tmp == true){return false;}
		var lSn = parseInt(srcollMan.Aman._lBut.attr("sN")),rSn = parseInt(srcollMan.Aman._rBut.attr("sN"));
		if(lSn-1 == 0){return false;}
		srcollMan.Aman.tmp = true;
		lSn--;
		rSn++;
		srcollMan.Aman._rBut.attr("sN",rSn);
		srcollMan.Aman._lBut.attr("sN",lSn);
		srcollMan.sRight();
		srcollMan.arrwS();
	},
	getLeft:function(){
		if(srcollMan.Aman.tmp == true){return false;}
		var lSn = parseInt(srcollMan.Aman._lBut.attr("sN")),rSn = parseInt(srcollMan.Aman. _rBut.attr("sN"));
		if(lSn == srcollMan.Aman.isMax){return false;}
		srcollMan.Aman.tmp = true;				
		lSn++;
		rSn--;			
		srcollMan.Aman._lBut.attr("sN",lSn);
		srcollMan.Aman._rBut.attr("sN",rSn);
		srcollMan.sLeft();
		srcollMan.arrwS();
		srcollMan.Aman.ss = true;											
	},
	clearOt:function(){
		clearInterval(srcollMan.Aman.ot);
		srcollMan.Aman.ot = null;
	},
	reSetOt:function(){
		srcollMan.Aman.ot = setInterval(function(){
			srcollMan.autoScroll();
		},srcollMan.Aman.ott);
	},
	autoScroll:function(){//自动滚动
		srcollMan.Aman._lBut.unbind("click");
		srcollMan.Aman._rBut.unbind("click");
		var lSn = parseInt(srcollMan.Aman._lBut.attr("sN")),rSn = parseInt(srcollMan.Aman. _rBut.attr("sN"));

		if(srcollMan.Aman.ss == undefined || srcollMan.Aman.ss == null){
			srcollMan.getLeft();
		}else{
			if(lSn == srcollMan.Aman.isMax){
				srcollMan.getRight();
			}else if(lSn-1 == 0){
				srcollMan.getLeft();
			}else{
				srcollMan.getLeft();
			}
		}	
	},
	sLeft:function(){//左滚
		var tM = parseInt(srcollMan.Aman.mE.css("left"));
		if(srcollMan.Aman.type != undefined){
			srcollMan.Aman.mE.animate({
				left:tM - (srcollMan.Aman.mWidth*srcollMan.Aman.showNum) + "px"
			},500,function(){
				srcollMan.Aman.tmp = false;
				srcollMan.Aman._lBut.bind("click",srcollMan.getLeft);
				srcollMan.Aman._rBut.bind("click",srcollMan.getRight);
			})
		}else{
			srcollMan.Aman.mE.animate({
				left:tM - srcollMan.Aman.mWidth + "px"
			},500,function(){
				srcollMan.Aman.tmp = false;
				srcollMan.Aman._lBut.bind("click",srcollMan.getLeft);
				srcollMan.Aman._rBut.bind("click",srcollMan.getRight);
			})
		}
	},
	sRight:function(){//右滚
		var tM = parseInt(srcollMan.Aman.mE.css("left"));
		if(srcollMan.Aman.type != undefined){
			srcollMan.Aman.mE.animate({
				left:tM + (srcollMan.Aman.mWidth*srcollMan.Aman.showNum) + "px"
			},500,function(){
				srcollMan.Aman.tmp = false;
				srcollMan.Aman._lBut.bind("click",srcollMan.getLeft);
				srcollMan.Aman._rBut.bind("click",srcollMan.getRight);
			})
		}else{
			srcollMan.Aman.mE.animate({
				left:tM + srcollMan.Aman.mWidth + "px"
			},500,function(){
				srcollMan.Aman.tmp = false;
				srcollMan.Aman._lBut.bind("click",srcollMan.getLeft);
				srcollMan.Aman._rBut.bind("click",srcollMan.getRight);
			})
		}

	},
	arrwS:function(){
		var arrLS,arrRS,tl = parseInt(srcollMan.Aman.mE.css("left"));
		arrLS = srcollMan.Aman._lBut.attr("sN");
		arrRS = srcollMan.Aman._rBut.attr("sN");
		if(arrLS-1 >=0){srcollMan.Aman._rBut.attr("class",srcollMan.Aman.clsArr[2]);}
		if(arrLS == srcollMan.Aman.isMax){
			srcollMan.Aman._lBut.attr("class",srcollMan.Aman.clsArr[1]);
			srcollMan.Aman._rBut.attr("class",srcollMan.Aman.clsArr[2]);
		}
		if(arrLS == arrRS){
			srcollMan.Aman._lBut.attr("class",srcollMan.Aman.clsArr[0]);
			srcollMan.Aman._rBut.attr("class",srcollMan.Aman.clsArr[3]);
		}
		if(tl <=0 && arrLS == srcollMan.Aman.showNum ){
			srcollMan.Aman._lBut.attr("class",srcollMan.Aman.clsArr[0]);
		}
		if(arrLS < srcollMan.Aman.isMax){srcollMan.Aman._lBut.attr("class",srcollMan.Aman.clsArr[0]);}
	}
}),
srcollChid = Class($_$,{
	creat:function(o){
		this.o = o;
		srcollChid.bag = this.o;
	},
	sO:function(){
		srcollChid.bag.tag = $("#" + srcollChid.bag.bid);
		srcollChid.bag.mE = $("#" + srcollChid.bag.bid + " "+srcollChid.bag.eles[0]).eq(0);
		srcollChid.bag.iE = $("#" + srcollChid.bag.bid + " "+srcollChid.bag.eles[1]);
		
		srcollChid.bag.upOnCls = srcollChid.bag.cls[0][0];
		srcollChid.bag.upOffCls = srcollChid.bag.cls[0][1];
		srcollChid.bag.downOnCls = srcollChid.bag.cls[1][0];
		srcollChid.bag.downOffCls = srcollChid.bag.cls[1][1];
		srcollChid.bag.eH = srcollChid.bag.iE.eq(0).outerHeight(true);
		
		srcollChid.bag.mE.css({
			top:"0",
			height:srcollChid.bag.eH * srcollChid.bag.iE.length +"px"
		});
		
		srcollChid.bag.uBut = srcollChid.bag.tag.find("*[bt='up']");
		srcollChid.bag.dBut = srcollChid.bag.tag.find("*[bt='down']");
		srcollChid.bag.uBut.attr("sn","1");
		srcollChid.bag.dBut.attr("sn","1");
		srcollChid.bag.uBut.attr("ns","t");
		srcollChid.bag.tmp = "";
		if(srcollChid.bag.aRoll != undefined){
			srcollChid.bag.ott = 4000;
		}
		if(srcollChid.bag){
			srcollChid.bag.rMax = Math.ceil(srcollChid.bag.iE.length/srcollChid.bag.rollNum);
		}else{
			srcollChid.bag.rMax = srcollChid.bag.iE.length - srcollChid.bag.rollNum + 1;
		}
	},
	bindE:function(){
		srcollChid.bag.uBut.bind("click",srcollChid.getTop);
		srcollChid.bag.dBut.bind("click",srcollChid.getDown);
		if(srcollChid.bag.aRoll != undefined){
			if(srcollChid.bag.ss == undefined){
				srcollChid.bag.uBut.bind("mouseover",srcollChid.clearOt);
				srcollChid.bag.uBut.bind("mouseout",srcollChid.reSetOt);
				srcollChid.bag.dBut.bind("mouseover",srcollChid.clearOt);
				srcollChid.bag.dBut.bind("mouseout",srcollChid.reSetOt);
			}
			srcollChid.bag.ot = setInterval(function(){
				srcollChid.autoR();
			},srcollChid.bag.ott);
		}
	},
	getDown:function(){
		if(srcollChid.bag.tmp == true){return false;}
		var uSn = parseInt(srcollChid.bag.uBut.attr("sN")),dSn = parseInt(srcollChid.bag.dBut.attr("sN"));
		if(uSn-1 == 0){return false;}
		srcollChid.bag.tmp = true;
		uSn--;
		dSn++;
		srcollChid.bag.uBut.attr("sN",uSn);
		srcollChid.bag.dBut.attr("sN",dSn);
		srcollChid.downRoll();
		srcollChid.arrwS();
	},
	getTop:function(){
		if(srcollChid.bag.tmp == true){return false;}
		var uSn = parseInt(srcollChid.bag.uBut.attr("sN")),dSn = parseInt(srcollChid.bag.dBut.attr("sN"));
		if(uSn == srcollChid.bag.rMax){return false;}
		srcollChid.bag.tmp = true;				
		uSn++;
		dSn--;			
		srcollChid.bag.uBut.attr("sN",uSn);
		srcollChid.bag.dBut.attr("sN",dSn);
		srcollChid.topRoll();
		srcollChid.arrwS();
		srcollChid.bag.ss = true;											
	},
	topRoll:function(){
		var tM = parseInt(srcollChid.bag.mE.css("top"));
		if(srcollChid.bag.tRoll != undefined){
			srcollChid.bag.mE.animate({
				top:tM - (srcollChid.bag.eH * srcollChid.bag.rollNum) + "px"
			},500,function(){
				srcollChid.bag.tmp = false;
				srcollChid.bag.uBut.bind("click",srcollChid.getTop);
				srcollChid.bag.dBut.bind("click",srcollChid.getDown);
			})
		}else{
			srcollChid.bag.mE.animate({
				top:tM - srcollChid.bag.eH + "px"
			},500,function(){
				srcollChid.bag.tmp = false;
				srcollChid.bag.uBut.bind("click",srcollChid.getTop);
				srcollChid.bag.dBut.bind("click",srcollChid.getDown);
			})
		}
	},
	downRoll:function(){
		var tM = parseInt(srcollChid.bag.mE.css("top"));
		if(srcollChid.bag.tRoll != undefined){
			srcollChid.bag.mE.animate({
				top:tM + (srcollChid.bag.eH * srcollChid.bag.rollNum) + "px"
			},500,function(){
				srcollChid.bag.tmp = false;
				srcollChid.bag.uBut.bind("click",srcollChid.getTop);
				srcollChid.bag.dBut.bind("click",srcollChid.getDown);
			})
		}else{
			srcollChid.bag.mE.animate({
				top:tM + ssrcollChid.bag.eH + "px"
			},500,function(){
				srcollChid.bag.tmp = false;
				srcollChid.bag.uBut.bind("click",srcollChid.getTop);
				srcollChid.bag.dBut.bind("click",srcollChid.getDown);
			})
		}
	},
	arrwS:function(){
		var ns=srcollChid.bag.uBut.attr("ns"),uSn= parseInt(srcollChid.bag.uBut.attr("sN"));
		
		if(uSn-1 == 0){
			srcollChid.bag.dBut.attr("class",srcollChid.bag.downOffCls);
		}
		if(uSn == srcollChid.bag.rMax){
			srcollChid.bag.uBut.attr("class",srcollChid.bag.upOffCls);
		}
		if(uSn > 1 && uSn != srcollChid.bag.rMax){
			srcollChid.bag.uBut.attr("class",srcollChid.bag.upOnCls);
			srcollChid.bag.dBut.attr("class",srcollChid.bag.downOnCls);
		}
		
	},
	autoR:function(){//自动滚动
		srcollChid.bag.uBut.unbind("click");
		srcollChid.bag.dBut.unbind("click");
		var uSn = parseInt(srcollChid.bag.uBut.attr("sN")),dSn = parseInt(srcollChid.bag.dBut.attr("sN"));
		if(srcollChid.bag.ss == undefined || srcollChid.bag.ss == null){
			srcollChid.getTop();
		}else{
			var ns=srcollChid.bag.uBut.attr("ns");
			if(uSn == srcollChid.bag.rMax){
				srcollChid.getDown();
				srcollChid.bag.uBut.attr("ns","d");
			}else if(uSn-1 == 0){
				srcollChid.getTop();
				srcollChid.bag.uBut.attr("ns","t");
			}else{
				if(ns == "t"){
					srcollChid.getTop();
				}else{
					srcollChid.getDown();
				}
			}
		}	
	},
	clearOt:function(){
		clearInterval(srcollChid.bag.ot);
		srcollChid.bag.ot = null;
	},
	reSetOt:function(){
		srcollChid.bag.ot = setInterval(function(){
			srcollChid.autoR();
		},srcollChid.bag.ott);
	},
	intt:function(){
		srcollChid.sO();
		srcollChid.bindE();
	}
}),
ajaxGetData = Class($_$, {
    creat: function(sOOP) {
        this.sOOP = sOOP;
        ajaxGetData._O = this.sOOP;
    },
    ajaxInnt: function() {
        ajaxGetData._O.aBox = $("#" + ajaxGetData._O.bId)
		var dayDate;
        //初始化参数
        dayDate = "Date=" + ajaxGetData.whatDay(0) + "&dateType=" + ajaxGetData._O.type + "&pid=" + ajaxGetData._O._ID + "&OffCityID=" + ajaxGetData._O.oId + "&DayNumber=" + ajaxGetData._O.nNum;

        if (ajaxGetData._O.aBox.val() == "") {
            ajaxGetData.getData(dayDate);
        }
    },
    whatDay: function(tps, someDay) {
        var nowDate = new Date(),
			dM = nowDate.getMonth(),
			nowM = dM + 1,
			nowY = nowDate.getFullYear(),
			nowD = nowDate.getDate(),
			nowS = nowDate.getSeconds(),
			dFmt = O_o.dateFormat,
			sTypr, nextM, nextY, nextM2, nextY2, backY, backM, backY2, backM2, thisY, thisM, thisD, fuY, fuM, fuD, realM, ds,
			daysList = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31],
			dDays = daysList[dM],
			ADate;

        if (dFmt.indexOf("-") != -1) {
            sTypr = "-";
        } else if (dFmt.indexOf("/") != -1) {
            sTypr = "/";
        } else {
            sTypr = ".";
        }

        //当月
        if (tps == 0) {
            if (nowM + 1 > 12) {
                nextM = 1;
                nextY = nowY + 1;
            } else {
                nextM = nowM + 1;
                nextY = nowY;
            }
            ADate = [nowY, nowM, nextY, nextM];
        }
        //下月
        if (tps == 1) {
            if (ajaxGetData.tDate[3] + 1 > 12) {
				if(ajaxGetData.tDate != 0 && ajaxGetData.tDate[0] > nowY){
					nextY = ajaxGetData.tDate[0] + 1;
					nextY2 = nextY;
				}else{
					nextY = nowY + 1;
					nextY2 = nextY;
				}
                nextM = 1;
                nextM2 = 2;
            } else {
                if(ajaxGetData.tDate.length != 0 && ajaxGetData.tDate[0] > nowY){
					nextY = ajaxGetData.tDate[0];
					nextY2 = nextY;
				}else{
					if(ajaxGetData.tDate[0] < ajaxGetData.tDate[2]){
						nextY = nowY + 1;
						nextY2 = nextY;
					}else{
						nextY = nowY;
						nextY2 = nowY;
					}
				}
				nextM = ajaxGetData.tDate[3] + 1;
                nextM2 = ajaxGetData.tDate[3] + 2;
            }
            ADate = [nextY, nextM, nextY2, nextM2];
        }
        //前月
        if (tps == 2) {
            if (ajaxGetData.tDate[1] - 1 < 1) {
                backM = 11;
                backY = ajaxGetData.tDate[0] - 1;
                backM2 = 12;
                backY2 = backY;
            } else {
                backM = ajaxGetData.tDate[1] - 2;
				if(backM==0){
					backM = 12;
				}
                backY = nowY;
                backM2 = ajaxGetData.tDate[1] - 1;
                backY2 = nowY;
            }
            ADate = [backY, backM, backY2, backM2];
        }

        //日期计算
        if (tps == 3 && someDay) {
            var fuDay, allDays;
            if (typeof (someDay) == "string") {
                if (someDay.indexOf(sTypr) != 1 && someDay.length == 10) {

                    dateS = someDay.split(sTypr);
                    thisY = parseInt(dateS[0]);
                    thisM = parseInt(dateS[1], 10);
                    thisD = parseInt(dateS[2], 10);
                    allDays = thisD + ajaxGetData._O.nNum-1;

                    if (allDays > dDays) {
                        if (thisM + 1 > 12) {
                            fuY = thisY + 1;
                            fuM = 1
                            fuD = allDays - dDays;
                        } else {
                            fuY = thisY;
                            fuM = thisM + 1;
                            fuD = allDays - dDays;
                        }
                    } else {
                        fuY = thisY;
                        fuM = thisM;
                        fuD = allDays;
                    }

                    if (fuM.toString().length == 1) {
                        realM = 0 + fuM.toString()
                    } else {
                        realM = fuM;
                    }

                    ds = dFmt.split(sTypr);
                    ds[$.inArray("mm", ds)] = realM;
                    ds[$.inArray("dd", ds)] = fuD;
                    ds[$.inArray("yyyy", ds)] = fuY;

                    fuDay = ds.join(sTypr);
                }
            }
            return fuDay;
        }

        ajaxGetData.tDate = ADate; //暂存
        return ADate;
    },
    getData: function(dat) {//日历获取
        $.ajax({
            type: "GET",
            url: O_o.F,
            data: dat,
            cache: false,
            error: function() {
                ajaxGetData._O.aBox.html(O_o.FailMsgB);
            },
            success: function(html) {
				if (ajaxGetData._O.dType != undefined) {
					if(ajaxGetData._O.aBox.find("div").length > 0){
						ajaxGetData._O.aBox.find("div").remove();
					}
					ajaxGetData._O.aBox.append(html);
				}else{
					ajaxGetData._O.aBox.html(html);
				}
                ajaxGetData._O.nextBut = $("#" + ajaxGetData._O.bId + " em[title='Next']");
                ajaxGetData._O.backBut = $("#" + ajaxGetData._O.bId + " em[title='Back']");
                ajaxGetData.dataInnt();
            }
        })
    },
    dataInnt: function() {//日历功能初始化
    
        var divs = $("#" + ajaxGetData._O.bId + " div"),
			tdS = $("#" + ajaxGetData._O.bId + " td"), I,
			nextDATE, backDATE,
			getNewDate = function(event) {
			    var ed = event.data
			    if (ed.dT == "next") {
					if(ajaxGetData._O.dType != undefined && ajaxGetData._O.dType == "diveData"){
						nextDATE = "Date=" + ajaxGetData.whatDay(1) + "&dateType=" + ajaxGetData._O.type + "&pid=" + ajaxGetData._O._ID;
					}else{
						nextDATE = "Date=" + ajaxGetData.whatDay(1) + "&dateType=" + ajaxGetData._O.type + "&pid=" + ajaxGetData._O._ID + "&OffCityID=" + ajaxGetData._O.oId + "&DayNumber=" + ajaxGetData._O.nNum;
					}
			        
			        ajaxGetData.getData(nextDATE);
			    }

			    if (ed.dT == "back") {
					
					if(ajaxGetData._O.dType != undefined && ajaxGetData._O.dType == "diveData"){
						backDATE = "Date=" + ajaxGetData.whatDay(2) + "&dateType=" + ajaxGetData._O.type + "&pid=" + ajaxGetData._O._ID;
					}else{
						backDATE = "Date=" + ajaxGetData.whatDay(2) + "&dateType=" + ajaxGetData._O.type + "&pid=" + ajaxGetData._O._ID + "&OffCityID=" + ajaxGetData._O.oId + "&DayNumber=" + ajaxGetData._O.nNum;
					}
					
			        ajaxGetData.getData(backDATE);
			    }

			};
        //下两月
        if (ajaxGetData._O.nextBut.attr("class").indexOf("Off") == -1) {
            ajaxGetData._O.nextBut.bind("click", {dT: "next" }, getNewDate);
        }
        //上两月
        if (ajaxGetData._O.backBut.attr("class").indexOf("Off") == -1) {
            ajaxGetData._O.backBut.bind("click", {dT: "back" }, getNewDate);
        }
        //样式操作
        if (typeof (ajaxGetData._O._class) == "object") {
            var _arrD = $("#" + ajaxGetData._O.pId + " div[title='arrow']"),
				__t = $("#" + ajaxGetData._O.pId)
            _mClass = ajaxGetData._O._class[0],
				_pClass = ajaxGetData._O._class[1],
				_arrClass = ajaxGetData._O._class[2];

            __t.addClass(_pClass);
            divs.addClass(_mClass);
            _arrD.addClass(_arrClass);
        } else {
            divs.addClass(ajaxGetData._O._class);
        }
        //日期td事件绑定
        for (I = 0; I < tdS.length; I++) {
            if (tdS[I].getElementsByTagName("strong").length > 0) {
                tdS[I].onmouseover = function() {
                    ajaxGetData.tdOver(this, ajaxGetData._O._class);
                }
                if (tdS[I].getElementsByTagName("b").length > 0) {
                    tdS[I].onclick = function() {
                        ajaxGetData.tdClick(this)
                    }
                }
            }
        }

    },
    tdOver: function(t) {//td鼠标经过
        $(t).attr("class", "tdOver");
        if (t.getElementsByTagName("b").length > 0) { $(t).css("cursor", "help"); }
        $(t).mouseout(function() {
            $(this).removeAttr("class");
            $(this).removeAttr("style");
        })
    },
    tdClick: function(t) {//td鼠标点击
        var dW = document.body.scrollWidth,
			bH = $(t).height(),
			bW = $(t).width(),
			bT = Math.ceil($(t).offset().top),
			bL = Math.ceil($(t).offset().left), tH, noL, noH, arW;
			
        if(ajaxGetData._O.dType != undefined){
			if(ajaxGetData._O.callBack != undefined){
				ajaxGetData._O.callBack(t);
			}
		}else{
			
			//隐藏域赋值
			var tag = $("#" + ajaxGetData._O.pId),
				rw = ajaxGetData._O.tabW == null ? 350 : ajaxGetData._O.tabW,
				showDM = t.title.split(","),
				_today = showDM[0],
				_fuDay, fuDat,
				_money = showDM[1],
				hp = $("#" + ajaxGetData._O.hiI),
				datP = $("#" + ajaxGetData._O.dIp),
				arrDiv = tag.find("*[title='arrow']").eq(0),
				closeBut = tag.find("*[close='close']").eq(0);
	        if (ajaxGetData._O.eIp && ajaxGetData._O.eIp != "") {
	            _fuDay = ajaxGetData.whatDay(3, showDM[0]);
	            $("#" + ajaxGetData._O.eIp).val(_fuDay);
	        }
			
			if(ajaxGetData._O.nVal != undefined){
			    var priceType,
				    pVal = $(t).find("b").html().match(/\d+/);
				priceType = pVal == null?1:0;
				$("#" + ajaxGetData._O.nVal).val(priceType);
			}
			
	        datP.val(_today);
	        hp.val(_money);
	        //关闭按钮
	        closeBut.click(function() {
	            ajaxGetData.hidePopD();
	        });
	        //页面空白处点击事件
	        document.documentElement.onclick = function(e) {
	            //if($("#" + ajaxGetData._O.pId).css("display") == "none"){return false;}
	            var ev = e || window.event;
	            var eleSrc = ev.srcElement || ev.target;
	            if (eleSrc.tagName.toLowerCase() == "body" || eleSrc.tagName.toLowerCase() == "html") {
	                ajaxGetData.hidePopD();
	            }
	        }
	        //显示
	        tag.css("width", rw + "px");
	        tH = tag.outerHeight();
	        if (tag.css("display") == "block") { tag.css("display", "none") }
	        noH = bT - tH + 2;
	        if (bL < rw) {
	            arW = 24 * 3;
	            noL = bL - bW;
	        }
	        if (bL > rw && dW - bL >= rw) {
	            arW = 24 * 3;
	            noL = bL - bW;
	        }
	        if (bL >= rw && dW - bL <= rw) {
	            arW = rw - 24 * 2;
	            noL = bL - rw + bW;
	        }
	        arrDiv.css("left", arW + "px");
	        tag.css({
	            width: rw + "px",
	            top: noH + "px",
	            left: noL + "px",
	            "z-index": "3"
	        })
	        tag.animate({
	            opacity: "show"
	        })
	        ajaxGetData.dateShadow(rw, noH, noL);
		}
    },
    dateShadow: function(w, noH, noL) {//阴影创建
        popDiv.theShadow(ajaxGetData._O.pId, noH, noL, 4);
    },
    hidePopD: function() {//关闭事件
        var _t = $("#" + ajaxGetData._O.pId), _Shadow = $("#shadow");
        _t.animate({
            opacity: "hide"
        }, "fast");
        if (_Shadow) {
            _Shadow.animate({
                opacity: "hide"
            }, "fast", function() { _Shadow.remove(); });
        }
    },
    tDate: [],
    _O: { bId: "", _class: "", pId: "", tabW: "", dIp: "", hiI: "", type: "", _ID: "", oId: "", nNum: "", eIp: ""}
}),
diveData = Class(ajaxGetData,{
	creat:function(o){
		this.o = o;
		diveData.x = this.o;
		ajaxGetData._O.dType = diveData.x.dType;
	},
	inntDData:function(){
		var ot,tt;
		if(isIE){
			diveData.x.b = "<div id=\"ajaxGetDate\" style=\"display:none;\"><i close=\"close\"></i><iframe style=\"height:380px;width:100%;\"></iframe></div>";
		}else{
			diveData.x.b = "<div id=\"ajaxGetDate\" style=\"display:none;\"><i close=\"close\"></i></div>";
		}
		
		if(!_$("ajaxGetDate")){
			$("body").append(diveData.x.b);
			diveData.x.bId = "ajaxGetDate";
		}
		diveData.x.eles = $("#" + diveData.x.dId + " input[dp]");
		diveData.x.priceBox = $("#" + diveData.x.dId +" td").eq(1);
		ajaxGetData._O.callBack = function(t){
			diveData.setInput(t);
		};
		diveData.x.eles.click(function(){
			diveData.getAjaxData(this);
			diveData.x.evTag = $(this);
			tt = this;
			ot = setInterval(function(){
				if($("#"+diveData.x.bId + " div").length>0){
					clearInterval(ot);
					ot = null;
					shower({
						oid:diveData.x.bId,
						evn:tt,
						set:{
							type:'nal|center',
							showType:'whiteMark',
							cls:['newPopBox','newArrow','newClosePop'],
							bStyle:'width:910px;padding:25px 10px 10px;border:3px solid #0B7ECD;background:#fff;'
						}
					});
				}
			},100)
			
		})
	},
	getAjaxData:function(t){
		ajaxGetData._O.aBox = $("#" + diveData.x.bId);
		ajaxGetData._O.bId = diveData.x.bId;
		
		var dayDate,
			dps = $(t).attr("dp").split("|");
		ajaxGetData._O.type = dps[1];
		ajaxGetData._O._ID = dps[0];
        dayDate = "Date=" + ajaxGetData.whatDay(0) + "&dateType=" + dps[1] + "&pid=" + dps[0];	
        if (ajaxGetData._O.aBox.val() == "") {
            ajaxGetData.getData(dayDate);
        }
	},
	setInput:function(t){
		diveData.x.evTag.val($(t).attr("title"));
		if($(t).find("b:first").attr("aprice") != undefined && $(t).find("b:first").attr("cprice") != undefined){
		    var tmp;
			if($(t).find("b:first").attr("cprice") == "0" || $(t).find("b:first").attr("cprice") == "-1"){
			    tmp = "<span style=\"color: Red; font-weight: bold;\">￥" + $(t).find("b:first").attr("aprice") + "</span>/成人";
			} else {
			    tmp = "<span style=\"color: Red; font-weight: bold;\">￥" + $(t).find("b:first").attr("aprice") + "</span>/成人,<span style=\"color: Red; font-weight: bold;\">￥" + $(t).find("b:first").attr("cprice") + "</span>/儿童";
				
			}
			diveData.x.priceBox.html(tmp);
		}
		newPop.ppHide();
	}
}),
WOW = Class($_$,{
	creat:function(_WoW,cbs){
		this._WoW = _WoW;
		WOW.battleField = this._WoW;
		if(cbs){
			WOW.battleField.callBack = cbs;//回调
			WOW.battleField.cbCtrl = 1;
		}
		WOW.callForDuty.iTable = O_o.hotelBookTitle;//酒店表格表头
	},
	firstBlood:function(){
		if(WOW.callForDuty.firstDay() == ""){//团灭
			WOW.callForDuty.field().html(O_o.FailMsgA);
			return false;
		}else{
			if(WOW.callForDuty.field().val() == ""){
				WOW.callForDuty.adultNum = $("#aNum").val();
				WOW.callForDuty.childNum = $("#cNum").val();
				WOW.callForDuty.defFly = $("#isAPIOrData").val();
				var fday = WOW.callForDuty.firstDay(),
					eday = WOW.callForDuty.endDay(),
					echData = "Ticket_BeginDate=" + fday + "&Ticket_EndDate=" + eday,
					hunterData;
				if($("#flieName").val()!=""){
					WOW.callForDuty.flieName = $("#flieName").val().split(",");
					hunterData = "TravelID="+ WOW.callForDuty.travel() +"&TravelCityID="+ WOW.callForDuty.travelCity() +"&DayNumber=1&file=" + WOW.callForDuty.flieName[0];
					
					var otMsg;
					otMsg = setTimeout(function(){
						alerter({msg:"您必须重新确认每一天的安排",set:{css:"width:200px;padding:15px 0;"},ot:2000},function(){
							clearTimeout(otMsg);
						});
					},500)
					
					
					//hunterData = "TravelID="+ WOW.callForDuty.travel() +"&TravelCityID="+ WOW.callForDuty.travelCity() + "&LodgingAdultNum=" + WOW.callForDuty.adultNum +"&LodgingChildNum="+WOW.callForDuty.childNum+"&"+echData+"&DayNumber=1&file="+WOW.callForDuty.flieName[0];
				}else{
					hunterData = "TravelID="+ WOW.callForDuty.travel() +"&TravelCityID="+ WOW.callForDuty.travelCity() + "&LodgingAdultNum=" + WOW.callForDuty.adultNum +"&LodgingChildNum="+WOW.callForDuty.childNum+"&"+echData+"&DayNumber=1&file=";
				}
				$("body").ajaxStart(function(){//loadding 信息
					WOW.isLoadding();
				});

				WOW.echelon(echData);//日期列表获取
				WOW.huntersMark(hunterData);//每日内容获取
				if(WOW.battleField.cbCtrl){
					WOW.battleField.callBack();//回调函数
				}
			}
		}
	},
	isLoadding:function(){
		if($("#nowLoadding")){$("#nowLoadding").remove()}
		$("body").append(WOW.callForDuty.loadding);
		$("#nowLoadding").css({
			display:"none",
			left:WOW.callForDuty.honor().offset().left + WOW.callForDuty.honor().width() + 10 +"px",
			top:WOW.callForDuty.honor().offset().top - 10 +"px"
		});
		newPop.creatMark("#fff",$(document).width(),$(document).height(),0.6);
		$("#nowLoadding").animate({
			opacity:"show"
		},300)
	},
	echelon:function(da){//日期列表构建Ajax请求
		$.ajax({
			type:"GET",
			url:O_o.G,
			cache:false,
			data:da,
			error:function(){
				WOW.callForDuty.field().html(O_o.FailMsgB);//团灭
			},
			success:function(html){
				
				$(document).ready(function(){
					WOW.callForDuty.field().html(html);
					var fLi = $("#" + WOW.callForDuty.Echelon + " li:first");
					if(WOW.callForDuty.flieName!= undefined){
						var ali = $("#" + WOW.callForDuty.Echelon + " li");
						$.each(ali,function(i,n){
							$(this).find("input:hidden").val(WOW.callForDuty.flieName[i]);
						})
					}
					fLi.addClass(WOW.callForDuty._eOn);
					WOW.getPosition();
					WOW.callForDuty._oC();//加载行程主容器
				})

			}
		})
	},
	getPosition:function(){//日期列表事件绑定
		var Ls = $("#" + WOW.callForDuty.Echelon + " li"),LL = Ls.length,_L;
		for(_L =0;_L<LL;_L++){
			(function(){
				var L = _L,ds = L+1,_Ls = Ls;
				$(_Ls[L]).attr("no",L);
				_Ls[L].onclick = function(){
					if($(this).attr("class") == WOW.callForDuty._eOn){return false;}
					//乘机人信息验证
					if(_$("selectFlight")){
						var fi,fif,aft;
						if (WOW.callForDuty.nowFly == 0) {
							aft = $("#selectFlight").find("table").eq(1).find("input[disabled!=true]");
						}
						
						if (WOW.callForDuty.nowFly == 1) {
							aft = $("#selectFlight").find("table").eq(2).find("input[disabled!=true]");
						}
						
						fi = aft;
						fif = aft.filter("[value]");
						if(fif.length != fi.length){
							//alert("请填写完整的乘机人信息 ");
							
							var otMsg;
							otMsg = setTimeout(function(){
								alerter({msg:"请填写完整的乘机人信息",set:{css:"width:200px;padding:15px 0;"},ot:2000},function(){
									clearTimeout(otMsg);
								});
							},500)
							
							return false;
						}
					}else{
						if(_$("tMark")){
							$("#tMark").remove();
						}
						//阴影
						popDiv.creatMark("#fff",$(document).width(),$(document).height(),0.5);
					}
					var NT = $("#" + WOW.callForDuty.Echelon +" li.itiOn"),
						ntPage = NT.find("input[type='hidden']").val(),pName,nName;
						
					if(ntPage.length != ""){//日文件
						pName = ntPage;
					}else{
						pName = "";
					}
					
					if($(this).find("input[type='hidden']").val() != ""){
						nName = $(this).find("input[type='hidden']").val();
					}else{
						nName = "";
					}
					$(_Ls).removeAttr("class");
					$(this).attr("class",WOW.callForDuty._eOn);
					//发送内容			
					
					var dayData = {CreateContent:WOW.callForDuty.mainField().html(),file:pName};
					WOW.saveD(NT,dayData,ds,nName);
				}
			})();
			$(Ls[_L]).attr("dayprice","0");//自定义属性初始化
		}
	},
	getJsonVal:function(nt){
		var boxs = WOW.callForDuty.mainField().find("div[class='productSelect']").get(),
			whos = nt.attr("no"),
			nowDats,
			getVal = function(t){
				switch(t.attr("id")){
					case "selectFlight"://机票及乘机人信息数据处理
						var pmBox,
							smBox,
							rmBox,
							fb = $("#selectFlight table").eq(0).find("input[checked=true]"),
							fb2 = $("#selectFlight table").eq(1).find("input[checked=true]"),
							allPs,
							flyStr = "",
							reOpin = function(str,obj){
								return $(obj).attr(str);
							};
							
						/*
						att = fb.attributes;//机票数据
						for(var i = 0;i<att.length;i++){
							if(att[i].specified){
								if($(att[i]).val()!="id"&&$(att[i]).val()!="checked"&&$(att[i]).val()!="radio"){
									batt.push($(att[i]).val())
								}
							}
						}
						*/
						
						if (WOW.callForDuty.nowFly == 0) {
							pmBox = t.find("table").eq(2).find("select").eq(0).val();
							smBox = t.find("table").eq(2).find("input[checked=true]").val();
							rmBox = t.find("table").eq(2).find("textarea").eq(0).val();
							flyStr = "{\"Price\":\""+reOpin("value",fb)+"\",\"ReachTime\":\"" + reOpin("ReachTime_B",fb) +"\",\"ReachTime_B\":\"" + reOpin("ReachTime",fb) +"\",\"PlaneType_B\":\"" + reOpin("PlaneType_B",fb) +"\",\"PlaneType\":\"" + reOpin("PlaneType",fb) +"\",\"FlightStop_B\":\"" + reOpin("FlightStop_B",fb) +"\",\"FlightStop\":\"" + reOpin("FlightStop",fb) +"\",\"FlightCode_B\":\"" + reOpin("FlightCode_B",fb) +"\",\"FlightCode\":\"" + reOpin("FlightCode",fb) +"\",\"TakeoffTime_B\":\"" + reOpin("TakeoffTime_B",fb) +"\",\"TakeoffTime\":\"" + reOpin("TakeoffTime",fb) +"\",\"TakeOffDate_B\":\"" + reOpin("TakeOffDate_B",fb) +"\",\"TakeoffDate\":\"" + reOpin("TakeoffDate",fb) +"\",\"AirCompany_B\":\"" + reOpin("AirCompany_B",fb) +"\",\"AirCompany\":\"" + reOpin("AirCompany",fb) +"\",\"Times\":\"" + reOpin("Times",fb) +"\",\"ProID\":\"" + reOpin("ProID",fb) +"\",\"ProID_B\":\"" + reOpin("ProID_B",fb) +"\",\"BuildFee_B\":\"" + reOpin("BuildFee_B",fb) +"\",\"OilFee_B\":\"" + reOpin("oilfee_b",fb) +"\",\"ChildPrice_B\":\"" + reOpin("airhotelchildprice_b",fb)+"\",\"AdultPrice_B\":\"" + reOpin("airhotelprice_b",fb)+"\",\"BuildFee\":\"" + reOpin("BuildFee",fb)+"\",\"OilFee\":\"" + reOpin("OilFee",fb)+"\",\"ChildPrice\":\"" + reOpin("airhotelchildprice",fb)+"\",\"AdultPrice\":\"" + reOpin("airhotelprice",fb)+"\",\"AdultNum\":\"" + WOW.callForDuty.adultNum +"\",\"ChildNum\":\"" + WOW.callForDuty.childNum +"\",\"PayMethod\":\"" + pmBox +"\",\"Remark\":\"" + rmBox +"\",\"SendMethod\":\"" + smBox+"\"}";
							allPs = $("#selectFlight table").eq(1).find("tr:first").nextAll();
						}
						
						if (WOW.callForDuty.nowFly == 1) {
							pmBox = t.find("table").eq(3).find("select").eq(0).val();
							smBox = t.find("table").eq(3).find("input[checked=true]").val();
							rmBox = t.find("table").eq(3).find("textarea").eq(0).val();
							flyStr = "{\"Price\":\""+reOpin("value",fb)+"\",\"ReachTime\":\"" + reOpin("ReachTime_B",fb2) +"\",\"ReachTime_B\":\"" + reOpin("ReachTime",fb) +"\",\"PlaneType_B\":\"" + reOpin("PlaneType_B",fb2) +"\",\"PlaneType\":\"" + reOpin("PlaneType",fb) +"\",\"FlightStop_B\":\"" + reOpin("FlightStop_B",fb2) +"\",\"FlightStop\":\"" + reOpin("FlightStop",fb) +"\",\"FlightCode_B\":\"" + reOpin("FlightCode_B",fb2) +"\",\"FlightCode\":\"" + reOpin("FlightCode",fb) +"\",\"TakeoffTime_B\":\"" + reOpin("TakeoffTime_B",fb2) +"\",\"TakeoffTime\":\"" + reOpin("TakeoffTime",fb) +"\",\"TakeOffDate_B\":\"" + reOpin("TakeOffDate_B",fb2) +"\",\"TakeoffDate\":\"" + reOpin("TakeoffDate",fb) +"\",\"AirCompany_B\":\"" + reOpin("AirCompany_B",fb2) +"\",\"AirCompany\":\"" + reOpin("AirCompany",fb) +"\",\"Times\":\"" + reOpin("Times",fb)+"\",\"Times_B\":\""+ reOpin("Times_B",fb2) +"\",\"ProID\":\"" + reOpin("ProID",fb) +"\",\"ProID_B\":\"" + reOpin("ProID_B",fb2) +"\",\"BuildFee_B\":\"" + reOpin("BuildFee_B",fb2) +"\",\"OilFee_B\":\"" + reOpin("oilfee_b",fb2) +"\",\"ChildPrice_B\":\"" + reOpin("airhotelchildprice_b",fb2)+"\",\"AdultPrice_B\":\"" + reOpin("airhotelprice_b",fb2)+"\",\"BuildFee\":\"" + reOpin("BuildFee",fb)+"\",\"OilFee\":\"" + reOpin("OilFee",fb)+"\",\"ChildPrice\":\"" + reOpin("airhotelchildprice",fb)+"\",\"AdultPrice\":\"" + reOpin("airhotelprice",fb)+"\",\"AdultNum\":\"" + WOW.callForDuty.adultNum +"\",\"ChildNum\":\"" + WOW.callForDuty.childNum +"\",\"PayMethod\":\"" + pmBox +"\",\"Remark\":\"" + rmBox +"\",\"SendMethod\":\"" + smBox+"\"}";
							allPs = $("#selectFlight table").eq(2).find("tr:first").nextAll();
						}

						$("#flys").val(flyStr);
						
						WOW.flyPerson =[];//乘机人信息
						$.each(allPs,function(){
							var __t,__pt,__ptn;
							if($(this).find("select").length >2){
								__ptn = $(this).find("input").eq(2).val()
								__pt = $(this).find("select").eq(1).val();
							}else{
								__ptn="";
								__pt =0;
							}
							__t = "{\"InsureNum\":"+ $(this).find("select:last").val() +",\"InsurePrice\":"+ $("#selectFlight table").eq(0).find("input:checked").attr("safetyfee")+",\"Name\":\""+ $(this).find("input").eq(1).val() +"\",\"PassportCode\":\""+ __ptn +"\",\"PassportType\":"+ __pt +",\"Sex\":"+ $(this).find("select").eq(0).val()+ ",\"Type\":"+ $(this).find("input").eq(0).val() +"}";
							WOW.flyPerson.push(__t);
						})
						$("#pInfo").val("["+WOW.flyPerson+"]");
					break;
					
					case "selectHotel"://酒店数据处理
						if(!WOW.hotelInfo){WOW.hotelInfo =[];}
						var allDayObj = "#_#";
						if($("#selectHotel table").length != 0){
							
							var _hs = $("#selectHotel tr:first").nextAll(), _hstr = [];
							$.each(_hs,function(){
								var _hsObj = "",_hid=$(this).attr("beselect"),_tag = $("#" + _hid),
									_sele = $(this).find("select"),
									allHotelVal = _sele.eq(0).attr("pv").split(",");
								_hsObj = "{\"Price\":\"" + allHotelVal[0] +"\",\"ProID\":\""+ _tag.attr("proid") +"\",\"Times\":\""+ _tag.attr("times") +"\",\"BedNum\":\""+ _sele.eq(1).val() +"\",\"BedPrice\":\""+ allHotelVal[2] +"\",\"BreakFastID\":\""+ _tag.attr("breakfast_id") +"\",\"BreakFastName\":\""+ _tag.attr("breakfast_name") +"\",\"BreakFastNum\":\""+ _sele.eq(2).val() +"\",\"BreakFastPrice\":\""+ allHotelVal[3] +"\",\"ChildBreakFastNum\":\""+ _sele.eq(3).val() +"\",\"ChildBreakFastPrice\":\""+ allHotelVal[4] +"\",\"Name\":\""+_tag.attr("roomname") +"\",\"RoomNum\":\""+ _sele.eq(0).val() +"\"}";
								_hstr.push(_hsObj);
								
							})
							allDayObj = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _hstr +"]}";
						}
						
						if(!WOW.hotelInfo[whos]){
							//if(allDayObj!= "#_#"){
								WOW.hotelInfo.push(allDayObj);
							//}
						}else{
							WOW.hotelInfo[whos] = allDayObj;
						}

						$("#hotels").val("["+WOW.hotelInfo+"]");
					break;
					
					case "selectOneday"://一日游数据处理
						if(!WOW.oneDayInfo){WOW.oneDayInfo =[];}
						var odAllDay = "#_#";
						if(($("#selectOneday div[us ='selected']").find("p").length) != 0){
							var _os = $("#selectOneday div[us ='selected']").find("p"),_ostr=[];
							$.each(_os,function(){
								var _osObj = "",_oid = $(this).attr("beselect"),_t = $("#"+_oid),_oSele = $(this).find("select");
								_osObj = "{\"Price\":\"" + _oSele.eq(0).attr("pv") +"\",\"ChildPrice\":\""+ _oSele.eq(1).attr("pv") +"\",\"ProID\":\""+ _t.attr("proid") +"\",\"Times\":\""+ $(this).attr("times") +"\",\"AdultNum\":\""+ _oSele.eq(0).val() +"\",\"ChildNum\":\""+ _oSele.eq(1).val() +"\",\"Name\":\""+ _t.next().find("a").html() +"\"}";
								_ostr.push(_osObj);
							})
							odAllDay = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _ostr +"]}";
						}
						
						if(!WOW.oneDayInfo[whos]){
							//if(odAllDay != "#_#"){
								WOW.oneDayInfo.push(odAllDay);
							//}
						}else{
							WOW.oneDayInfo[whos] = odAllDay;
						}

						$("#oDays").val("["+WOW.oneDayInfo+"]");
					break;
					
					case "selectFood"://餐饮数据处理
						if(!WOW.foodsInfo){WOW.foodsInfo =[];}
						var fdAllDay = "#_#";
						if (($("#selectFood div[us ='selected']").find("p").length) != 0) {
							var _fs = $("#selectFood div[us ='selected']").find("p"),_fstr=[];
							$.each(_fs,function(){
								var _fsObj = "",_fid = $(this).attr("beselect"),_tf = $("#"+_fid),_fSele = $(this).find("select");
								_fsObj = "{\"Price\":\""+$(this).attr("price")+"\",\"ProID\":\""+ _tf.attr("proid") +"\",\"Times\":\""+ $(this).attr("times") +"\",\"ChildNum\":\""+_fSele.eq(1).val()+"\",\"ChildPrice\":\""+$(this).attr("ChildPrice")+"\",\"Name\":\""+_tf.next().find("a").html()+"\",\"Num\":\"" + _fSele.eq(0).val()+"\"}";
								_fstr.push(_fsObj);
							})
							fdAllDay = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _fstr +"]}";
						}
						if(!WOW.foodsInfo[whos]){
							//if(fdAllDay!="#_#"){
								WOW.foodsInfo.push(fdAllDay);
							//}
						}else{
							WOW.foodsInfo[whos] = fdAllDay;
						}
						
						$("#foods").val("["+WOW.foodsInfo+"]");
					break;
					
					case "selectCar"://猪车数据处理
						if(!WOW.carsInfo){WOW.carsInfo = []};
						var carAllDay = "#_#";
						if(($("#selectCar div[us ='selected']").find("p").length) != 0){
							
							var _cas = $("#selectCar div[us ='selected']").find("p"),_castr=[];
							$.each(_cas,function(){
								var _caObj = "",_caid = $(this).attr("beselect"),_tca = $("#"+_caid),_caSele = $(this).find("select"),idr,rds = $(this).find(":radio");
								if(rds.eq(0).attr("chk")){
									idr = "true"
								}else{
									idr = "false"
								}
								_caObj = "{\"Price\":\""+_caSele.eq(0).attr("pv")+"\",\"ProID\":\""+ _tca.attr("proid") +"\",\"Times\":\""+$(this).attr("times")+"\",\"Deposit\":\""+$(this).attr("deposit")+"\",\"DriverFee\":\""+$(this).attr("driverfee")+"\",\"InsteadDrive\":\""+idr+"\",\"Name\":\""+_tca.attr("carname")+"\",\"Num\":\""+_caSele.eq(0).val()+"\",\"ShuntingFeeDesc\":null}";
								_castr.push(_caObj);
							})
							carAllDay = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _castr +"]}";
						}
						if(!WOW.carsInfo[whos]){
							//if(carAllDay != "#_#"){
								WOW.carsInfo.push(carAllDay);
							//}
						}else{
							WOW.carsInfo[whos] = carAllDay;
						}

						$("#cars").val("["+WOW.carsInfo+"]");
					break;
					
					case "selectEnt":
					
						if(!WOW.ent){WOW.ent =[];}
						var ent = "#_#";
						if(($("#selectEnt div[us ='selected']").find("p").length) != 0){
							var _os = $("#selectEnt div[us ='selected']").find("p"),_ostr=[];
							$.each(_os,function(){
								var _osObj = "",_oid = $(this).attr("beselect"),_t = $("#"+_oid),_oSele = $(this).find("select");
								_osObj = "{\"Price\":\"" + $(this).attr("price") +"\",\"ChildPrice\":\""+ $(this).attr("childprice") +"\",\"ProID\":\""+ _t.attr("proid") +"\",\"Times\":\""+ $(this).attr("times") +"\",\"AdultNum\":\""+ _oSele.eq(0).val() +"\",\"ChildNum\":\""+ _oSele.eq(1).val() +"\",\"Name\":\""+ _t.next().find("a").html() +"\"}";
								_ostr.push(_osObj);
							})
							ent = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _ostr +"]}";
						}
						
						if(!WOW.ent[whos]){
							//if(odAllDay != "#_#"){
								WOW.ent.push(ent);
							//}
						}else{
							WOW.ent[whos] = ent;
						}
						//alert(ent)
						$("#sEnt").val("["+WOW.ent+"]");
						
					break;
					
					case "selectMarry":
						if(!WOW.marry){WOW.marry =[];}
						var marry = "#_#";
						if(($("#selectMarry div[us ='selected']").find("p").length) != 0){
							var _os = $("#selectMarry div[us ='selected']").find("p"),_ostr=[];
							$.each(_os,function(){
								var _osObj = "",_oid = $(this).attr("beselect"),_t = $("#"+_oid),_oSele = $(this).find("select");
								_osObj = "{\"Price\":\"" + $(this).attr("price") +"\",\"ProID\":\""+ _t.attr("proid") +"\",\"Times\":\""+ $(this).attr("times") +"\",\"AdultNum\":\""+ _oSele.eq(0).val() +"\",\"Name\":\""+ _t.next().find("a").html() +"\"}";
								_ostr.push(_osObj);
							})
							marry = "{\"Key\":\""+ nowDats +"\",\"Value\":["+ _ostr +"]}";
						}
						
						if(!WOW.marry[whos]){
							//if(odAllDay != "#_#"){
								WOW.marry.push(marry);
							//}
						}else{
							WOW.marry[whos] = marry;
						}
						
						$("#sMarry").val("["+WOW.marry+"]");
					break;
					
					default:
					return false;
				}
			};
		nowDats = nt.attr("nowday");
		$.each(boxs,function(i,n){
			getVal($(n));
		})
		//目的地信息
		if(!WOW.tagAreaInfo){WOW.tagAreaInfo=[]}
		var taInfo = "{\"Key\":\""+ nowDats +"\",\"Value\":{\"Destination\":\""+ $("#tagArea").attr("title") +"\"}}";
		
		if(!WOW.tagAreaInfo[whos]){
			WOW.tagAreaInfo.push(taInfo);
		}else{
			WOW.tagAreaInfo[whos] = taInfo
		}
		$("#locInfo").val("["+WOW.tagAreaInfo+"]");
	},
	saveD:function(tag,da,ds,pageName){//数据保存
		WOW.getJsonVal(tag);
		$.ajax({
			type:"POST",
			url:O_o.N,
			data:da,
			cache:false,
			async:false,
			error:function(){//团灭
				if($("#nowLoadding")){$("#nowLoadding").remove()};
				if($("#tMark")){$("#tMark").remove();}
				//WOW.callForDuty.mainField().html(O_o.FailMsgB);
				var otMsg;
				otMsg = setTimeout(function(){
					alerter({msg:"很抱歉，保存数据的时候发生了异常，请重新点击您要安排的日期以保存您的行程安排。",set:{css:"width:200px;padding:15px 0;"},ot:2000},function(){
						clearTimeout(otMsg);
					});
				},500)
				return false;
			},
			success:function(st){
				
				if(st != 0){//保存成功
					var tVal =$(tag).find("input[type='hidden']");
					if(tVal.val() == ""){
						tVal.val(st);
					}
					if(ds != undefined && pageName != undefined){
						$(tag).attr("planed","yes");
						var hData = "TravelID="+ WOW.callForDuty.travel() +"&TravelCityID="+ WOW.callForDuty.travelCity() +"&DayNumber="+ ds +"&Ticket_BeginDate="+WOW.callForDuty.firstDay()+"&file=" + pageName;
						WOW.huntersMark(hData);
					}else{
						$("#tMark").animate({
							opacity:"hide"
						},600,function(){
							$("#tMark").remove();
						})
						
						$("#nowLoadding").animate({
							opacity:"hide"
						},300,function(){
							$("#nowLoadding").remove();
						})
					}
					
				}else{//保存失败
					if($("#nowLoadding")){$("#nowLoadding").remove()};
					if($("#tMark")){$("#tMark").remove();}
					WOW.callForDuty.mainField().html(O_o.FailMsgB);
				}
			}
		})

	},
	huntersMark:function(dat){//Ajax请求
		//var _tmp = dat;//debug用
		if(!_$("tMark")){
			$("body").ajaxStart(function(){//loadding 信息
				WOW.isLoadding();
			});
		}

		$.ajax({
			type:"GET",
			url:O_o.H,
			data:dat,
			cache:false,
			error:function(){//团灭
				if($("#nowLoadding")){$("#nowLoadding").remove()};
				if($("#tMark")){$("#tMark").remove();}
				//WOW.callForDuty.mainField().html(O_o.FailMsgB);
				var otMsg;
				otMsg = setTimeout(function(){
					alerter({msg:"很抱歉，获取您的行程安排时发生了个错误，请重新点击您要安排行程的日期重新获取您的行程安排。",set:{css:"width:200px;padding:15px 0;"},ot:2000},function(){
						clearTimeout(otMsg);
					});
				},500)
				return false;
			},
			success:function(html){
				$("#tMark").animate({
					opacity:"hide"
				},600,function(){
					$("#tMark").remove();
				})
				
				$("#nowLoadding").animate({
					opacity:"hide"
				},300,function(){
					$("#nowLoadding").remove();
				})
				WOW.callForDuty.mainField().html("");
				//WOW.callForDuty.mainField().append(_tmp);//debug用
				WOW.callForDuty.mainField().append(html);
				
				//机票
				if($("#"+WOW.callForDuty.flight)){
					WOW.callForDuty.flyPort = $("#flyPort");
					if(WOW.callForDuty.flieName == undefined){
						WOW.morePT(WOW.callForDuty.defFly);
						//WOW.morePT();
					}else{
						WOW.raidOn(WOW.callForDuty.flight,2);
					}
				}
				//酒店
				if($("#"+WOW.callForDuty.hou)){WOW.raidOn(WOW.callForDuty.hou,1);}
				//一日游
				if($("#"+WOW.callForDuty.oneDay)){WOW.raidOn(WOW.callForDuty.oneDay,3);}
				//美食
				if($("#"+WOW.callForDuty.foods)){WOW.raidOn(WOW.callForDuty.foods,0);}
				//猪车
				if($("#"+WOW.callForDuty.cars)){WOW.raidOn(WOW.callForDuty.cars,4);}
				//休闲娱乐
				if($("#"+WOW.callForDuty.ent)){WOW.raidOn(WOW.callForDuty.ent,5);}
				//婚纱
				if($("#"+WOW.callForDuty.marry)){WOW.raidOn(WOW.callForDuty.marry,6);}
				
				//价格计算
				WOW.liquidate();
				/*
if($("#"+WOW.callForDuty.flight) || $("#"+WOW.callForDuty.hou) || $("#"+WOW.callForDuty.oneDay) || $("#"+WOW.callForDuty.foods) || $("#"+WOW.callForDuty.cars)){
					WOW.liquidate();
				}else{
					WOW.callForDuty.mainField().html(O_o.FailMsgA);
				}
*/
			}
		})
	},
	houseSet:function(){//房间数初始化，有bug，待改进
		var _hS = $("#"+ WOW.callForDuty.hou +" div[US='selected']").find("select:first"),
			_hss = _hS.length,
			_H = WOW.callForDuty.houses(),
			_S;
		for(_S = 0;_S < _hss;_S++){
			$("<option value="+ _H + ">"+_H+"</option>").appendTo(_hS[_S])
			_hS[_S].selectedIndex =  _hss-1;
		}
	},
	raidOn:function(tags,ty){//已选区域初始化与产品事件绑定
		var tag = $("#" + tags),
			isSelect = $("#" + tags +" div[US='selected']"),
			unSelect = $("#" + tags +" div[US='unSelect']"),
			//sI = unSelect.find("input[disabled!='true']"),
			sI = unSelect.find("input"),
			sInput,
			cInput = WOW.callForDuty.mainField().find("*[chk='yes']");
		
		//初始化
		if(cInput.length >0){
			for(var c =0;c < cInput.length;c++){
				if(cInput[c].tagName.toLowerCase() =="input"){
					$(cInput[c]).attr("checked",true);
				}
				if(cInput[c].tagName.toLowerCase() =="option"){
					$(cInput[c]).attr("selected","selected");
				}
			}
		}
		//酒店与其它,0餐饮，1酒店，2机票,3一日游
		sInput = unSelect.find("input[checked='true']");
		if(isSelect.find("select").length <= 0 && sInput.length > 0){
			isSelect.html("");
			for(var a = 0;a<sInput.length;a++){
				var sHtml = $(sInput[a]).siblings().html(),thisPr = $(sInput[a]).val(),thisDif,vId = $(sInput[a]).attr("id"),tThePr = $(sInput[a]);
				if(ty == 0){
					var __cfP = $(this).attr("childprice"),
						__afP = $(this).val();
					var tP = "<p childprice=\""+ __cfP +"\" Price=\""+ __afP +"\" times=\""+ $(sInput[a]).attr("times") +"\" beSelect=\"" + vId +"\">成人"+ WOW.callForDuty.tenSelect(thisPr) + O_o.bfUnit +"儿童" + O_o.bfUnit +WOW.callForDuty.tenSelect(thisPr,0) + O_o.bfUnit +"<b>"+ sHtml +"</b></p>";
					isSelect.append(tP);
				}
				
				if(ty == 6){
					var _mp =  $(sInput[a]).attr("adultprice"),
						mp = "<p Price=\""+ _mp +"\" times=\""+ $(sInput[a]).attr("times") +"\" beSelect=\"" + vId +"\">"+ WOW.callForDuty.tenSelect(thisPr) + O_o.bfUnit +"<b>"+ sHtml +"</b></p>";
					isSelect.append(mp);
				}
				
				if(ty == 5){
					var __cfP = $(sInput[a]).attr("childprice"),
						__afP = $(sInput[a]).attr("adultprice");
					var stP = "<p childprice=\""+ __cfP +"\" Price=\""+ __afP +"\" times=\""+ $(sInput[a]).attr("times") +"\" beSelect=\"" + vId +"\">成人"+ WOW.callForDuty.tenSelect(tThePr.attr("adultprice")) + O_o.bfUnit +"儿童" + O_o.bfUnit +WOW.callForDuty.tenSelect(tThePr.attr("childprice"),0) + O_o.bfUnit +"<b>"+ sHtml +"</b></p>";
					isSelect.append(stP);
				}
				
				if(ty == 1){
					if(isSelect.find("table").length ==0){isSelect.append(WOW.callForDuty.iTable);}
					var bfsele = function(){
							var __a;
							
							if($(sInput[a]).attr("breakfast_id") == 0){
								__a = WOW.callForDuty.tenSelect(null,-1);
							}else{
								__a = WOW.callForDuty.tenSelect(null,0);
							}
							return __a;
						},
						_tp ="<tr beSelect=\""+ vId +"\"><td>"+ WOW.callForDuty.tenSelect(thisPr) + O_o.roomUnit +"</td><td class=\"tL\">"+ sHtml +"</td><td><i>"+parseInt(thisPr.split(",")[1])+"</i></td><td>"+ WOW.callForDuty.tenSelect(null,0) +"</td><td>"+ bfsele() +"</td><td>"+ bfsele() +"</td></tr>";
					
					isSelect.find("table").append(_tp);
				}
				if(ty == 3){
					var tP = "<p times=\""+ $(sInput[a]).attr("times") +"\" beSelect=\"" + vId +"\">成人"+ WOW.callForDuty.tenSelect(tThePr.attr("adultprice"),0) + "儿童" + O_o.bfUnit +WOW.callForDuty.tenSelect(tThePr.attr("childprice"),0) + O_o.bfUnit +"<b>"+ sHtml +"</b></p>";
					isSelect.append(tP);
				}
				if(ty == 4){
					var ifD = $(sInput[a]).attr("ifinste_addrive"),_tms= $(sInput[a]).attr("times"),_deposit = $(this).attr("deposit"),_driverfee = $(this).attr("driverfee"),tP;
					if(ifD =="True"){
						tP = "<p times=\""+ _tms +"\" _deposit=\""+deposit+"\" _driverfee=\""+driverfee+"\" beSelect=\""+ vId +"\">"+ WOW.callForDuty.tenSelect(thisP) + O_o.bfUnit +"<b>"+ sHtml +"&nbsp;&nbsp;&nbsp;&nbsp;代驾<input type=\"radio\" name=\"driver"+vId+"\" chk=\"yes\" checked=\"checked\" />&nbsp;&nbsp;&nbsp;&nbsp;不代驾<input type=\"radio\" name=\"driver"+vId+"\" /></b></p>";
					}else{
						tP = "<p times=\""+ _tms +"\" deposit=\""+deposit+"\" _driverfee=\""+driverfee+"\" beSelect=\""+ vId +"\">"+ WOW.callForDuty.tenSelect(thisP) + O_o.bfUnit +"<b>"+ sHtml +"&nbsp;&nbsp;&nbsp;&nbsp;代驾<input type=\"radio\" name=\"driver"+vId+"\" />&nbsp;&nbsp;&nbsp;&nbsp;不代驾<input type=\"radio\" name=\"driver"+vId+"\" checked=\"checked\" chk=\"yes\" /></b></p>";
					}
					isSelect.append(tP);
					WOW.bindRadio(isSelect);
				}
			}
		}
		WOW.bindSelect(isSelect);
		//机票
		if(ty == 2){
			if(!_$("selectFlight")){return false;}
			WOW.callForDuty.nowFly = $("#isAPIOrData").val();//当前机票类型
			var fBox = $("#" + tags),
				ftr = $("#" + tags +" tr"),
				_fr = $("#" + tags + " input[type='radio']"),
				lastSelect,
				R;
			if(WOW.callForDuty.nowFly == 1){
				lastSelect = $("#selectFlight table").eq(2).find("tr:first").nextAll()
			}
			if(WOW.callForDuty.nowFly == 0){
				lastSelect = $("#selectFlight table").eq(1).find("tr:first").nextAll()
			}
			for(R = 0;R<_fr.length;R++){
				if($(_fr[R]).parent().attr("rowspan") >= 2){
					if($(_fr[R]).attr("checked") == true){
						$(_fr[R]).parent().parent().attr("class","bge3f2fa");
						$(_fr[R]).parent().parent().next().attr("class","bge3f2fa");
					}
				}else{
					if($(_fr[R]).attr("checked") == true){
						$(_fr[R]).parent().parent().attr("class","bge3f2fa");
					}
				}

				_fr[R].onclick = function(){
					
					if($(this).parent().attr("rowspan") >= 2){
						if($(this).parent().parent().parent().parent().find("tbody").length == 0){
							$(this).parent().parent().parent().find("tr").removeAttr("class");
							$(this).parent().parent().parent().find("input").attr("checked",false);
							$(this).parent().parent().parent().find("input[chk='yes']").removeAttr("chk");
						}else{
							$(this).parent().parent().parent().parent().find("tr").removeAttr("class");
							$(this).parent().parent().parent().parent().find("input").attr("checked",false);
							$(this).parent().parent().parent().parent().find("input[chk='yes']").removeAttr("chk");
						}
						$(this).parent().parent().attr("class","bge3f2fa");
						$(this).parent().parent().next().attr("class","bge3f2fa");
					}else{
						if ($(this).parent().parent().parent().parent().find("tbody").length == 0) {
							$(this).parent().parent().parent().find("tr").removeAttr("class");
							$(this).parent().parent().parent().find("input:checked").attr(false);
							$(this).parent().parent().parent().find("input[chk='yes']").removeAttr("chk");
						}else{
							$(this).parent().parent().parent().parent().find("tr").removeAttr("class");
							$(this).parent().parent().parent().parent().find("input").attr("checked",false);
							$(this).parent().parent().parent().parent().find("input[chk='yes']").removeAttr("chk");
						}
						$(this).parent().parent().attr("class","bge3f2fa");
					}
					$(this).attr("chk","yes");
					$(this).attr("checked",true);
					WOW.liquidate();
				}
			}
			
			if(WOW.flyPerson || $("#pInfo").val() !=""){
				var allP,sM;
				
				if(WOW.callForDuty.nowFly == 1){
					allP = $("#selectFlight table").eq(2).find("tr:first").nextAll();
					sM = $("#selectFlight").find("table").eq(3);
				}
				if(WOW.callForDuty.nowFly != undefined && WOW.callForDuty.nowFly == 0){
					allP = $("#selectFlight table").eq(1).find("tr:first").nextAll();
					sM = $("#selectFlight").find("table").eq(2);
				}
				
				if(!WOW.flyPerson){
					WOW.flyPerson = eval($("#pInfo").val());
				}
				$.each(allP,function(i,n){
					var _ip = $(this).find("input"),tjson;
					if(typeof(WOW.flyPerson[i])=="object"){
						tjson = WOW.flyPerson[i];
					}else if(typeof(WOW.flyPerson[i])=="string"){
						tjson = eval("("+WOW.flyPerson[i]+")");
					}
					_ip.eq(1).val(tjson.Name);
					_ip.eq(2).val(tjson.PassportCode);
					tjson = null;
				})
				
				if($("#flys").val()!= ""){
					var fpo = eval("("+$("#flys").val()+")");
					sM.find("textarea").val(fpo.Remark);
				}
			}

			/*
if($("#selectFlight").find("table").eq(3)){
				var allFS = $("#selectFlight").find("table").eq(3).find("select");

				$.each(allFS,function(){
					if($(this).find("option").eq(0).val()=="0"){
						$(this).change(function(){
							$(this).find("option").removeAttr("chk");
							$(this).find("option").eq($(this).val()).attr("chk","yes");
							WOW.liquidate();
						})
					}else{
						$(this).change(function(){
							$(this).find("option").removeAttr("chk");
							$(this).find("option").eq($(this).val()-1).attr("chk","yes");
							WOW.liquidate();
						})
					}
				})			
				
				$("#selectFlight p.tRight").click(function(){
					$(this).unbind();
					WOW.morePT(this);
				})
			}
*/
			WOW.bindSelect(isSelect);
		}
		
		//事件绑定
		sI.click(function(){
			var beS = $(this).siblings().html(),pVl = $(this).attr("id"),thisP = $(this).val(),tms = $(this).attr("times");
			if($(this).attr("checked") != false){//选了
				if($(this).attr("disabled") == true){return false;}
				var bP;
				
				if(ty != 1){
					if(isSelect.find("p").length == 0){isSelect.text("")}
					if(ty == 0){
						var _cfP = $(this).attr("childprice"),
							_afP = $(this).val();
						bP = "<p childprice=\""+_cfP+"\" Price=\""+_afP+"\" times=\""+ tms +"\" beSelect=\""+ pVl +"\">成人"+ WOW.callForDuty.tenSelect(thisP) + O_o.bfUnit +"&nbsp;&nbsp;&nbsp;&nbsp;儿童" +WOW.callForDuty.tenSelect(thisPr,0) + O_o.bfUnit +"<b>"+ beS +"</b></p>";
					}
					if(ty == 3){
						var _cP = $(this).attr("childprice"),
							_aP = $(this).attr("adultprice");
						bP = "<p times=\""+ tms +"\" beSelect=\"" + pVl +"\">成人"+ WOW.callForDuty.tenSelect(_aP) + "&nbsp;&nbsp;&nbsp;&nbsp;儿童" +WOW.callForDuty.tenSelect(_cP,0) + O_o.bfUnit +"<b>"+ beS +"</b></p>";
					}
					
					if(ty == 4){
						var ifD = $(this).attr("ifinsteaddrive"),deposit = $(this).attr("deposit"),driverfee = $(this).attr("driverfee");
						if(ifD =="True"){
							bP =  "<p times=\""+ tms +"\" deposit=\""+deposit+"\" driverfee=\""+driverfee+"\" beSelect=\""+ pVl +"\">"+ WOW.callForDuty.tenSelect(thisP) +"<b>"+ beS +"&nbsp;&nbsp;&nbsp;&nbsp;代驾<input type=\"radio\" name=\"driver"+pVl+"\" chk=\"yes\" checked=\"checked\" />&nbsp;&nbsp;&nbsp;&nbsp;不代驾<input type=\"radio\" name=\"driver"+pVl+"\" /></b></p>";
						}else{
							bP =  "<p times=\""+ tms +"\" deposit=\""+deposit+"\" driverfee=\""+driverfee+"\" beSelect=\""+ pVl +"\">"+ WOW.callForDuty.tenSelect(thisP) +"<b>"+ beS +"&nbsp;&nbsp;&nbsp;&nbsp;代驾<input type=\"radio\" name=\"driver"+pVl+"\" />&nbsp;&nbsp;&nbsp;&nbsp;不代驾<input type=\"radio\" name=\"driver"+pVl+"\" chk=\"yes\" checked=\"checked\" /></b></p>";
						}
					}
					
					if(ty == 5){
						var __cfP = $(this).attr("childprice"),
							__afP = $(this).attr("adultprice");
						bP = "<p childprice=\""+__cfP+"\" Price=\""+__afP+"\" times=\""+ tms +"\" beSelect=\""+ pVl +"\">成人"+ WOW.callForDuty.tenSelect(thisP) + O_o.bfUnit +"&nbsp;&nbsp;&nbsp;&nbsp;儿童" +WOW.callForDuty.tenSelect(thisPr,0) + O_o.bfUnit +"<b>"+ beS +"</b></p>";
					}
					
					if(ty == 6){
						var _mp = $(this).attr("adultprice"),
							bP = "<p Price=\""+ _mp +"\" times=\""+ tms +"\" beSelect=\"" + pVl +"\">"+ WOW.callForDuty.tenSelect(thisPr) + O_o.bfUnit +"<b>"+ beS +"</b></p>";
					}
					
					isSelect.append(bP);
					$(this).attr("chk","yes");
					$(this).attr("checked",true);
					WOW.liquidate();
					WOW.bindSelect(isSelect);
					WOW.bindRadio(isSelect);
				}
				
				if(ty == 1){
					var bfseles = function(t){
							var __a;
							if($(t).attr("breakfast_id") == 0){
								__a = WOW.callForDuty.tenSelect(null,-1);
							}else{
								__a = WOW.callForDuty.tenSelect(null,0);
							}
							return __a;
						},
						_bP ="<tr beSelect=\""+ pVl +"\"><td>"+ WOW.callForDuty.tenSelect(thisP) + O_o.roomUnit +"</td><td class=\"tL\">"+ beS +"</td><td><i >"+parseInt(thisP.split(",")[1])+"</i></td><td>"+ WOW.callForDuty.tenSelect(null,0) +"</td><td>"+ bfseles(this)+"</td><td>"+ bfseles(this) +"</td></tr>";
					if(isSelect.find("table").length ==0){isSelect.text("");isSelect.append(WOW.callForDuty.iTable);}
					isSelect.find("table").append(_bP);
					$(this).attr("chk","yes");
					$(this).attr("checked",true);
					WOW.liquidate();
					WOW.bindSelect(isSelect);
				}
				
			}else{//没选
				if(ty != 1){
					$(this).removeAttr("chk");
					isSelect.find("p[beSelect='"+pVl+"']").remove();
					WOW.liquidate();
					if(isSelect.find("p").length == 0){isSelect.text(O_o.notYet)};
				}
				if(ty == 1){
					$(this).removeAttr("checked");
					$(this).removeAttr("chk");
					isSelect.find("tr[beSelect='"+pVl+"']").remove();
					WOW.liquidate();
					if(isSelect.find("td").length == 0){isSelect.text(O_o.notYet)}
				}
			}
		})
	},
	bindSelect:function(t,s){//下拉列表价格计算事件绑定
		var dSelect = t.find("select");
		dSelect.change(function(){
			$(this).find("option").removeAttr("chk");
			if($(this).find("option").eq(0).text()=="0"){
				$(this).find("option").eq($(this).val()).attr("chk","yes");
			}else{
				$(this).find("option").eq($(this).val() - 1).attr("chk","yes");
			}
			
			
			/*if(s != undefined){
				$(this).find("option").eq($(this).val()).attr("chk","yes");
			}else{
				$(this).find("option").eq($(this).val() - 1).attr("chk","yes");
			}*/
			
			WOW.liquidate();
		});
		
	},
	bindRadio:function(t){
		var dRadio = t.find(":radio");
		dRadio.click(function(){
			if(!$(this).attr("chk")){
				dRadio.removeAttr("chk");
				$(this).parent().find(":radio").removeAttr("checked");
				$(this).attr("checked",true)
				$(this).attr("chk","yes");
				
				WOW.liquidate();
			}else{
				return false
			}
		})
	},
	morePT:function(t){
		if(WOW.callForDuty.starCity == undefined){
			WOW.callForDuty.starCity =encodeURIComponent($("#starCity").val());
			WOW.callForDuty.endCity = encodeURIComponent($("#endCity").text());
		}
		
		var PTLP,aDat,
			sDat = "TravelID="+ WOW.callForDuty.travel() +"&TravelCityID="+ WOW.callForDuty.travelCity() +"&Ticket_BeginDate="+WOW.callForDuty.firstDay()+"&Ticket_BeginDate_B="+WOW.callForDuty.endDay()+"&strStart_City="+ WOW.callForDuty.starCity +"&strEnd_City="+WOW.callForDuty.endCity+"&LodgingAdultNum="+WOW.callForDuty.adultNum+"&LodgingChildNum="+WOW.callForDuty.childNum+"&isAPIOrData=";
		if(t){
			PTLP = t;
		}else{
			PTLP = $("#isAPIOrData").val()==0?1:0
		}
		aDat = sDat+PTLP;
		
		$.ajax({
			type:"GET",
			url:"/order/ajax/api-planticket-list.aspx",
			data:aDat,
			cache:false,
			error:function(){//团灭
			},
			success: function(h){
				if(h != "0"){
					WOW.callForDuty.flyPort.html(h);
					if(!t){$("#isAPIOrData").val(PTLP)}
					WOW.callForDuty.nowFly = PTLP;
					WOW.raidOn(WOW.callForDuty.flight,2);
					WOW.liquidate();
					/*
var	dTag = $(t).prev(),
						fTag = dTag.find("table");
						
					var nowTable = fTag.html(),
						tmpTable = "<table>"+nowTable+h+"</table>";
						
					dTag.html(tmpTable);
					dTag.find("input[type='radio']").unbind();
					dTag.find("input[type='radio']").click(function(){
						dTag.find("tr").removeAttr("class");
						$(this).parent().parent().attr("class","bge3f2fa");
						var dRadio = dTag.find("input[type='radio']");
						if(!$(this).attr("chk")){
							dRadio.removeAttr("chk");
							dTag.find(":radio").removeAttr("checked");
							$(this).attr("checked",true)
							$(this).attr("chk","yes");
							WOW.liquidate();
						}else{
							return false
						}
					})

					$(t).css("color","#ccc");
					$(t).html($(t).find("a").html());
*/
				}
			}
		})
	},
	liquidate:function(){//清算
		WOW.callForDuty.honors = [];
		var getSelect = $("#" + WOW.battleField.fID +" div[US='selected']"),
		gL = getSelect.length,
		dayHonor = 0,
		allHonor = 0,
		tPP = getSelect.attr("type"),
		allDay = $("#" + WOW.callForDuty.Echelon + " li"),
		nowDay = $("#" + WOW.callForDuty.Echelon + " li.itiOn"),
		G,_H,J;
		for(G=0;G<gL;G++){
			switch($(getSelect[G]).attr("type")){
				case "hotel"://酒店
					//var ips = getSelect.find("tr:first").nextAll().length;
					WOW.revenge(getSelect[G],1);
				break;
				
				case "flight"://机票
				
					if(WOW.callForDuty.nowFly == 0){
						var trs = [getSelect.find("input[checked=true]").val(),getSelect.find("input[checked=true]").attr("safetyfee")];
						if(trs == undefined){trs = [0,0]};
					}
					
					if(WOW.callForDuty.nowFly == 1){
						var trs = [[$(getSelect[G]).find("table").eq(0).find("input[checked=true]").val(),$(getSelect[G]).find("table").eq(0).find("input[checked=true]").attr("safetyfee")],[$(getSelect[G]).find("table").eq(1).find("input[checked=true]").val(),$(getSelect[G]).find("table").eq(1).find("input[checked=true]").attr("safetyfee")]];
						if(trs == undefined){trs = [[0,0],[0,0]]};
					}
					WOW.revenge(trs,2);
					
				break;
				
				case "oneday"://一日游
					WOW.revenge(getSelect[G],3);
				break;
				
				case "food"://餐饮
					WOW.revenge(getSelect[G],0);
				break;
				
				case "car"://猪车
					WOW.revenge(getSelect[G],4);
				break;
				
				case "ent"://娱乐
					WOW.revenge(getSelect[G],5);
				break;
				
				case "marry"://婚纱
					WOW.revenge(getSelect[G],6);
				break;
				
				/*
default:
				return;
*/
			}
		}
		
		//本日价
		for(_H=0;_H<WOW.callForDuty.honors.length;_H++){
			dayHonor += parseInt(WOW.callForDuty.honors[_H]);
		}
		nowDay.attr("dayprice",dayHonor);
		
		//总价
		for(J = 0;J<allDay.length;J++){
			allHonor += parseInt($(allDay[J]).attr("dayprice"));
		}
		WOW.callForDuty.honor().html(O_o.mM + allHonor);
		WOW.callForDuty.honor().attr("allprice",allHonor);
	},
	revenge:function(t,rT){//复仇
	
		//酒店
		if(rT == 1){
			var sTr = $(t).find("tr:first").nextAll(),_sP;
			
			for(var _i=0;_i<sTr.length;_i++){
				var allVal = $(sTr[_i]).find("select").eq(0).attr("pv").split(","),
					hNum = parseInt($(sTr[_i]).find("select").eq(0).val()),
					bNum = parseInt($(sTr[_i]).find("select").eq(1).val()),
					bfNum = parseInt($(sTr[_i]).find("select").eq(2).val()),
					bfNum2 = parseInt($(sTr[_i]).find("select").eq(3).val());
				
				//酒店价格计算
				_sP = hNum * (parseInt(allVal[0]) + (parseInt(allVal[2]) * bNum ) + (parseInt(allVal[3]) * bfNum) + (parseInt(allVal[4]) * bfNum2));
				WOW.callForDuty.honors.push(_sP);
			}
		}
		//机票
		if(rT == 2){
			
			if (WOW.callForDuty.nowFly == 0) {
				var _fP = t[0], _sf = t[1], t2, _asf = 0, _ap;
				t2 = $("#selectFlight").find("table").eq(1).find("tr:first").nextAll();
				$.each(t2, function(){
					_asf += $(this).find("select:last").val() * _sf;
				})
			}
			
			if (WOW.callForDuty.nowFly == 1) {
				var _fP = parseFloat(t[0][0]) + parseFloat(t[1][0]), _sf = parseFloat(t[0][1]) + parseFloat(t[1][1]), t2, _asf = 0, _ap;
				t2 = $("#selectFlight").find("table").eq(2).find("tr:first").nextAll();//乘机人信息+保险
				$.each(t2, function(){
					_asf += $(this).find("select:last").val() * _sf;
				})
			}
			
			_ap = _asf + parseFloat(_fP);
			$("#selectFlight").find("table").eq(0).find("input:checked").attr("rprice",_ap);
			WOW.callForDuty.honors.push(_ap);

		}
		
		if(rT != 1 && rT != 2){
			var _pS = $(t).find("p"),ppS = _pS.length,_nP;
			
			if(ppS == 0){return};
			//餐饮
			if(rT == 0){
				for(var t = 0;t<ppS;t++){
					var nSel = parseFloat($(_pS[t]).find("select").eq(0).attr("pv")),
						nNum = parseInt($(_pS[t]).find("select").eq(0).val()),
						nSel2 = parseFloat($(_pS[t]).attr("childprice")),
						nNum2 = parseInt($(_pS[t]).find("select").eq(1).val()),
						fTs = parseFloat($(_pS[t]).attr("times"));
					
					//其他价格计算
					_nP = nNum * (nSel*fTs) + nNum2 * (nSel2*fTs);
					WOW.callForDuty.honors.push(_nP);

				}
				
			}
			//一日游
			if(rT == 3){
				for(var b = 0;b<ppS;b++){
					var aSel = parseFloat($(_pS[b]).find("select").eq(0).attr("pv")),
						aNum = parseInt($(_pS[b]).find("select").eq(0).val()),
						cSel = parseFloat($(_pS[b]).find("select").eq(1).attr("pv")),
						cNum = parseInt($(_pS[b]).find("select").eq(1).val()),
						_Ts = parseFloat($(_pS[b]).attr("times"));
					//一日游价格计算
					
					_nP = (aNum * (aSel*_Ts))+(cNum * (cSel*_Ts));
					WOW.callForDuty.honors.push(_nP);
				}
			}
			
			//猪车
			if(rT == 4){
				for(var b = 0;b<ppS;b++){
					var carVal = parseFloat($(_pS[b]).find("select").eq(0).attr("pv")),
						driverf = parseFloat($(_pS[b]).attr("driverfee")),
						dep = parseFloat($(_pS[b]).attr("deposit"))
						_time = parseFloat($(_pS[b]).attr("times"));
					
					//猪车价格计算
					if($(_pS[b]).find(":radio:first").attr("chk")){
						_nP = carVal*_time+driverf+dep;
					}else{
						_nP = carVal*_time+dep;
					}
					WOW.callForDuty.honors.push(_nP);
				}
			}
			//娱乐
			if(rT == 5){
				for(var b = 0;b<ppS;b++){
					var apV = parseFloat($(_pS[b]).attr("price")),
						an = parseInt($(_pS[b]).find("select").eq(0).val()),
						cn = parseInt($(_pS[b]).find("select").eq(1).val()),
						cpV = parseFloat($(_pS[b]).attr("childprice")),
						_time = parseFloat($(_pS[b]).attr("times"));
					
					//娱乐价格计算
					_nP = (apV*an + cpV*cn)*_time;
					WOW.callForDuty.honors.push(_nP);
				}
			}
			
			//色应
			if(rT == 6){
				for(var b = 0;b<ppS;b++){
					var pvs = parseFloat($(_pS[b]).attr("price")),
						ans = parseInt($(_pS[b]).find("select").eq(0).val()),
						_time = parseFloat($(_pS[b]).attr("times"));
					
					//娱乐价格计算
					_nP = (pvs*ans)*_time;
					WOW.callForDuty.honors.push(_nP);
				}
			}
			
		}
	},
	callForDuty:{
		field:function(){//主要加载区域
			return $("#" + WOW.battleField.fID);
		},
		firstDay:function(){//开始日期
			var _fds = $("#" + WOW.battleField.fDId).val();
			return _fds;
		},
		endDay:function(){//结束日期
			var _eds = $("#endDay").val();
			return _eds;
		},
		travel:function(){//度假产品
			var _trl = $("#TravelId").val();
			return _trl;
		},
		travelCity:function(){//出发城市
			var trlc = $("#TravelCityID").val();
			return trlc;
		},
		days:function(){//持续天数
			return $("#" + WOW.battleField.gDId).val();
		},
		_oC:function(){//每日行程加载容器创建方法
			var _O ="<div class=\"itiRBox\" id=\"orderContent\"></div>";
			WOW.callForDuty.field().append($(_O));
		},
		mainField:function(){//每日行程加载容器
			return $("#orderContent");
		},
		houses:function(){//房间数
			return $("#" + WOW.battleField.rId).val();
		},
		honor:function(){//总价显示标签
			return $("#allPrice");
		},
		tenSelect:function(n,z){//下拉列表生成方法
			var Zz,tSe;
			if(n && n != null){Zz = n}else{Zz = ""}
			if(z != undefined){
				if(z== -1){
					tSe = "<select disabled=\"disabled\" pV=\""+ Zz +"\"><option selected=\"selected\">0</option></select>";
				}else{
					tSe = "<select pV=\""+ Zz +"\"><option selected=\"selected\">0</option><option>1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option></select>";
				}
				
			}else{
				
				tSe = "<select pV=\""+ Zz +"\"><option selected=\"selected\">1</option><option>2</option><option>3</option><option>4</option><option>5</option><option>6</option><option>7</option><option>8</option><option>9</option><option>10</option></select>"
			}
			
			return tSe;
		},
		loadding:"<p class=\"loadding\" id=\"nowLoadding\">"+ O_o.loadMsgA +"</p>",//加载提示信息
		iTable:"",
		Echelon:"theEchelon",
		_eOn:"itiOn",
		flight:"selectFlight",
		hou:"selectHotel",
		oneDay:"selectOneday",
		foods:"selectFood",
		cars:"selectCar",
		ent:"selectEnt",
		marry:"selectMarry",
		honors:[]//价格存储
	},
	battleField:{fID:"",fDId:"",gDId:"",rId:"",setId:""}
}),
WLK = Class(WOW,{
	creat:function(w,cb){
		this.w = w;
		WLK.wB = this.w;
		if(cb){
			sideScroll.roll.callBack = cb;
			sideScroll.roll.cbCtrl = 1;
		}
	},
	innts:function(){
		var tBut = $("#"+WLK.wB.wid),
			forms = $("#"+WLK.wB.formId);
		tBut.bind("click",function(){
			var pI = $("#theEchelon li[planed]").length,_ot;
			
			function getFlieName(){
				var fN = $("#flieName").val().split(",").length;
				if(fN != WOW.callForDuty.days()){
					return false;
				}else{
					if(_ot != undefined){
						clearInterval(_ot);
					}
					pushAllName();
					forms.submit();
				}
			}
			
			function pushAllName(){
				var lis = $("#theEchelon li").find("input[type='hidden']"),fnArr = [];
				$.each(lis,function(){
					fnArr.push($(this).val());
				})
				$("#flieName").val(fnArr);
			}
			var ttt =WOW.callForDuty.days();
			if(pI == WOW.callForDuty.days() || pI == WOW.callForDuty.days()-1){
				var NT=$("#theEchelon li[class='itiOn']").eq(0),dayData = {CreateContent:WOW.callForDuty.mainField().html(),file:""};
				if(pI == WOW.callForDuty.days()-1){
					var fNum = $("#flieName").val().split(",").length;
					WOW.saveD(NT,dayData);
					
					if(fNum != WOW.callForDuty.days()){
						pushAllName();
						forms.submit();
					}else{
						_ot = setInterval(function(){getFlieName()},500);
					}
					
				}else{
					pushAllName()
					forms.submit();
				}
			}else{
				var otMsg;
				otMsg = setTimeout(function(){
					alerter({msg:"您还未安排完所有天数的行程",set:{css:"width:200px;padding:15px 0;"},ot:2000},function(){
						clearTimeout(otMsg);
					});
				},500)
				return false;
			}
		})
	}
}),
//高尔夫预定 tid:"gConfirm",bt:"bookTotal",sb:"goflNext",jp:"jsonPort",cs:".golfBookTab"
setGolf = Class($_$,{
	creat:function(o,cb){
		this.o = o;
		setGolf.g = this.o;
		if(cb){
			setGolf.g.cc = 1;
			setGolf.g.callBack = cb;
		}
	},
	setOp:function(){
		setGolf.g.box = $("#" + setGolf.g.tid);
		if(setGolf.g.bt != undefined){
			setGolf.g.total = $("#" + setGolf.g.bt);
		}
		if(setGolf.g.f){
			if(typeof(setGolf.g.f)== "string"){
				setGolf.g.form = $("#" + setGolf.g.f);
			}else if(typeof(setGolf.g.f)== "number"){
				setGolf.g.form = $("form").eq(setGolf.g.f);
			}else{
				alert("请以数字或表单id指定需要提交的表单。");
			}
		}else{
			setGolf.g.form = $("form:first");
		}
		setGolf.g.sb = $("#" + setGolf.g.sb);
		setGolf.g.jsonPort = $("#" + setGolf.g.jp);
		setGolf.g.ts = setGolf.g.box.find("div").filter(setGolf.g.cs);
		setGolf.g.sler = setGolf.g.ts.find("select");
		setGolf.g.green = [];
		setGolf.g.time = [];
		setGolf.g.tr = function(i){
			var s = i+Math.ceil(Math.random()*10),
				trString = "<tr><td>选用</td><td><input type=\"radio\" value=\"100.0000\" name=\"BallCartFee_1_"+s+"\" json=\"GFN_BallCartPerFee\"/></td><td><input type=\"radio\" value=\"200.0000\" name=\"BallCartFee_1_"+s+"\" json=\"GFN_BallCartDoubleFee\"/></td><td><input type=\"radio\" value=\"100\" name=\"CaddieFee_1_"+s+"\" json=\"GFN_CaddiePerFee\"/></td><td><input type=\"radio\" value=\"200\" name=\"CaddieFee_1_"+s+"\" json=\"GFN_CaddieDoubleFee\"/></td><td><input type=\"checkbox\" value=\"80.0000\" name=\"GFN_GarderobeFee\" json=\"GFN_GarderobeFee\"/></td><td><input type=\"checkbox\" value=\"100.0000\" name=\"GFN_HirePoleFee\" json=\"GFN_HirePoleFee\"/></td><td><input type=\"checkbox\" value=\"50.0000\" name=\"GFN_HireShoesPrice\" json=\"GFN_HireShoesPrice\"/></td><td><input type=\"checkbox\" value=\"80\" name=\"GFN_WorlkFee\" json=\"GFN_WorlkFee\"/></td><td><input type=\"checkbox\" value=\"50.0000\" name=\"GFN_ServiceFee\" json=\"GFN_ServiceFee\"/></td><td><input type=\"checkbox\" value=\"100.0000\" name=\"GFN_Assurance\" json=\"GFN_Assurance\"/></td></tr>";
			return trString;
		}
		$.each(setGolf.g.ts,function(){
			var _t = $(this).find("p:first").find("input");
			setGolf.g.green.push(_t.eq(1).val());//果岭价格
			setGolf.g.time.push(_t.eq(0).val());//每场事件
		})
	},
	findTag:function(n){//获取目标
		return $(setGolf.g.ts[n]).find("table").eq(0);
	},
	getTr:function(t,i){//获取目标tr或tr集合
		if(i){
			return t.find("tr").eq(2+i);
		}else{
			return t.find("tr").eq(2).nextAll("tr");
		}
	},
	addTr:function(i,n){//添加tr
		var tag = setGolf.findTag(i),
			tr = setGolf.getTr(tag),
			fn,ftr,_tmp;
		if(tr.length == n){
			return false;
		}else if(tr.length > n){
			fn = tr.length-(tr.length - n);
			ftr = setGolf.getTr(tag,fn);
			setGolf.destroy(tag);
			ftr.nextAll().remove();
			setGolf.bindInput(tag);
		}else{
			fn = n - tr.length;
			ftr = setGolf.getTr(tag,fn);
			_tmp="";
			for(var i =0;i<fn;i++){
				_tmp+=setGolf.g.tr(i);
			}
			tag.append(_tmp);
			setGolf.bindInput(tag);
		}
		
		if(setGolf.g.total){
			setGolf.liquidate();
		}
	},
	bindInput:function(t){//页面input元素绑定
		if(t){
			t.find("input").bind("change",function(){
				setGolf.liquidate();
			})
		}else{
			setGolf.g.box.find("input").bind("change",function(){
				setGolf.liquidate();
			})
		}
	},
	bindEles:function(){//事件绑定
		$.each(setGolf.g.sler,function(i,n){
			$(this).bind("change",function(){
				setGolf.addTr(i,$(this).val());
			})
		})
		if(setGolf.g.total){
			setGolf.bindInput();
		}
		setGolf.g.sb.bind("click",function(){
			if (setGolf.g.total) {
				setGolf.g.form.submit(function(){
					return setGolf.setJson();
				})
			}else{
				setGolf.g.form.submit(function(){
					return false;
				})
				setGolf.setJson();
				setGolf.g.form.ajaxForm(function() {
					setGolf.destroy();
		            if(setGolf.g.cc){
						setGolf.g.callBack();
					}
		        });
			}
		})
	},
	setJson:function(){//json生成
		var _k,trs,mans = [],gTmp ="";
		setGolf.g.tArr=[];
		setGolf.g.ground=[];
		$.each(setGolf.g.ts,function(i,n){//每场的选择
			var tt = setGolf.findTag(i),sn = i,key = i+1;
			mans = setGolf.getTr(tt);
			setGolf.g.tGr=[];
			
			$.each(mans,function(i,n){//美人
				setGolf.g.round = [];
				var s =$(this).find("input:checked"),tmp = "";
				
				if(s.length > 0){
					$.each(s, function(ii, nn){//每场美人的数据
						tmp = "\"" + $(this).attr("json") + "\":\"" + $(this).val() + "\"";
						setGolf.g.tArr.push(tmp);
						if (ii == s.length - 1) {
							setGolf.g.round.push("{\"OpenBallTime\":\"" + setGolf.g.time[sn] + "\",\"GFN_CourtFee\":\"" + setGolf.g.green[sn] + "\"," + setGolf.g.tArr.toString() + "}");
							setGolf.g.tGr.push(setGolf.g.round.toString());
							setGolf.g.tArr = [];
						}
					})
				}else{
					setGolf.g.round.push("{\"OpenBallTime\":\"" + setGolf.g.time[sn] + "\",\"GFN_CourtFee\":\"" + setGolf.g.green[sn] + "\"}");
					setGolf.g.tGr.push(setGolf.g.round.toString());
					setGolf.g.tArr = [];
				}
			})
			
			gTmp ="{\"Key\":"+ key+",\"Value\":["+setGolf.g.tGr.toString()+"]}";//每场数据生成
			setGolf.g.ground.push(gTmp);
		})
		setGolf.g.jsonPort.val("["+setGolf.g.ground.toString()+"]");
		if (setGolf.g.total) {
			setGolf.destroy();
			//return false;
			return true;
			if(setGolf.g.cc){
				setGolf.g.callBack();
			}
		}
	},
	liquidate:function(){//清算
		var allPrice = 0,
			nowChk = setGolf.g.box.find("input:checked");
		$.each(setGolf.g.green,function(i,n){
			allPrice += parseFloat(n)*setGolf.g.sler.val();
		})
		$.each(nowChk,function(){
			allPrice += parseFloat($(this).val());
		})
		if(setGolf.g.total){
			setGolf.g.total.html("&yen;&nbsp;" + allPrice)
		}
	},
	inntGolf:function(){//初始化
		setGolf.setOp();
		setGolf.bindEles();
		if(setGolf.g.total){
			setGolf.liquidate();
		}
	},
	destroy:function(d){
		if(d){//单场input事件回收
			d.find("input").unbind();
		}else{//全场input事件回收
			setGolf.g.box.find("input").unbind();
			setGolf.g.box.find("select").unbind();
		}
	}
}),
sideScroll = Class($_$,{
	creat:function(balls,cb){
		this.balls = balls;
		sideScroll.roll = this.balls;
		if(cb){
			sideScroll.roll.callBack = cb;
			sideScroll.roll.cbCtrl = 1;
		}
	},
	scrollInnt:function(){
		sideScroll.rollBox.rollTag().css("top",sideScroll.rollBox.bottomS() +"px");
		if(sideScroll.roll.pisition == "left"){
			sideScroll.rollBox.rollTag().removeAttr("style");
			sideScroll.rollBox.rollTag().css({
				left:sideScroll.rollBox.leftP() +"px"
			});
			sideScroll.rollBox.rollTag().show();
		}
		if(sideScroll.roll.pisition == "right"){
			sideScroll.rollBox.rollTag().removeAttr("style");
			sideScroll.rollBox.rollTag().css({
				left:sideScroll.rollBox.rightP() +"px"
			});
			sideScroll.rollBox.rollTag().show();
		}
		if(navigator.userAgent.indexOf("MSIE 6.0")>0){
			$(window).scroll(function(){
				sideScroll.rollItem();
			})
		}
		sideScroll.rollBox.rollTag().click(function(){
			window.scroll(0,0);
		})
		if(sideScroll.roll.cbCtrl){
			sideScroll.roll.callBack();
		}
	},
	rollItem:function(){
		sideScroll.rollBox.rollTag().css("top",sideScroll.rollBox.bottomS() +"px");
	},
	rollBox:{
		rollTag:function(){
			var rT = $("#" + sideScroll.roll.rId);
			return rT;
		},
		rightP:function(){
			var rP;
			if($.support.opacity ==true){
				rP = Math.ceil(sideScroll.roll.mW + ($("body").innerWidth() - sideScroll.roll.mW)/2);
			}else{
				rP = Math.ceil(sideScroll.roll.mW + ($("body").innerWidth() - sideScroll.roll.mW)/2 + 8);
			}
			return rP;
		},
		leftP:function(){
			var lp = Math.ceil(($("body").innerWidth() - sideScroll.roll.mW)/2);
			return lp;
		},
		bottomS:function(){
			var boxT = Math.ceil(document.documentElement.scrollTop + document.documentElement.clientHeight*0.85);
			return boxT;
		},
		whiteSp:function(){
			var wSp = ($("body").innerWidth() - sideScroll.roll.mW)/2;
			return wSp;
		}
	},
	roll:{rId:"",pisition:"",mW:""}
}),
ajaxGetImg = Class($_$,{
	creat:function(imgdata){
		this.imgdata = imgdata;
		ajaxGetImg._img = this.imgdata;
	},
	inntImg:function(){
		var imgNode=$("#"+ajaxGetImg._img.titleNode);
		
		ajaxGetImg.titleChange(imgNode[0],imgNode,"0");
		
		for (var i=0;i<imgNode.length ;i++ )
		{			
			eval("imgNode[i].onclick=function(){clearInterval(ajaxGetImg._img.timer);ajaxGetImg.titleChange(this,imgNode,"+i+");}");
		}
	},
	titleChange:function(node,imgNode,i){
		imgNode.removeClass("act");
		ajaxGetImg.addClassName(node,"act")
		ajaxGetImg.contentChange(imgNode,i);
		
		if(ajaxGetImg._img.autoChange){
			ajaxGetImg._img.temp=Number(i)+1;
			if(ajaxGetImg._img.temp >= imgNode.length){ ajaxGetImg._img.temp=0};
			ajaxGetImg._img.timer =window.setTimeout(ajaxGetImg._titleChange(imgNode[ajaxGetImg._img.temp],imgNode,ajaxGetImg._img.temp),4000);
		}
	},
	_titleChange:function(node,imgNode,i){return function(){ajaxGetImg.titleChange(node,imgNode,i);}},
	contentChange:function(imgNode,i){
		
		if(!$("#"+ajaxGetImg._img.contentId+"_"+i).html()){
		  ajaxGetImg.getImgData(imgNode[i].id,i);
		}
		else{
		  ajaxGetImg.contentClassChange(i);
		}

	},
	contentClassChange:function(i){
		switch(ajaxGetImg._img.type){
					case 'img': 
					
						$("#"+ajaxGetImg._img.contentId).children("div[id]").addClass("none");
						$("#"+ajaxGetImg._img.contentId).animate({
						opacity:"hide"
						},1,function(){
								$("#"+ajaxGetImg._img.contentId+"_"+i).removeClass("none");
								$("#"+ajaxGetImg._img.contentId).animate({
								opacity:"show"
							},800,function(){})
						});
						break;
				
					case 'list':
						$("#"+ajaxGetImg._img.contentId).children("div[id]").addClass("none");
						$("#"+ajaxGetImg._img.contentId+"_"+i).removeClass("none");
						break;
					default: return false;
				}
		
			
	},
	getImgData:function(id,i){
		$.ajax({
			type:"GET",
			url:ajaxGetImg._img.ajaxUrl+id,
			dataType: "json",
	        data: '',
			cache:false,
			error:function(){
				return;
			},
			success:function(html){
				var imgHtml="";
				
				switch(ajaxGetImg._img.type){
					case 'img': imgHtml+='<a href="'+html.pic[0].link+'" target="_blank"><img src="/images/blank.gif" lang="'+html.pic[0].url+'" alt="'+html.pic[0].title+'"></a><p><a href="'+html.pic[0].link+'" target="_blank">'+html.pic[0].title+'</a></p>';break;
				
					case 'list':
						for (var z=0;z<html.pic.length;z++){
							imgHtml+='<div class="'+ajaxGetImg._img.contentClassName+'"><a href="'+html.pic[z].link+'" target="_blank"><img src="images/blank.gif" lang="'+html.pic[z].url+'" alt="'+html.pic[z].title+'"></a><p><a href="'+html.pic[z].link+'" target="_blank">'+html.pic[z].title+'</a></p></div>'
						}
						break;
					default: return false;
				}
				$("#"+ajaxGetImg._img.contentId).prepend('<div id="'+ajaxGetImg._img.contentId+'_'+i+'">'+imgHtml+'</div>'); 
				autoLoadImg();
				ajaxGetImg.contentClassChange(i);
			}
		})
	},
	addClassName:function(element, className){
		if (!element){ return;}
		var elementClassName = element.className;
		if (elementClassName.length == 0)
		{
			element.className = className;
			return;
		}
		else 
		{	
			element.className = elementClassName + " " + className;
			return;
		}
	},
	_img:{titleNode:"",contentId:"",type:"",autoChange:"",contentClassName:"",timer:"",temp:"",ajaxUrl:""}
}),
topImgChange = Class($_$,{
	creat:function(imgdata){
		this.imgdata = imgdata;
		topImgChange._img = this.imgdata;
	},
	inntImg:function(){
		var imgNode=$("#"+topImgChange._img.imgNode);
		var titleNode=$("#"+topImgChange._img.titleNode);
		topImgChange._img.temp=-1;
		_$('num').innerHTML=imgNode.length;
		_$(topImgChange._img.leftAr).onclick= function(){clearInterval(topImgChange._img.timer);topImgChange.imgContentChange(imgNode,titleNode,'-');};
		_$(topImgChange._img.rightAr).onclick= function(){clearInterval(topImgChange._img.timer);topImgChange.imgContentChange(imgNode,titleNode);};
		topImgChange.imgContentChange(imgNode,titleNode);
		
	},	
	imgContentChange:function(imgNode,titleNode,add){
		
		if(add=="-"){topImgChange._img.temp=topImgChange._img.temp-1;}
		else{topImgChange._img.temp=topImgChange._img.temp+1;}
		if(topImgChange._img.temp>= imgNode.length){ topImgChange._img.temp=0};
		if(topImgChange._img.temp<0){ topImgChange._img.temp=imgNode.length-1};
		titleNode.addClass('none');
		imgNode.addClass('none');
		_$('temp').innerHTML=topImgChange._img.temp+1;
		$("#"+topImgChange._img.imgNode).parent().animate({
			opacity:"hide"
		},1,function(){
			imgNode[topImgChange._img.temp].className="";
			titleNode[topImgChange._img.temp].className="";
			$("#"+topImgChange._img.imgNode).parent().animate({
				opacity:"show"
			},800,function(){})
		});
		
		topImgChange._img.timer =window.setTimeout(topImgChange._imgContentChange(imgNode,titleNode),5000);
		
	},
	_imgContentChange:function(imgNode,titleNode){return function(){topImgChange.imgContentChange(imgNode,titleNode);}},
	_img:{imgNode:"",titleNode:"",leftAr:"",rightAr:"",temp:"",timer:""}
}),
imgScroll = Class($_$,{
	creat:function(imgdata){
		this.imgdata = imgdata;
		imgScroll._img = this.imgdata;
	},			  
	inntImg:function(){
		var imgSrc=$(imgScroll._img.imgScrollId),
			scrollNode=$(imgScroll._img.scrollNode),
			upNode=$(imgScroll._img.up),
			downNode=$(imgScroll._img.down);
			
		imgScroll._img.nodeHeight=scrollNode.outerHeight(true);
		
		for(var i=0;i<scrollNode.length;i++){
			if(scrollNode[i].className==imgScroll._img.node){
				imgScroll._img.nodeNow=i;
				break;
			}
		}
		if(scrollNode.length<3){}
		else{
		switch(imgScroll._img.nodeNow){
								case 0: imgSrc.css("top","0px");
										downNode.removeClass('downOff');			
										downNode.addClass('down');	
										downNode.click( function () {location.href = scrollNode[imgScroll._img.nodeNow+1].firstChild.href;});
										break;
								
								case scrollNode.length-1: imgSrc.css("top","-"+imgScroll._img.nodeHeight*(imgScroll._img.nodeNow-2)+"px");
														  upNode.removeClass('upOff');			
														  upNode.addClass('up');	
													      upNode.click( function () {location.href = scrollNode[imgScroll._img.nodeNow-1].firstChild.href;});
									 					  break;
								
								default:imgSrc.css("top","-"+imgScroll._img.nodeHeight*(imgScroll._img.nodeNow-1)+"px"); 
										upNode.removeClass('upOff');			
										upNode.addClass('up');	
										upNode.click( function () {location.href = scrollNode[imgScroll._img.nodeNow-1].firstChild.href;});
										downNode.removeClass('downOff');			
										downNode.addClass('down');	
										downNode.click( function () {location.href = scrollNode[imgScroll._img.nodeNow+1].firstChild.href;});
										break;
							}
		}
	},	
	_img:{imgScrollId:"",scrollNode:"",node:"",nodeHeight:"",nodeNow:"",up:"",down:""}
}),
reply = Class($_$,{
	creat:function(data){
		this.data = data;
		reply._rep = this.data;
	},			  
	inntreply:function(){
		//alert(reply._rep.replyId);
		showPop('hDetail',600,'black','aa');
		_$(reply._rep.replyId).onclick=function (){

			if(_$(reply._rep.replyText).value==''){alert('请填写回复内容');return;}
			
			reply.replyAjax();
		}
	},	
	replyAjax:function(){
	
	   $.ajax({
		   type: "POST",
		   url: url,
		   data: _$(reply._rep.replyText).value,
		   error: function(){
			alet('ajaxerr');return false;
		   },
		   success: function(json){
			 if(json==0){return;}

			 var htm='<div class="replyBoxUp"><div class="replyBoxDown"><table><tbody><tr><td  class="w80"><a href="" title="">'+ _$(reply._rep.replyName).innerHTML+'</a></td><td>'+ _$(reply._rep.replyText).value+'</td></tr></tbody></table></div></div>'
			  $("#"+reply._rep.id).append(htm);
			  popDiv.hideBox('hDetail');
			  _$(reply._rep.replyText).value='';

		   }
	   });
	},
	_rep:{id:"",replyId:"",replyText:"",replyName:"",url:""}
}),
Login = Class($_$,{
	creat:function(L,callB){
		this.L = L;
		Login.logOp = this.L;
		Login.logOp.logType = -1;//登陆框类型标示，初始化为-1；
		if(callB){
			Login.logOp.callBack = callB;
			Login.logOp.cbCtrl = 1;
		}
	},
	getState:function(){
		if(Login.logOp.but != undefined && Login.logOp.but.className == "bookItFail"){
			return false;
		}
		
		if($(Login.logOp.but).parent().attr("id") == Login.logOp.tid){
			Login.logOp.logType = 0;//2009.11.05 改为只有弹出层方式登陆。
			//Login.logOp.logType = 1;//页头的登录框
		}else{
			Login.logOp.logType = 0;//弹出式登陆框
		}
		
		$(function(){
			if(Login.logOp.popCon){
				if(Login.logOp.popCon == 0){
					Login.getCon(Login.logSet.logUrl);//获取登录框
				}
				if(Login.logOp.popCon == 1){
					Login.getCon(Login.logSet.regUrl);//获取注册框
				}
			}else{
				Login.getCon(Login.logSet.logUrl);//获取内容，默认为登录框
			}
		})
	},
	getCon:function(_url){//获取内容方法
		$.ajax({
			type:"GET",
			url:_url,
			//data:dat,
			cache:false,
			error:function(){
				Login.logOp.con.html(O_o.FailMsgB);
			},
			success:function(html){
				
				//确保同时只有一个弹出层
				if(_$("popLogBox")){
					$("#popLogBox").remove();
				}
				if(!_$("popLogBox")){
					Login.logSet.logBox();
				}
				
				Login.logSet.setBox();//弹出层基本属性设定
				//Login.logOp.con.html(html);//插
				Login.logOp.con.append(html);
				
				if(_$("regBut")){
					Login.logOp.con.removeAttr("class");
					Login.logOp.con.addClass("newRegBox");
				}
				Login.logOp.loadBox = $("#isLoadding");
				var logInsite;
				if(Login.logOp.logType == 0){
					
					if(!_$("tMark")){
						popDiv.creatMark("#000",Login.logOp.dW,Login.logOp.dH,0.6);//遮罩创建
					}
					
					if($("#logInB").html() != null){
						$("#logInB").remove();
						Login.logOp.box.css({//登陆框显示设定
							margin:"-" + Login.logOp.box.outerHeight()/2 + "px 0 0 -"+ Login.logOp.box.outerWidth()/2 +"px",
							top:document.documentElement.scrollTop + document.documentElement.clientHeight/2 + "px",
							display:"block"
						});
						Login.logOp.remember = Login.logOp.box.find("input:checkbox");
						$("#popUserName").focus();
						$("#popUserName").css("border","1px solid #f90");
						
					}else{
						Login.logOp.box.find("p:first").attr("class","regTitle")
						Login.logOp.box.css({//注册显示设定
							margin:"-" + Login.logOp.box.outerHeight()/2 + "px 0 0 -"+ Login.logOp.box.outerWidth()/2 +"px",
							top:document.documentElement.scrollTop + document.documentElement.clientHeight/2 + "px",
							display:"block"
						});
						$("#user").focus();
						$("#user").css("border","1px solid #f90");
					}
				}
				if(Login.logOp.logType == 1){
					
					//内容设置
					Login.logOp.con.append($("#logInB").html())
					$("#logInA").remove();
					$("#logInB").remove();

					//登陆框显示
					var ev = Login.logOp.but,
						bH = $(ev).height(),
						bT = $(ev).offset().top,
						bL = $(ev).offset().left;
					popTypeArrow.setContent("popLogBox",Login.logOp.box,null,"nal",null,null,250,bH,bT,bL);
				}
				
				if(_$("logBut")){
					Login.bindLogBut();//登录界面各元素事件绑定
					$("#logBut").unload(function(){
						$("#regBut").find("*").unbind();
					})
				}
				
				if(_$("regBut")){
					Login.bindRegBut();
					$("#regBut").unload(function(){
						$("#regBut").find("*").unbind();
					})
					
				}
			}
		})
	},
	chkLogin:function(){//登录验证
		var isRemember;
		
		 isRemember = Login.logOp.remember.attr("checked") == true?1:0;
		
		Login.logOp.dat = "username="+ $("#popUserName").val() +"&password="+Login.logSet.md5 + "&remember="+isRemember;
		$.ajax({
			type:"GET",
			url:Login.logSet.chkUrl,
			data:Login.logOp.dat,
			cache:false,
			dataType:"json",
			error:function(){
				//Login.logOp.con.html(O_o.FailMsgB);
			},
			success:function(Re){
				if(Re.name != 0 && Re.name != undefined){//成功
				    $("#" + Login.logOp.tid).html(Re.name);
				    if (Login.logOp.lid) {
				        $("#" + Login.logOp.lid).html(Re.name);
					}
					
					if(Login.logOp.cbCtrl == 1){
						Login.logOp.loadBox.show();
						var st = function(){
							try {
								var ott;
								Login.logOp.callBack();
								ott = setTimeout(function(){
									clearTimeout(ott);
									Login.hideLogBox();
									Login.logOp.box.remove();
									return true;
								},1000);
								return false;
							}catch(e){
								return true;
							}
						}
						Login.logOp.isOk =  st();
					}else{
						Login.hideLogBox();
						Login.logOp.box.remove();
						Login.logOp.isOk = true;
					}
				}
				if (Re.name == undefined || Re.name == 0) {//失败
				    
					if(Login.logOp.logType == 0){
						if(Login.logOp.con.find("li").eq(0).find("span").length < 1){
							Login.logOp.con.find("li").eq(0).append(Login.logSet.someWrong);
						}
					}
					
					if(Login.logOp.logType == 1){
					    if (Login.logOp.box.find("i").length > 0) {
							//Login.logOp.box.find("i").html(Login.logSet.someWrongB);
							return false;
						}else{
							//Login.logOp.box.find("p:first").append(Login.logSet.someWrongB);
							return false;
						}
					}
				}
			}
		})
	},
	chkReg:function(){//注册验证
		Login.logOp.dat = "username="+ $("#user").val() +"&password="+ Login.logSet.md5;
		var regDat = Login.logOp.dat + "&email=" +$("#eMail").val();
		$.ajax({
			type:"GET",
			url:Login.logSet.chkRegUrl,
			data:regDat,
			cache:false,
			dataType:"json",
			error:function(){
				//Login.logOp.con.html(O_o.FailMsgB);
			},
			success:function(Re){
				if(Re != 0){//成功
					$("#" + Login.logOp.tid).html(Re.name);
					if(Login.logOp.lid != undefined){$("#" + Login.logOp.lid).html(Re.name);}
					Login.hideLogBox();
					Login.logOp.box.remove();
					
					if(Login.logOp.cbCtrl == 1){
						Login.logOp.loadBox.show();
						var st = function(){
							try {
								var ott;
								Login.logOp.callBack();
								ott = setTimeout(function(){
									clearTimeout(ott);
									Login.hideLogBox();
									Login.logOp.box.remove();
									return true;
								},1000);
								return false;
							}catch(e){
								return true;
							}
						}
						Login.logOp.isOk =  st();
					}else{
						Login.hideLogBox();
						Login.logOp.box.remove();
						Login.logOp.isOk = true;
					}
				}
				if(Re == 0){//失败
					alert(O_o.postFail);
					Login.hideLogBox();
					Login.logOp.box.remove();
				}
			}
		})
	},
	hideLogBox:function(){//关闭事件
		Login.logOp.box.hide();
		try{
			Login.logOp.box.find("*").unbind();
		}finally{
			if(_$("tMark")){$("#tMark").remove();}
			if(_$("shadow")){$("#shadow").remove();}
		}
	},
	bindLogBut:function(){//登录元素事件
		$("#logBut").click(function(){
			Login.getMD("popPassWord","Login.chkLogin()");
		})
		
		$("#popPassWord").keyup(function(event){
			Login.autoSumit(event);
		})
		
		Login.logOp.box.find("li input").focus(function(){
			$(this).css("border","1px solid #f90");
		})
		
		Login.logOp.box.find("li input").blur(function(){
			$(this).removeAttr("style");
		})
		
		$("#regNow").click(function(){
			Login.getCon(Login.logSet.regUrl);
		})
	},
	autoSumit:function(e){
		var key = window.event ? e.keyCode : e.which;
        if (key == 13) {
			Login.getMD("popPassWord","Login.chkLogin()");
        }
	},
	getMD:function(id,fn){
		$.get(Login.logSet.mdUrl,"password="+$("#" + id).val(),function(data){
			Login.logSet.md5 = data;
			eval(fn);
		});
	},
	bindRegBut:function(){//注册元素事件
		var users = $("#user"),
			uCheck = $("#userCheck"),
			pws = $("#password"),
			pwsD = $("#passwordo"),
			pCheck = $("#passwordCheck"),
			eMail = $("#eMail"),
			eCheck = $("#eMailCheck"),
			regNut = $("#regBut")
		
		Login.logOp.box.find("li input").focus(function(){
			$(this).css("border","1px solid #f90");
		})
		
		Login.logOp.box.find("li input").blur(function(){
			$(this).removeAttr("style");
		})
		
		users.blur(function(){
			var userName = trim(users.val());
			
		    if (userName.length < 2 || userName.length > 20) {
				uCheck.html("<b class='cff2200'>"+O_o.nameLenFail+"</b>");
		        return false;
		    }
			

			
		    $.ajax({
		        type: "GET",
		        url: "../ajax/RegisterCheckUserName.asp?username=" + encodeURI(userName),
		        error: function(){
		            return false;
		        },
				async:false,
		        success: function(sn){
		            if (sn == 0) {
						uCheck.html("<b class=\"cff2200\">"+O_o.nameExists+"</b>");
						Login.logSet.unExists = 1;
						users.focus();
		                return false;
		            }else if (sn == 1) {
						Login.logSet.unExists = 0;
		               uCheck.html("");
		            }
		        }
		    })
		})
		
		pws.blur(function(){
			return false;//2009.12.15取消密码强度验证
			if(pws.val() == ""){
				pCheck.html("<b class=\"cff2200\">"+O_o.noUserPws+"</b>");
				return false;
			}
			if (trim(pws.val()).length < 6 || trim(pws.val()).length > 18) {
		        _$('passwordTest').innerHTML = "<b class='cff2200'>"+O_o.pwsLenFail+"</b>";
		        return false;
		    }
		    /*
			else if (!chkpwd('password')) {
		        return false;
		    }
			*/
		    $("#passwordTest").html("");
		    return true;
		})
		
		pwsD.blur(function(){
			if(trim(pwsD.val())!= trim(pws.val())){
				pCheck.html("<b class=\"cff2200\">"+O_o.pwsNoMath+"</b>");
				return false;
			}
			pCheck.html("");
			return true;
		})
		
		eMail.blur(function(){
		    var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		    if (!myreg.test($(this).val())) {
				eCheck.html("<b class='cff2200'>"+O_o.emailFail+"</b>");
		        return false;
		    }
		    eCheck.html("")
		})
		
		$("#regBut").click(function(){
			
			if(Login.logSet.unExists == 1){
				return false;
			}

			var userName = trim(users.val());
			
		    if (userName.length < 2 || userName.length > 20) {
				uCheck.html("<b class='cff2200'>"+O_o.nameLenFail+"</b>");
		        return false;
		    }
			

			
			if(trim(users.val()) == ""){
				alert(O_o.noUserName);
				return false;
			}
			if(trim(pws.val()) == ""){
				alert(O_o.noUserPws);
				return false;
			}
			
			if(pws.val() == ""){
				pCheck.html("<b class=\"cff2200\">"+O_o.noUserPws+"</b>");
				return false;
			}
			if (trim(pws.val()).length < 6 || trim(pws.val()).length > 18) {
		        _$('passwordTest').innerHTML = "<b class='cff2200'>"+O_o.pwsLenFail+"</b>";
		        return false;
		    }
		    /*
			else if (!chkpwd('password')) {
		        return false;
		    }
			*/
			
			if(trim(pwsD.val()) == ""){
				//alert(O_o.noPwsMath);
				return false;
			}
			
			if(trim(pwsD.val())!= trim(pws.val())){
				pCheck.html("<b class=\"cff2200\">"+O_o.pwsNoMath+"</b>");
				return false;
			}
			
			if(trim(eMail.val()) == ""){
				//alert(O_o.noEmail);
				return false;
			}
			
			var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
		    if (!myreg.test(eMail.val())) {
				eCheck.html("<b class='cff2200'>"+O_o.emailFail+"</b>");
		        return false;
		    }
			if($("#checkbox").attr("checked") ==false){
				alert(O_o.chkCitsInfo);
				return false;
			}
			Login.getMD("password","Login.chkReg()");
		})
		
		$("#loginNow").click(function(){
			Login.getCon(Login.logSet.logUrl);
		})
	},
	logSet:{
		chkLog:function(){//登录验证，未登录为true，已登录为false；
			if($("#" + Login.logOp.tid).html().indexOf("loger") != -1){
				return true;
			}
			return false;
		},
		logBox:function(){//弹出层结构
			var box;
			
			if(Login.logOp.logType == 0){
				box = "<div id=\"popLogBox\" class=\"newLoginBox\"><span class=\"newCloseLoging\" id=\"closeLogBox\" title=\"close\"></span></div>";
			}
			if(Login.logOp.logType == 1){
				box = "<div class=\"logBox\" id=\"popLogBox\"><p>"+ O_o.loginTitle +"</p><span id=\"closeLogBox\" title=\"close\"></span><div id=\"LogTagBox\"></div><b></b></div>"
			}
			$("body").append(box);
		},
		setBox:function(){//基本属性设置
			Login.logOp.box = $("#popLogBox");
			//Login.logOp.con = $("#LogTagBox");
			Login.logOp.con = $("#popLogBox");
			Login.logOp.dW = document.body.scrollWidth;
			Login.logOp.dH = $(document).height();
			$("#closeLogBox").click(function(){
				Login.hideLogBox();
			});
		},
		logUrl:"/member/login/logInsite.asp",
		regUrl:"/member/login/regInsite.asp",
		chkUrl:"/Ajax/Login.asp",
		chkRegUrl: "/Ajax/register.asp",
		mdUrl:"/Ajax/secret.asp",
		someWrong:"<span class=\"cff2200\">"+ O_o.FailMsgD +"</span>",
		someWrongB:"<i class=\"ml10 cff2200\">"+ O_o.FailMsgD +"</i>"
	},
	logOp:{tid:"",but:"",lid:"",con:"",box:""}
}),
sendBoom = Class(Login, {//Login派生类，用以传递ooxx;
    creat: function(_u, c) {
        this._u = _u;
        sendBoom.bob = this._u;
        if (c) {
            sendBoom.bob.cc = 1;
            sendBoom.bob.cb = c;
        }
    },
    sendIt: function() {
		var c = 0;
		$(document).ajaxComplete(function(){
			c+=1;
		})
        $.each(sendBoom.bob.url, function(i, n) {
			
			//$.get(n,Login.logOp.dat);
			$.getJSON(n + "?" + Login.logOp.dat+"&jsoncallback=?",function(r){
				try{
					return true
				}catch(e){
					return true
				}
			})
            if (i == sendBoom.bob.url.length - 1) {
                if (Login.logOp.but && $(Login.logOp.but).attr("href") != undefined) {
                    if ($(Login.logOp.but).attr("href").indexOf("javascript") == -1) {
						var ott;
						ott = setTimeout(function(){
							clearTimeout(ott);
							window.location.href = $(Login.logOp.but).attr("href");
							return true;
						},1000);
                        
                    }
                }
				if (sendBoom.bob.cc) {
		            sendBoom.bob.cb();
		        }
            }
        });
        //alert(Login.logOp.but.href)
    },
    bob: { url: [] }
}),
//vid:'roomID',evn:this,vals:239,sDay: '2009-11-07' ,eDay:'2009-11-14' ,aUrl:'../Ajax/Hotel/hotelCalendar.aspx',bUrl:'asd'
calenders = Class($_$,{
	creat:function(ca){
		this.ca = ca;
		calenders.calOp = this.ca;
		calenders.calOp.boxBody = "<div class=\""+ O_o.calenderSet.mainClas +"\"><p class=\""+ O_o.calenderSet.barClass +"\">"+O_o.checkIn+"<input type=\"text\" onclick=\""+ O_o.calenderSet.checkInFn +"\" class=\""+ O_o.calenderSet.dateInput +"\" id=\"checkInCal\"/>"+ O_o.checkOut +"<input type=\"text\" onfocus=\""+ O_o.calenderSet.checkOutFn +"\" class=\""+ O_o.calenderSet.dateInput +"\" id=\"checkOutCal\"/><span><input type=\"button\" value=\""+ O_o.regSearch + "\" class=\""+ O_o.calenderSet.sumitBut +"\" onclick=\"showCalenderAg()\" /></span><input onclick=\"bookHotel()\" class=\"smallBook\" type=\"button\" value=\"\" /></p><div id=\"dateTable\" class=\""+ O_o.calenderSet.calBox +"\"></div></div>";
	},
	inntCal:function(){
		if($("div[pop='pop']") && $("div").attr("id") != "citsPop"){
			$("div[pop='pop']").hide();
		}
		
		//calenders.calOp.d = $(document).width();
		//calenders.calOp.p = Math.ceil((calenders.calOp.d-960)/2);
		
		if(calenders.calOp.vid != "" || calenders.calOp.vid != undefined){
			shower({
				oid:null,
				evn:calenders.calOp.evn,
				set:{type:'ajax|GET',showType:'arrow',cls:['newPopBox','newArrow','newClosePop'],bStyle:'width:550px;'},
				bPath:calenders.calOp.aUrl + "?HGRP_GuestRoomID=" + calenders.calOp.vals + "&s_date=" + calenders.calOp.sDay + "&e_date=" + calenders.calOp.eDay
			},function(){
				calenders.calOp.tBox = $("#citsPop");
				calenders.calOp.tBox.append(calenders.calOp.boxBody);
				$("#checkInCal").val(calenders.calOp.sDay);
				$("#checkOutCal").val(calenders.calOp.eDay);
				calenders.opSet.vT();
				$("#dateTable").append(calenders.calOp.tBox.find("table").eq(0));
				calenders.tdEven();
			})
		}
	},
	opSet:{
		vT:function(){
			$("#" + calenders.calOp.vid).val(calenders.calOp.vals);
		},
		_T:function(){
			return $("#calender");
		},
		_TC:function(){
			return $("#dateTable");
		}
	},
	tdEven:function(ele){
		var eles;
		if(ele){
			eles = ele;
		}else{
			eles = $("#dateTable td");
		}
		
		eles.hover(
			function(){
				var bs = $(this).find("b"),mt = _$("citsPop") == null?"dateTable":"citsPop",tt,tl;
				if(bs.length > 0){
					
					if($("#"+mt).css("position") == "static"){
						tt = 0;
						tl = 0;
					}else{
						tt = parseInt($("#"+mt).css("top"));
						tl = parseInt($("#"+mt).css("left"));
					}
					
					var bw = $("#"+mt).outerWidth(),
						bsw = bs.outerWidth(),
						l = $(this).offset().top - tt + $(this).height()/2,
						t = $(this).offset().left - tl + $(this).width()/2;
					
					if(bsw+t > bw){
						t = $(this).offset().left - tl + $(this).width() - bsw;
					}
					
					bs.css({
						top:l + "px",
						left:t + "px",
						display:"block"
					})
				}
			},
			function(){
				var bs = $(this).find("b");
				if(bs.length > 0){
					bs.css("display","none");
				}
			}
		)
	}
}),
outterBfEven = Class(calenders,{
	creat:function(){},
	inntEven:function(){
		if("dateTable"){
			calenders.tdEven();
		}
	}
}),
calBookHotel = Class(calenders,{
	creat:function(){},
	getBook:function(){
		var urlStr ="../order/hotel-order-step1.aspx?HGRP_GuestRoomID=" + calenders.calOp.vals + "&s_date=" + $("#checkInCal").val() + "&e_date=" + $("#checkOutCal").val();
		
		if ($("#topLog").html().indexOf("loger") != -1) {

			loger({
				tid:"topLog",but:calenders.calOp.evn
				},function(){
					sendUrl({url:['http://passport2.etcits.com/ajax/Login.aspx','http://www.ethainan.com/cookie.asp','http://bbs.etcits.com/login_in.aspx']});
					window.location.href=urlStr;
				}
			) 
	
	    }else{
			window.location.href=urlStr;
		}
	}
}),
chkAgainDate = Class(calenders,{
	creat:function(ag){
		this.ag = ag;
		chkAgainDate.agOp = this.ag;
	},
	doAgain:function(){
		$.ajax({
			type: "GET",
			url: calenders.calOp.aUrl + "?HGRP_GuestRoomID=" + calenders.calOp.vals + "&s_date=" + $("#checkInCal").val() + "&e_date=" + $("#checkOutCal").val(),
			error: function(){
				alert(O_o.FailMsgE);
			},
			success: function(msg){
			    calenders.opSet._TC().html(msg);
				calenders.tdEven();
			}
		})
	},
	agOp:{}
}),
realTxt = Class($_$,{
	creat:function(t){
		this.t = t;
		realTxt.tOp = this.t;
	},
	setIt:function(){
		var boxs = realTxt.tOp.box,eles = realTxt.tOp.ele;
		realTxt.Eye = {};
		realTxt.Eye.eleArr = [];
		if(typeof(boxs) == "object"){
			realTxt.Eye.idArr = [];
			for(var _a = 0;_a < boxs.length;_a++){
				realTxt.Eye.idArr.push(boxs[_a]+ "ID");
				realTxt.Eye.eleArr.push($("#" + boxs[_a]).find(eles));
			}
		}
		realTxt.eleInnt();
		realTxt.elebind();
	},
	eleInnt:function(){
		$.each(realTxt.tOp.box,function(i,n){
			var tI = $("#" + n + "ID").val();
			$("#" + n + tI).addClass(realTxt.tOp.Cls);
		})
	},
	elebind:function(){
		$.each(realTxt.Eye.eleArr,function(i){
			var _i = i;
			$.each(this,function(){
				$(this).click(function(){
					var tmpId = $(this).attr("id");
					$("#" + realTxt.Eye.idArr[_i]).val($(this).attr("id").match(/\d+/));
					$("#" + realTxt.tOp.page).val(1);
					if(tmpId.indexOf("city") != -1){
						$("#liveID").val(0);
					}
					if($("#hotelName").val()!=""){
						$("#hotelName").val("");
					}
					if(realTxt.tOp.f != undefined){
						$("form").eq(realTxt.tOp.f).submit();
					}else{
						$("form").eq(0).submit();
					}
				});
			})
		})
	}
}),
//sid:"thisSs",pt:"span",sm:"b",cls:"act"
setKeyWord = Class($_$,{//2009.12.03作废
	creat:function(o){
		this.o = o;
		setKeyWord.x = this.o;
	},
	setInt:function(){
		setKeyWord.bindEle()
	},
	bindEle:function(){
		var eles = $("#" + setKeyWord.x.sid + " " +setKeyWord.x.pt),
			sb = $("#" + setKeyWord.x.sid + " " +setKeyWord.x.sm);
		eles.click(function(){
			var keys = $(this).attr("key");
			if (keys == "hotelName"){
				$("#" + keys).val("");
			}else{
				var _tt = $("#" + keys.toLowerCase()).parent();
				$("#" + keys.toLowerCase()).removeAttr("class");
				
				if(realTxt.tOp.ele){
					_tt.find(realTxt.tOp.ele).eq(0).addClass(setKeyWord.x.cls);
				}else{
					_tt.find("a").eq(0).addClass(setKeyWord.x.cls);
				}								
				if(_tt.attr("id") == "city"){
					$("#live").remove();
				}
				$("#" + _tt.attr("id").toLowerCase()+"ID").val(0);
			}
			$(this).remove();
		})
		
		sb.click(function(){
			if(realTxt.tOp.f){
				$("form").eq(realTxt.tOp.f).submit();
			}else{
				$("form").eq(0).submit();
			}
		})
	}
}),
orderBy = Class(realTxt,{
	creat:function(o){
		this.o = o;
		orderBy.oop = this.o;
	},
	inntOrder:function(o){
		if(o && orderBy.oop == undefined){
			this._o = o;
			orderBy.oop = this._o;
		}
		//orderBy.oop.orderTmp = $("#" + orderBy.oop.oid).val().split(",");
		//$("#" + orderBy.oop.orderTmp[0]).attr("class",orderBy.oop.orderTmp[1]);
		orderBy.bindOrderBut();
	},
	bindOrderBut:function(){
		$.each(orderBy.oop.oList.did,function(ii,nn){
			$("#"+nn).click(function(){
				var tCls = $(this).attr("class");
				if(tCls.indexOf("TureDown")!= -1){
					if(tCls.indexOf("TureUp") == -1){
						$(this).attr("class",nn + orderBy.oop.oList.clsT[0]);
						
						$("#" + orderBy.oop.oid).val($(this).attr("id")+","+nn + orderBy.oop.oList.clsT[0]);
						
					}else{
						$(this).attr("class",nn + orderBy.oop.oList.clsT[1]);
						$("#" + orderBy.oop.oid).val($(this).attr("id")+","+nn + orderBy.oop.oList.clsT[1]);
					}
				}else{
					var did = orderBy.oop.oList.did;
					$.each(did,function(iii,nnn){
						$("#" + nnn).attr("class",nnn + orderBy.oop.oList.clsT[2])
					})
					$(this).attr("class",nn + orderBy.oop.oList.clsT[1]);
					$("#" + orderBy.oop.oid).val($(this).attr("id")+","+nn + orderBy.oop.oList.clsT[1]);
				}
				$("#aspxPost").submit();
			})
		})
	}
}),
Autobots = Class($_$, {
    creat: function(ro) {
        this.ro = ro;
        Autobots.carport = this.ro;
        Autobots.part = {};
        Autobots.part.where = "hide";
        Autobots.part.type = "hotel";
        Autobots.part.pp = -1;
        Autobots.part.num = 0;
        Autobots.part.pakage = null;
        Autobots.part.body = "<div style=\"display: none;\" id=\"Autobots\"><ul></ul></div>";
        if (typeof (Autobots.carport.tid) == "object") {
			Autobots.part.Eyes = [];
			Autobots.part.tBox = [];
			$.each(Autobots.carport.tid,function(i,n){
				$("#" + n[0]).attr("robot",i);
				$("#" + n[1]).attr("robot",i);
				Autobots.part.Eyes.push($("#" + n[0]));
				Autobots.part.tBox.push($("#" + n[1]));
			});
        } else {
            Autobots.part.Eyes = $("#" + Autobots.carport.tid);
        }
    },
    GoGo: function() {
		
        if (!_$("Autobots")) {
            $(document).ready(function(){
				$("body").append(Autobots.part.body);
            Autobots.part.Name = $("#Autobots");
            Autobots.part.Name.attr("class", Autobots.carport.Coating[0]);
			})
        };
		
		$.each(Autobots.part.Eyes,function(){
			
			$(this).keyup(function(event) {
				
	            if ($(this).val().length == 0) {
	                Autobots.hideRobot();
	                return false;
	            }
	            Autobots.getWord(encodeURI($(this).val()), event,$(this).attr("robot"));
	            Autobots.keyHandler(event,$(this).attr("robot"));
	        })
			
			$(this).blur(function(){
				Autobots.part.where = "hide";
				Autobots.part.Name.animate({
					opacity: "hide"
				}, "fast")
				$("#shadow").animate({
						opacity: "hide"
					}, "fast", function() {
						$("#shadow").remove();
				})
			})
		})
		
    },
    getWord: function(w, e,n) {
        var _kk = window.event ? e.keyCode : e.which;
        if (_kk == 9 || _kk == 13 || _kk == 38 || _kk == 40) {
            return false;
        }
        $.ajax({
            type: "GET",
            url: Autobots.carport.xPath,
            data: "s=" + w,
            cache: false,
            async: false,
            dataType: "json",
            error: function() {
            },
            success: function(re) {
                Autobots.part.fSn = [];
                if (re.hotel != undefined) {
                    Autobots.part.type = "hotel";
                    Autobots.part.pakage = re.hotel;
                }

                if (re.flight != undefined) {
                    Autobots.part.type = "flight";
                    Autobots.part.pakage = re.flight;
                }

                if (Autobots.part.pakage.length == 0) {
                    Autobots.hideRobot();
                }

                Autobots.part.num = Autobots.part.pakage.length;
                Autobots.part.Name.find("ul:first").find("li").remove();

                var inTag = Autobots.part.Name.find("ul:first"), inBody;

                inTag.html("");
                $.each(Autobots.part.pakage, function(i, n) {
                    if (Autobots.part.type = "flight") {
                        inBody = "<li sn=\"" + i + "\">" + n[1] + "<p>" + n[0] + "</p></li>";
                        Autobots.part.fSn.push(n[2]);
                    } else {
                        inBody = "<li>" + n[1] + "<p>" + n[0] + "</p></li>";
                    }
                    inTag.append(inBody);
                })

                if (Autobots.part.Name.css("display") == "none") {
                    Autobots.part.where = "show";
                    Autobots.part.Name.animate({
                        opacity: "show"
                    }, "fast")

                    var aT,aL;
					
					if(typeof (Autobots.carport.tid) == "object"){
						aT = Math.ceil(Autobots.part.Eyes[n].offset().top + Autobots.part.Eyes[n].outerHeight()),
						aL = Math.ceil(Autobots.part.Eyes[n].offset().left);
					}else{
						aT = Math.ceil(Autobots.part.Eyes.offset().top + Autobots.part.Eyes.outerHeight()),
						aL = Math.ceil(Autobots.part.Eyes.offset().left);
					}
					
                    Autobots.part.Name.css({
                        top: aT + "px",
                        left: aL + "px",
                        "z-index": "99"
                    });
                    popDiv.theShadow("Autobots", aT, aL, 5);
                };
                $("#shadow").height(Autobots.part.Name.outerHeight());
                Autobots.bootRobot(n);
            }
        })
    },
    bootRobot: function(n) {
        var allInner = Autobots.part.Name.find("li");

        allInner.hover(
			function() {
			    $(this).addClass(Autobots.carport.Coating[1]);
			},
			function() {
			    $(this).removeClass(Autobots.carport.Coating[1]);
			}
		)

        allInner.click(function() {
			if (typeof(Autobots.carport.tid) == "object") {
				Autobots.part.Eyes[n].val($(this).find("p").html());
	            if (Autobots.part.type == "flight") {
	                Autobots.part.tBox[n].val(Autobots.part.fSn[$(this).attr("sn")]);
	            }
			}else{
				Autobots.part.Eyes.val($(this).find("p").html());
	            if (Autobots.part.type == "flight") {
	                Autobots.part.tBox.val(Autobots.part.fSn[$(this).attr("sn")]);
	            }
			}
            
            Autobots.hideRobot();
        })

        document.documentElement.onclick = function(e) {
            var ev = e || window.event;
            var eleSrc = ev.srcElement || ev.target;
            if (eleSrc.tagName.toLowerCase() == "body" || eleSrc.tagName.toLowerCase() == "html") {
                Autobots.hideRobot();
            }
        }
    },
    hideRobot: function() {
        Autobots.part.Name.animate({
            opacity: "hide"
        }, "fast")
        $("#shadow").animate({
            opacity: "hide"
        }, "fast", function() {
            $("#shadow").remove();
        })
        Autobots.part.where = "hide";
        Autobots.part.pp = 0;
        Autobots.part.fSn = [];
    },
    keyHandler: function(e,n) {
        var key = window.event ? e.keyCode : e.which;
        if (key != 13 && key != 38 && key != 40) {
            return false;
        }
        if (Autobots.part.where == "show") {
            var lis = Autobots.part.Name.find("li");
            if (key == 13) {//如果是Enter键，则选择当前的项
	            if (typeof(Autobots.carport.tid) == "object") {
					Autobots.part.Eyes[n].val($(lis[Autobots.part.pp]).find("p").html());
	                if (Autobots.part.type == "flight") {
	                    Autobots.part.tBox[n].val(Autobots.part.fSn[$(lis[Autobots.part.pp]).attr("sn")]);
	                }
				}else{
					Autobots.part.Eyes.val($(lis[Autobots.part.pp]).find("p").html());
	                if (Autobots.part.type == "flight") {
	                    Autobots.part.tBox.val(Autobots.part.fSn[$(lis[Autobots.part.pp]).attr("sn")]);
	                }
				}
                
                Autobots.hideRobot();
                return false;

            } else {//如果是向上键和向下键
                if (key == 38) {//向上键
                    --Autobots.part.pp;
                    if (Autobots.part.pp < 0) {
                        Autobots.part.pp = 0;
                    }
                    lis.removeClass(Autobots.carport.Coating[1]);
                    $(lis[Autobots.part.pp]).addClass(Autobots.carport.Coating[1]);

                } else if (key == 40) {//向下键
                    ++Autobots.part.pp;
                    if (Autobots.part.pp > Autobots.part.num - 1) {
                        Autobots.part.pp = Autobots.part.num - 1;
                    }
                    lis.removeClass(Autobots.carport.Coating[1]);
                    $(lis[Autobots.part.pp]).addClass(Autobots.carport.Coating[1]);
                }
            }
        }
    }
}),
seeker = Class($_$,{
	creat:function(ar){
		this.ar = ar;
		seeker.tool = this.ar;
		seeker.packUpBox();
	},
	packUpBox:function(){
		seeker.toolBox = {};
		//seeker.toolBox.num = seeker.tool.aDat[1];
		seeker.toolBox.siteid = ""
		seeker.toolBox.lifeCircle = $("#" + seeker.tool.aLive);
		seeker.toolBox.part = [];
		var sA_ = seeker.tool.aList;
		for(var ii = 0;ii < sA_.length;ii++){
			seeker.toolBox.part.push($("#" + sA_[ii]));
		}
	},
	look:function(){
		var sP = seeker.toolBox.part;
		if(sP[0].find(seeker.tool.aDat[0]).length <= 1){
			seeker.getArea(0,0)
		}
	},
	getArea:function(sn,n){
		var dat = "htmltype="+ seeker.tool.aDat[0] +"&level="+ seeker.tool.aDat[1] +"siteid=" + seeker.toolBox.siteid;
		$.ajax({
			type:"GET",
			url:seeker.tool.aPath,
			data:dat,
			cache:false,
			async:false,
			error: function(){},
			success: function(App){
				
				if(n ==0){
					seeker.toolBox.part[sn].append(App);
					seeker.binkEle(sn);
				}
				
				if(n ==1){
					seeker.toolBox.lifeCircle.append(App);
				}
				
			}
		})
	},
	binkEle:function(sn){
		if(seeker.tool.aDat[0] == "option"){
			seeker.toolBox.part[sn].find("select").change(function(){
				seeker.toolBox.siteid = $(this).val();
				seeker.getArea(seeker.toolBox.siteid,1);
			})
		}
	}
}),
flightCal = Class(ajaxGetData,{
	creat:function(ops,cbs){
		this.ops = ops;
		flightCal.c = this.ops;
		flightCal.c.Var = [];
		flightCal.c.arg = [];
		if(cbs){
			flightCal.c.callBack = cbs;
			flightCal.c.x = 1;
		}
	},
	setArg:function(){
		try {
			if (flightCal.c.dop != undefined) {
				$.each(flightCal.c.dop,function(i,n){
					var tmp = n.split(":");
					flightCal.c.Var.push(tmp[0]);
					flightCal.c.arg.push(tmp[1]);
				})
			}
		}catch(e){}
	},
	fInnt:function(){
		flightCal.setArg();
		flightCal.getDate(0);
	},
	getDate:function(t,rVar,rArg){
		var dat = "",realDat,nowDate;
		
		$.each(flightCal.c.Var,function(i,n){
			dat += n +"="+flightCal.c.arg[i] + "&";
		})
		
		nowDate = "date=" + ajaxGetData.whatDay(t)
		realDat = dat + nowDate;
		
		$.ajax({
			type:"GET",
			url:flightCal.c.url,
			data:realDat,
			cache:false,
			error: function(){},
			success: function(App){
				flightCal.c.box = $("#"+flightCal.c.bid);
				flightCal.c.box.html(App);
				flightCal.bindEle();
			}
		})
	},
	bindEle:function(){
		flightCal.c.next = flightCal.c.box.find("em[title='Next']");
		flightCal.c.back = flightCal.c.box.find("em[title='Back']");
		flightCal.c.next.click(function(){
			flightCal.getDate(1);
		})
		flightCal.c.back.click(function(){
			flightCal.getDate(2);
		})
		
		if(flightCal.c.x){
			flightCal.c.callBack();
		}
	},
	finshAll:function(){
		flightCal.c.box.bind("unload",function(){
			flightCal.c.box.find("*").unbind();
		})
	}
}),
flightCalBack = Class(flightCal,{
	creat:function(ops,cbs){
		this.ops = ops;
		flightCalBack.c = this.ops;
		flightCalBack.c.Var = [];
		flightCalBack.c.arg = [];
		if(cbs){
			flightCalBack.c.callBack = cbs;
			flightCalBack.c.x = 1;
		}
		try {
			if (flightCalBack.c.sop != undefined) {
				$.each(flightCalBack.c.sop,function(i,n){
					var tmp = n.split(":");
					flightCalBack.c.Var.push(tmp[0]);
					flightCalBack.c.arg.push(tmp[1]);
				})
			}
		}catch(e){}
	},
	fbInnt:function(){
		flightCalBack.getDate(0);
	},
	getDate:function(t,rVar,rArg){
		var dat = "",realDat,nowDate;
		
		$.each(flightCalBack.c.Var,function(i,n){
			dat += n +"="+flightCalBack.c.arg[i] + "&";
		})
		
		nowDate = "date=" + ajaxGetData.whatDay(t)
		realDat = dat + nowDate;
		
		$.ajax({
			type:"GET",
			url:flightCalBack.c.url,
			data:realDat,
			cache:false,
			error: function(){},
			success: function(App){
				flightCalBack.c.box = $("#"+flightCalBack.c.bid);
				flightCalBack.c.box.html(App);
				flightCalBack.bindEle();
			}
		})
	},
	bindEle:function(){
		flightCalBack.c.next = flightCalBack.c.box.find("em[title='Next']");
		flightCalBack.c.back = flightCalBack.c.box.find("em[title='Back']");
		flightCalBack.c.next.click(function(){
			flightCalBack.getDate(1);
		})
		flightCalBack.c.back.click(function(){
			flightCalBack.getDate(2);
		})
		
		if(flightCalBack.c.x){
			flightCalBack.c.callBack();
		}
	},
	finshAll:function(){
		flightCalBack.c.box.bind("unload",function(){
			flightCalBack.c.box.find("*").unbind();
		})
	}
	
}),
inAjaxSearch = Class($_$,{
	creat:function(t,c){
		this.t = t;
		inAjaxSearch.cache = {};
		inAjaxSearch.cache = this.t;
		if(c){
			inAjaxSearch.cache.callBack = cbs;
			inAjaxSearch.cache.x = 1;
		}
	},
	inntAjax:function(){
		inAjaxSearch.setOp();
		inAjaxSearch.bindMenu();
		if(inAjaxSearch.cache.con.find("li").length == 0){
			inAjaxSearch.loadCon(0)
		}
	},
	setOp:function(){
		inAjaxSearch.cache.eType = inAjaxSearch.cache.even== undefined?"click":inAjaxSearch.cache.even;
		inAjaxSearch.cache.menu = $("#" + inAjaxSearch.cache.aid);
		inAjaxSearch.cache.con = $("#" + inAjaxSearch.cache.tid);
		inAjaxSearch.cache.uNum = inAjaxSearch.cache.url.length;
		inAjaxSearch.cache.mmNum = inAjaxSearch.cache.url.length -1;
		//inntAjax.cache.uList
	},
	bindMenu:function(){
		var mop = inAjaxSearch.cache.menu.find(inAjaxSearch.cache.mt);
		$.each(mop,function(i,n){
			$(this).bind(inAjaxSearch.cache.eType,function(){
				if($(this).attr("class") == inAjaxSearch.cache.cls){
					return false
				}else{
					mop.removeAttr("class");
					$(this).attr("class",inAjaxSearch.cache.cls);
					inAjaxSearch.loadCon(i);
				}
			})
		})
	},
	loadCon:function(n){
		if(n > inAjaxSearch.cache.mmNum){
			return false;
		}
		$.ajax({
			type:"GET",
			url:inAjaxSearch.cache.url[n],
			//data:realDat,
			cache:false,
			error: function(){},
			success: function(App){
				inAjaxSearch.cache.con.html(App);
				if(inAjaxSearch.cache.x){
					inAjaxSearch.cache.callBack();
				}
			}
		})
	}
}),
VSS = Class($_$,{
	creat: function(o){
		this.o = o;
		VSS.s = this.o;
	},
	setOp:function(){
		VSS.s.box = $("#" + VSS.s.tid);
		VSS.s.finger = $("#" + VSS.s.selecter);
		if(VSS.s.now == undefined) {
			VSS.s.now = VSS.s.def;
		}
		VSS.s.area = $("#" + VSS.s.bid);
	},
	displaySearch:function(i){
		var realNum = i-1;
		//VSS.s.tag.css("display","none");
		//$(VSS.s.tag[realNum]).removeAttr("style");
		//VSS.s.box.attr("action",VSS.s.vUrl[realNum]);
		VSS.s.finger.unbind();
		VSS.s.now = realNum;
		VSS.getSearch();
	},
	getSearch:function(o){
		$.ajax({
			type:"GET",
			url:VSS.s.sUrl[VSS.s.now],
			//cache:true,
			success: function(Re){
				VSS.s.area.html(Re);
				//VSS.s.tag = $("#" + VSS.s.tid + " " + VSS.s.ele);
				//VSS.s.area.append($(VSS.s.tag[VSS.s.now]));
				//VSS.s.area.find(VSS.s.ele + ":last").prevAll().remove();
				VSS.s.area.find(VSS.s.ele).removeAttr("style");
				_$(VSS.s.selecter).selectedIndex = VSS.s.now;
				VSS.s.box.attr("action",VSS.s.vUrl[VSS.s.now]);
				
				VSS.s.finger.change(function(){
					VSS.displaySearch($(this).val());
				})
			}
		})
	},
	innt:function(){
		VSS.setOp();
		if(VSS.s.area.html() == ""){
			VSS.getSearch();
		}
	}
}),
flyOrder = Class($_$, {
    creat: function(o, cb) {
        this.o = o;
        flyOrder.o = this.o;
    },
    setO: function() {
        flyOrder.o.t = $("#" + flyOrder.o.fid[0]);
        flyOrder.o.table = flyOrder.o.t.find("table");
        flyOrder.o.tr = "<tr>" + flyOrder.o.table.find("tr:first").html() + "</tr>";
        flyOrder.o.addBut = $("#" + flyOrder.o.fid[2]);
        flyOrder.o.price = $("#" + flyOrder.o.fid[1]);
        flyOrder.o.oas = $("#" + flyOrder.o.fid[3]).find("input");
        flyOrder.o.sBox = $("#" + flyOrder.o.fid[4]);
        flyOrder.o.rad = $("#" + flyOrder.o.fid[4] + " input:radio");
        flyOrder.o.str = "";
        flyOrder.o.mStr = ["乘机人", "①", "②", "③", "④", "⑤", "⑥", "⑦", "⑧", "⑨", "⑩"];
        flyOrder.o.opList = ["CusName", "CusCardNo", "CusType", "CusCardType", "CustSafe"];
        flyOrder.o.hidden = []; //隐藏域对象缓存数组
        $.each(flyOrder.o.oas, function(i, n) {
            flyOrder.o.str += $(this).attr("name") + ":\"" + parseFloat($(this).val()) + "\",";
            flyOrder.o.hidden.push($(this));
            if (i == flyOrder.o.oas.length - 1) {
                var realStr, tmp, to;
                eval("flyOrder.o.flyPPrice = {" + flyOrder.o.str.substr(0, flyOrder.o.str.length - 1) + "}");
            }
        })
        flyOrder.getSafes();
        //flyOrder.o.flyPPrice.sNum = 0;
        //FO.o
    },
    bindDB: function() {
        flyOrder.o.db = flyOrder.o.table.find("th input");
        if (flyOrder.o.db.eq(0).attr("man") != undefined) {
            var mtp = 1;
        }
        $.each(flyOrder.o.db, function(i, n) {

            if (mtp) {
                if ($(this).attr("man") == undefined) {
                    var nM = parseInt(flyOrder.o.table.find("tr:last").prev().find("th input").eq(0).attr("man")) + 1;
                    $(this).attr("man", nM);
                }
            } else {
                $(this).attr("man", i + 1);
            }

            $(this).bind("click", function() {
                var dNum = flyOrder.o.table.find("th input").length;
                if (dNum == 1) {
                    alerter({ msg: "至少要有一个乘机人。", set: { css: "padding:10px;width:250px;text-align:center;"} });
                    return false;
                }
                if (flyOrder.o.db.length == 1) { return false }
                flyOrder.removeMans(i);
            })
        })
    },
    TDEle: function(t) {
        var tn = $(t).find("option").length,
			vals = parseInt($(t).val()),
			type;
        type = tn == 3 ? "man" : "safe";

        switch (type) {
            case "man":
                var a = [], b = [], c = [],
					fs = flyOrder.o.table.find("td select").filter(function(i) {
					    return $("option", this).length == 3;
					});
                $.each(fs, function(i, n) {
                    if (i == fs.length) { return false; }
                    if ($(this).val() == "1") {
                        a.push("Adu");
                    }
                    if ($(this).val() == "2") {
                        b.push("Chi");
                    }
                    if ($(this).val() == "3") {
                        c.push("Inf");
                    }

                })
                flyOrder.o.flyPPrice.AduNum = a.length;
                flyOrder.o.flyPPrice.ChiNum = b.length;
                flyOrder.o.flyPPrice.InfNum = c.length;
                $(flyOrder.o.hidden[7]).val(flyOrder.o.flyPPrice.AduNum);
                $(flyOrder.o.hidden[8]).val(flyOrder.o.flyPPrice.ChiNum);
                $(flyOrder.o.hidden[9]).val(flyOrder.o.flyPPrice.InfNum);
                break;

            case "safe":
                flyOrder.getSafes();
                break;
        }
        flyOrder.getPrices();
    },
    getSafes: function() {
        var safes = flyOrder.o.table.find("td select").filter(function(i) {
            return $("option", this).length == 11;
        });
        flyOrder.o.flyPPrice.sNum = 0;
        $.each(safes, function() {
            flyOrder.o.flyPPrice.sNum += parseInt($(this).val());
        })
    },
    setArr: function() {
        var aMan = flyOrder.o.table.find("th input");
        flyOrder.o.manList = [];
        $.each(aMan, function() {
            flyOrder.o.manList.push($(this).attr("man"))
        })
        $(flyOrder.o.hidden[10]).val(flyOrder.o.manList);
    },
    addMans: function() {
        flyOrder.o.table.append(flyOrder.o.tr);
        flyOrder.bindDB();

        var ltr = flyOrder.o.table.find("tr:last"),
			tt = ltr.find("input:first").attr("man"),
			theInput = ltr.find("td input"),
			theSele = ltr.find("td select"),
			num = parseInt(ltr.find("input:first").attr("man"));

        ltr.find("th p:first").html(flyOrder.o.mStr[0] + flyOrder.o.mStr[num]);
        theInput.eq(0).attr("name", flyOrder.o.opList[0] + num);
        theInput.eq(1).attr("name", flyOrder.o.opList[1] + num);
        theSele.eq(0).attr("name", flyOrder.o.opList[2] + num);
        theSele.eq(1).attr("name", flyOrder.o.opList[3] + num);
        theSele.eq(2).attr("name", flyOrder.o.opList[4] + num);
        flyOrder.o.flyPPrice.AduNum = parseInt(flyOrder.o.flyPPrice.AduNum) + 1;
        $(flyOrder.o.hidden[7]).val(flyOrder.o.flyPPrice.AduNum);
        theSele.eq(0).bind("change", function() {
            flyOrder.TDEle(this);
        })
        theSele.eq(2).bind("change", function() {
            flyOrder.TDEle(this);
        })
        flyOrder.setArr();
        flyOrder.getPrices();
    },
    bindRad: function() {
        $.each(flyOrder.o.rad, function() {
            $(this).bind("click", function() {
                flyOrder.o.sBox.find("div").removeAttr("style");
                if ($(this).parent().find("div").length > 0) {
                    $(this).parent().find("div").css("display", "block");
                }
                flyOrder.getPrices();
            })
        })
    },
    removeMans: function(i) {
        var ltr = flyOrder.o.table.find("tr").eq(i),
			dM = ltr.find("select").eq(0), Ds = ltr.find("select").eq(2),
			rI;
        if (ltr.length == 0) {
            rI = $.inArray(i.toString(), flyOrder.o.manList);
            ltr = flyOrder.o.table.find("tr").eq(rI);
            dM = ltr.find("select").eq(0);
            Ds = ltr.find("select").eq(2);
        }
        ltr.find("input,select").unbind();
        if (dM.val() == "1") {
            flyOrder.o.flyPPrice.AduNum = parseInt(flyOrder.o.flyPPrice.AduNum) - 1;
            $(flyOrder.o.hidden[7]).val(flyOrder.o.flyPPrice.AduNum);
        }
        if (dM.val() == "2") {
            flyOrder.o.flyPPrice.ChiNum = parseInt(flyOrder.o.flyPPrice.ChiNum) - 1;
            $(flyOrder.o.hidden[8]).val(flyOrder.o.flyPPrice.ChiNum);
        }
        if (dM.val() == "3") {
            flyOrder.o.flyPPrice.InfNum = parseInt(flyOrder.o.flyPPrice.InfNum) - 1;
            $(flyOrder.o.hidden[9]).val(flyOrder.o.flyPPrice.InfNum);
        }
        flyOrder.o.flyPPrice.sNum = parseInt(flyOrder.o.flyPPrice.sNum) - parseInt(Ds.val());
        ltr.remove();
        flyOrder.setArr();
        flyOrder.getPrices();
    },
    noThreeNoFour:function(str){
var t1 = parseInt(str.substring(str.length-1,str.length)),
t2 = parseInt(str.substring(str.length-2,str.length-1)),
to = str.substr(0,str.length-2),f;
if(t1>=5){
t2 += 1;
}
f=to+t2.toString()+"0";
return f;
},
    getPrices: function() {
        var ap = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0;
var s=parseFloat(flyOrder.o.flyPPrice.hidOilFee)/2,chiOil = parseInt(flyOrder.noThreeNoFour(s.toString()));
        a = parseFloat(flyOrder.o.flyPPrice.hidAdu) * parseInt(flyOrder.o.flyPPrice.AduNum); //成人总价
        b = parseFloat(flyOrder.noThreeNoFour(flyOrder.o.flyPPrice.hidChi)) * parseInt(flyOrder.o.flyPPrice.ChiNum); //儿童总价
        c = parseFloat(flyOrder.noThreeNoFour(flyOrder.o.flyPPrice.hidInf)) * parseInt(flyOrder.o.flyPPrice.InfNum)//婴儿总价
        d = (parseFloat(flyOrder.o.flyPPrice.hidBuildFee) + parseFloat(flyOrder.o.flyPPrice.hidOilFee)) * parseInt(flyOrder.o.flyPPrice.AduNum) + chiOil * parseInt(flyOrder.o.flyPPrice.ChiNum); //燃油&机建费
        e = parseFloat(flyOrder.o.flyPPrice.hidSafetyFee) * parseInt(flyOrder.o.flyPPrice.sNum); //保险
        if (flyOrder.o.rad.filter(":last").attr("checked") == true) {
            f = 10; //快递
        }
        ap = a + b + c + d + e + f;
        flyOrder.o.flyPPrice.hidTotal = ap;
        $(flyOrder.o.hidden[6]).val(ap);
        flyOrder.o.price.html("&yen;" + ap);
    },
    reSetMan: function() {//防止标准浏览器缓存人数
        $(flyOrder.o.hidden[7]).val(flyOrder.o.flyPPrice.AduNum);
        $(flyOrder.o.hidden[8]).val(flyOrder.o.flyPPrice.ChiNum);
        $(flyOrder.o.hidden[9]).val(flyOrder.o.flyPPrice.InfNum);
    },
    inntFly: function() {

        flyOrder.setO();
        flyOrder.bindDB();
        var fSelect = flyOrder.o.table.find("td select").not(flyOrder.o.table.find("td select").eq(1));
        $.each(fSelect, function() {
            $(this).bind("change", function() {
                flyOrder.TDEle(this);
            })
        })
        flyOrder.o.addBut.bind("click", function() {
            flyOrder.addMans();
        })
        flyOrder.bindRad();
        flyOrder.reSetMan();
        flyOrder.setArr();
        flyOrder.getPrices();
    },
    destroy: function() { }
}),
flyOrderChk = Class(flyOrder, {
    creat: function(o) {
        if (o) {
            flyOrder.o.chkCC = 1;
            flyOrder.o.chkCar = o;
        }
    },
    chkMoth: function() {
        if (flyOrder.o.aInput == undefined) {
            flyOrder.o.aInput = flyOrder.o.table.find("td input");
        }
        var aN = 0,
			bN = 0,
			csr = flyOrder.o.rad.filter("[checked=true]").parent().find("div:first input"),
			cssSet = "padding:10px;width:250px;text-align:center;";
        $.each(csr, function() {
            if ($(this).val() != "") {
                bN += 1;
            }
        })

        $.each(flyOrder.o.aInput, function() {
            if ($(this).val() != "") {
                aN += 1;
            }
        })

        if (aN != flyOrder.o.aInput.length) {
            alerter({ msg: "请填写完整的乘机人信息。", set: { css: cssSet} });
            return false;
        }

        if (bN != csr.length) {
            alerter({ msg: "请填写完整的行程单（发票）配送方式。", set: { css: cssSet} });
            return false;
        }

        return true;
    },
    chkChk: function() {
        if (flyOrder.o.chkCC) {
            var ntt = flyOrderChk.chkMoth();
            if (ntt == true) {

                try {
                    return false;
                } finally {
                    flyOrder.o.chkCar();
                }

            } else {
                $("form:first").bind("submit", function() {
                    return false;
                })
            }
        } else {
            $("#aspnetForm").bind("submit", function() {
                return flyOrderChk.chkMoth();
            })
        }
    }
}),
newBH = Class($_$,{
	creat:function(o,c){
		this.o = o;
		newBH.o = this.o;
		if(c){
			newBH.o.cbCtrl = 1;
			newBH.o.callBack = c;
		}
	},
	setGlobal:function(){
		newBH.o.dateBox = $("#" + newBH.o.oid[0])
		newBH.o.tableBox = $("#" + newBH.o.oid[2])
		newBH.o.Gop = $("#" + newBH.o.opBox).val();
		newBH.o.nextB = $("#" + newBH.o.nid);
		newBH.o.reChk = $("#" + newBH.o.oid[1]);
		newBH.o.apBox = $("#"+newBH.o.aP);
		newBH.o.manInfo = $("#"+newBH.o.info);
		newBH.o.advBook = $("#"+newBH.o.advBut);
		newBH.o.rooms = $("#"+newBH.o.roomListId +" a");
		newBH.o.priceList = [];
		newBH.o.bedList = [];
		if(newBH.o.Gop != ""){
			eval("newBH.o.o="+newBH.o.Gop);
			newBH.getJO();
		}
	},
	getJO:function(){
		var tmpStr = "";
		for(key in newBH.o.o){
			tmpStr += key +"="+newBH.o.o[key]+"&";
		}
		newBH.o.pStr = tmpStr.substr(0,tmpStr.length-1);
		newBH.o.fDate = "HGRP_GuestRoomID=" + newBH.o.o.HGRP_GuestRoomID +"&s_date=" + newBH.o.o.s_date + "&e_date=" + newBH.o.o.e_date;
	},
	getDate:function(d,fn){
		newBH.destroy(0);
		var datas = newBH.o.fDate;
		
		if(d&&d!=null){
			datas = d;
		}
		if(fn != undefined){
			var cF = fn;
		}
		$.ajax({
	        type:"GET",
	        url:newBH.o.oUrl.date,
			data:datas,
	        error:function(){
	            alert(O_o.FailMsgE);
	        },
	        success:function(Re){
				newBH.o.dateBox.html(Re);
				showBF();
				if(fn != undefined){
					cF();
					cF = null;
				}
	        }
	    });
	},
	getTable:function(){
		$.ajax({
	        url:newBH.o.oUrl.book,
	        data:newBH.o.pStr,
			cache: false,
	        error: function(){
	            alert(O_o.FailMsgE);
	        },
	        success: function(Re){
				newBH.o.tableBox.html(Re);
				newBH.setAllEven();
	        }
	    });
	},
	setAllEven:function(){
		newBH.o.advBox = newBH.o.tableBox.find("tbody:last");
		newBH.o.sBox = newBH.o.tableBox.find("tbody:first");
		if(newBH.o.advBook.attr("checked")==true){
			newBH.o.tableBox.find("tbody:last").removeAttr("style");
			newBH.setRoomVar();
			newBH.getTDEs();
			newBH.bindEven();
			newBH.bindTDEven();
			newBH.getPrice();
		}else{
			newBH.setRoomVar();
			newBH.setSimpleRoom();
			newBH.bindEven();
			newBH.getPrice();
		}
	},
	setRoomVar:function(){
		var rL = $("#" + newBH.o.oid[3]).val(),
			bL = $("#" + newBH.o.oid[4]).val();
		newBH.o.priceList = rL.split(",");
		newBH.o.bedList = bL.split(",");
		
	},
	getTDEs:function(){
		newBH.o.tbs = newBH.o.tableBox.find("td");
		newBH.o.allSelect = newBH.o.tableBox.find("select");
		newBH.o.pre = newBH.o.tableBox.find("th span");
		newBH.o.addBf = newBH.o.tableBox.find("td b");
		newBH.o.delBfb = newBH.o.tableBox.find("td del");
	},
	addBf:function(t){
		var tt = "<p>"+$(t).prev().html()+"<del>删除该早餐</del></p>",
			tp= $(t).parent().parent();
		tp.append(tt);
		newBH.o.allSelect = newBH.o.tableBox.find("select");
		newBH.o.allSelect.bind("change",function(){
			newBH.getPrice();
		})
		$.each(tp.find("del"),function(){
			$(this).bind("click",function(i,n){
				newBH.delBf(this);
			})
		})
		newBH.getPrice();
	},
	delBf:function(t){
		$(t).unbind();
		$(t).prev().find("select").unbind();
		$(t).parent().remove();
		newBH.o.allSelect = newBH.o.tableBox.find("select");
		newBH.getPrice();
	},
	asPre:function(o,t){
		var tda = newBH.o.tableBox.find("tbody:last").find("td").eq(o),
			tdS = tda.find("select").slice(0,2),
			bfS = tda.find("div").eq(0).html(),
			tdd = newBH.o.tableBox.find("tbody:last").find("td").eq(o+1),
			tdr = tdd.find("select").slice(0,2),
			tS,seNum,dS = "<p>"+tdd.find("div p").eq(0).html()+"</p>",
			tSv = [];

		$.each(tda.find("div select"),function(){
			tSv.push(this.selectedIndex);
		})
		
		seNum = tSv.length/3;
		delBFButNum = seNum-1;
		var addArea = tdd.find("div div").eq(0);
		addArea.find("select,b,del").unbind();
		addArea.empty();
		for(var i=0;i<seNum;i++){
			addArea.append(dS);
		}
		tS = tdd.find("div select");
		$.each(tS,function(i,n){
			this.selectedIndex = tSv[i];
		})
		$.each(tdS,function(i,n){
			tdr[i].selectedIndex = this.selectedIndex;
		})
		
		if(delBFButNum > 0){
			var delBFBut = tdd.find("b").not(":first");
			$.each(delBFBut,function(){
				$(this).replaceWith("<del>删除该早餐</del>");
			})
		}
		newBH.o.allSelect = newBH.o.tableBox.find("select");
		newBH.o.allSelect.bind("change",function(){
			newBH.getPrice();
		})
		$.each(tdd.find("del"),function(){
			$(this).bind("click",function(i,n){
				newBH.delBf(this);
			})
		})
		tdd.find("b").bind("click",function(){
			newBH.addBf(this);
		})
		newBH.getPrice();
	},
	getPrice:function(){
		newBH.o.allPrice = 0;
		newBH.o.days = parseInt(newBH.o.tableBox.find("tr").length);
		var allRoom =[],
			allBed =[],
			mT =[],
			bfT = [],
			bfN = [],
			aaL = [],
			acL=[],
			bfts = [],
			aNum =0,
			rommPrice = 0,
			bfPrice = 0,
			bedPrive = 0,
			varGeter = function(o,t){
				var n = t.selectedIndex,rVal = $(t).find("option").eq(n).text();
				switch(o){
					case "RoomNum":
						allRoom.push(rVal);
					break;
					
					case "BedsNumber":
						allBed.push(rVal);
					break;
					
					/*case "ManType":
						mT.push($(t).val())
					break;*/
					
					case "BreakfastType":
						var bfp,
							mTs = $(t).prevAll("select[name='ManType']").eq(0).val().substr(0,1),
							bT = $(t).find("option").eq(n).attr("title").split(",");
						
						if(mTs == "0"){
							bfp = bT[0];
						}
						if(mTs == "1"){
							bfp = bT[1];
						}
						bfts.push(mTs);
						aaL.push(bT[0]);
						acL.push(bT[1]);
						bfT.push(bfp);
					break;
					
					case "BreakfastNumber":
						bfN.push(rVal)
					break;
				}
			};
		
		$.each(newBH.o.allSelect,function(){
			varGeter($(this).attr("name"),this);
		})
		$.each(newBH.o.priceList,function(i,n){
			var nprice,
				bPrice = parseInt(newBH.o.bedList[i])*parseInt(allBed[i]);
				
			if(newBH.o.advBox.css("display")=="none"){
				nprice = parseInt(n)*parseInt(allRoom[0]);
				bPrice = parseInt(newBH.o.bedList[i])*parseInt(allBed[0]);
			}else{
				nprice = parseInt(n)*parseInt(allRoom[i]);
				bPrice = parseInt(newBH.o.bedList[i])*parseInt(allBed[i]);
			}
			
			rommPrice +=nprice;
			bedPrive +=bPrice;
		})
		if(bfT.length !=0){
			$.each(bfN,function(i,n){
				var nBfPrice = 0;
				if (newBH.o.advBox.css("display") == "none") {
					if (n != "0") {
						if(bfts[i] == "0"){
							$.each(aaL,function(ii,nn){
								if(ii == newBH.o.days-1){return false;}
								nBfPrice += parseInt(nn)*parseInt(n);
							})	
						}
						if(bfts[i] == "1"){
							$.each(acL,function(ii,nn){
								if(ii == newBH.o.days-1){return false;}
								nBfPrice += parseInt(nn)*parseInt(n);
							})	
						}
					}
				}else{
					nBfPrice = parseInt(bfT[i])*parseInt(n);
				}
				bfPrice += nBfPrice;
			})
		}
		//newBH.o.days
		/*
		if(newBH.o.advBox.css("display")=="none"){
			//rommPrice = rommPrice*newBH.o.advBox.find("tr").length;
			bedPrive = bedPrive*newBH.o.advBox.find("tr").length;
			bfPrice = bfPrice*newBH.o.advBox.find("tr").length;
		}
		*/
		newBH.o.allPrice = rommPrice + bedPrive + bfPrice;
		newBH.o.apBox.html("&yen;" + newBH.o.allPrice);
		allRoom =null;
		allBed =null;
		mT = null;
		bfT = null;
		bfN = null;
		aaL = null;
		acL= null;
		bfts =null;
	},
	setSimpleRoom:function(){
		var dayOne = newBH.o.advBox.find("td:first").children();
		dayOne.unbind();
		newBH.o.sBox.find("td").append(dayOne.clone());
		//newBH.destroy();
		dayOne.remove();
		newBH.getTDEs();
		newBH.bindTDEven();
		newBH.o.tableBox.find("tbody").css("display","none");
		newBH.o.sBox.css("display","block")
		//newBH.o.sBox.removeAttr("style");
	},
	showAdv:function(){
		var allDay = newBH.o.sBox.find("td:first").children();
		newBH.o.sBox.css("display","none");
		allDay.unbind();
		newBH.o.advBox.find("td:first").append(allDay.clone());
		//newBH.destroy();
		allDay.remove();
		newBH.getTDEs();
		newBH.bindTDEven();
		newBH.o.sBox.css("display","none");
		newBH.o.advBox.css("display","block");
		//newBH.o.advBox.removeAttr("style");
	},
	bindTDEven:function(){
		
		newBH.o.delBfb.bind("click",function(){
			newBH.delBf(this);
		})

		newBH.o.allSelect.bind("change",function(){
			newBH.setBadNum(this);
			newBH.getPrice();
		})
		
		$.each(newBH.o.pre,function(i,n){
			$(this).bind("click",function(){
				newBH.asPre(i,this);
			})
		})
		
		$.each(newBH.o.addBf,function(i){
			$(this).bind("click",function(){
				newBH.addBf(this);
			})
		})
	},
	setBadNum:function(t){
		
		if($(t).attr("name") == "RoomNum"){
			var maxo = parseInt($(t).val())+1,
				ns = $(t).parent().next().find("select"),
				nDay =ns.find("option").val().substr(ns.find("option").val().indexOf("_"),ns.find("option").val().length);
			ns.empty();
			for(var i = 0;i<maxo;i++){
				var ov;
				if(i == 0){
					ov = "<option selected=\"selected\" value=\""+ i + nDay +"\">"+i+"</option>";
				}else{
					ov = "<option value=\""+ i + nDay +"\">"+i+"</option>";
				}
				ns.append(ov);
			}
		}
	},
	bindEven:function(){
		newBH.o.advBook.bind("click",function(){
			if($(this).attr("checked") == true){
				newBH.showAdv();
			}else{
				newBH.setSimpleRoom();
			}
		})
		newBH.o.reChk.bind("click",function(){
			newBH.o.o.s_date = $("#checkIn").val();
			newBH.o.o.e_date = $("#checkOut").val();
			newBH.getJO();
			newBH.o.fDate = "HGRP_GuestRoomID=" + newBH.o.o.HGRP_GuestRoomID +"&s_date=" + newBH.o.o.s_date + "&e_date=" + newBH.o.o.e_date;
			newBH.getDate(null,function(){newBH.getTable()});
		})
		newBH.o.rooms.bind("click",function(){
			try{
				return false;
			}finally{
				var hrefs = $(this).attr("href"),
					nStr = "&s_date=" + $("#checkIn").val() + "&e_date=" + $("#checkOut").val();
				window.location.href = hrefs+nStr;
			}
		})
	},
	inntHotel:function(){
		newBH.setGlobal();
		if(newBH.o.chkCar == undefined){
			newBH.getDate();
			newBH.getTable();
		}else{
			newBH.getDate();
			newBH.setAllEven();
		}
	},
	destroy:function(o){
		if(o!=undefined && newBH.o.advBox != undefined){
			newBH.o.advBook.unbind();
			newBH.o.reChk.unbind();
			newBH.o.tableBox.find("select,b,del").unbind();
		}else{
			newBH.o.tableBox.find("select,b,del").unbind();
		}
	}
}),
/*
hotelScomb({
dayId:"#dayInfo",
roomId:"#cAndKInfo",
otId:"#bookTableBox",
sId:"#rnums",
totalId: ["#bookTotal","#TotalPrice"],
romId:"#rpInfo",
wpSet:["#wpId",function(){WdatePicker({minDate:'%y-%M-%d',doubleCalendar:true,onpicked:function(){reGetHotelScomb({t:this});}})},"dayType.html"],
idList:["#goodgoodstudy","#daydayup","#goNext",0,0],
roomSet:["roomType.html",123]
})
*/
hotelScomb = Class(newBH, {
    creat: function(o, c) {
        this.o = o;
        hotelScomb.o = this.o;
        if (c) {
            hotelScomb.o.cc = 1;
            hotelScomb.o.cb = c;
        }
    },
    setScomb: function() {
        hotelScomb.o.dayType = $(hotelScomb.o.dayId + " input:radio");
        hotelScomb.o.pBox = $(hotelScomb.o.otId);
        hotelScomb.o.wpBox = $(hotelScomb.o.wpSet[0]);
        hotelScomb.o.wpInput = hotelScomb.o.wpBox.find("input:first");
        hotelScomb.o.roomNum = $(hotelScomb.o.sId);
        hotelScomb.o.total = $(hotelScomb.o.totalId[0]);
        hotelScomb.o.totalHid = $(hotelScomb.o.totalId[1]);
        hotelScomb.o.man = $(hotelScomb.o.romId);
        hotelScomb.o.g = $(hotelScomb.o.idList[0]);
        hotelScomb.o.d = $(hotelScomb.o.idList[1]);
        hotelScomb.o.n = $(hotelScomb.o.idList[2]);
        if (hotelScomb.o.daysId) {
            hotelScomb.o.daysNum = parseInt($(hotelScomb.o.daysId).val());
        }
        hotelScomb.o.forms = typeof (hotelScomb.o.idList[3]) == "string" ? $(hotelScomb.o.idList[3]) : $("form").eq(hotelScomb.o.idList[3]);
    },
    setType: function(t, tt) {
        if (t == 0) {
            hotelScomb.o.g.html($(tt).next().text());
        }
        if (t == 1) {
            hotelScomb.o.d.html($(tt).next().html());
        }
        if (newPop.x != undefined) {
            newPop.ppHide();
        }
        //hotelScomb.getPrice();
    },
    getRoomType: function() {//获取房型
        var dat;
        if ($(hotelScomb.o.roomId).find("div").length == 0) {
            dat = "LodgingDate=" + hotelScomb.o.wpBox.find("input:first").val() + "&DayNumberID=" + hotelScomb.o.dayType.filter(":checked").val() + "&RoomID=" + hotelScomb.o.dayType.filter(":checked").attr("roomid");
        } else {
            dat = "LodgingDate=" + hotelScomb.o.wpBox.find("input:first").val() + "&DayNumberID=" + hotelScomb.o.dayType.filter(":checked").val();
        }
        $.ajax({
            url: hotelScomb.o.roomSet[0],
            type: "GET",
            data: dat,
            success: function(re) {
                $(hotelScomb.o.roomId + " input").unbind();
                if ($(hotelScomb.o.roomId).find("div").length == 0) {
                    $(hotelScomb.o.roomId).append(re);
                } else {
                    $(hotelScomb.o.roomId).find("div:first").html(re);
                }
                hotelScomb.o.roomType = $(hotelScomb.o.roomId + " input:radio");
                var theChk = hotelScomb.o.roomType.filter(":checked");
                hotelScomb.o.roomPrice = parseFloat(theChk.next().next().html().match(/\d+/));
                hotelScomb.o.d.html(theChk.next().html());
                hotelScomb.o.wpBox.find("td").eq(4).find("strong").html(theChk.next().next().html())
                hotelScomb.getProducts(theChk);
                //hotelScomb.bindSelect();
                hotelScomb.bindEven();
            }
        })
    },
    extendedStay: function(o, ac) {//延住天数价格计算
        $.ajax({
            type: "GET",
            url: hotelScomb.o.roomSet[3],
            async: true,
            data: "HPOI_ExtendedDayNumber=" + $(o).val() + "&HPOI_WeekMark=" + $(o).attr("mark") + "&HPOI_ExtendedWeekPrice=" + $(o).attr("extendedweekprice") + "&HPOI_ExtendedPrice=" + $(o).attr("extendedpric") + "&HPOI_LeaveDate=" + hotelScomb.o.leaveDate,
            success: function(re) {
                if (re != -1) {
                    hotelScomb.o.addProsPrice = parseFloat(re);
                    if (ac) {
                        var tfn = ac;
                        tfn();
                    }
                    hotelScomb.getPrice();
                } else {
                    alerter({ msg: "杯具了，发生了个未知的错误。请刷新页面已解决该问题。<br />如还未能解决请致电我们的客服热线<strong style=\"color:#f20;\">400-789-8888</strong>", set: { css: "padding:10px;width:250px;text-align:center;"} });
                }
            }
        })
    },
    getPrice: function() {
        var allRoomPrice = hotelScomb.o.roomPrice * parseInt(hotelScomb.o.roomNum.val())
        hotelScomb.o.allPrice = 0;
        hotelScomb.o.allAddProsPrice = 0;
        if (hotelScomb.o.addProsPrice == undefined) {
            hotelScomb.o.addProsPrice = 0;
        }

        if (hotelScomb.o.cPrice == undefined) {
            if (hotelScomb.o.hasBF != undefined) {
                hotelScomb.o.cPrice = parseFloat(hotelScomb.o.other.filter("[name='BreakfastChildNumber']").attr("price")) * parseInt(hotelScomb.o.other.filter("[name='BreakfastChildNumber']").val());
            } else {
                hotelScomb.o.cPrice = 0;
            }
        }
        if (hotelScomb.o.aPrice == undefined) {
            if (hotelScomb.o.hasBF != undefined) {
                hotelScomb.o.aPrice = parseFloat(hotelScomb.o.other.filter("[name='BreakfastNumber']").attr("price")) * parseInt(hotelScomb.o.other.filter("[name='BreakfastNumber']").val());
            } else {
                hotelScomb.o.aPrice = 0;
            }

        }
        if (hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").length > 0 && hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").val() == "0") {
            //hotelScomb.o.bPrice = 0;
            hotelScomb.o.addProsPrice = 0;
        }
        if (hotelScomb.o.other.filter("[name='BedsNumber']").length > 0) {
            hotelScomb.o.bPrice = parseFloat(hotelScomb.o.other.filter("[name='BedsNumber']").attr("price")) * parseInt(hotelScomb.o.other.filter("[name='BedsNumber']").val());
        } else {
            hotelScomb.o.bPrice = 0;
        }
		if(hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").length > 0){
			hotelScomb.o.addPrice = hotelScomb.o.addProsPrice * parseInt(hotelScomb.o.other.filter("[name='HPOI_NumExtendedDay']").val());
		}else{
			hotelScomb.o.addPrice = 0;
		}
		
        hotelScomb.o.allAddProsPrice = hotelScomb.o.addPrice + hotelScomb.o.bPrice + hotelScomb.o.cPrice + hotelScomb.o.aPrice;
        hotelScomb.o.allPrice = allRoomPrice + hotelScomb.o.allAddProsPrice;
        if (hotelScomb.o.totalHid != undefined) {
            hotelScomb.o.totalHid.val(hotelScomb.o.allPrice);
        }
        hotelScomb.o.addTotal.html("&yen;" + hotelScomb.o.allAddProsPrice);
        hotelScomb.o.total.html("&yen;" + hotelScomb.o.allPrice);
    },
    getProducts: function(o) {//获取附加产品
        $.ajax({
            type: "GET",
            url: hotelScomb.o.roomSet[2],
            data: "LodgingDate=" + hotelScomb.o.wpBox.find("input:first").val() + "&DayNumberID=" + hotelScomb.o.dayType.filter(":checked").val() + "&RoomID=" + $(o).val(),
            success: function(re) {
                if (hotelScomb.o.pBox.html() != "") {
                    hotelScomb.o.pBox.find("select,span").unbind();
                }
                hotelScomb.o.pBox.html(re);
                hotelScomb.o.leaveDate = $(hotelScomb.o.otId + " input[name='HPOI_LeaveDate']").val();
                hotelScomb.o.addTotal = $(hotelScomb.o.totalId[2]);
                hotelScomb.setType(1, o);
                hotelScomb.o.addProsPrice = 0;
                hotelScomb.o.other = hotelScomb.o.pBox.find("select");
                hotelScomb.bindSelect();
                hotelScomb.getPrice();
            }
        })
    },
    setBedNum: function(t, o) {
        var Max, days,aD,aDN;
        if (hotelScomb.o.daysId != undefined) {
            days = hotelScomb.o.daysNum;
        } else {
            days = parseInt(hotelScomb.o.dayType.filter(":checked").parent().next().next().val());
        }
        if (days == undefined) {days = 1;}
		if(hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").length > 0){
			aD = parseInt(hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").val());
		}else{
			aD = 0;
		}
		if(hotelScomb.o.other.filter("[name='HPOI_NumExtendedDay']").length > 0){
			aDN = parseInt(hotelScomb.o.other.filter("[name='HPOI_NumExtendedDay']").val());
		}else{
			aDN = 0;
		}
        Max = parseInt(t.val()) * days + aD*aDN;

        if (o.find("option").length > 2) {
            o.find("option").eq(1).nextAll().remove();
        }
        for (var i = 1; i < Max; i++) {
            var no = parseInt(i) + 1;
            o.append("<option value=\"" + no + "\">" + no + "</option>");
        }
    },
    setAddProds: function(o) {
        var Max = parseInt(hotelScomb.o.roomNum.val());
        if (o.find("option").length > 1) {
            o.find("option:first").nextAll().remove();
        }
        for (var i = 1; i < Max; i++) {
            var no = parseInt(i) + 1;
            o.append("<option value=\"" + no + "\">" + no + "</option>")
        }
    },
    bindSelect: function(o) {
        if (hotelScomb.o.other == undefined) {
            hotelScomb.o.other = $(hotelScomb.o.otId + " select");
        }
        if (o == undefined) {
            hotelScomb.setAddProds(hotelScomb.o.other.filter("[name='HPOI_NumExtendedDay']"));
        }
        $.each(hotelScomb.o.other, function(i, n) {
            if ($(this).attr("name") == "HPOI_ExtendedDayNumber") {
                $(this).bind("change", function() {
                    if ($(this).val() == "0") {
                        hotelScomb.getPrice();
                    } else {
                        hotelScomb.extendedStay(this);
                    }
                })
            } else if ($(this).attr("name") == "BedsNumber") {

                $(this).bind("change", function() {
                    //if (hotelScomb.o.other.eq(0).val() != "0") {
                    hotelScomb.getPrice();
                    //}
                })
            } else if ($(this).attr("name") == "BreakfastNumber") {
                hotelScomb.o.hasBF = 1;
                $(this).bind("change", function() {
                    hotelScomb.o.aPrice = parseFloat($(this).attr("price")) * parseInt($(this).val());
                    hotelScomb.getPrice();
                })
            } else if ($(this).attr("name") == "HPOI_NumExtendedDay") {
                $(this).bind("change", function() {
                    //if(hotelScomb.o.other.eq(2).attr("name") =="BedsNumber"){
                    hotelScomb.setBedNum($(this),hotelScomb.o.other.filter("[name='BedsNumber']"));
                    //}
                    hotelScomb.getPrice();
                })
            } else if ($(this).attr("name") == "BreakfastChildNumber") {
                $(this).bind("change", function() {
                    hotelScomb.o.cPrice = parseFloat($(this).attr("price")) * parseInt($(this).val());
                    hotelScomb.getPrice();
                })
            } else {
                $(this).bind("change", function() {
                    hotelScomb.getPrice();
                })
            }
        })
    },
    bindEven: function() {

        hotelScomb.o.roomNum.bind("change", function() {
            hotelScomb.setAddProds(hotelScomb.o.other.filter("[name='HPOI_NumExtendedDay']"));
            if (hotelScomb.o.other.filter("[name='BedsNumber']").length > 0) {
                hotelScomb.setBedNum($(this),hotelScomb.o.other.filter("[name='BedsNumber']"));
            }
            hotelScomb.getPrice();
        })

        hotelScomb.o.wpInput.bind("click", function() {
            $(hotelScomb.o.wpSet[1]);
        })

        hotelScomb.o.dayType.bind("click", function() {
            hotelScomb.destroy();
            hotelScomb.setType(0, this);
            hotelScomb.getRoomType();
        })

        hotelScomb.o.roomType.bind("click", function() {
            hotelScomb.o.wpBox.find("td").eq(4).find("strong").html($(this).next().next().html())
            hotelScomb.o.roomPrice = parseFloat($(this).next().next().html().match(/\d+/));
            hotelScomb.o.addProsPrice = 0;
            hotelScomb.o.aPrice = 0;
            hotelScomb.o.cPrice = 0;
            hotelScomb.getProducts(this);
        })

        hotelScomb.o.n.click(function() {
            hotelScomb.o.forms.submit();
        })

        hotelScomb.o.forms.bind("submit", function() {
            newBH.o = {};
            newBH.o.manInfo = hotelScomb.o.man;
            if (hotelScomb.o.idList[3] == 0) {
                return newHBNext.chkHotle()
            } else {
                try {
                    return false;
                } finally {
                    ajaxFP(hotelScomb.o.idList[3]);
                    hotelScomb.o.forms.submit();
                }
            }
        })
    },
    inntScomb: function() {
        hotelScomb.setScomb();
        if ($(hotelScomb.o.roomId + " input").length > 0) {
            hotelScomb.o.roomType = $(hotelScomb.o.roomId + " input:radio");
            hotelScomb.o.roomPrice = parseFloat(hotelScomb.o.roomType.filter(":checked").next().next().html().match(/\d+/));
            hotelScomb.o.leaveDate = $(hotelScomb.o.otId + " input[name='HPOI_LeaveDate']").val();
            hotelScomb.bindEven();
            hotelScomb.bindSelect();
        } else {
            hotelScomb.getRoomType();
        }
    },
    destroy: function() {
        hotelScomb.o.wpBox.find("input,select,a").unbind();
        hotelScomb.o.pBox.find("select").unbind();
    }
}),

/*
carHotelScombs({
    nId:"#rnums",
    aId:"#bookTableBox",
    tId:"#wpId",
    rId:"#rpInfo",
    sId:"#goNext",
    totalId: ["#bookTotal","#addPrice"],
    purl:"ajax/hotelpackages-extendedtotalprice.aspx",
    f:"#innerForm"
})
*/
carHotelScomb = Class(hotelScomb, {
    creat: function(o, c) {
        this.o = o;
        carHotelScomb.o = this.o;
        if (c) {
            carHotelScomb.o.cc = 1;
            carHotelScomb.o.cb = c;
        }
    },
    setOps: function() {
        hotelScomb.o = {};
        hotelScomb.o.daysId = carHotelScomb.o.daysId;
        hotelScomb.o.roomNum = $(carHotelScomb.o.nId);
        hotelScomb.o.total = $(carHotelScomb.o.totalId[0]);
        hotelScomb.o.addTotal = $(carHotelScomb.o.totalId[1]);
        hotelScomb.o.other = $(carHotelScomb.o.aId + " select");
        hotelScomb.o.roomPrice = $(carHotelScomb.o.tId + " td").eq(4).html().match(/\d+/);
        hotelScomb.o.roomSet = ["", "", "", carHotelScomb.o.purl];
        carHotelScomb.o.manInfo = $(carHotelScomb.o.rId);
        carHotelScomb.o.next = $(carHotelScomb.o.sId);
        hotelScomb.o.leaveDate = $(carHotelScomb.o.aId + " input[name='HPOI_LeaveDate']").val();
        carHotelScomb.o.form = typeof (carHotelScomb.o.f) == "string" ? $(carHotelScomb.o.f) : $("form").eq(carHotelScomb.o.f);
    },
    chkCar: function() {
        var cf = function() {
            var mI = carHotelScomb.o.manInfo.find("input"), m = 0;
            $.each(mI, function() {
                if ($(this).val() != "") {
                    m += 1;
                }
            })
            if (m != mI.length) {
                alerter({ msg: "请填写完整的取房人信息 。", set: { css: "padding:10px;width:250px;text-align:center;"} });
                return false;
            } else {
                return true;
            }
        }, ss = cf();
        if (ss == true) {
            carHotelScomb.o.form.unbind();
            carHotelScomb.o.form.ajaxForm(function() {
                alert("修改成功!");
                carHotelScomb.o.form.find("*").unbind();
                carHotelScomb.o.form = null;
                closeCarInfo();
            })
            carHotelScomb.o.form.submit();
            if (carHotelScomb.o.cc != undefined) {
                carHotelScomb.o.cb();
            }
        }
    },
    bindEven: function() {
        hotelScomb.bindSelect(0);
        hotelScomb.o.roomNum.unbind();
        hotelScomb.o.roomNum.bind("change", function() {

            var o = hotelScomb.o.other.eq(1),
				Max = parseInt(hotelScomb.o.roomNum.val());
            if (o.find("option").length > 1) {
                o.find("option:first").nextAll().remove();
            }
            for (var i = 0; i < Max; i++) {
                var no = parseInt(i) + 1;
                o.append("<option value=\"" + no + "\">" + no + "</option>");
            }
            if (hotelScomb.o.other.filter("[name='BedsNumber']").length > 0) {
                hotelScomb.setBedNum($(this),hotelScomb.o.other.filter("[name='BedsNumber']"));
            }
            //hotelScomb.setAddProds(hotelScomb.o.other.eq(1));
            hotelScomb.getPrice();
        })

        carHotelScomb.o.form.submit(function() {
            try {
                return false;
            } finally {
                carHotelScomb.chkCar();
            }
        })
    },
    outBFP: function() {
    if (hotelScomb.o.hasBF == 1) {
            hotelScomb.o.aPrice = parseFloat(hotelScomb.o.other.filter("[name='BreakfastNumber']").attr("price")) * parseInt(hotelScomb.o.other.filter("[name='BreakfastNumber']").val());
            hotelScomb.o.cPrice = parseFloat(hotelScomb.o.other.filter("[name='BreakfastChildNumber']").attr("price")) * parseInt(hotelScomb.o.other.filter("[name='BreakfastChildNumber']").val());
        }
    },
    inntCar: function() {
        carHotelScomb.setOps();
        carHotelScomb.bindEven();
        if (hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").length > 0 && hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']").val() != "0") {
            hotelScomb.extendedStay(hotelScomb.o.other.filter("[name='HPOI_ExtendedDayNumber']"), carHotelScomb.outBFP());
        } else {
            hotelScomb.getPrice();
        }
    }
}),
reHotelScomb = Class(hotelScomb, {
    creat: function(o, c) {
        this.o = o;
        reHotelScomb.o = this.o;
    },
    isThatOk: function() {
        $.ajax({
            type: "GET",
            data: "HotelPackagesID=" + hotelScomb.o.roomSet[1] + "&LodgingDate=" + $(reHotelScomb.o.t).val(),
            url: hotelScomb.o.wpSet[2],
            async: true,
            success: function(re) {
                if (re != 0) {
                    hotelScomb.destroy();
                    reHotelScomb.o.forms.unbind();
                    reHotelScomb.o.forms.attr("action", hotelScomb.o.wpSet[3]);
                    reHotelScomb.o.forms.submit();
                } else {
                    alerter({ msg: "您所选的日期无价格 。<br />请重新选择。", set: { css: "padding:10px;width:250px;text-align:center;"} });
                }
            }
        })
    },
    doRe: function() {
        if (reHotelScomb.o.f != undefined) {
            reHotelScomb.o.forms = typeof (reHotelScomb.o.f) == "stribg" ? $(reHotelScomb.o.f) : $("form").eq(reHotelScomb.o.f);
        } else {
            reHotelScomb.o.forms = $("form:first");
        }
        reHotelScomb.isThatOk();
    }
}),
newHBNext = Class(newBH, {
    creat: function(o, c) {
        this.o = o;
        newHBNext.o = this.o;
        if (c) {
            newHBNext.o.cCtrl = 1;
            newHBNext.o.chkCC = c;
        }
    },
    chkHotle: function() {
        var mI = newBH.o.manInfo.find("input"), m = 0;
        $.each(mI, function() {
            if ($(this).val() != "") {
                m += 1;
            }
        })
        if (m != mI.length) {
            alerter({ msg: "请填写完整的取房人信息 。", set: { css: "padding:10px;width:250px;text-align:center;"} });
            return false;
        } else {
            return true;
        }
        return false;
    },
    loser: function() {
        return false;
    },
    aChks: function() {
        try {
            return false;
        } finally {
            $.ajax({
                type: "GET",
                url: newBH.o.oUrl.next,
                data: newBH.o.fDate,
                async: true,
                error: function() {
                    alert(O_o.FailMsgE);
                    return false;
                },
                success: function(Re) {
                    if (Re != 0) {
                        newHBNext.doNext();

                    } else {
                        alerter({ msg: "您选择的时间段内有一或多天无客房出售（日历上无价格）。<br />您可以重新选择预定的时间段或拨打我们的客服热线：400-789-8888咨询预定。", set: { css: "padding:10px;width:250px;text-align:center;text-align:left;" }, ot: 4000 });
                        return false;
                    }
                }
            });
        }

    },
    doNext: function() {
        var ntt = newHBNext.chkHotle();
        if (ntt == true) {
            if (newHBNext.o.cCtrl) {
                //newHBNext.o.chkCC();
                newHBNext.o.form.unbind();

                newHBNext.o.form.ajaxForm(function() {
                    alert("修改成功!");
                    newHBNext.o.form.find("*").unbind();
                    newHBNext.o.form = null;
                    closeCarInfo();
                })
                newHBNext.o.form.submit();
            } else {
                newHBNext.o.form.unbind();
                newHBNext.o.form.submit();
            }
        }
    },
    inntNext: function() {
        newHBNext.o.form = typeof (newHBNext.o.f) == "string" ? $("#" + newHBNext.o.f) : $("form").eq(newHBNext.o.f);
        newHBNext.o.form.unbind();
        if (newHBNext.o.cCtrl) {
            newHBNext.o.form.bind("submit", function() {
                return newHBNext.aChks();
            })
        } else {
            newHBNext.o.form.bind("submit", function() {
                return newHBNext.aChks();
            })
        }
    }
}),
/*
recommendJourney({
	pBoxId:["#topTotal","#bookTotal"],//顶部的总价跟底部的总价
	cBoxId:"#orderBox",//主要加载容器
	nextId:"#nextBut",//下一步
	varBoxId:"#varBox",//参数主容器
	DIYid:"diySp",//自费项目
	priceId:"#allPrices",/总价隐藏域
	loadBoxId:"#isLoadding",//正在加载时的有好界面
	uList:{//ajax请求页面地址
		G:"recommendJourneyInner.html",
		D:"123.html"
	}
})
 */
journey = Class($_$,{
	creat:function(o,c){
		this.o = o;
		journey.o = this.o;
		if(c){
			journey.o.cc = 1;
			journey.o.cb = c;
		}
	},
	setGlobal:function(){
		journey.o.topPrice = $(journey.o.pBoxId[0]);
		journey.o.bottomPrice = $(journey.o.pBoxId[1]);
		journey.o.allPrices = $(journey.o.priceId);
		journey.o.contentBox = $(journey.o.cBoxId);
		journey.o.next = $(journey.o.nextId);
		journey.o.varEles = $(journey.o.varBoxId).find("input,select");
		journey.o.loadBox = $(journey.o.loadBoxId);
		journey.o.tmp = "";
		journey.o.uStr ="";
		$.each(journey.o.varEles,function(){
			
			if($(this).attr("name") == ""){
				return
			}
			var na = $(this).attr("name"),
				va = $(this).val();
			journey.o.tmp += na+":\""+va+"\",";
			
		})
		eval("journey.o.obj={"+journey.o.tmp.substr(0,journey.o.tmp.length-1)+"}");
		journey.o.tmp = null;
		journey.o.uStr = $.param(journey.o.obj);
	},
	setPart:function(){
		journey.o.moreSpan = journey.o.contentBox.find("span[bt]");
		journey.o.moreBut = journey.o.contentBox.find("input[bt]");
		journey.o.allRadio = journey.o.contentBox.find(":radio");
		journey.o.rBox = journey.o.contentBox.find("table[id]");
		journey.o.allCheckbox = journey.o.contentBox.find(":checkbox");
		journey.o.allSelect = journey.o.contentBox.find("select");
		journey.o.DIYbox = $(journey.o.DIYid);
		journey.o.diyImg = journey.o.allCheckbox.prev("img");
		
		var ta = [],nt = [];
		$.each(journey.o.allRadio,function(i){
			if($(this).attr("name") != journey.o.allRadio.eq(i+1).attr("name")){
				nt.push($(this));
				ta.push(nt);
				nt = [];
			}else{
				nt.push($(this));
			}
		})
		$.each(ta,function(i,n){
			$.each(n,function(ii,n){
				$(this).attr("an",i);
				//$(this).attr("tn",ii);
			})
		})
		
	},
	isFly:function(t){
		var t1 = "<tr>"+$(t).parent().parent().parent().html()+"</tr>",
			t2 = "<tr>"+$(t).parent().parent().parent().next().html()+"</tr>";
		tr = t1+t2;
		if(journey.o.rBox.eq(0).find("tr").length > 1){
			journey.o.rBox.eq(0).find("tr").eq(0).nextAll().remove();
			journey.o.rBox.eq(0).append(tr);
		}else{
			journey.o.rBox.eq(0).append(tr);
		}
		journey.o.rBox.eq(0).attr("price",$(t).attr("price"));
		journey.o.rBox.eq(0).find("p").attr("class","isSelect");
		journey.o.rBox.eq(0).find("input").remove();
	},
	isOther:function(t,i){
		if($(t).parent().parent().parent().find("td").length == 8){
			tr = "<tr>"+$(t).parent().parent().parent().html()+"</tr>";
		}else{
			tr = "<tr><td>"+$(t).parent().parent().parent().parent().find("td").html()+"</td>"+$(t).parent().parent().parent().html()+"</tr>";
		}
		if(journey.o.rBox.eq(i).find("tr").length > 1){
			journey.o.rBox.eq(i).find("tr").eq(1).replaceWith(tr.replace(/rowspan/g,"rowspans"));
		}else{
			journey.o.rBox.eq(i).append(tr.replace(/rowspan/g,"rowspans"));
		}
		
		var ss = journey.o.rBox.eq(i).find("select"),
			ssv = ss.find("option[sl]").text(),
			rn = ssv==""?ss.val():ssv;
		journey.o.rBox.eq(i).attr("price",$(t).attr("price"));
		journey.o.rBox.eq(i).attr("rnum",rn);
		journey.o.rBox.eq(i).find("p").attr("class","isSelect");
		ss.parent().html(rn);
		journey.o.rBox.eq(i).find("input").remove();
	},
	setAlready:function(){
		var isCheck = journey.o.allRadio.filter(":checked"),tr;
		$.each(isCheck,function(i){
			if($(this).attr("name").indexOf("fly")!= -1){
				$(this).attr("checked",true);
				journey.isFly(this);
			}
			if($(this).attr("name").indexOf("Room")!=-1){
				$(this).attr("checked",true);
				journey.isOther(this,i);
			}
		})
	},
	bindEven:function(){
		$.each(journey.o.moreSpan,function(){
			$(this).toggle(
				function(){
					$(this).attr("class","hideMore");
					$(this).attr("txt",$(this).html());
					$(this).html("收起列表");
					$(this).parent().next().find("tbody").eq(1).removeAttr("style");
				},
				function(){
					$(this).attr("class","showMore");
					$(this).html($(this).attr("txt"));
					$(this).parent().next().find("tbody").eq(1).css("display","none");
				}
			)
		})
		$.each(journey.o.moreBut,function(){
			//.moreInfo ,.closeMoreInfo
			$(this).toggle(
				function(){
					$(this).attr("class","closeMoreInfo");
					$(this).attr("txt",$(this).val());
					$(this).val("收起列表");
					$(this).parent().next().find("table").removeAttr("style");
				},
				function(){
					$(this).attr("class","moreInfo");
					$(this).val($(this).attr("txt"));
					$(this).parent().next().find("table").css("display","none");
				}
			)
		})
		journey.o.allRadio.bind("click",function(){
			if($(this).attr("name").indexOf("fly")!= -1){
				journey.isFly(this);
			}
			if($(this).attr("name").indexOf("Room")!=-1){
				journey.isOther(this,parseInt($(this).attr("an")));
			}
			journey.getPrice();
		})
		journey.o.allCheckbox.bind("click",function(){
			$(this).parent().attr("class","isSelect");
			journey.getPrice();
		})
		journey.o.diyImg.bind("click",function(){
			$(this).next().click();
			$(this).parent().removeAttr("class");
			journey.getPrice();
		})
		journey.o.allSelect.bind("change",function(){
			var nR = $(this).parent().parent().find(":radio").filter(":checked"),
				nC=  $(this).parent().parent().find("input:checkbox").filter(":checked");
			
			function r2Get(o,o2){
				journey.o.contentBox.find("table[id]").eq(parseInt(o2.attr("an"))).attr("rnum",$(o).val());
				$(o).find("option").removeAttr("sl");
				$(o).find("option").eq(parseInt($(o).val())-1).attr("sl","1");
			}
			
			if(nR.length > 0){
				r2Get(this,nR);
				journey.getPrice();
			}
			if(nC.length > 0){
				r2Get(this,nC);
				journey.getPrice();
			}
		})
	},
	getPrice:function(){
		var pt1 = journey.o.contentBox.find("table[id]"),
			allCheck = journey.o.contentBox.find(":checkbox").filter(":checked");
		journey.o.pArr = [];
		journey.o.price = 0;
		
		$.each(pt1,function(i,n){
			var rP,pp = parseFloat($(this).attr("price")),rn;
			if($(this).attr("rnum") != undefined){
				rn = parseInt($(this).attr("rnum"));
				rP = pp*rn;
			}else{
				rP = pp;
			}
			journey.o.pArr.push(rP);
		})
		
		$.each(allCheck,function(){
			var tv = 0,
				theS = $(this).parent().parent().parent().find("select"),
				AdultNum = parseInt(theS.eq(0).val()),
				ChildNum = parseInt(theS.eq(1).val()),
				AdultPrice = parseFloat($(this).attr("adultprice")),
				ChildPrice = parseFloat($(this).attr("childprice"));
			tv = AdultPrice*AdultNum + ChildPrice*ChildNum;
			journey.o.pArr.push(tv);
		})
		
		$.each(journey.o.pArr,function(i,n){
			journey.o.price += parseFloat(n);
		})
		journey.o.allPrices.val(journey.o.price);
		journey.o.topPrice.html("&yen;"+journey.o.price);
		journey.o.bottomPrice.html("&yen;"+journey.o.price);
	},
	stars:function(){
		journey.o.loadBox.ajaxStart(function(){
			$(this).show();
		});
		$.ajax({
			type:"GET",
			url:journey.o.uList.G,
			data:journey.o.uStr,
			cache:false,
			success: function(re){
				journey.o.contentBox.html(re);
				journey.setPart();
				journey.bindEven();
				journey.setAlready();
				journey.getPrice();
				journey.o.ot = setTimeout(function(){
					journey.o.loadBox.animate({
						opacity:"hide"
					},"fast",function(){
						clearTimeout(journey.o.ot);
						journey.o.ot = null;
						journey.o.loadBox.unbind();
						journey.o.contentBox.animate({
							opacity:"show"
						});
					})
				},500)
			}
		});
	},
	innt:function(){
		journey.setGlobal();
		journey.stars();
	}
}),
rjGetPrice = Class(journey,{
	creat:function(o){
		this.o = o
		rjGetPrice.o = this.o;
	},
	doGet:function(){
		var t = $(rjGetPrice.o.ev),
			tag = t.parent().prev(),
			tArr = t.attr("pid").split(","),
			pStr = "ProID="+tArr[0]+"&Type="+tArr[1]+"&Date="+t.val();
		
		$.ajax({
			type:"GET",
			url:journey.o.uList.D,
			data:pStr,
			success: function(re){
				tag.html(re);
			}
		});
	}
}),
/*
journeyChk({flyId:'flyPeople',hotelId:'rpInfo',sendId:'sendM',f:0})
*/
journeyChked = Class($_$,{
	creat:function(o,c){
		this.o = o;
		journeyChked.o = this.o;
		if(c){
			journeyChked.o.cc = 1;
			journeyChked.o.cb = c;
		}
	},
	setVar:function(){
		newBH.o = {};
		flyOrder.o = {};
		newBH.o.manInfo = $(journeyChked.o.hotelId);
		flyOrder.o.aInput = $(journeyChked.o.flyId).find("input");
		flyOrder.o.sBox = $(journeyChked.o.sendId);
		flyOrder.o.rad = flyOrder.o.sBox.find("input:radio");
		flyOrder.bindRad();
	},
	whosyourdaddy:function(){
		journeyChked.setVar();
		journeyChked.o.form = typeof(journeyChked.o.f)=="string"?$("#"+journeyChked.o.f):$("form").eq(journeyChked.o.f);
		journeyChked.o.form.bind("submit",function(){
			
			var h = newHBNext.chkHotle(),
				f = flyOrderChk.chkMoth(),
				n = 0;
			if(h == true){
				n+=1;
			}
			if(f == true){
				n+=1;
			}
			if(n < 2){
				return false;
			}else{
				
				try{
					var aa = loger({tid:'topLog',but:this,lid:'subLog'},function(){sendUrl({url:O_o.logUrl});})
					return aa;
				}finally{
					aa = loger({tid:'topLog',but:this,lid:'subLog'},function(){sendUrl({url:O_o.logUrl});})
					if(aa == true){
						journeyChked.o.form.unbind();
						journeyChked.o.form.submit();
					}
				}
			}
		})
	}
}),
//oneDAY({tid:"#diveSelect",totalId:"#bookTotal",pid:"#prices"})
oneNight = Class($_$,{
	creat:function(o,c){
		this.o =o;
		oneNight.o = this.o;
		if(c){
			oneNight.o.cb = c;	
		}
	},
	setONS:function(){
		oneNight.o.sEle = $(oneNight.o.tid + " select");
		oneNight.o.priceBox = $(oneNight.o.totalId);
		oneNight.o.pBox = $(oneNight.o.pid);
		if(isNaN(parseInt(oneNight.o.pBox.val().split(",")[0])) == true){
			oneNight.o.ap = parseFloat(oneNight.o.pBox.val().split(",")[0].match(/\d+/));
			oneNight.o.cp = parseFloat(oneNight.o.pBox.val().split(",")[1].match(/\d+/));
		}else{
			oneNight.o.ap = parseFloat(oneNight.o.pBox.val().split(",")[0]);
			oneNight.o.cp = parseFloat(oneNight.o.pBox.val().split(",")[1]);
		}
	},
	getPrice:function(){
		var yp = 0;
		oneNight.o.price = 0;
		$.each(oneNight.o.sEle,function(){
			var tn = $(this).attr("name"),np = parseInt($(this).val());
			if(tn == "BookNum"){
				yp += np*oneNight.o.ap;
			}
			if(tn == "BookChildNum"){
				yp += np*oneNight.o.cp;
			}
		})
		oneNight.o.price = yp;
		oneNight.o.priceBox.html("&yen;"+oneNight.o.price);
	},
	bindEven:function(){
		oneNight.o.sEle.bind("change",function(){
			oneNight.getPrice();
		})
	},
	inntONS:function(){
		oneNight.setONS();
		oneNight.bindEven();
		oneNight.getPrice();
	}
}),
//checkPay({pe:"#payee",pr:"#payer",pn:"#productName",pp:"#price",pt:"payNow",nb:"#goNext",f:0})
paySetp = Class($_$,{
	creat:function(o,c){
		this.o = o;
		paySetp.o = this.o;
		if(c){
			paySetp.o.cb = c;
		}
	},
	setDefOp:function(){
		paySetp.o.alerterCss = "padding:10px;width:250px;text-align:center;text-align:center;";
		paySetp.o.alerterOt = 1500;
		paySetp.o.subBut = $(paySetp.o.nb);
		if(paySetp.o.f != undefined){
			paySetp.o.forms = typeof(paySetp.o.f) == "string"?$(paySetp.o.f):$("form").eq(paySetp.o.f);
		}else{
			paySetp.o.forms = $("form:first");
		}
	},
	getFirst:function(txt){
		var f = txt.substr(0,1);
		return f;
	},
	getLast:function(txt){
		var l = txt.substr(txt.length-1,txt.length);
		return l;
	},
	inputNoSpace:function(strArr,num,arr,cb){
		$.each(strArr,function(i,n){
			if(n == "" || n == " "){
				alerter({msg:paySetp.o.payNowMsg[num[i]][0],set:{css:paySetp.o.alerterCss},ot:paySetp.o.alerterOt});
				return false;
			}else{
				if(paySetp.getFirst(n) == " "){
					alerter({msg:paySetp.o.payNowMsg[num[i]][1],set:{css:paySetp.o.alerterCss},ot:paySetp.o.alerterOt});
					return false;
				}else{
					if(paySetp.getLast(n) == " "){
						alerter({msg:paySetp.o.payNowMsg[num[i]][2],set:{css:paySetp.o.alerterCss},ot:paySetp.o.alerterOt});
						return false;
					}
				}
			}
			if(arr){
				arr.push(1);
			}
			if(i == strArr.length-1 && cb != undefined){
				var a = cb;
				a();
			}
			return true;
		})
		//arr.push(1);
	},
	chkNum:function(str,num,arr){
		$.each(str,function(i,n){
			if(isNaN(n) == true){
				alerter({msg:paySetp.o.payNowMsg[num[i]][0],set:{css:paySetp.o.alerterCss},ot:paySetp.o.alerterOt});
				return false;
			}
			if(arr){
				arr.push(1);
			}
			return true;
		})
	},
	chkEmail:function(str,i,arr){
		var theReg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
	    if (!theReg.test(str)) {
			alerter({msg:paySetp.o.payNowMsg[i][0],set:{css:paySetp.o.alerterCss},ot:paySetp.o.alerterOt});
	        return false;
	    }
		if(arr){
			arr.push(1);
		}
		return true;
	},
	doSetp:function(){
		paySetp.setDefOp();
		paySetp.toCheck();
	},
	toCheck:function(){
		paySetp.o.subBut.unbind();
		paySetp.o.subBut.click(function(){
			paySetp.o.forms.submit();
		})
		paySetp.o.forms.unbind();
		if(paySetp.o.chkId.ci != undefined){
			if(paySetp.o.chkId.ci.length == 2){
				$.each($(paySetp.o.chkId.ci[0]+" input:radio"),function(){
					$(this).bind("click",function(){
						$(paySetp.o.chkId.ci[1]).val($(this).val());
						paySetp.o.method = $(paySetp.o.chkId.ci[1]).val();
					})
				})
				if(paySetp.o.method == undefined){
					paySetp.o.method = $(paySetp.o.chkId.ci[1]).val();
				}
			}else{
				paySetp.o.method = $(paySetp.o.chkId.ci[0]+" input:checked").val();
			}
		}else{
			paySetp.o.method = "0";
		}
		switch(paySetp.o.pt){
			case "payNow":
				paySetp.o.forms.submit(function(){
					return paySetp.payNow(3);
				})
			break;
			
			case "contact":
				paySetp.o.forms.submit(function(){
					return paySetp.contacts(4);
				})
			break;
			
			default:
			break
		}
	},
	contacts:function(){
		/*
		ni:"#theName",
	    mi:"#theMoblie",
	    pi:"#thePhone",
	    ei:"#theEmail",
	    ci:["#comType","#radiomethod"]
		 */
		paySetp.o.theName = $(paySetp.o.chkId.ni).val();
		paySetp.o.theMoblie = parseInt($(paySetp.o.chkId.mi).val());
		paySetp.o.thePhone = parseInt($(paySetp.o.chkId.pi).val());
		paySetp.o.theEmail = $(paySetp.o.chkId.ei).val();
		paySetp.o.contactMsg = [["姓名不能为空","姓名不能以空格开头","姓名不能以空格结尾"],["手机号码不能为空或必须是数字"],["电话号码不能为空或必须是数字"],["E-mail格式错误","E-mail不能为空"]];
		paySetp.o.payNowMsg = paySetp.o.contactMsg;
		paySetp.o.ta = [];
		
		//0未定义，全部必填,1电话确认,2电子邮件确认,3传真确认,4短信确认
		switch(paySetp.o.method){
			case "0":
				n = 4;
				paySetp.inputNoSpace([paySetp.o.theName],[0],paySetp.o.ta);
				paySetp.chkNum([paySetp.o.theMoblie,paySetp.o.thePhone],[1,2],paySetp.o.ta)
				paySetp.chkEmail(paySetp.o.theEmail,3,paySetp.o.ta);
			break;
			
			case "1":
				n = 2;
				paySetp.inputNoSpace([paySetp.o.theName],[0],paySetp.o.ta);
				paySetp.chkNum([paySetp.o.thePhone],[2],paySetp.o.ta);
			break;
			
			case "2":
				n = 2;
				paySetp.inputNoSpace([paySetp.o.theName],[0],paySetp.o.ta);
				if (paySetp.o.theEmail == "") {
					alerter({msg:paySetp.o.payNowMsg[3][1],set:{css:paySetp.o.alerterCss}});
					return false;
				}else{
					paySetp.chkEmail(paySetp.o.theEmail,3,paySetp.o.ta);
				}
			break;
			
			case "3":
				n = 2;
				paySetp.inputNoSpace([paySetp.o.theName],[0],paySetp.o.ta);
				paySetp.chkNum([paySetp.o.thePhone],[2],paySetp.o.ta);
			break;
			
			case "4":
				n = 2;
				paySetp.inputNoSpace([paySetp.o.theName],[0],paySetp.o.ta);
				paySetp.chkNum([paySetp.o.theMoblie],[1],paySetp.o.ta);
			break;
			
		}

		if(paySetp.o.ta.length != n){
			return false
		}
		paySetp.o.ta = null;
		return true;
	},
	payNow:function(n){
		paySetp.o.payee = $(paySetp.o.chkId.pe).val();
		paySetp.o.payer = $(paySetp.o.chkId.pr).val();
		paySetp.o.productName = $(paySetp.o.chkId.pn).val();
		paySetp.o.price = parseFloat($(paySetp.o.chkId.pp).val());
		paySetp.o.payNowMsg = [["付款人不能为空","付款人不能以空格开头","付款人不能以空格结尾"],["商品名称不能为空","商品名称不能以空格开头","商品名称不能以空格结尾"],["付款金额必须为数字"]];
		paySetp.o.ta = [];
		paySetp.inputNoSpace([paySetp.o.payer,paySetp.o.productName],[0,1],paySetp.o.ta,function(){paySetp.chkNum([paySetp.o.price],[2],paySetp.o.ta)});
		if(paySetp.o.ta.length != n){
			return false
		}
		paySetp.o.ta = null;
		return true;
	}
})




//释放内存,请保持在最后
$(document).bind("unload", function() {
	try {
		$_$ = null;
		$("*").unbind();
	} catch(e){}
});
window.onerror = function() { return true;}














