﻿function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function CheckForm(n)
{
  if (document.se.KeyWords.value == "")
  {
	alert("请输入关键字");
	document.se.KeyWords.focus();
	return false;
   }
   else
   {
	   document.se.submit();
   }
}

function Click(){ 
if (event.button!=1){alert('版权所有:中国鑫丰集团'); 
}} 
//document.onmousedown=Click; 

//产品图片
function MouseOver(n)
{        
  document.getElementById("img"+n).className='img1';
}  

function MouseOut(n)
{           
  document.getElementById("img"+n).className='img';  
}  
//产品图片

//图片按比例缩放,可输入参数设定初始大小
function resizeimg(ImgD,iwidth,iheight) {
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0)
	 {
        if(image.width/image.height>= iwidth/iheight)
		{
           if(image.width>iwidth){
               ImgD.width=iwidth;
               ImgD.height=(image.height*iwidth)/image.width;
           }else{
                  ImgD.width=image.width;
                  ImgD.height=image.height;
                }
               //ImgD.alt="宽×高:"+image.width+"×"+image.height;
        }
        else
		{
                if(image.height>iheight){
                       ImgD.height=iheight;
                       ImgD.width=(image.width*iheight)/image.height;
                }else{
                        ImgD.width=image.width;
                        ImgD.height=image.height;
                     }
               // ImgD.alt="宽×高:"+image.width+"×"+image.height;
         }
    }
}

function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
//document.getElementById("pic"+sid).src="images/open.gif";
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
//document.getElementById("pic"+sid).src="images/close.gif";
}
}


function resizeimg1(ImgD,iwidth,iheight,str) {
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0)
	 {
        if(image.width/image.height>= iwidth/iheight)
		{
           if(image.width>iwidth){
               ImgD.width=iwidth;
               ImgD.height=(image.height*iwidth)/image.width;
           }else{
                  ImgD.width=image.width;
                  ImgD.height=image.height;
                }
               ImgD.alt=str;
        }
        else
		{
                if(image.height>iheight){
                       ImgD.height=iheight;
                       ImgD.width=(image.width*iheight)/image.height;
                }else{
                        ImgD.width=image.width;
                        ImgD.height=image.height;
                     }
                ImgD.alt=str;
         }
    }
}
//图片按比例缩放,可输入参数设定初始大小 

//检测空字符
function checkspace(checkstr) {
  var str = '';
  for(i = 0; i < checkstr.length; i++) {
    str = str + ' ';
  }
  return (str == checkstr);
}
//检测空字符

function CheckEmail(email)
{
	var RegExpStr = /^([\w\_\-\.]{1,})(@)([\w\-\.]{1,})(\.)([a-zA-Z\.]{1,})$/;
	return RegExpStr.test(email);
}


//信息反馈
function infor_insert()
{
	var subject=(document.form.subject.value).replace(/(^\s*)|(\s*$)/g,"");
	var email=(document.form.email.value).replace(/(^\s*)|(\s*$)/g,"");
	var name=(document.form.name.value).replace(/(^\s*)|(\s*$)/g,"");
	var company=(document.form.company.value).replace(/(^\s*)|(\s*$)/g,"");
	var address=(document.form.address.value).replace(/(^\s*)|(\s*$)/g,"");
	var telphone=(document.form.telphone.value).replace(/(^\s*)|(\s*$)/g,"");
	var fax=(document.form.fax.value).replace(/(^\s*)|(\s*$)/g,"");
	var content=(document.form.content.value).replace(/(^\s*)|(\s*$)/g,"");
	
	if (subject=="")
	{
		alert("请输入标题");
		form.subject.focus();
		return false;
	}
	if (email=="")
	{
		alert("请输入邮件地址");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(email))
	{
		alert("请输入正确的邮件地址");
		form.email.focus();
		return false;
	}
	if (name=="")
	{
		alert("请输入您的姓名");
		form.name.focus();
		return false;
	}
	if (telphone=="")
	{
		alert("请输入电话");
		form.telphone.focus();
		return false;
	}
	if (content=="")
	{
		alert("请输入反馈内容");
		form.content.focus();
		return false;
	}
	
	
}
//信息反馈
function check()
{
	if (checkspace(document.f.Title.value))
	{
		alert("留言标题为必须填写项");
		document.f.Title.focus();
		return false;
	}
	if (checkspace(document.f.Content.value))
	{
		alert("留言内容为必须填写项");
		document.f.Content.focus();
		return false;
	}
}