<!--
/* Javascript Document 
 .....................................................................................
 .. www.ectrip.com V 3.1 Sys Public Javascript									    ..
 ..	说明：忽略所有javascript 错误                                                      ..
 ..	设计：肖一兵 深圳鼎游信息技术有限公司 Design Time: 2007年01月23日 星期二 10:00         ..
......................................................................................*/
//隐藏错误
var sysTitle="畅游网后台管理系统";
var errTitle="畅游网后台管理系统温馨提示您：";
var errImgErr="<img src='/ticket/images/li_err.gif' align='absmiddle'  height='16'/>";
var errImgOk="<img src='/ticket/images/li_ok.gif' align='absmiddle' height='16'/>";
var loading="<div style=\"margin:5px; padding:5px; border:2px #FFFFFF dotted;\"><img src=\"/ticket/images/loading.gif\" alt=\"\" align=\"absmiddle\" />&nbsp;Loading....</div>";

//function killErrors() {
//  return true;
//}
//window.onerror = killErrors; 
function getDiv(divid){
	return document.getElementById(divid); 
}
//显示 隐含 
function show(strtype){
	if (window.navigator.userAgent.indexOf("MSIE")>=1)
    document.all.item(strtype).style.display = "block";
	else
	getDiv(strtype).style.display = "block";
	//MM_showHideLayers(strtype,'','show');
   }
function hide(strtype){
	if (window.navigator.userAgent.indexOf("MSIE")>=1)
	document.all.item(strtype).style.display = "none";
	else
	getDiv(strtype).style.display = "none";
	//MM_showHideLayers(strtype,'','hide');
}
//显示 隐含 

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function openwin(url,wid,hei,reload)
{
  var str;
  if(url==null)
     {
      alert('您的URL不能为空!');
      return;
     }
  
  if(wid==null || wid=='')
     wid=450;
  if(hei==null || hei=='')
     hei=360;
 
  str=window.showModalDialog('/ticket/system/openwin.html',url,'dialogWidth:'+wid+'px;dialogHeight:'+hei+'px;status:no;scrollbars=no;scroll=no;help:0;center:1');
  if(reload==true&&str!="login"&&str!="no"&&eval("typeof("+str+")")!='undefined'){
	 location.reload();
  }
  if(str=="login")
     window.top.location.replace("/ticket/system/");
  return str;           
}
//刷新 showModalDialog 
function F5_reload(){
var url=self.location.toString();
if (event.keyCode==116)	
window.self.location=url;
}

//刷新 showModalDialog 
function F5_reload_01(){
//var url=self.location;
//alert("刷新窗口！");
//window.location=url; 
if (event.keyCode==116)
reload();
}

//document.onkeydown=F5_reload();
//document.onkeyup=F5_reload(); 
//document.onkeypress=F5_reload(); 

function openwin1(url,wid,hei,reload)
{
  var str;
  //alert(url);
  if(url==null)
     {
      alert("您的URL不能为空!");
 
      return;
     }
  
  if(wid==null||wid=='')
     wid=470;
  if(hei==null||hei=='')
     hei=360;
 
  str=window.showModalDialog(url,window,'dialogWidth:'+wid+'px;dialogHeight:'+hei+'px;status:no;scrollbars=no;scroll=no;help:0;center:1');
  
  if(str!='0' && reload==true)
     window.location.reload(); 
	 
  return str;           
}


function opennew(url, width, height) {
	var sFeature;
	if (width==null) {
		sFeature = "width=300,height=400";
	} else {
		sFeature = "width="+width+",height="+height;
	}
	window.open(url,"_blank",sFeature);
}

function DeleteSpaces(str)   
{
	var count = 0;
	for (var i = 0; i < str.length; i++) 
	{	
		if (str.charAt(i) == " ") 
		{		
			count++;
		}
		else
		{	
			break;
		}
	}
	str = str.substring(count, str.length);
	count = 0;	
	for (var i = str.length; i >=0; i--) 
	{	
		if (str.charAt(i - 1) == " ") 
		{		
			count++;
		}
		else
		{	
			break;
		}
	}	
	str = str.substring(0, str.length - count);
	return str;
}



function getSearch(){
var chaxunStr="";
if(eval("typeof("+"chaxun"+")")!='undefined'){
	if(chaxun==1)
		return chaxunStr="没有统计到任何数据，请修改条件重新统计！";	
	else if(chaxun==2)
		return chaxunStr="没有搜索到任何数据，请修改条件重新搜索！";	
	else if(chaxun==3)
		return chaxunStr="没有任何数据提供分析，请修改条件重新分析！";	
	else if(chaxun==99999)
		return chaxunStr="暂时没有任何数据，请稍后访问！";	
	else
		return chaxunStr="没有查询到任何数据，请修改条件重新查询！";	
}else{
	return chaxunStr="没有查询到任何数据，请修改条件重新查询！";	
}

}
//获取热点样式

