//--------显示日期
function initArray(){for(i=0;i<initArray.arguments.length;i++)
this[i]=initArray.arguments[i];}var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");today=new Date();hrs=today.getHours();min=today.getMinutes();sec=today.getSeconds();clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;clck=(hrs>=12)?"下午":"上午";var stnr="";var ns="0123456789";var a="";

//--------------------------------------------------选择日期
function calendar(t)
{
	var sPath = "/tonghang/calendar1.htm";
	strFeatures = "dialogWidth=210px;dialogHeight=210px;center=1;help=no;directories=no;status=no;scrollbars=no;resizable=0;menubar=0";
	st = t.value;
	//初始化日期
	//if (st==""){
	//	st=new Date();
	//}
	sDate = showModalDialog(sPath,st,strFeatures);
	t.value = formatDate(sDate, 0);
	t.focus();
}
function checkDate(t)
{
	dDate = new Date(t.value);
	if (dDate == "NaN") {t.value = ""; return;}
	iYear = dDate.getFullYear()

	if ((iYear > 1899)&&(iYear < 1950)){
		sYear = "" + iYear + ""
		if (t.value.indexOf(sYear,1) == -1){
			iYear += 100
			sDate = (dDate.getMonth() + 1) + "-" + dDate.getDate() + "-" + iYear
			dDate = new Date(sDate)
		}
	}
	t.value = formatDate(dDate);
}
function formatDate(sDate)
{
	var sScrap = "";
	var dScrap = new Date(sDate);
	if (dScrap == "NaN") return sScrap;

	iDay = dScrap.getDate();
	iMon = dScrap.getMonth();
	iYea = dScrap.getFullYear();

	sScrap = iYea + "-" + (iMon + 1) + "-" + iDay ;
	return sScrap;
}

//---------------------------------------------------选择日期结束

//--------打开一个新窗口
function OpenWindow(HttpPage)
{
  window.open (HttpPage,"win","width=700,height=500,directories=no,toolbar=no,resizsable=yes,menubar=no,scrollbars=yes,location=no");
}

//--------身份证验证
function PassPort(HttpPage)
{
  window.open (HttpPage);
}


//-------为当前窗口命名,并打开一个窗口
  function NameAndOpenWindow(HttpPage)
  {
   var selProdWnd=window.open(HttpPage,"new","resizable=yes,width=440,height=230,top=0,scrollbars=yes");
   if(selProdWnd.opener== null) 
   selProdWnd.opener = self;
   //return (false);
  }

//-------将选择的职员名及id号自动输入到表单
function LoadSelct2(Name,UserID) 
{
 if (!opener) return true;
    opener.document.forms[0].UserID.value = UserID;
 if(opener.document.forms[0].Name)
  opener.document.forms[0].Name.value = Name;
 self.close();
 //return false;
}

//-------将选择的客人自动输入到表单
function LoadSelctGuest(Name,UserID,Tel) 
{
 if (!opener) return true;
    opener.document.forms[0].UserID.value = UserID;
 if(opener.document.forms[0].Name)
  opener.document.forms[0].Name.value = Name;
 if(opener.document.forms[0].Tel)
  opener.document.forms[0].Tel.value = Tel;
 self.close();
 //return false;
}


//-------传入酒店名、id，价格，早标
function LoadHotelSelct(HotelName,HotelID,Bre,HotelPrice) 
{
 if (!opener) return true;
    opener.document.forms[0].HotelID.value = HotelID;
    opener.document.forms[0].Bre.value = Bre;
    opener.document.forms[0].HotelPrice.value = HotelPrice;
 if(opener.document.forms[0].HotelName)
  opener.document.forms[0].HotelName.value = HotelName;
 self.close();
 //return false;
}

