//浮动提示框功能 Begin ========================================
var Obj=''
document.onmouseup=MUp
document.onmousemove=MMove

function MDown(Object){
Obj=Object.id
document.all(Obj).setCapture()
pX=event.x-document.all(Obj).style.pixelLeft;
pY=event.y-document.all(Obj).style.pixelTop;
}

function MMove(){
if(Obj!=''){
  document.all(Obj).style.left=event.x-pX;
  document.all(Obj).style.top=event.y-pY;
  }
}

function MUp(){
if(Obj!=''){
  document.all(Obj).releaseCapture();
  Obj='';
  }
}

document.write("<style>");
document.write(".massage_box{position:fixed;z-index:10001;");
document.write("line-height:150%;");
document.write("FILTER: progid:DXImageTransform.Microsoft.DropShadow();");
document.write(" _position:absolute;");
document.write(" _top:expression(eval(document.compatMode && document.compatMode=='CSS1Compat') ?");
document.write("        documentElement.scrollTop");
document.write("		+(documentElement.clientHeight-this.clientHeight) / 2");
document.write("        : document.body.scrollTop");
document.write("        +(document.body.clientHeight-this.clientHeight) / 2);");
document.write("}");
document.write("</style>");
document.write('<div id="massage_box" style="display:none;">loading...</div>');
document.write('<div id="bgDiv" style="display:none"></div>');
function openWithIframe(tit,url,w,h){
    //屏幕背景变暗
	var sWidth,sHeight;
	sWidth=document.body.clientWidth;
	sHeight=document.body.scrollHeight;
	if(sHeight<window.screen.height){sHeight=window.screen.height;}
	document.getElementById("bgDiv").style.display="";
	document.getElementById("bgDiv").style.position="absolute";
	document.getElementById("bgDiv").style.top="0";
	document.getElementById("bgDiv").style.background="#000000";
	document.getElementById("bgDiv").style.filter="Alpha(Opacity=30);";
	document.getElementById("bgDiv").style.left="0";
	document.getElementById("bgDiv").style.width=sWidth + "px";
	document.getElementById("bgDiv").style.height=sHeight + "px";
	document.getElementById("bgDiv").style.zIndex = "10000";
    //显示层
    document.getElementById("massage_box").style.left = (document.body.clientWidth - w) / 2+"px";
    document.getElementById("massage_box").style.top = (screen.height - h) / 2-80+"px";
    document.getElementById("massage_box").style.screenx = (document.body.clientWidth - w) / 2+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.screeny = (screen.height - h) / 2-80+"px";//仅适用于Netscape
    document.getElementById("massage_box").style.width = w+"px";
    document.getElementById("massage_box").style.height = h+"px";
    document.getElementById("massage_box").className = "massage_box";
	var popiframe;
	popiframe = '<div style="border-width:1 1 3 1; width:100%; height:100%; background:#fff; color:#666666; font-size:12px;zIndex:1000">'
	popiframe += '<div onmousedown=MDown(massage_box) style="background:#666666; height:20px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px;color:#fff;cursor:move;padding:0 0 4px 0">'
	popiframe += '<div style="display:inline; width:200px; position:absolute;padding:3px 0 0 5px;color:#ffffff" id=pop_title>'+tit+'</div>'
	popiframe += '<span onClick="closeWithIframe()" style="float:right; display:inline; cursor:pointer;padding:3px 5px 0 0;font-size:12px;color:#ffffff;">关闭</span>'
	popiframe += '</div>'
	popiframe += '<div style="padding:5px" ><iframe src="'+url+'" width="'+(w-11)+'px"  height="'+(h-36)+'px" frameborder=0 scrolling=no></iframe></div>'
	popiframe += '</div>'
    document.getElementById("massage_box").innerHTML=popiframe;
    document.getElementById("massage_box").style.display = "";
}
function closeWithIframe(){
    document.getElementById("massage_box").style.display="none";
    document.getElementById("bgDiv").style.display="none";
}
//浮动提示框功能 End ========================================

//图片处理 Begin ===========================================
var flag=false;
function DrawImage(ImgD,w,h){
var image=new Image();
image.src=ImgD.src;
if(image.width>0 && image.height>0){
  flag=true;
  if(image.width/image.height>= w/h){
    if(image.width>w){
      ImgD.width=w;
      ImgD.height=(image.height*w)/image.width;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }else{
    if(image.height>h){
      ImgD.height=h;
      ImgD.width=(image.width*h)/image.height;
    }else{
      ImgD.width=image.width;
      ImgD.height=image.height;
    }
  }
}
}
//图片处理 End ===========================================

function get_Code(str){
document.getElementById("imgurl").src=str+'?'+Math.random()
}

function InitAjax(){
var ajax=false;
try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (E) { ajax = false; } }
if (!ajax && typeof XMLHttpRequest!='undefined') { ajax = new XMLHttpRequest(); }
return ajax;}

