﻿// JavaScript Document
 String.prototype.Trim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); }
 var $e=function(id){return document.getElementById(id);}
 var myReg=/^[a-zA-Z]([a-zA-Z0-9]*[-_.]?[a-zA-Z0-9]+)+@([\w-]+\.)+[a-zA-Z]{2,}$/;
 function showlist(CurID,ShowID){
    var o=$e(CurID);
    var x=o.offsetLeft;
    var y=o.offsetTop;
    while(o=o.offsetParent){
        x+=o.offsetLeft;
        y+=o.offsetTop;
    }
	$e(ShowID).style.left=x+"px";
	$e(ShowID).style.top=y+23+"px";
	$e(ShowID).style.display="block";
  }
  
  function hidelist(ShowID){
	 $e(ShowID).style.display="none";   
   }
   
   
   function fontSize(id,size)
   {
	   $e(id).style.fontSize=size;  
   }
   
   
   function DrawImage(id,FitWidth,FitHeight){
     ImgD=document.getElementById(id);
     var image=new Image();
     image.src=ImgD.src;
     if(image.width>0 && image.height>0){
         if(image.width/image.height>= FitWidth/FitHeight){
             if(image.width>FitWidth){
                 ImgD.width=FitWidth;
                 ImgD.height=(image.height*FitWidth)/image.width;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             }
         } else{
             if(image.height>FitHeight){
                 ImgD.height=FitHeight;
                 ImgD.width=(image.width*FitHeight)/image.height;
             }else{
                 ImgD.width=image.width; 
                ImgD.height=image.height;
             } 
        }
      }
   }
   
   
   var flag=false;
   function DrawImage1(ImgD,i,j){
			var image=new Image();
			var iwidth = i;  //定义允许图片宽度
            var iheight = j;  //定义允许图片高度
            image.src=ImgD.src;
            if(image.width>0 && image.height>0){
				flag=true;
				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 Flash(flash,w,h){
	   var str='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	   str+=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0"';
	   str+=' width="'+w+'" height="'+h+'">';
	   str+='<param name="movie" value="'+flash+'" />';
       str+='<param name="quality" value="high" />';
	   str+='<param name="wmode" value="transparent" />';
       str+='<embed src="'+flash+'" wmode="transparent" quality="high"';
	   str+=' pluginspage="http://www.macromedia.com/go/getflashplayer"';
	   str+=' type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
       str+=' </object> ';       
	   document.writeln(str)
	}

 
 function toleft(demo,demo1,demo2,speed,flag){
       demo=$e(demo);demo1=$e(demo1);demo2=$e(demo2)
       demo2.innerHTML=demo1.innerHTML
       function Marquee(){
            if(demo2.offsetWidth-demo.scrollLeft<=0){
                    demo.scrollLeft-=demo1.offsetWidth
              }else{
                    demo.scrollLeft++
              }
        }
       flag=setInterval(Marquee,speed)
       demo.onmouseover=function(){clearInterval(flag);}
       demo.onmouseout=function(){flag=setInterval(Marquee,speed);}
  }
  //向右滚动函数，demo包含demo1与demo2,speed是滚动速度，flag一个网页内有多个时设置为不同的任意字符。
  //by 柳永法(yongfa365)'Blog　www.yongfa365.com
 function toright(demo,demo1,demo2,speed,flag){
        demo=$e(demo);demo1=$e(demo1);demo2=$e(demo2)
        demo2.innerHTML=demo1.innerHTML
        function Marquee(){
              if(demo.scrollLeft<=0){
                   demo.scrollLeft=demo2.offsetWidth
              }else{
                   demo.scrollLeft--
              }
        }
        flag=setInterval(Marquee,speed)
        demo.onmouseover=function(){clearInterval(flag);}
        demo.onmouseout=function(){flag=setInterval(Marquee,speed);}
  }
   
   
  function encode(datastr, bassnum) {
	var tempstr;
	var tchar;
	var newdata = "";
 
	for (var i = 0; i < datastr.length; i++)
	{
		tchar = 65535 + bassnum - datastr.charCodeAt(i);
		tchar = tchar.toString();
 
		while(tchar.length < 5)
		{
			tchar = "0" + tchar;
		}
 
		newdata = newdata + tchar;
	}
 
	return newdata;
  }

function che1()
   {
       if($e("pro").value.Trim()=="")
	   {
	      alert("Please enter a name！");
		  $e("pro").focus();
	      return false;
	   }
}
   function checkfrm()
   {
       if($e("input_name").value.Trim()=="")
	   {
	      alert("Please enter a name！");
		  $e("input_name").focus();
	      return false;
	   }
	   if($e("input_address").value.Trim()=="")
	   {
	      alert("Please enter the address！");
		  $e("input_address").focus();
	      return false;
	   }
	   var myReg=/^[a-zA-Z]([a-zA-Z0-9]*[-_.]?[a-zA-Z0-9]+)+@([\w-]+\.)+[a-zA-Z]{2,}$/;
	   if(!myReg.test($e("input_mail").value))
	   {
		      alert("Please check your email is correct！");
		      $e("input_mail").focus();
	          return false;
	   }
	   if($e("input_content").value.Trim()=="")
	   {
	      alert("Please enter a Message！");
		  $e("input_content").focus();
	      return false;
	   }

   }
function opencat(cat){
 if(cat.style.display=="none"){
 cat.style.display="";
 } else {
 cat.style.display="none"; 
 }
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

function MM_jumpMenu1(targ,selObj,restore){ //v3.0
eval(targ+".open('"+selObj.options[selObj.selectedIndex].value+"')");
if (restore) selObj.selectedIndex=0;
}

<!--
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 navbarOver(src,clrOver,clrOverBorder) { if (!src.contains(event.fromElement)){ src.style.cursor = 'hand'; src.bgColor = clrOver; src.borderColor = clrOverBorder; src.children.tags('a')[0].style.color='#FFFF33'; }}

function navbarOut(src,clrIn,clrInBorder) { if (!src.contains(event.toElement)) { src.style.cursor = 'default'; src.bgColor = clrIn; src.borderColor = clrInBorder; src.children.tags('a')[0].style.color='#FFFFFF';}}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() 
{ //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  if ((obj=MM_findObj(args[i]))!=null) 
	  { 
		v=args[i+2];
		if (obj.style) 
		{
		obj=obj.style;
		v=(v=='show')?'visible':(v=='hide')?'hidden':v;
		}
		obj.visibility=v;
		}
}
function che()
   {
       if($e("pro").value.Trim()=="")
	   {
	      alert("Please enter a name！");
		  $e("pro").focus();
	      return false;
	   }
}

function showInfo(j)
{
for(ii=0;ii<4;ii++){
document.getElementById("Informationshow"+ii).style.display = "none";
document.getElementById("cla"+ii).style.background = "none";
}
document.getElementById("Informationshow"+j).style.display= "block";
document.getElementById("cla"+j).style.background = "url(images/bk.jpg)";
}
//-->