﻿//快速分页条转
function FP_jumpMenu(el,frm,sel) {//v1.0
 var href=el.options[el.selectedIndex].value; if(sel) el.selectedIndex=0;
 if('_new'==frm) open(href); else eval(frm+".location='"+href+"'");
}

//产品图片
function MouseOver(n,img_url)
{        
  document.getElementById("img"+n).className='img1';
  document.getElementById("pic_span").src=img_url;
}  

function MouseOut(n)
{           
  document.getElementById("img"+n).className='img';  
} 
//产品图片

//图片切换
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)
{
  var Msg = "";
  if (document.se.KeyWords.value == "")
  {
	alert("Enter KeysWords");
	document.se.KeyWords.focus();
	return false;
    Msg = "Err";
   }
  if (Msg == "")
  {
	  if (n==1)
	  {
		  var lu="";
	  }
	  else
	  {
		  var lu="../";
	  }
	  
	//alert("search.html?KeyWords="+document.se.KeyWords.value);
	document.se.action=lu+"search.html?KeyWords="+encodeURI(document.se.KeyWords.value);
	document.se.submit();
   }
}

function Ctlent()
{
	if(window.event.keyCode==13){CheckForm();}
}

function continue_shopping()
{
	document.shopping1.target="_parent";
	document.shopping1.action="../go_shopping.html";
	document.shopping1.submit();
}

//图片按比例缩放,可输入参数设定初始大小
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 look_pic(id)
{
	if (id!="")
	{
	document.getElementById("pic_span").innerHTML="<img src='"+id+"' border='0'>";
	}
}

//检测空字符
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);
}


// JavaScript Document
function createXMLHttpRequest()  //针对不同浏览器设置XMLHttpRequest方式
{ 
    xmlhttp = false; 
     
    if(window.XMLHttpRequest)
	{        //for Mozilla 
        xmlhttp = new XMLHttpRequest(); 
        if(xmlhttp.overrideMimeType)
		{ 
            xmlhttp.overrideMimeType("text/xml"); 
        } 
    } 
    else if(window.ActiveXObject)
	{   //for IE 
        try
		{ 
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
        }
		catch(e)
		{ 
            try
			{ 
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
            }
		catch(e)
		{} 
        } 
    } 
}


//信息反馈界面
function feedback_en()
{
	var xmlHttp = createXMLHttpRequest();
	var getURL = "template/feedback_response.asp?action=en";
	xmlhttp.open("POST",getURL,true);
	xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
	xmlhttp.onreadystatechange=function() 
	{
		if ( xmlhttp.readyState==4 || xmlhttp.readyState=='complete' )
		{
			document.getElementById("feedback").innerHTML = xmlhttp.responseText;
		}
	}
	xmlhttp.send(null);
}


//信息反馈
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,"");
	
	var msg="yes";
	
	if (subject=="")
	{
		msg="no";
		alert("Enter Country");
		form.subject.focus();
		return false;
	}
	if (email=="")
	{
		msg="no";
		alert("Enter e-mail address");
		form.email.focus();
		return false;
	}
	if (!CheckEmail(email))
	{
		msg="no";
		alert("Enter right e-mail address");
		form.email.focus();
		return false;
	} 
	if (name=="")
	{
		msg="no";
		alert("Please enter your name");
		form.name.focus();
		return false;
	}
	if (company=="")
	{
		msg="no";
		alert("Please enter your company");
		form.company.focus();
		return false;
	}
	if (telphone=="")
	{
		msg="no";
		alert("Enter Phone");
		form.telphone.focus();
		return false;
	}
	if (content=="")
	{
		msg="no";
		alert("Please enter Content");
		form.content.focus();
		return false;
	}
	
	if (msg=="yes")
	{
		var xmlHttp = createXMLHttpRequest();
		var getURL = "template/feedback_response.asp";
		var posturl = "action=save&subject="+subject+"&email="+email+"&name="+name+"&company="+company+"&telphone="+telphone+"&address="+address+"&fax="+fax+"&content="+content;
		xmlhttp.open("POST",getURL,true);
		xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
		xmlhttp.onreadystatechange=function() 
		{
			if ( xmlhttp.readyState==4 || xmlhttp.readyState=='complete' )
			{
				document.getElementById("feedback").innerHTML = xmlhttp.responseText;
			}
		}
		xmlhttp.send(posturl);
	}
	else
	{
		alert("Please fill out complete information on request!");
		return false;
	}
	
}
