// JavaScript Document
<!--   
/**   
 *    
 * @param {} sURL 收藏链接地址   
 * @param {} sTitle 收藏标题   
 *<a href="#" ONCLICK="SetHome(this,window.location)">设为首页</a> | <a onclick="AddFavorite(window.location,document.title)" href="#">加入收藏</a>
 */  
function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加");   
        }   
    }   
}   
/**   
 *    
 * @param {} obj 当前对象，一般是使用this引用。   
 * @param {} vrl 主页URL   
 */   
function SetHome(obj, vrl) {   
    try {   
        obj.style.behavior = 'url(#default#homepage)';   
        obj.setHomePage(vrl);   
    } catch (e) {   
        if (window.netscape) {   
            try {   
                netscape.security.PrivilegeManager   
                        .enablePrivilege("UniversalXPConnect");   
            } catch (e) {   
                alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");   
            }   
            var prefs = Components.classes['@mozilla.org/preferences-service;1']   
                    .getService(Components.interfaces.nsIPrefBranch);   
            prefs.setCharPref('browser.startup.homepage', vrl);   
        }   
    }   
}   

function isEmail(vEMail)
{
var regInvalid=/(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/;
var regValid=/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/;
return (!regInvalid.test(vEMail)&&regValid.test(vEMail));
}	
function is_number(str)
				{
					exp=/[^0-9()-]/g;
					if(str.search(exp) != -1)
					{
						return false;
					}
					return true;
				}

/*if(!(isEmail($("#customeremail").val() ))){
		alert('');
		$("#customeremail").focus();
		return ;
	}
	
	if(is_number($("#customernumber").val())==false){
		alert("Quantity (Qty.) must be a number.");
		 $("#customernumber").focus();
		return;
	}
	
		if($("#brow").attr('checked')==false){
		}
	*/
//-->  
function DrawImage(ImgD,FitWidth,FitHeight){
	var image=new Image();
	var iwidth = FitWidth; //定义允许图片宽度
	var iheight = FitHeight; //定义允许图片高度
	image.src=ImgD.src;
		if(image.width==FitWidth && image.height==FitHeight){
	return;
	}
	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;
			}
		}
		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.style.display="";
}
<!--  

function killerrors() { 

return true; 

} 

window.onerror = killerrors; 

//--> 
