/*
'/*
'// ------------------------------------------------------------------------ //
'// Project Name       : 旅程网                                         //
'// Program Name       : Manage                                           //
'// Copyright          : COPYRIGHT (C) 2004 - 2005 BY 868E.COM        //
'// Version            : 2.0                                                 //
'// Author             : 祁文广                               //
'//                                                                          //
'// Date        By            Description                                    //
'// ---------   ------------- -----------------------------------------------//
'// 2006/01/06  祁文广        系统类库		                     //
'// ------------------------------------------------------------------------ //
*/
var $ =document.getElementById;
document.write('<div id="MaskWindow" style="position:absolute;dispaly:block;FILTER: alpha(opacity=80); background-color:#EBEBEB; z-index:2; left: 0px;"></div>')
///div不能遮住select的暂时解决方法
document.write('<iframe  style="position:absolute;z-index:3;width:expression(this.nextSibling.offsetWidth);height:expression(this.nextSibling.offsetHeight);top:expression(this.nextSibling.offsetTop);left:expression(this.nextSibling.offsetLeft);" frameborder="0" ></iframe>')
document.write('<div id="SystemWindow" style="display: none; position: absolute;z-index:4; "></div>')

document.write('<div id="SystemErrWindow" style="DISPLAY: none; POSITION: absolute;z-index:5;"></div>')
var LoadStr = '<table id="loadstr" width="218" border="0" cellpadding="1" cellspacing="1" bgcolor="#FF6600"><tr><td bgcolor="#FFF9DD"><table width="100%" border="0"><tr><td><img src="/common/images/animated_loading.gif" width="16" height="16" /></td><td>正在处理您的请求，请稍后...</td></tr></table></td></tr></table>';

///全局变量
var SiteTel = '0755-26640333,26640999  ';




function Js_System()
{
	this.Item;
}	



