﻿// JScript 文件

function closeDiv()
{
  if(document.getElementById('eMeng')!=null)
  {
    document.getElementById('eMeng').style.visibility='hidden';
  }
}

  function checkNaN()
{
   var code=event.keyCode;
   if(code<48 || code>57)
   {
     event.returnValue=false;
   }
   else
     event.returnValue=true;
}

function colorpick(field){
   var rtn = window.showModalDialog("color.aspx","","dialogWidth:225px;dialogHeight:170px;status:no;help:no;scrolling=no;scrollbars=no");
   if(rtn!=null)
   {
	field.style.background=rtn;
	field.value=rtn;
	}
 	return;
}

function getcount(txt,lbl)
           {
             var text=document.getElementById(txt);
             var label=document.getElementById("Count"+lbl);
             label.value=text.value.length;
           }
           
function CheckAll(form)
{
    for (var i=0;i<document.all.length;i++)
    {
        var e = document.all[i];
        if (e.name != 'chkall' && e.type=="checkbox")
            e.checked = document.getElementById("chkall").checked;
    }
}

function checkdel()
{
  return confirm("你确定要执行操作吗？");
}

function clickcheck(therow)
{
var j=0;
  for (var i=0;i<document.all.length;i++)
    {
        var e = document.all[i];
        if (e.name != 'chkall' && e.type=="checkbox")
        {
           if(therow==j)
            {
               if(e.checked==false)
                  e.checked=true;
                else
                  e.checked=false;
            }
            j=j+1;
        }
     }   
}

function loads()
{
 window.location.reload();
}

 function trim(str)
 {
   return str.replace(/(^\s*)|(\s*$)/g,"");
 }

function Fcalendar(field){
   var rtn = window.showModalDialog("../Calende.aspx","","dialogWidth:320px;dialogHeight:200px;status:no;help:no;scrolling=no;scrollbars=no");
   if(rtn!=null)
	document.getElementById(field).value=rtn;
 	return;
   }
   
function submitfrm(){ //提交表单
	var opt={
    		method: 'post',		
    		postBody: 'errcontent='+$F('TextBox1')+'&errurl='+$F('HURL'),
    		onSuccess: function(t) {
				$('errshow').style.display='none';
			alert('提示：发送成功！');
			document.getElementById('TextBox1').value='';
    		},
    		on404: function(t) {
				$('errshow').style.display='';
    	    	alert('Error 404: 页面未找到');
    		},
    		onFailure: function(t) {
				$('errshow').style.display='';
       	 		alert('Error ' + t.status + ' -- ' + t.statusText);
			}

		};
	new Ajax.Request('errAdd.aspx',opt);
}

function updateErr()
{
  var errcontent=document.getElementById("TextBox1");
 // if($F('TextBox1')=='')
 if(errcontent.value=='')
  {
    alert("提示：请填写简要介绍！");
    errcontent.focus();
    return false;
  }
  submitfrm();
}

function showCZ(ID)
{
   document.getElementById("results").style.display='';
   document.getElementById("mainframe").src='HallCZdetail.aspx?id='+ID;
}

function ShowOrgCZ(ID)
{
   document.getElementById("results").style.display='';
   document.getElementById("mainframe").src='OrgCZdetail.aspx?id='+ID;
}

 function LogOut()
     {
           document.body.filters.item(0).opacity=40;
           parent.leftFrame.document.body.filters.item(0).opacity=40;
           parent.mainFrame.document.bgColor='WhiteSmoke';
          // parent.mainFrame.document.body.filters.item(0).opacity=40;
           parent.bottomFrame.document.body.filters.item(0).opacity=40;
           if(confirm("你确定要退出后台吗？"))
           {
             return true;
           }
           else
           {
           document.body.filters.item(0).opacity=100;
           parent.leftFrame.document.body.filters.item(0).opacity=100;
           parent.mainFrame.document.bgColor='#ffffff';
        //   parent.mainFrame.document.body.filters.item(0).opacity=100;
           parent.bottomFrame.document.body.filters.item(0).opacity=100;
            return false;
            }
     }
     
     function CheckHotelSearch()
     {
        var flag=false;
        var citys=document.getElementsByName("selectCity");
        for(var i=0;i<citys.length;i++)
        {
           if(citys[i].checked)
           {
            flag=true;
            break;
            }
        }
        if((!flag) && document.getElementById("otherCity").value=="")
        {
            alert("提示：请选择城市！");
            return false;
        }
        if(document.getElementById("inTime").value=="")
        {
           alert("提示：请输入入店日期！");
           return false;
        }
        if(document.getElementById("outTime").value=="")
        {
           alert("提示：请输入离店日期！");
           return false;
        }
        return true;
     }