﻿// JScript 文件

/**   
 *    
 * @param {} sURL 收藏链接地址   
 * @param {} sTitle 收藏标题   
 */   
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 ShowAlertToGo(iWarnText,iGoUrl,iTarget)
    {
	    if (iWarnText != "")
	    {
		    alert(iWarnText) ; 
		    if (iGoUrl != "" ) 
		    {
				if (iTarget != "")
				{
					window.parent.location.href(iGoUrl) ; 
				}
				else
				{
					window.location.href(iGoUrl);		
				}
		    }
		    else
		    {
			    window.history.go(-1) ; 
		    }
	    }

    }
    
        
    function ShowAlertAndClose(iWarnText)
    {
	    if (iWarnText != "")
	    {
	        alert(iWarnText) ;
	    }
	    window.close();
    }


    // 多选的全选与取消
    function SelectAll(boolvalue)
    {
        if(document.all.SelectID.length>1)
        {
            for(var i=0;i<document.all.SelectID.length;i++)
            {
                document.all.SelectID[i].checked = boolvalue;            
            }
        }
        else
            document.all.SelectID.checked = boolvalue;
    }
    //
    
    
    function GoToUrl(strUrl)
    {
        if (strUrl != "")
        {
            window.location.href(strUrl);
        }
    }
    
    
   function GoToCusUrl(strUrl,strPageNo)
   {
        if (strUrl != "")
        {
            var strNewUrl = strUrl + strPageNo
            window.location.href(strNewUrl);
        }
   }
   
   function OpenTargetFile(strFile)
   {
        //alert(strFile) ; 
        if (strFile != "" )
        {
            window.open(strFile);
        }
        
   }
   
   function OpenSubCatelog(strCurrentDiv,strSubDiv,strCount,strOpenOrClose)
   {
        if (strSubDiv != "")
        {
            var ShowDivList = strSubDiv.split('|');
			var Link_ap = strCurrentDiv + "_ap" ; 
			var Link_ac = strCurrentDiv + "_ac" ; 
			
			for (var i=0 ; i < ShowDivList.length ; i++)
			{
				
				if (strOpenOrClose == "1")
				{
				    if (document.getElementById(ShowDivList[i]))
				    {
						document.getElementById(Link_ap).style.display = 'none'; 
						document.getElementById(Link_ac).style.display = ''; 
						
					    if (document.getElementById(ShowDivList[i]).style.display == 'none')
					    {
						    document.getElementById(ShowDivList[i]).style.display = '' ; 	
					    }

					}
				}
				else
				{
				   
				    if (document.getElementById(ShowDivList[i]))
				    {
						document.getElementById(Link_ap).style.display = ''; 
					    document.getElementById(Link_ac).style.display = 'none'; 
						
					    if (document.getElementById(ShowDivList[i]).style.display == '')
					    {
							var sub_Link_ap = ShowDivList[i] + "_ap" ; 
							var sub_Link_ac = ShowDivList[i] + "_ac" ; 
							
							//alert(sub_Link_ap +"-"+ sub_Link_ac)
							if (document.getElementById(sub_Link_ap))
							{
								document.getElementById(sub_Link_ap).style.display = ''; 	
							}
							if (document.getElementById(sub_Link_ac))
							{
							    document.getElementById(sub_Link_ac).style.display = 'none'; 
							}
							
							document.getElementById(ShowDivList[i]).style.display = 'none' ; 				
					    }
						
					}
					
				}
				
			}
        }
    
   }
   
	function ChangeTwoDecimal(x)
	{
		var f_x = parseFloat(x);
		
		if (isNaN(f_x))
		{
		alert('function:changeTwoDecimal->parameter error');
		return false;
		}
	   	var f_x = Math.round(x*100)/100;
	
		return f_x;
	} 
	
	function ForDight(Dight)
	{
		Dight = Math.round(Dight*Math.pow(10,0))/Math.pow(10,0);
		return Dight;
	}
	
	function CheckClientPdf(inOpenUrl)
	{
		var str_page = inOpenUrl ; 
		try
		{
			var pdf = new ActiveXObject('AcroPDF.PDF.1');
			window.open(str_page,"","","");
		}
		catch(e)
		{
			if(window.confirm('Acrobat Reader  尚未安装，为保证您能正确阅读，请先安装最新版本的 Reader，您需要下载安装吗？'));
			
			window.open('http://www.gemboom.com/web_uploadfile/soft/adberdr_zh_cn.zip');
		}
	}



function AcrobatTest() 
{ 
var acrobat=new Object(); 
var Check_result;

// Set some base values 
acrobat.installed=false; 
acrobat.version='0.0'; 

if(navigator.plugins && navigator.plugins.length) 
{ 
   
    for (x=0; x <navigator.plugins.length; x++) 
    { 
      if (navigator.plugins[x].description.indexOf('Adobe Acrobat') != -1) 
      
      { 
        acrobat.version=parseFloat(navigator.plugins[x].description.split('Version ')[1]); 
        if (acrobat.version.toString().length == 1) acrobat.version+='.0'; 
        acrobat.installed=true; 
       
        break; 
      } 
    } 
     
} 
else if (window.ActiveXObject) 
{ 
    for (x=2; x <10; x++) 
    { 
      try 
      { 
        oAcro=eval("new ActiveXObject('PDF.PdfCtrl."+x+"');"); 
        if (oAcro) 
        { 
          acrobat.installed=true; 
          acrobat.version=x+'.0'; 

        } 
      } 
      catch(e) 
      { 
      
      } 
    } 
    
    try 
    { 
      oAcro4=new ActiveXObject('PDF.PdfCtrl.1'); 
      if (oAcro4) 
      { 
        acrobat.installed=true; 
        acrobat.version='4.0'; 
      } 
    } 
    catch(e) 
    { 
    
    } 

    try 
    { 
      oAcro7=new ActiveXObject('AcroPDF.PDF.1'); 
      if (oAcro7) 
      { 
        acrobat.installed=true; 
        alert(oAcro7.GetVersions());
        //acrobat.version='7.0'; 
      } 
    } 
    catch(e) 
    { 
   
    } 
} 

acrobat.ver4=(acrobat.installed && parseInt(acrobat.version) >= 4) ? true:false; 
acrobat.ver5=(acrobat.installed && parseInt(acrobat.version) >= 5) ? true:false; 
acrobat.ver6=(acrobat.installed && parseInt(acrobat.version) >= 6) ? true:false; 
acrobat.ver7=(acrobat.installed && parseInt(acrobat.version) >= 7) ? true:false; 
acrobat.ver8=(acrobat.installed && parseInt(acrobat.version) >= 8) ? true:false; 
acrobat.ver9=(acrobat.installed && parseInt(acrobat.version) >= 9) ? true:false; 

var acrobatVersionElement = document.getElementById("acrobatVersion");

if (acrobat.version == 0.0) 
{ 
      Check_result="您的计算机尚未安装Acrobat Reader软件，请安装后浏览本站标准文本！"; 
      //alert (Check_result); 
} 
else 
{ 
      Check_result="Adobe Reader version : "+acrobat.version; 
      //alert (Check_result); 
    } 
}



