function over(id){
	id.style.backgroundColor = "#F0F0F0";
}
function out(id){
	id.style.backgroundColor = "#FFFFFF";
}
function hover(id){
	id.style.color = "#ffffff";
}
function hout(id){
	id.style.color = "#a1a1a1";
}

function over1(id){
	id.className ="sort_hover";
}
function out1(id){
	id.className ="sort_hout";
}
function sortover(id){
	id.style.color = "#ff6600";
}
function sortout(id){
	id.style.color = "#636363";
}
function xt(doing,id){
	if(doing=='on')
	{
		var str=id.substr(1);
		if(document.getElementById("l"+str))document.getElementById("l"+str).style.color ="#ff6600";
		if(document.getElementById("e"+str))document.getElementById("e"+str).style.color ="#ff6600";
	}
	if(doing=='out')
	{
		var str=id.substr(1);
		if(document.getElementById("l"+str))document.getElementById("l"+str).style.color ="#636363";
		if(document.getElementById("e"+str))document.getElementById("e"+str).style.color ="#636363";
	}
}
function Preview(imgFile){
	document.getElementById("imagead").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
	document.getElementById("imagead").style.width="330px";
	document.getElementById("imagead").style.height="222px";
	document.getElementById("imagead").innerHTML="";
	document.getElementById("imagead").style.border="none";
}
function Preview1(imgFile){
	document.getElementById("imagead").filters.item("DXImageTransform.Microsoft.AlphaImageLoader").src = imgFile.value;
	document.getElementById("imagead").style.width="200px";
	document.getElementById("imagead").style.height="150px";
	document.getElementById("imagead").innerHTML="";
	document.getElementById("imagead").style.border="none";
}
function setborder(list,setcolor,setcolorback,colorkey){
	document.getElementById("ad"+list[0]).style.borderColor=list[1];
	document.getElementById("tele"+list[0]).style.backgroundColor =list[2];
	document.getElementById("tele"+list[0]).style.color =list[1];
	document.getElementById("com"+list[0]).style.backgroundColor =list[1];
}
function bookmarksite(title, url){
		if (document.all)window.external.AddFavorite(url, title);
		else if (window.sidebar)window.sidebar.addPanel(title, url);
}
function fEvent(sType,oInput){
	switch (sType){
		case "focus" :
			oInput.isfocus = true;
			oInput.style.borderColor = '#9ecc00';
			break;
		case "mouseover" :
			oInput.style.borderColor = '#9ecc00';
			break;
		case "blur" :
			oInput.isfocus = false;
			oInput.style.borderColor='#84a1bd';
			break;
		case "mouseout" :
			if(!oInput.isfocus){
			oInput.style.borderColor='#84a1bd';
			}
			break;
	}
}
function FOD_createControl(divId, flashUrl, width, height, opt_clickTagUrl) {
  var d = document.getElementById(divId);
  if (opt_clickTagUrl) {
    flashUrl = cdUtils.updateUrlWithParam(flashUrl, "clickTAG",
        cdUtils.makeUrlAbsolute(opt_clickTagUrl));
  }
  d.innerHTML =
  '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
      + ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"'
      + ' width=' + width
      + ' height=' + height + '>'
      + '<param name="movie" value="' + flashUrl + '"/>'
      + '<param name="quality" value="high"/><param name="wmode" value="transparent" />'
      + '<embed src=' + flashUrl
      + ' width=' + width
      + ' height=' + height
      + ' type="application/x-shockwave-flash"'
      + ' pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent">'
      + '</embed>'
      + '</object>';
}
function cdUtils(){};
cdUtils.updateUrlWithParam = function(oldUrl, name, value) {
  value = encodeURIComponent(value);
  name = encodeURIComponent(name);
  var nameValue = name + "=" + value;
  var nameIndex = 0;
  var oldUrlAndFragment = oldUrl.split('#');
  var oldPathAndArgs = oldUrlAndFragment[0].split('?');
  var oldUrlBase = oldPathAndArgs[0];
  var newArgs;
  if (oldPathAndArgs.length == 1) {
    newArgs = new Array();
  } else {
    newArgs = oldPathAndArgs[1].split('&');
    for (var i = 0; i < newArgs.length; i++) {
      if (newArgs[i].split('=')[0] == name) break;
    }
    nameIndex = i;
  }
  newArgs[nameIndex] = nameValue;
  var newUrl = oldUrlBase;

  for (var i = 0; i < newArgs.length; i++) {
    newUrl += ((i == 0) ? '?' : '&');
    newUrl += newArgs[i];
  }
  if (oldUrlAndFragment[1]) {
    newUrl += "#" + oldUrlAndFragment[1];
  }
  return newUrl;
};
cdUtils.makeUrlAbsolute = function(relativeUrl, opt_fakeLocation) {
  var location = opt_fakeLocation ? opt_fakeLocation : window.location;
  var start = location.protocol + "//" + location.host;
  var path = location.pathname;
  if (relativeUrl.indexOf("://") != -1) {
    return relativeUrl;
  }
  if (location.port) {
    start += ":" + location.port;
  }
  if (relativeUrl.indexOf("/") == 0) {
    return start + relativeUrl;
  }
  if (relativeUrl.indexOf("?") == 0) {
    return start + path + relativeUrl;
  }
  var relativePath = path.substring(0, path.lastIndexOf("/") + 1);
  return start + relativePath + relativeUrl;
}
function edit(doing,id,tex)
{
	this.answer=function(list)
	{
		if(list[0]=="?")if(confirm(list[1]))x_edit(doing,id,2,answer);
		if(list[0]=="!")
		{
			alert(list[1]);
			location.reload();
		}
		if(list[0]=="!!")alert(list[1]);
		if(list[0]=="add")location.href="/index.php?action=add";
		if(list[0]=="edit1")location.href="/index.php?action=add&id="+id;
		if(list[0]=="ad")location.href="/index.php?action=editline&aid="+id;
		if(list[0]=="ed")location.href="/index.php?action=editline&id="+id;
	}
	x_edit(doing,id,1,answer);
}
function reg() {
    var reg=document.getElementById("form_a");
    var passport=document.getElementById("passport");
    var password=document.getElementById("password");
    var password1=document.getElementById("password1");
    var company=document.getElementById("company");
    var telephone=document.getElementById("telephone");
    var connect=document.getElementById("connect");
    if(!passport.value){
        alert("用户名不能为空！");
        passport.focus();
        return false;
    }
    if(!password.value)
    {
        alert("密码不能为空！");
        password.focus();
        return false;
    }
    if(password.value.length<6)
    {
        alert("密码不能少于6位！");
        password.focus;
        return false;
    }
    if(password.value.length>15)
    {
        alert("密码不能多于15位！");
        password.focus;
        return false;
    }
    if(password.value!=password1.value)
	{
		alert("两次输入的密码不一致！");
		password.focus;
		return false;
	}
	if(!company.value)
    {
        alert("旅行社名称不能为空！");
        company.focus();
        return false;
    }
    if(!telephone.value)
    {
        alert("电话不能为空！");
        telephone.focus();
        return false;
    }
    if(!connect.value)
    {
        alert("联系人不能为空！");
        connect.focus();
        return false;
    }
    reg.submit();
}
function login() {
    var loginform=document.getElementById("login");
    var passport=document.getElementById("passport");
    var password=document.getElementById("password");
    if(!passport.value){
        alert("用户名不能为空！");
        passport.focus();
        return false;
    }
    if(!password.value||password.value.length<6)
    {
        alert("密码不能为空或少于6位！");
        password.focus();
        return false;
    }
	loginform.submit();
}
function editpassword() {
    var editpasswordform=document.getElementById("editpassword");
    var oldpassword=document.getElementById("oldpassword");
    var password=document.getElementById("password");
	var password1=document.getElementById("password1");
    if(!oldpassword.value){
        alert("旧密码不能为空！");
        passport.focus();
        return false;
    }
    if(!password.value||password.value.length<6||password.value.length>15)
    {
        alert("密码不能为空或少于6位或多于15位！");
        password.focus();
        return false;
    }
	if(password.value!=password1.value)
    {
        alert("两次输入的密码不一致！");
        password.focus();
        return false;
    }
	editpasswordform.submit();
}
function info()
{
		var title=document.getElementById('title');
		var prices=document.getElementById('prices');
		var dates=document.getElementById('dates');
		var from=document.getElementById('fromadd');
		var to=document.getElementById('toadd');
		if(!title.value)
		{
			alert("名称不能为空！");
			title.focus();
			return false;
		}
		if(!prices.value)
		{
			alert("价格不能为空！");
			prices.focus();
			return false;
		}
		if(!dates.value)
		{
			alert("行程天数不能为空！");
			dates.focus();
			return false;
		}
		if(!from.value)
		{
			alert("出发地不能为空！");
			from.focus();
			return false;
		}
		if(!to.value)
		{
			alert("返回地不能为空！");
			to.focus();
			return false;
		}
	document.getElementById("form").submit();
}
function imginfo()
{
		var id=document.getElementById('id');
		var title=document.getElementById('image');
		var imgform=document.getElementById("form");
		var prices=0
		if(imgform.line.length)
		{
			for(i=0;i<imgform.line.length;i++)
			{
				if(imgform.line[i].checked)prices=1;
			}
		}
		else
		{
			if(imgform.line.checked)prices=1;
		}
		if(!id.value && !title.value)
		{
			alert("没有选择文件！");
			title.focus();
			return false;
		}
		if(!prices)
		{
			alert("请选择一条线路！");
			return false;
		}
	document.getElementById("form").submit();
}
function userimginfo()
{
		var id=document.getElementById('id');
		var title=document.getElementById('image');
		var imgform=document.getElementById("form");
		var prices=document.getElementById("title");
		if(!id.value && !title.value)
		{
			alert("没有选择文件！");
			title.focus();
			return false;
		}
		if(!prices.value)
		{
			alert("请填写标题！");
			prices.focus();
			return false;
		}
	document.getElementById("form").submit();
}
function bookline()
{
		var id=document.getElementById('id');
		var lxr_id=document.getElementById('lxr_id');
		var imgform=document.getElementById("form");
		var tel_id=document.getElementById("tel_id");
		var rs_id=document.getElementById("rs_id");
		if(!lxr_id.value)
		{
			alert("请填写联系人！");
			lxr_id.focus();
			return false;
		}
		if(!tel_id.value)
		{
			alert("请填写联系方式！");
			tel_id.focus();
			return false;
		}
		if(isNaN(rs_id.value))
		{
			alert("请填写仅由阿拉伯数字组成的人数！");
			rs_id.focus();
			return false;
		}
		else if(rs_id.value<1)
		{
			alert("人数不能小于1！");
			rs_id.focus();
			return false;
		}
	document.getElementById("form").action="/index.php?action=book";
	document.getElementById("form").submit();
}
function showdiv(title,url,height,width,top,left,topb,leftb)
{
	if(!height)height="322px";
	if(!width)width="508px";
	if(!top)top=-75;
	if(!left)
	{
		left="-300px";
	}
	if(!topb)
	{
		topb="40%";
	}
	if(!leftb)leftb="50%";
	var cdivsh = document.createElement("DIV");
	cdivsh.id ="divsh";
	cdivsh.style.position = "absolute";
	cdivsh.style.left = "0px";
	cdivsh.style.top = "0px";
	cdivsh.style.width = "100%";
	cdivsh.style.height =document.body.offsetHeight>window.screen.height?document.body.offsetHeight+"px":window.screen.height+140+"px";
	cdivsh.style.background = "#222222";
	cdivsh.style.zIndex = "10000";
	cdivsh.style.filter = "alpha(opacity=80)";
	cdivsh.style.opacity = 0.8;
	var cdiv = document.createElement("DIV");
	cdiv.id="div";
	cdiv.style.position = "absolute";
	cdiv.style.left = leftb;
	cdiv.style.top = topb;
	cdiv.style.marginLeft=-width/2+"px";
	cdiv.style.marginTop = top+document.documentElement.scrollTop+"px";
	cdiv.style.width =width+"px";
	cdiv.style.background = "#ffffff";
	cdiv.style.textAlign = "center";
	cdiv.style.lineHeight = "30px";
	cdiv.style.zIndex = "10001";
	strHtml =' <div id="title" style="clear:both;background:#EEF6FE;text-align:center;font-weight:bold;height:32px;line-height:32px;margin-bottom:0px;border:0px solid #666666;">'+title+'</div>\n';
	strHtml +='	<div><iframe id="ciframe" style="width:'+width+'px; height:'+height+'px; z-index: 100000;" src="'+url+'" frameborder="no"></iframe></div>\n';
	strHtml +=' <div style="clear:both;background:#EEF6FE;text-align:center;font-weight:bold;height:32px;line-height:32px;margin-bottom:0px;border:0px solid #666666;"><input type="button" value="关 闭" id="bton" onclick="closediv(\''+url.substr(18,4)+'\');" style="background:#EEF6FE;margin-top:6px;border:1px solid #EEF6FE;"></div>\n';
	cdiv.innerHTML = strHtml;
	document.body.appendChild(cdivsh);
	document.body.appendChild(cdiv);
}
function closediv(url){
	if(url=="book")
	{
		location.href="/index.php?action=book";
	}
	else
	{
		document.body.removeChild(document.getElementById("divsh"));
		document.body.removeChild(document.getElementById("div"));
	}
}