// JavaScript Document
//图片按比例缩放
var flag=false;
function DrawImage(ImgD,iwidth,iheight){
    //参数(图片,允许的宽度,允许的高度)
    var image=new Image();
    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 CheckForm()
{
	if(document.Login.username.value=="")
	{
		alert("请填写你的姓名！");
		document.Login.username.focus();
		return false;
	}
	if(document.Login.danwei.value == "")
	{
		alert("请填写你的单位！");
		document.Login.danwei.focus();
		return false;
	}
	if(document.Login.address.value == "")
	{
		alert("请填写单位地址！");
		document.Login.address.focus();
		return false;
	}
	if(document.Login.tel.value == "")
	{
		alert("请填写联系电话！");
		document.Login.tel.focus();
		return false;
	}
	if(document.Login.proname.value == "")
	{
		alert("请填写产品名称！");
		document.Login.proname.focus();
		return false;
	}
	if(document.Login.content.value == "")
	{
		alert("请填写订购说明！");
		document.Login.content.focus();
		return false;
	}
	
	
}
function CheckForms()
{
if(document.Login.title.value=="")
	{
		alert("留言主题不能为空值！");
		document.Login.title.focus();
		return false;
	}
	if(document.Login.truename.value == "")
	{
		alert("真实姓名不能为空值！");
		document.Login.truename.focus();
		return false;
	}
}


   var bannerAD=new Array();
   var bannerADlink=new Array();
   var adNum=0;

   bannerAD[0]="img/jing1.jpg";
   bannerADlink[0]="javascript:;";
   bannerAD[1]="img/jing.jpg";
   bannerADlink[1]="javascript:;";
   bannerAD[2]="img/jing3.jpg";
   bannerADlink[2]="javascript:;";
   bannerAD[3]="img/jing2.jpg";
   bannerADlink[3]="javascript:;";
     


   var preloadedimages=new Array();
   for (i=1;i<bannerAD.length;i++){
      preloadedimages[i]=new Image();
      preloadedimages[i].src=bannerAD[i];
   }

function setTransition(){
   if (document.all){
      bannerADrotator.filters.revealTrans.Transition=Math.floor(Math.random()*23);
      bannerADrotator.filters.revealTrans.apply();
   }
}

function playTransition(){
   if (document.all)
      bannerADrotator.filters.revealTrans.play()
}

function nextAd(){
   if(adNum<bannerAD.length-1)adNum++ ;
      else adNum=0;
   setTransition();
   document.images.bannerADrotator.src=bannerAD[adNum];
   playTransition();
   theTimer=setTimeout("nextAd()", 5000);
}

function jump2url(){
   jumpUrl=bannerADlink[adNum];
   jumpTarget='';
   if (jumpUrl != ''){
      if (jumpTarget != '')window.open(jumpUrl,jumpTarget);
      else location.href=jumpUrl;
   }
}
function displayStatusMsg() { 
   status=bannerADlink[adNum];
   document.returnValue = true;
}