Js_System.prototype.MessageBox=function(Title,Note,BoxWidth,BoxHeight)
{

	var html
	
	
	html  = '<table border="0" cellpadding="0" cellspacing="0">';
	html += '<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" background="/Manage/Image/SysWindowTopBg.gif">';
    html += '<tr><td width="30"><img src="/Manage/Image/SysWindowTopLeft.gif" width="30" height="30" /></td>';
	html += '<td>$Title</td><td width="34"><img src="/Manage/Image/SysWindowTopRight.gif" width="34"   onmouseout="javascript:document.getElementById(\'SysWindowClose\').src=\'/Manage/Image/SysWindowTopRight.gif\'" id="SysWindowClose" onmouseover="javascript:document.getElementById(\'SysWindowClose\').src=\'/Manage/Image/SysWindowTopRightOnMove.gif\'"'
	html += 'onclick="javascript:document.getElementById(\'SystemWindow\').style.display=\'none\';document.getElementById(\'MaskWindow\').style.display=\'none\';document.getElementById(\'SystemErrWindow\').style.display=\'none\';parent.document.frames[\'main\'].document.body.scroll = \'yes\'" height="30" /></td>';
    html += '</tr></table></td></tr><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0">';
    html += '<tr><td width="8" background="/Manage/Image/SysWindowLeft.gif"><img src="/Manage/Image/SysWindowLeft.gif" width="8" height="29" /></td>';
    html += '<td bgcolor=white><table width="'+ BoxWidth +'" height="'+BoxHeight+'"><tr><td valign="top"><span id="SystemWindowMain">$Main</span></td></tr></table></td><td width="8" background="/Manage/Image/SysWindowRight.gif"><img src="/Manage/Image/SysWindowRight.gif" width="8" height="10" /></td>';
    html += '</tr></table></td></tr><tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0" background="/Manage/Image/SysWindowFootBg.gif">';
    html += '<tr><td width="8" height="10"><img src="/Manage/Image/SysWindowFootLeft.gif" width="8" height="10" /></td>';
    html += '<td><img src="/Manage/Image/SysWindowFootBg.gif" width="8" height="10" /></td><td width="8"><img src="/Manage/Image/SysWindowFootRight.gif" width="8" height="10" /></td>';
    html += '</tr></table></td></tr></table>';
	
	
	var SystemDiv =document.getElementById('SystemWindow') 
	if (Note == "")
	{
		Note = LoadStr;
	}
	html = html.replace('$Title',Title);
	html = html.replace('$Main',Note);
	SystemDiv.innerHTML=html;
	
	var thish=parseInt(document.body.scrollTop);
	var bodyh=parseInt(document.body.clientHeight);
	
	parent.document.frames['main'].document.body.scroll = 'no';
	
	var Mask = document.getElementById('MaskWindow');
	
	Mask.style.top = 0;
	Mask.style.width = document.body.scrollWidth;
	if (document.body.scrollHeight>document.body.clientHeight)
	{
		Mask.style.height = document.body.scrollHeight;
	}
	else
	{
		Mask.style.height = document.body.clientHeight;
	}
	Mask.style.display = "block";
	
	
	SystemDiv.style.top =document.body.scrollTop + bodyh /2 - (BoxHeight/2 + 25);
	SystemDiv.style.left = document.body.clientWidth /2 -BoxWidth/2;
	SystemDiv.style.display = "block";
	
	

	//alert( )
		/*var  s = "";
		s += "\r\n网页可见区域宽："+ document.body.clientWidth;
		s += "\r\n网页可见区域高："+ document.body.clientHeight;
		s += "\r\n网页可见区域宽："+ document.body.offsetWidth  +" (包括边线的宽)";
		s += "\r\n网页可见区域高："+ document.body.offsetHeight +" (包括边线的宽)";
		s += "\r\n网页正文全文宽："+ document.body.scrollWidth;
		s += "\r\n网页正文全文高："+ document.body.scrollHeight;
		s += "\r\n网页被卷去的高："+ document.body.scrollTop;
		s += "\r\n网页被卷去的左："+ document.body.scrollLeft;
		s += "\r\n网页正文部分上："+ window.screenTop;
		s += "\r\n网页正文部分左："+ window.screenLeft;
		s += "\r\n屏幕分辨率的高："+ window.screen.height;
		s += "\r\n屏幕分辨率的宽："+ window.screen.width;
		s += "\r\n屏幕可用工作区高度："+ window.screen.availHeight;
		s += "\r\n屏幕可用工作区宽度："+ window.screen.availWidth;
		alert(s);
		*/
}

Js_System.prototype.LoadWin=function(Title)
{
	var html=""
	html +='<table width="200" border="0" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">'
	html +='<tr><td bgcolor="#F3F3F3"><table width="200" border="0" cellpadding="0" cellspacing="0">'
	html +='<tr><td>&nbsp;$Title</td></tr><tr><td height="41"><img src="/common/images/loading4.gif" width="189" height="11" /></td>'
	html +='</tr></table></td></tr></table>'
	
	var SystemDiv =document.getElementById('SystemWindow') 
	html = html.replace('$Title',Title);
	SystemDiv.innerHTML=html;
	
	var thish=parseInt(document.body.scrollTop);
	var bodyh=parseInt(document.body.clientHeight);
	
	var Mask = document.getElementById('MaskWindow');
	
	Mask.style.top = 0;
	Mask.style.width = document.body.scrollWidth;
	Mask.style.height = document.body.scrollHeight;
	Mask.style.display = "block";
	
	
	SystemDiv.style.top =document.body.scrollTop + bodyh /2 - (100/2 + 25);
	SystemDiv.style.left = document.body.clientWidth /2 -200/2;
	SystemDiv.style.display = "block";
	
	
}


Js_System.prototype.Drag=function(sender)
{
    sender.left=parseInt(sender.left)+event.x-x;
    sender.top=parseInt(sender.top)+event.y-y;
}