//----------------------------------------------传入餐点
function LoadEatSelect(EatName,EatID,Which) 
{
 if (!opener) return true;

if (Which == "Bre") {
    opener.document.forms[0].BreEatID.value = EatID;
 if(opener.document.forms[0].BreakfastPlace)
  opener.document.forms[0].BreakfastPlace.value = EatName;
}

if (Which == "Lun") {
    opener.document.forms[0].LunEatID.value = EatID;
 if(opener.document.forms[0].LunchPlace)
  opener.document.forms[0].LunchPlace.value = EatName;
}

if (Which == "Sup") {
    opener.document.forms[0].SupEatID.value = EatID;
 if(opener.document.forms[0].SupperPlace)
  opener.document.forms[0].SupperPlace.value = EatName;
}

 self.close();
 //return false;
}


 //-------将选择的name2名及id2号自动输入到表单 
function LoadSelct3(Name,UserID) {
 if (!opener) return true; 
opener.document.forms[0].ID2.value = UserID; 
if(opener.document.forms[0].Name2)
 opener.document.forms[0].Name2.value = Name; 
self.close(); 
//return false; 
} 

 //-------将选择的name3名及id3号自动输入到表单 
function LoadSelct4(Name,UserID) {
 if (!opener) return true; 
opener.document.forms[0].ID4.value = UserID; 
if(opener.document.forms[0].Name4)
 opener.document.forms[0].Name4.value = Name; 
self.close(); 
//return false; 
} 


//-------将选择的时间自动输入到表单 
function LoadSelctDate(SelectDate) 
{
   if(opener.document.forms[0].TheDate) 
    opener.document.forms[0].TheDate.value = SelectDate;
    self.close(); 
//return false;
} 


//--------从cookie取值
function getCookie(Name) {
   var search = Name + "="
   if(document.cookie.length > 0) {
      offset = document.cookie.indexOf(search)
      if(offset != -1) {
         offset += search.length
         end = document.cookie.indexOf(";", offset)
         if(end == -1) end = document.cookie.length
         return unescape(document.cookie.substring(offset, end))
      }
      else return "";
   }
}

//-------------------设置cookie 
function setCookie(name, value) 
{ 
var today = new Date() 
var expires = new Date() 
expires.setTime(today.getTime() + 1000*60*60*24*365) 
document.cookie = name + "=" + escape(value) + "; expires=" + expires.toGMTString() 
} 

//--------粘入选择到表单
function LoadSelect(FormIndex,Select){

  FormIndex.focus();
  FormIndex.value=getCookie(Select);

}

//--------检查输入内容为空的函数，传递的参数为一个表单 
function CheckFormString(FormIndex){
 CheckFormStringOver = true; 
 if (FormIndex.value == "") 
 {
    CheckFormStringOver = false; 
    alert('╳，此项必填，请在此输入内容！\n\n所有带*号的项都必须准确填写!'); 
    FormIndex.focus();
    return CheckFormStringOver; 
 } 
 else 
  { 
    return CheckFormStringOver; 
  } 
} 

//-------------右键显示
function RightClick()
{
	if (event.button == 2 | event.button == 3)
	{
		alert("禁止使用右键，请用键盘进行拷贝'Ctrl键+C键'和粘贴'Ctrl键+V键'。\n\n感谢使用:旅行社业务综合管理系统&同行协作信息系统公共平台.\n\n中华旅游同行协作网:\n旅游行业强大的资源数据库\n强势业务广告网络媒体\n从业人员/企业高效电子商务操作平台\n旅游从业人员工具手册\n旅游企业信息化、解决方案专业研发提供.....\n\n---------------------中国旅游产业信息化研究所\n\n---------------------中国旅游联盟在线www.tourunion.com");
	}
}


//-------------在新窗口中打开一个团的：信息、各种财务报表
function OpenWeb(GoWeb)
{
OkWeb=document.forms[0].TeamID.value
OkWeb=GoWeb+"?TeamID=" + OkWeb
OpenWindow(OkWeb)
}

//-------------线路详细信息，调用TourMall
function LineInfo(ComID,NewsID)
{
if (ComID == "")
{
    alert('╳，你社未使用TourMall旅游超市，\n\n或此办公司系统的系统设置有误，请管理员在系统管理中设置旅游超市ID！');
    history.back(-1)
}
else
{
TourMall="http://www.tourunion.com/tourmall/" + ComID + "/line.asp?NewsID=" + NewsID
  window.open (TourMall,"TourMall");
}

}
