var mdiv=document.createElement("div"),timeOut=null;
function rmtips(){
	try {
		if(timeOut){window.clearTimeout(timeOut);timeOut=null}
		if(mdiv){document.body.removeChild(mdiv);}
	}catch(e){
		//alert(e);
	}
		
}
function ycrmtips(){
	window.clearTimeout(timeOut);
	timeOut=window.setTimeout('rmtips()',100);
}
//动态生成提示框
function tips(a,b,c){
	    var html='';
		mdiv.className='zn_room_tips';
		mdiv.style.width=c+'px'
		mdiv.style.left=(gL(a)-parseInt(mdiv.style.width)/2+50)+'px';		
	    html+=b;
	    mdiv.innerHTML=html;
	    rmtips();		
	    a.onmouseout=ycrmtips;
	    document.body.appendChild(mdiv);	
	    mdiv.style.top=(gT(a)+20)+'px';
}

function _g(id){return document.getElementById(id)}
function gL(x){var l=0;while(x){l+=x.offsetLeft;x=x.offsetParent;}return l}
function gT(x){var t=0;while(x){t+=x.offsetTop;x=x.offsetParent;}return t}


//动态生成提示框
function tips2(a,b,c,d,e,f){  
	    //this,v1,支付方式,奖金,附加服务,担保
	    var html='';
	    if(b=='v1'){
		mdiv.className='zn_room_tips';
		mdiv.style.width='400px';
		mdiv.style.left=(gL(a)-parseInt(mdiv.style.width)/2+35)+'px';		
			html+='<div class="zn_rt_con">';
		if(c=="T")
		{
		   if(d!="")
		    {
    //		    _plan.description.Promotion = _plan.description.Promotion.replace("\u4F4F\u54EA","\u672C\u7AD9");
    //		    _plan.description.Promotion = _plan.description.Promotion.replace("\u827A\u9F99","\u672C\u7AD9");
    //		    _plan.description.Promotion = _plan.description.Promotion.replace("e\u9F99","\u672C\u7AD9");
			    html+='<p class="zn_rt_con_jj" '+isHotelBack_display+'>网上成功订购此房型,每间夜可获得<span style="color:Red">'+d+'</span>元点评奖金(如您订购一间住两晚或两间住一晚,均为两夜间,入住结束后返回网站点评,可以获得<span style="color:Red">'+(d*1*2)+'</span>元点评奖金)</p>';
		    }
		    if(f!="null"&&f)
		    {
		        f= f.replace("艺龙","本站");
		        f= f.replace("elong","本站");
		        f= f.replace("住哪","本站");
		        
			    html+='<p class="zn_rt_con_db">'+f+'</p>';
			    html+='<p class="zn_rt_con_fj">支付方式：'+GetPaymentType2(c);
		    }
		    if(e!="null"&&e)
		    {
			    html+='<br/>'+e;
			    html+='</p>';		
			    html+='</div>';
	        }
	    }else{
	        
	    }
	}
	
    mdiv.innerHTML=html;
	rmtips();		
	a.onmouseout=ycrmtips;
	document.body.appendChild(mdiv);	
	mdiv.style.top=(gT(a)+20)+'px';
}

function GetPaymentType2(f){
	if(f=='T'){
		return '现 付';
	}else if(f=='S'){
		return '预 付';	
	}else if(f=='Y'){
		return '预 付';
	}
}

//保留几位小数
function round(num,length){
    
    var v=1;
    for(var i=0;i<length;i++)
    {
        v=v*10;
    }
    
    num=num*v;
    num=Math.round(num);
    return (num/v).toFixed(length);
    
}
