﻿function GotoSearch()
{
    var k = document.getElementById('Key').value;
    var type = document.getElementById('InfoType').value;
    switch(type)
    {
        case 'company':
            window.location.href = 'Company.html?'+ escape(k);
            break;
        case 'supply info':
            window.location.href = 'Supply.html?'+ escape(k);
            break;
        case 'demand info':
            window.location.href = 'Demand.html?'+ escape(k);
            break;
        case 'agent':
            window.location.href = 'Agent.html?'+ escape(k);
            break;
        case 'cooperate':
            window.location.href = 'Cooperate.html?'+ escape(k);
            break;
        case 'product':
            window.location.href = 'Product.html?'+ escape(k);
            break;
    }

}
function BinKeyValue(value,type)
{
    document.getElementById('Key').value = value;
    document.getElementById('InfoType').value = type;
}

function ImageLoadErr(img)
{
    img.src = '/Images/Null.gif';
}

function GotoCenterCompany()
{
    var k = document.getElementById('Key').value;
    if(k!='')
        window.location.href = 'CCompany.html?'+ escape(k);
    else
        window.location.href = 'CCompany.html';
}

function MoveImg(ImgD,M,IW,IH)
{	
	var H;
	var W;
	var MAX=M;
	var width=IW;
	var height=IH;
	
	var  image=new  Image();  
    image.src=ImgD.src;
	  
	if(image.width>0  &&  image.height>0)
	{  
	    flag=true;
		if(image.width/image.height>= 120/120)
		{ 
			if(image.width>IW)
			{
				ImgD.height=IH;
				ImgD.width=(image.width*IH)/image.height;  
            }   	
		}
		else
		{  
			if(image.height>IH)
			{        
                ImgD.width=IW;
                ImgD.height=(image.height*IW)/image.width;    
			}
		} 		    	
	}
	 
}
function GetNull()
{
    document.getElementById("Key").value="";
}
function IsNull()
{
    var userName=document.getElementById("Login1_TextBox1").value;
    var password=document.getElementById("Login1_Text1").value;
    var code=document.getElementById("Login1_Validate1_TextBox1").value;
    if(userName=="" && password=="" && code=="")
    {
        return false; 
    }
    else
    {
        if(userName=="")
        {
            alert("请输入用户名！");
            return false; 
        }
        if(password=="")
        {
            alert("请输入密码！");
            return false; 
        }
        if(code=="")
        {
            alert("请输入验证码！");
            return false; 
        }
    }
    return true;    
}
function MoveImage(ImgD,M,IW,IH)
{	
	var H;
	var W;
	var MAX=M;
	var width=IW;
	var height=IH;
	
	var  image=new  Image();  
    image.src=ImgD.src;
	if(image.width>0  ||  image.height>0)
	{  
	    flag=true;
		if(image.width/image.height>= 120/120 )
		{ 
			if(image.width>IW && image.height>IH)
			{
				ImgD.height=IH;
				ImgD.width=(image.width*IH)/image.height;  
				// alert("w:" + ImgD.width + "   h:"+ImgD.height)
            } 
            else if(image.width>IW && image.height<=IH)
            {
                ImgD.width=IW;
                ImgD.height=(image.height*IW)/image.width;
				// alert("w:" + ImgD.width + "   h:"+ImgD.height)
            }  	
		}
		else
		{  
			if(image.height>IH && image.width>IW)
			{        
                ImgD.width=IW;
                ImgD.height=(image.height*IW)/image.width; 
                // alert("w:" + ImgD.width + "   h:"+ImgD.height)    
			}
			else if(image.height>IH && image.width<=IW)
			{
			    ImgD.height=IH;
				ImgD.width=(image.width*IH)/image.height; 
				// alert("w:" + ImgD.width + "   h:"+ImgD.height)
			}
		} 		    	
	}
	 
}