function checkReport(str){
var num=0;
num=parseInt(str.match(/\d+/));
if(getDiv("main_errors")&&getDiv("orderList")){
//	getDiv("orderList").style.display="block";
//	getDiv("orderList").innerHTML=loading;
	if (num==0){
	getDiv("main_errors").style.display="block";
	getDiv("orderList").style.display="none";
	getDiv("main_errors").innerHTML="<div class=\"red left\">"+errImgErr+" "+getSearch()+"<div>";
	}else{
	getDiv("orderList").style.display="block";
	}
}else if(getDiv("main_errors")==null&&getDiv("orderList")){
	if (num==0){
	getDiv("main_errors").innerHTML="<div class=\"red left\">"+errImgErr+" "+getSearch()+"<div>";
	}else{
	getDiv("orderList").style.display="block";
	}
}
if (num==99999)
getDiv("orderList").style.display="block";
}
//获取热点样式
function getHot() {
var hotid= new Array("hot_zdtj","hot_tj","hot_btj","hot_hotline","hot_jdline","hot_qy","hot_ty","hot_yx","hot_wx","hot_qd");
var hotype= new Array("重点推荐","推荐","不推荐","热点","经典","启用","停用","有效","无效","启动");
var hotclass= new Array("yellow","red","gray","red","blue","green","gray","green","gray","green");
var trclass= new Array("tr_bg_ok","tr_bg_ok","tr_bg_ok","tr_bg_ok","tr_bg_ok","tr_bg_ok","tr_bg_no","tr_bg_ok","tr_bg_no","tr_bg_ok");
var report=0;
var reportStr="";
var getHotId;
	if(document.getElementById("boardlist")){
		getHotId=document.getElementById("boardlist");
	}else if(document.getElementById("deplist")){
		getHotId=document.getElementById("deplist");
	}
	else if(document.getElementById("syslist")){
		getHotId=document.getElementById("syslist");
	}
	//报表控制
	//if(eval("typeof("+"imgUrl"+i+")")!='undefined'){//}
	if(document.getElementById("report1")){
		getHotId=document.getElementById("report1");
		report=1;
		reportStr="_report";
	}else if(document.getElementById("report1_1")){
		getHotId=document.getElementById("report1_1");
		report=1;
		reportStr="_report";
	}		
		
	if(getHotId){
		if (getHotId.rows.length==1){			
			if(getDiv("sysmain")&&hideErrId()==0){
			getDiv("main_errors").style.display="block";
			getDiv("sysmain").style.display="none";
			getDiv("main_errors").innerHTML="<div class=\"red left\">"+errImgErr+" "+getSearch()+"<div>";
			}else if(getDiv("sysmain")&&hideErrId()==1){
			getDiv("sysmain").style.display="none";
			}
			return false;
		}else{
		//getHotId.style.display="block";
		var col=getHotId.cells.length/getHotId.rows.length;
			for (i=col; i<getHotId.cells.length; i++){							
					for (var j=0; j<=hotype.length-1; j++){	
						if ((DeleteSpaces(getHotId.cells[i].innerText)==DeleteSpaces(hotype[j]))){
						getHotId.cells[i].className=hotclass[j]+reportStr;
						getHotId.rows[parseInt(i/col)].className=trclass[j]+reportStr;
						getHotId.rows[parseInt(i/col)].title=hotype[j];
						}else if(document.getElementById(hotid[j])){
						document.getElementById(hotid[j]).className=hotclass[j];
						}
					}
					if((DeleteSpaces(getHotId.cells[i].innerText).indexOf("条记录")!=-1)){
						checkReport(DeleteSpaces(getHotId.cells[i].innerText));/*校验报表记录数是否为0*/
					}
					if((DeleteSpaces(getHotId.cells[i].innerText).indexOf("总人数：")!=-1)){
						checkReport(DeleteSpaces(getHotId.cells[i+1].innerText));/*校验报表人数是否为0*/
					}
			}
		}
		
	}
}

//获取后台标题
function getMainTitle(){
	var titleText=new String(sysTitle);	
	for (var i=0; i<10; i++){	
		if(document.getElementById("location0"+i)){
			titleText=titleText+" >> "+document.getElementById("location0"+i).innerText;
		}
	}	
	window.top.document.title=titleText;
	
}

//禁止右键
if (window.Event) 
  document.captureEvents(Event.MOUSEUP); 
function nocontextmenu() 
{
 event.cancelBubble = true
 event.returnValue = false;
 return false;
}

//** iframe自动适应页面 **//

//输入你希望根据页面高度自动调整高度的iframe的名称的列表
//用逗号把每个iframe的ID分隔. 例如: ["myframe1", "myframe2"]，可以只有一个窗体，则不用逗号。

//定义iframe的ID
var iframeids=["main_content"]

//如果用户的浏览器不支持iframe是否将iframe隐藏 yes 表示隐藏，no表示不隐藏
var iframehide="yes"

