// JavaScript Document

function dc_get(id){
   return document.getElementById(id);
}
/**
* 加入收藏夹
* <a onclick="AddFavorite(window.location,document.title)" href="javascript:void(0);">
*/
function AddFavorite(sURL, sTitle) {   
    try {   
        window.external.addFavorite(sURL, sTitle);   
    } catch (e) {   
        try {   
            window.sidebar.addPanel(sTitle, sURL, "");   
        } catch (e) {   
            alert("加入收藏失败，请使用Ctrl+D进行添加"); 
			//alert("Favorite fails, use Ctrl + D to add");
        }   
    }   
}   
/**   
 * 设为首页   
 * @param {} obj 当前对象，一般是使用this引用。   
 * @param {} vrl 主页URL 
 * <a onClick="SetHome(this,window.location)" href="javascript:void(0);">
 */   
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);   
        }   
    }   
} 

/**
* 控制产品数量函数
* 用法：onKeyUp="this.value=get_num(this.value);"
*/
function get_num(strers)
{
  if (isNaN(strers) || strers == "" || strers==0)
  {
    return 1;
  }
  else
  {
    return parseInt(strers);
  }
}

/**
* 窗口最大化
*/
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);

/**
* 禁止后退
*/
//javascript:window.history.forward(1); 

function LoadFlash(url,wmode,width,Height)
{ 
document.write(
  '<embed src="' + url + '" wmode=' + wmode +
  ' quality="high" pluginspage=http://www.macromedia.com/go/getflashplayer type="application/x-shockwave-flash" width="' + width + 
  '" height="' + Height + '"></embed>');   
}