Js_System.prototype.ErrWin=function(msg,left,top)
{
	var html = "";
	html +=	'<table border="0" cellpadding="0" cellspacing="0">'
	html += '<tr><td width="5" height="6"><img src="/common/images/dialog/titlewin/top_left.gif" width="5" height="6"></td>'
	html += '<td background="/common/images/dialog/titlewin/top_linebg.gif"><img src="/common/images/dialog/titlewin/top_linebg.gif" width="5" height="6"></td>'
	html += '<td width="5" height="6"><img src="/common/images/dialog/titlewin/top_right.gif" width="5" height="6"></td>'
	html += '</tr><tr><td background="/common/images/dialog/titlewin/leftbg.gif"><img src="/common/images/dialog/titlewin/leftbg.gif" width="5" height="1"></td>'
	html += '<td bgcolor="#FEFACF">$Main</td><td background="/common/images/dialog/titlewin/rightbg.gif"><img src="/common/images/dialog/titlewin/rightbg.gif" width="5" height="1"></td>'
	html += '</tr><tr><td width="5" height="4"><img src="/common/images/dialog/titlewin/boot_left.gif" width="5" height="4"></td>'
	html += '<td background="/common/images/dialog/titlewin/boot_bg.gif"><img src="/common/images/dialog/titlewin/boot_left_1.gif" width="37" height="4"></td>'
	html += '<td width="5" height="4"><img src="/common/images/dialog/titlewin/boot_right.gif" width="5" height="4"></td>'
	html += '</tr><tr><td height="4" colspan="3"><img src="/common/images/dialog/titlewin/boot_jiao.gif" width="42" height="11"></td>'
	html += '</tr></table>'
	
	var SystemErrWin = document.getElementById('SystemErrWindow');
	html =html.replace("$Main",msg)
	SystemErrWin.innerHTML = html;
	
	SystemErrWin.style.top =top -20;
	SystemErrWin.style.left = left-20;
	SystemErrWin.style.display = "block";	
}

Js_System.prototype.ErrBottonWin=function(msg,left,top)
{
	var html = "";
	html += '<table border="0" cellpadding="0" cellspacing="0"><tr>'
	html += '<td colspan="3"><img src="/common/images/dialog/titlewin/1_top_jiao.gif" width="37" height="11" /></td>'
	html += '</tr><tr><td width="4" height="4"><img src="/common/images/dialog/titlewin/1_top_left.gif" width="4" height="4" /></td>'
	html += '<td background="/common/images/dialog/titlewin/1_top_bg.gif"><img src="/common/images/dialog/titlewin/1_top_left_1.gif" width="31" height="4" /></td>'
	html += '<td width="4" height="4"><img src="/common/images/dialog/titlewin/1_top_right.gif" width="4" height="4" /></td>'
	html += '</tr><tr><td background="/common/images/dialog/titlewin/1_left_bg.gif"><img src="/common/images/dialog/titlewin/1_left_bg.gif" width="4" height="1" /></td>'
	html += '<td bgcolor="#FEFAD3">$Main</td><td background="/common/images/dialog/titlewin/1_right_bg.gif"><img src="/common/images/dialog/titlewin/1_right_bg.gif" width="4" height="1" /></td>'
	html += '</tr><tr><td width="4" height="4"><img src="/common/images/dialog/titlewin/1_foot_left.gif" width="4" height="4" /></td>'
	html += '<td background="/common/images/dialog/titlewin/1_foot_bg.gif"><img src="/common/images/dialog/titlewin/1_foot_bg.gif" width="11" height="4" /></td>'
	html += '<td width="4" height="4"><img src="/common/images/dialog/titlewin/1_foot_right.gif" width="4" height="4" /></td></tr></table>'
	var SystemErrWin = document.getElementById('SystemErrWindow');
	html =html.replace("$Main",msg)
	SystemErrWin.innerHTML = html;
	
	SystemErrWin.style.top =top;
	SystemErrWin.style.left = left;
	SystemErrWin.style.display = "block";	
}

