//跳转页面代码////////////
function MM_jumpMenu(targ, selObj, restore) {
	//v3.0
	eval(targ+".location='?page="+selObj.options[selObj.selectedIndex].value+"'");
	if (restore) {
		selObj.selectedIndex = 0;
	}
}

////弹出窗口居中
function openwindow(url,name,iWidth,iHeight){
	var url;                           //转向网页的地址;
	var name;                           //网页名称，可为空;
	var iWidth;                          //弹出窗口的宽度;
	var iHeight;                        //弹出窗口的高度;
	var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
	window.open(url,name,'height='+iHeight+',width='+iWidth+',innerHeight='+iHeight+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=auto,resizeable=no,location=no,status=no');
}
/*function openwindow2(url,name,iWidth,iHeight){
	var url;                           //转向网页的地址;
	var name;                           //网页名称，可为空;
	var iWidth;                          //弹出窗口的宽度;
	var iHeight;                        //弹出窗口的高度;
	var iTop = (window.screen.availHeight-30-iHeight)/2;       //获得窗口的垂直位置;
	var iLeft = (window.screen.availWidth-10-iWidth)/2;           //获得窗口的水平位置;
	showModalDialog(url,name,'dialogWidth:'+iWidth+'px;dialogHeight:'+iHeight+'px;dialogLeft:'+iLeft+'px;dialogTop:'+iTop+'px;center:no;help:no;resizable:no;status:no')
}
*/
function turnoff(target){
	if(document.getElementById(target).style.display=="none"){
		document.getElementById(target).style.display="block";
	}else{
		document.getElementById(target).style.display="none";
	}
}


//判断字符长度////////////////////////////////
function onCharsChange(varField,n,inputName) {
	var leftChars = getLeftChars(varField,n);
	if (leftChars>=0) {
		OutMsg(inputName, inputName+"_Div", n+"字以内，还可以写"+leftChars+" 字");
		return true;
	} else {
		var len = document.getElementById(inputName).value.length+leftChars;
		document.getElementById(inputName).value = document.getElementById(inputName).value.substring(0, len);
		leftChars = getLeftChars(document.getElementById(inputName),n);
		if (leftChars>=0) {
			OutMsg(inputName, inputName+"_Div", n+"字以内，还可以写"+leftChars+" 字");
		}
		return false;
	}
}
function getLeftChars(varField,cap) {
	var counter = 0;
	var leftchars = cap-varField.value.length;
	return (leftchars);
}
/////////////////////

function AddFavorite() {
	var sURL = "http://www.yantai-trip.com/";
	var sTitle = "莱阳交通旅行社";
	try {
		window.external.addFavorite(sURL, sTitle);
	} catch (e) {
		try {
			window.sidebar.addPanel(sTitle, sURL, "");
		} catch (e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}
