<!--

//下拉菜单
function menu_action(sender) {
   var lis = sender.getElementsByTagName("li");
   for (key in lis) {
    lis[key].onmouseover=onMouseOver;
    lis[key].onMouseDown=onMouseDown;
    lis[key].onMouseUp=onMouseUp;
    lis[key].onmouseout=onMouseOut;
   }
   sender.onmouseover = null;
}
function onMouseOver(){OnMouse(this,"block")}
function onMouseDown(){OnMouse(this,"block")}
function onMouseUp(){OnMouse(this,"none")}
function onMouseOut(){OnMouse(this,"none")}
function OnMouse(Obj,Display){
   var ul = Obj.getElementsByTagName("ul")[0];
   if(ul!=null){
    ul.style.display=Display;
   }
}

function openpic(cats,imgs,url){
    var cat=document.getElementById(cats);
	var img=document.getElementById(imgs);
	if(cat.style.display=="none"){
	cat.style.display="";
	img.src=url+"images/class2.gif";
	}	else {
	cat.style.display="none"; 
	img.src=url+"images/class1.gif";
	}
}


//分类菜单
function opencat(cats,imgs,url){
    var cat=document.getElementById(cats);
	var img=document.getElementById(imgs);
	if(cat.style.display=="none"){
	cat.style.display="";
	img.src=url+"images/class2.gif";
	}	else {
	cat.style.display="none"; 
	img.src=url+"images/class1.gif";
	}
}

//
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
  }
  
// 
function showDiv(objId){
   var objDiv=document.getElementById(objId);   
   if(objDiv.style.display=="none"){
      objDiv.style.display="";
    return;
	}else{
   objDiv.style.display="none";
   }
}
//
function CheckUserForm()
{
	if (document.payment.Subject.value.length == 0) {
		alert("Please input Subject");
		document.payment.Subject.focus();
		return false;
	}	
	if (document.payment.Receiver.value.length == 0) {
		alert("Please input contact person.");
		document.payment.Receiver.focus();
		return false;
	}
	if (document.payment.Email.value.length == 0) {
		alert("Please input  Email.");
		document.payment.Email.focus();
		return false;
	}
	if (document.payment.Email.value.length > 0 && !document.payment.Email.value.match( /^.+@.+$/ ) ) {
	    alert("EMAIL wrong.");
	    document.payment.Email.focus();
		return false;
	}	
	return true;
}

//图片按比例缩放
var flag=false;
function DrawImg(Img,iwidth,iheight){
//参数(图片,允许的宽度,允许的高度)
var image=new Image();
image.src=Img.src;

if(image.width>0 && image.height>0){
    flag=true;
if (image.width/image.height >= iwidth/iheight){
    if(image.width>iwidth){ 
        Img.width=iwidth;
        Img.height=(image.height*iwidth)/image.width;
       }
	else{
        Img.width=image.width; 
        Img.height=image.height;
       }
    }
else{
    if(image.height>iheight){ 
        Img.height=iheight;
        Img.width=(image.width*iheight)/image.height; 
    }else{
        Img.width=image.width; 
        Img.height=image.height;
        }
      }
    } 
  }

/*按比例生成缩略图*/
function DrawImage(MyPic,W,H){
  var flag=false;
  var image=new Image();
  image.src=MyPic.src;
  if(image.width>0 && image.height>0){
    flag=true;
    if(image.width/image.height>= W/H){
      if(image.width>W){  
        MyPic.width=W;
        MyPic.height=(image.height*W)/image.width;
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
    else{
      if(image.height>H){  
        MyPic.height=H;
        MyPic.width=(image.width*H)/image.height;     
      }
	  else{
        MyPic.width=image.width;  
        MyPic.height=image.height;
      }
    }
  }
} 

<!--
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_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_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 CheckSearchEn()
{
if (searchform.sokey.value=="") 
{
alert('Plese input the keyword!');
searchform.sokey.focus();
return false;
}
}

function CheckSearchCh()
{
if (searchform.sokey.value=="") 
{
alert('请输入关键字');
searchform.sokey.focus();
return false;
}
}


//禁止图片右键  
var clickmessage="Sorry, the picture is only for view!"
function disableclick(e) {
if (document.all) {
if (event.button==2||event.button==3) {
if (event.srcElement.tagName=="IMG"){
alert(clickmessage);
return false;
}
}
}
if (document.layers) {
if (e.which == 3) {
alert(clickmessage);
return false;
}
}
}

function associateimages(){
for(i=0;i<document.images.length;i++)
document.images[i].onmousedown=disableclick;
}

if (document.all)
document.onmousedown=disableclick
else if (document.layers)
associateimages()

-->