Js_System.prototype.ShowLoadWin=function()
{
	$('SystemWindow').innerHTML = LoadStr;
	$('SystemWindow').style.top =document.documentElement.scrollTop;
	$('SystemWindow').style.left = document.body.clientWidth-200;
	$('SystemWindow').style.display = "block";		
}
Js_System.prototype.HiddenLoadWin=function()
{
	$('SystemWindow').style.display = "none";		
}

Js_System.prototype.HiddenErrWin=function()
{
	document.getElementById('SystemErrWindow').style.display = "none";	
}

Js_System.prototype.ShowErr=function(ErrName,ErrMsg)  
{
	alert('您在'+ErrName+'的时候，发生了错误:\r\n\r\n  '+ErrMsg);
}
Js_System.prototype.ShowOk=function(Msg)  
{
	alert(Msg);
}


Js_System.prototype.ShowMarkDiv=function()
{
	document.all["MarkDiv"].style.display="block";
}

/*
获取物件坐标
*/

function getPosition(_object)
{
	var _top = _object.offsetTop;
	var _left = _object.offsetLeft;
	while(_object = _object.offsetParent)
	{
		_top += _object.offsetTop;
		_left += _object.offsetLeft;
	}
	return{ top: _top, left: _left };
}


//日期格式检查
function isDateString(str) {
	var reg=/^\d{4}-[0-1]?\d{1}-[0-3]?\d{1}$/;
	return reg.test(str);
}
///字符串转日期
function stringToDate(sDate, bIgnore)
{	var bValidDate, year, month, day;
	var iaDate = new Array(3);
	
	if (bIgnore) 
	 bValidDate = true
	else
	 bValidDate = isDateString(sDate);
	
	if (bValidDate)
	{  iaDate = sDate.toString().split("-");
		year = parseFloat(iaDate[0]);
		month = parseFloat(iaDate[1]) - 1;
		day=parseFloat(iaDate[2]);
		return (new Date(year,month,day));
	}
	else 
	return (new Date(1900,1,1));
}
///日期比较
function CheckDate(strDate1,strDate2) {
	//var tmp1=strDate1.split('-');
	//var tmp2=strDate2.split('-');
	//var date1=eval('new Date('+tmp1[0]+','+tmp1[1]+','+tmp1[2]+')');
	//var date2=eval('new Date('+tmp2[0]+','+tmp2[1]+','+tmp2[2]+')');
	//return (date2>date1);
	return(stringToDate(strDate1, true)<stringToDate(strDate2, true));
}

///判断预定日期是否大于20天
function compareDate(strDate1,strDate2) {
	var tmp1=strDate1.split('-');
	var tmp2=strDate2.split('-');
	var date1=eval('new Date('+tmp1[0]+','+tmp1[1]+','+tmp1[2]+')');
	var date2=eval('new Date('+tmp2[0]+','+tmp2[1]+','+tmp2[2]+')');
	if ((date2.valueOf()-date1.valueOf())>=20*24*60*60*1000)
	{
		return true;
	}
	else
	{
		return false;
	}
}

///判断预定日期是否在60天以后
function compareDate1(strDate1,strDate2) {
	var tmp1=strDate1.split('-');
	var tmp2=strDate2.split('-');
	var date1=eval('new Date('+tmp1[0]+','+tmp1[1]+','+tmp1[2]+')');
	var date2=eval('new Date('+tmp2[0]+','+tmp2[1]+','+tmp2[2]+')');
	if ((date2.valueOf()-date1.valueOf())>=60*24*60*60*1000)
	{
		return true;
	}
	else
	{
		return false;
	}
}

///返回星期几
function getWeek(Year,Month,Day,cn)
{
	
	var d,s, x;
	var x = new Array("星期日", "星期一", "星期二");
	var x = x.concat("星期三","星期四", "星期五");
	var x = x.concat("星期六");
	 
	var d = new Date();
	d.setFullYear(Year);
	d.setMonth(Month);
	d.setDate(Day);
	s = d.getDay();
	
	
	s = (cn == 1) ? x[s]:s;
	
	return s;
}