function dyniframesize() 
{
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++)
{
        if (document.getElementById)
{
//自动调整iframe高度
dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
if (dyniframe[i] && !window.opera)
{
dyniframe[i].style.display="block"
if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) //如果用户的浏览器是NetScape
dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight; 
else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) //如果用户的浏览器是IE
dyniframe[i].height = dyniframe[i].Document.body.scrollHeight;
}
}
//根据设定的参数来处理不支持iframe的浏览器的显示问题
if ((document.all || document.getElementById) && iframehide=="no")
{
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function autoIframe(){
//if (window.addEventListener)
//window.addEventListener("load", dyniframesize, false)
//else if (window.attachEvent)
//window.attachEvent("onload", dyniframesize)
//else
//dyniframesize();
var width;
var widthD;
widthD=261;
width=parseFloat(screen.width);
if (width<1024)
width=1016;
//alert(parent.document.all.main_left.style.display);
if(parent.document.all("main_left")){
if (parent.document.all.main_left.style.display=="none")
widthD=261-181;
}
if (window.navigator.userAgent.indexOf("MSIE")>=1){
	if(parent.document.all("main_content")){
		
		if(document.body.scrollHeight<250)
			parent.document.all("main_content").style.height=250;
		else
			parent.document.all("main_content").style.height=document.body.scrollHeight;
			
	parent.document.all("main_content").style.width=(width-widthD)+"px"; 
	//alert(parent.document.all("main_content").style.width);
	//parent.document.all("main_content").style.width=parent.document.all.main_mid.style.width; 
	//alert(document.body.scrollWidth);
	//parent.document.all("main_content").style.width=parent.document.all.main_mid.clientWidth;
	//parent.document.all("main_content").style.width=document.body.scrollWidth;
	}
}else{
	if(getDiv("main_content")!=null){	
	main_content.height=contentDocument.body.scrollHeight;
	parent.document.all("main_content").style.width=(width-widthD)+"px"; 
	//main_content.width=parent.main_mid.width; 
	
	//parent.document.all("main_content").style.width=parent.document.all.main_mid.clientWidth;
	//parent.document.all("main_content").style.width=document.body.scrollWidth;
	}
}


}

//错误信息判断
function hideErrId() 
{
	var ifshow=0;
	if (getDiv("main_errors")){
		var lengthErr=getDiv("main_errors").getElementsByTagName("li").length;
		if (DeleteSpaces(getDiv("main_errors").innerHTML)==""||DeleteSpaces(getDiv("main_errors").innerHTML)=="<!--错误ID-->"){
			getDiv("main_errors").style.display="none";//MM_showHideLayers(strtype,'','hide');//hide("main_errors");
			return ifshow=0;
		}else{
			getDiv("main_errors").style.display="block";
			getDiv("main_errors").innerHTML=getDiv("main_errors").innerHTML.replace("系统提示:",errTitle);
			return ifshow=1;
		}
		
		if (lengthErr>0){
		  for (i=0; i<lengthErr; i++){
			 // if ((getDiv("main_errors").getElementsByTagName("li"))[i].innerText=="null")
			  
			 // getDiv("main_errors").innerHTML=getDiv("main_errors").innerHTML.replace("null","意外错误，请您重新试一试");
		  }
		}
	
	}
}


//分页判断
function hidePageId() 
{
	if (getDiv("publicPage")){
		if (DeleteSpaces(getDiv("publicPage").innerHTML)==""){
			getDiv("publicPage").style.display="none";//MM_showHideLayers(strtype,'','hide');//hide("main_errors");
		}else{
			getDiv("publicPage").style.display="block";
		}
	}	
}

function disableRightClick(e)
{ 
  getMainTitle();//获取后台标题
  hideErrId();//错误信息判断 
  getHot();//获取热点样式
  hidePageId();//分页判断
  setInterval('autoIframe()',500);//自动适应Iframe
  var message = "Right click disabled";
  
  if(!document.rightClickDisabled) // initialize
  {
    if(document.layers) 
    {
      document.captureEvents(Event.MOUSEDOWN);
      document.onmousedown = disableRightClick;
    }
    else document.oncontextmenu = disableRightClick;
    return document.rightClickDisabled = true;
  }
  if(document.layers || (document.getElementById && !document.all))
  {
    if (e.which==2||e.which==3)
    {
      alert(message);
      return false;
    }
  }
  else
  {
    return false;
  }

//document.oncontextmenu = nocontextmenu;  // for IE5+
//document.onmousedown =nocontextmenu ; // for all others

}
//disableRightClick();

function closewindow() { 
   window.returnValue ="no";
   window.close();  
	}
function goto(LocationUrl) {
   window.location=LocationUrl; 
	}
function alertmsg(err) {
   alert(err); 
	}
	
//报表操作
function reportOpen(url,width,height,reloade){
	if(url=="")
		alert(errTitle+"1、系统参数意外错误");
	else
		var isReload = openwin( url,width,height,reloade);
	}

//-->