window.onerror=function(){return true}
var BigDiv,ImgDiv
function ShowImg(obj){
	var d1=document.createElement("div");
	d1.setAttribute("id","BigDiv");
	d1.setAttribute("onClick",CloseImg,"");
	document.body.insertBefore(d1,null);
	var d2=document.createElement("div");
	d2.setAttribute("id","ImgDiv");
	d2.setAttribute("onMouseDown",startmov,"");
	document.body.insertBefore(d2,null);
	BigDiv=document.getElementById("BigDiv");
	ImgDiv=document.getElementById("ImgDiv");
	BigDiv.style.display='block';
	BigDiv.style.height=document.documentElement.scrollHeight+"px";
	ImgDiv.innerHTML="<img src="+obj.src+" onmousewheel='return bbimg(this)' />"; 
	ImgDiv.style.display='block';
	ImgDiv.style.top=((document.documentElement.offsetHeight-ImgDiv.childNodes[0].offsetHeight)/2+document.documentElement.scrollTop)+"px";
	ImgDiv.style.left=((document.documentElement.offsetWidth-ImgDiv.childNodes[0].offsetWidth)/2)+"px";
	ImgDiv.innerHTML+="<img src='images/close.gif' class='close'  title='点击关闭' onclick='CloseImg()'>"
	document.documentElement.style.overflow="hidden";
}

function CloseImg(){
	BigDiv.style.display='none';
	ImgDiv.style.display='none';
	document.documentElement.style.overflow="auto";
}

//滚动缩放图片大小,使用方法:在img中加入onmousewheel="return bbimg(this)"
function bbimg(o){
	var zoom=parseInt(o.style.zoom,10)||100;
	zoom+=event.wheelDelta/10;
	if(zoom>0) o.style.zoom=zoom+'%';
	return false;
}

//拖动
var movTF=false
var x,y,xPos,yPos
function startmov(){
	if(!ImgDiv) return
	movTF=true
	x=event.clientX
	y=event.clientY
	xPos=ImgDiv.style.posLeft
	yPos=ImgDiv.style.posTop
}
function mov(){
	if(!ImgDiv) return
	if(!movTF) return
	ImgDiv.style.left=event.clientX-x+xPos
	ImgDiv.style.top=event.clientY-y+yPos
}
function stopmov(){
	movTF=false
}
document.onmousemove=mov
document.onmouseup=stopmov


//选择
function ckbox(id){
	var ck=document.getElementById("ck"+id)
	var tr=document.getElementById("tr"+id)
	if(ck.checked){
		ck.checked=false
		tr.className="tx_ct"
	}else{
		ck.checked=true
		tr.className="tb_col_over tx_ct"
	}
}
//全选
function ckall(){  
	var ck=document.getElementsByName("ck")
	for	(i=0;i<ck.length;i++){
		ck[i].checked=true;
		document.getElementById("tr"+ck[i].value).className="tb_col_over tx_ct"
	}
}

//反选
function ckanti(){   
	var ck=document.getElementsByName("ck")
	for	(i=0;i<ck.length;i++){
		ckbox(ck[i].value)
	}
}

//取消选择
function ckno(){  
	var ck=document.getElementsByName("ck")
		for	(i=0;i<ck.length;i++){
			ck[i].checked=false;
		document.getElementById("tr"+ck[i].value).className="tx_ct"
	}
}

//删除所选
function delchecked(){ 
	var formobj=document.forms[0]
	var ck=document.getElementsByName("ck")
	for(i=0;i<ck.length;i++){
		if(ck[i].checked){
			if(confirm("确定要删除吗?\n\n删除之后无法恢复!")){formobj.submit()}
			return;
		}
	}
	alert("请选择要删除的信息!")
}

//输出选择方式
function getSelect(){
	var AStr="<a href='javascript:ckall()'>全选</a>-"
	AStr+="<a href='javascript:ckanti()'>反选</a>-"
	AStr+="<a href='javascript:ckno()'>不选</a>-"
	AStr+="<a href=\"javascript:delchecked()\">删除所选</a>"
	if(document.getElementById("Select")){document.getElementById("Select").innerHTML=AStr}
}

function GetKeyDown(){ 
	//alert(event.keyCode)
	if(event.ctrlKey){
		if(event.keyCode==65){
			ckall()
		}
		if(event.keyCode==90){
			ckno()	
		}
	}
	if(event.keyCode==46){
		delchecked();	
	}
}


//IE6支持PNG透明图片的补丁
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6. 
{ 
    var arVersion = navigator.appVersion.split("MSIE") 
    var version = parseFloat(arVersion[1]) 
    if ((version >= 5.5) && (document.body.filters)) 
    { 
       for(var j=0; j<document.images.length; j++) 
       { 
          var img = document.images[j] 
          var imgName = img.src.toUpperCase() 
          if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
          { 
             var imgID = (img.id) ? "id='" + img.id + "' " : "" 
             var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
             var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
             var imgStyle = "display:inline-block;" + img.style.cssText 
             if (img.align == "left") imgStyle = "float:left;" + imgStyle 
             if (img.align == "right") imgStyle = "float:right;" + imgStyle 
             if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
             var strNewHTML = "<span " + imgID + imgClass + imgTitle 
             + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
             + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
             + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
             img.outerHTML = strNewHTML 
             j = j-1 
          } 
       } 
    }     
} 
if(window.attachEvent) {
window.attachEvent('onload', correctPNG);
}

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)
}

//check gbook form
var ckNull=/^\s*$/
function ckGbookForm(){
	var f=document.gbookForm
	if(ckNull.test(f.Name.value)){
		alert("姓名不能为空!");
		f.Name.focus();
		return;
	}
	if(ckNull.test(f.Tel.value)){
		alert("联系电话不能为空!");
		f.Tel.focus();
		return;
	}
	if(ckNull.test(f.Title.value)){
		alert("留言主题不能为空!");
		f.Title.focus();
		return;
	}
	if(ckNull.test(f.Content.value)){
		alert("留言内容不能为空!");
		f.Content.focus();
		return;
	}
	if(ckNull.test(f.VerifyCode.value)){
		alert("验证码不能为空!");
		f.VerifyCode.focus();
		return;
	}
	f.sb.value='正在提交'
	f.sb.disabled=true;
	f.submit()
}
//显示验证码
function showVerifyCode(){
	document.getElementById("Code").src="Inc/Code.asp?n="+Math.random();
	document.getElementById("Tips").style.display='none';
	document.getElementById("Code").style.display='block';
}

//只能输入数字
function InputNumber(obj){
	var keynum
	var keychar
	var numcheck
	if(window.event){   //IE
		keynum = event.keyCode
	}else if(event.which){  // Netscape/Firefox/Opera
		keynum = event.which
	}
	keychar = String.fromCharCode(keynum)
	numcheck = /\d/
	return numcheck.test(keychar)
}

function ckSearchForm(){
	var f=document.Form_Search;
	if(!ckNull.test(f.KeyWord.value)){
		f.sb.disabled="disabled";
		f.submit();
	}else{
		alert("请输入产品名称关键词!");
		f.KeyWord.focus();
	}
}

function ckOrderForm(isIndex){
	var f=document.OrderForm
	if(isIndex==true){createDiv();return}
	if(f.Name.value==""){
		alert("对不起,姓名不能为空!");
		f.Name.focus();
		return
	}
	if(f.Tel.value==""){
		alert("对不起,联系电话不能为空!");
		f.Tel.focus();
		return
	}
	f.submit()
}