//全站回复
//0 刷新 NewRe 1刷新本页
ckreview=0;
function Clreview(){
  if(ckreview > 0){
    alert('请求已经发出，请等待片刻！\n\n'+'不要重复提交，谢谢！');
	return false;
  }
  return true;
}
function reviewajax(url,i){
  if(Clreview()){
     ckreview=1;
     var ChannelID = document.reform.ChannelID.value;
     var ID = document.reform.ID.value;
     var Content = document.reform.Content.value;
	 var ContentRe = document.reform.ContentRe.value;
     var Code = document.reform.Code.value;
     var Anonymity = "";
	 if(document.reform.Anonymity.checked){Anonymity = "True"}
     var getinfo = "";
	 var ajax = InitAjax();
     ajax.open("POST",url, true);
     ajax.setRequestHeader("CONTENT-TYPE","application/x-www-form-urlencoded; charset=GB2312");
     ajax.send("Action=ReviewSave&ID="+ID+"&ChannelID="+ChannelID+"&Content="+escape(Content)+"&ContentRe="+escape(ContentRe)+"&Code="+escape(Code)+"&Anonymity="+Anonymity);
     ajax.onreadystatechange = function(){
       if (ajax.readyState == 4){getinfo = ajax.responseText;
	     if(getinfo!=""){get_Code();ckreview=0;alert(getinfo)}else{get_Code();alert("发送成功");ckreview=0;
		   if(i==0){NewRe.location.reload();}else{location.href="?ID="+ID;}
		 }
		 document.reform.Content.value = "";
		 document.reform.Code.value = "";
	   }
     }
  }
  return false;
}
//全站回复 end
// -->

//点评 begin
function ClickSubmit(){
  var Msg = "<strong class=F14>出错啦！</strong>";
  var Err = 0
  if (document.myform.ReSer.value == "0"){
    Msg = Msg + "<br><font color=red><strong>·服务评分必须选择！</strong></font>";
    Err = 1;
  }
  if (document.myform.RePrice.value == "0"){
    Msg = Msg + "<br><font color=red><strong>·价格评分必须选择！</strong></font>";
    Err = 1;
  }
  if (document.myform.All.value == "0"){
    Msg = Msg + "<br><font color=red><strong>·综合评分必须选择！</strong></font>";
    Err = 1;
  }
  if (document.myform.Consume.value == ""){
    Msg = Msg + "<br><font color=red><strong>·人均消费必须填写！</strong></font>";
    Err = 1;
  }
  if (CheckMoneyNum(document.myform.Consume.value)==false){
    Msg = Msg + "<br><font color=red><strong>·人均消费填写错误！</strong></font>";
    Err = 1;
  }
  if (document.myform.Intro.value == ""){
    Msg = Msg + "<br><font color=red><strong>·消费感受必须填写！</strong></font>";
    Err = 1;
  }
  if ("{$IsIDCode}" == "True" && document.myform.Code.value == ""){
    Msg = Msg + "<br><font color=red><strong>·验证码必须填写！</strong></font>";
    Err = 1;
  }
  if ( Err == 1){
    document.getElementById("ErrMsg").innerHTML = Msg;
	document.getElementById("ErrTD").style.display = "";
	return false;
  }else{
    document.myform.submit();
  }
}

// 检测money
function CheckMoneyNum(str){
 var reg = /^[\d|\.]*$/;
 return Check( reg, str );
}
//利用正则表达式检测字符串
function Check(reg, str){
 if( reg.test( str )){
    return true;
 }
 else{
    return false;
 }
}

function om(u,str,n){
  for (var i=1;i<6;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_1.gif";
   }
  for (var i=1;i<str+1;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_2.gif";
   }
}
function oo(u,str,n){
  for (var i=1;i<6;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_1.gif";
   }
  for (var i=1;i<parseInt(str)+1;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_2.gif";
   }
}
function od(u,str,input,n){
  for (var i=1;i<6;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_1.gif";
   }
  document.myform[input].value=str;
  for (var i=1;i<str+1;i++)    {
    document.getElementById(n+i).src = u+"/icon_star_2.gif";
   }
}

var con_one_id=0;
function setTab(n){
  if(n!=con_one_id){
    document.getElementsByName("con_one")[con_one_id].style.display = "none";
    document.getElementsByName("con_one")[n].style.display = "";
    document.getElementsByName("morelink")[con_one_id].style.display = "none";
    document.getElementsByName("morelink")[n].style.display = "";
    document.getElementsByName("mTab")[con_one_id].className = "";
    document.getElementsByName("mTab")[n].className = "hover";
    con_one_id = n;
  }
}
//点评 end
