//window.onerror=function(){return true}

var isNull=/^[\s'　']*$/
var ckNumber=/^\-?\d{1,}$/
var ckDate=/^[1-9]\d{3}\-\d{1,2}\-\d{1,2}(\s\d{1,2}:\d{1,2}:\d{1,2})?$/

function $(Obj){
	return document.getElementById(Obj)
}

function $$(ElementsName){
	return document.getElementsByName(ElementsName)
}

function $V(obj){
	return document.getElementById(obj).value;
}

function p(string){
	document.write(string);
}

//将Form的元素设置为只读
function lockForm(form){
	if(!form) return;
	for(i=0;i<form.elements.length;i++){
		form.elements[i].readOnly="readOnly";
	}
}

function hiddenObj(obj){
	if(obj=="") return;
	var objs=obj.split(",");
	for(i=0;i<objs.length;i++){
		if(typeof($(objs[i]))=="object"){
			$(objs[i]).style.display="none";
		}
	}
}

function showObj(obj){
	if(obj=="") return;
	var objs=obj.split(",");
	for(i=0;i<objs.length;i++){
		if(typeof($(objs[i]))=="object"){
			$(objs[i]).style.display="block";
		}
	}
}

function getFla(FlaSrc,width,height,wmode){
	var str;
	wmode==""?wmode="opaque":true;
	str="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0\" width=\""+width+"\" height=\""+height+"\">"
	str+="  <param name=\"movie\" value=\""+FlaSrc+"\" />"
	str+="  <param name=\"quality\" value=\"high\" />"
	str+="  <param name=\"wmode\" value=\""+wmode+"\" />"
	str+="  <embed src=\""+FlaSrc+"\" quality=\"high\" wmode=\""+wmode+"\"  pluginspage=\"http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\"></embed>"
	str+="</object>"
	document.write(str)
}

//自动调整图片大小
function autoResize(obj,maxWidth,maxHeight){
	var oW=obj.offsetWidth;
	var oH=obj.offsetHeight;
	if(oW>maxWidth||oH>maxHeight){
		if((maxWidth/oW)<(maxHeight/oH)){
			obj.style.width=maxWidth+"px";
			obj.style.height=oH*maxWidth/oW;
		}else{
			obj.style.height=maxHeight+"px";
			obj.style.width=oW*maxHeight/oH;
		}
		oH=obj.offsetHeight;
	}
	obj.style.marginTop=(maxHeight-oH)/2+"px";
	obj.style.visibility="visible";
}

function getTop(e){ 
	var offset=e.offsetTop; 
	if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
	return offset; 
} 

function getLeft(e){ 
	var offset=e.offsetLeft; 
	if(e.offsetParent!=null) offset+=getLeft(e.offsetParent); 
	return offset; 
}


/*建立XmlHttp对象**********************************************************************************************/
var xmlHttp;
function createXmlHttp(showLoadimgTF) 
{	
	try{
		if(document.all){
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			xmlHttp=new XMLHttpRequest();	
		}
	}catch(e){
		alert("创建XMLHttp失败,部分内容无法显示!/n/n请使用IE6.0或更高版本浏览器浏本站!");
		return;
	}
	showLoadimgTF!="0"?showLoadingImg():true;
}
/******************************************************************************************************************/

//取得一个文件名的扩展名
function getFileExt(fname){
	if(fname=="") return
	var temp;
	temp=fname.substr(fname.lastIndexOf(".")+1,fname.length);
	temp=temp.toLowerCase();
	return temp;
}

function IE7(){ 
	if(navigator.appName == "Microsoft Internet Explorer"){ 
		if(navigator.appVersion.match(/7./i)=='7.'){ 
			return true;
		}else{ 
			return false;
		} 
	}else{
		return false;
	}
} 