var UserAgent = navigator.userAgent.toLowerCase();
var ie4=document.all&&UserAgent.indexOf("opera")==-1
var ns6=document.getElementById&&!document.all





function $(id) {
	return document.getElementById(id);
}


//UrlPost Start
document.write("<form id=UrlPost method=Post></form>")
function UrlPost(Url){
	$("UrlPost").action = Url;
	document.forms['UrlPost'].submit()
}
//UrlPost END

//XmlDom Start
var XmlDom;
function GetXmlDom() {
	if (window.ActiveXObject) {//IE浏览器
		return new ActiveXObject("Microsoft.XMLDOM");
	}
	else if (document.implementation && document.implementation.createDocument) { //其它浏览器
		return document.implementation.createDocument("","",null);
	}
}


//add area script
function ValidateTextboxAdd(box, button)
{
 var buttonCtrl = $(button);
 if ( buttonCtrl != null )
 {
 if (box.value == "" || box.value == box.Helptext)
 {
 buttonCtrl.disabled = true;
 }
 else
 {
 buttonCtrl.disabled = false;
 }
 }
}
//add area script end

//Ajax Start
function Ajax_GetXMLHttpRequest() {
	if (window.ActiveXObject) {
		return new ActiveXObject("Microsoft.XMLHTTP");
	} 
	else if (window.XMLHttpRequest) {
		return new XMLHttpRequest();
	}
}
function Ajax_CallBack(FormName,ID,URL,IsAlert){
	var x = Ajax_GetXMLHttpRequest();
	var ID = $(ID);
	x.open("POST",URL);
	x.setRequestHeader("REFERER", location.href);
	x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200){if(IsAlert){x.responseText?alert(x.responseText):alert('添加成功');}else if(ID){ID.innerHTML=x.responseText;}}}
	var encodedData=""
	if (document.forms.length > 0 && FormName) {
		var form = document.forms[FormName];
		for (var i = 0; i < form.length; ++i) {
			var element = form.elements[i];
			if (element.name) {
				var elementValue = null;
				if (element.nodeName == "INPUT") {
					var inputType = element.getAttribute("TYPE").toUpperCase();
					if (inputType == "TEXT" || inputType == "PASSWORD" || inputType == "HIDDEN") {
						elementValue = escape(element.value);
					} else if (inputType == "CHECKBOX" || inputType == "RADIO") {
						if (element.checked) {
							elementValue = escape(element.value);
						}
					}
				} else if (element.nodeName == "SELECT" || element.nodeName == "TEXTAREA") {
					elementValue = escape(element.value);
				}
				if (elementValue) {
					if(encodedData==""){
						encodedData = element.name + "=" + encodeURIComponent(elementValue);
					}
					else{
						encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue);
					}
				}
			}
		}

	}
	x.send(encodedData);
}

//Ajax End





function ShowPannel(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+"_tab_"+i).style.display = "none";
		document.getElementById(tabName+"_btn_"+i).className = "";
	};
	document.getElementById(tabName+"_tab_"+id).style.display = "block";
	btn.className = "NowTag";
}

function AjaxShowPannel(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = idname.substr(s, e-s);
	var tabNumber = btn.parentNode.childNodes.length;
	var menu =  new String(btn.getAttributeNode("menu").nodeValue);	//getAttributeNode("menu").nodeValue 兼容FF3。0
	var ajaxurl = new String(btn.parentNode.getAttributeNode("ajaxurl").nodeValue) + '&' + menu;
	for(i=0;i<tabNumber;i++){
		document.getElementById(tabName+id+i).className = "";
	};
	btn.className = "NowTag";
	$(tabName).innerHTML = '<table cellspacing=0 cellpadding=0 width="100%" class="PannelBody"><tr><td><img src="images/loading.gif" border=0 /></td></tr></table>';
	Ajax_CallBack(false,tabName,ajaxurl);
}

//图片输出


function ShowCheckResult(ObjectID, Message, ImageName) {
	obj = $(ObjectID);
	obj.style.display = '';
	obj.innerHTML = '<img src="images/check_'+ImageName+'.gif" align=absmiddle>&nbsp;' + Message;
}

//图片输出


//表单检测 start

//联系人


