﻿var searchKeyNotes='Enter product name or CAS No.';
var searchKeyAlert='Please enter a key word!';
function doSearchKeyword()
{
	
    if(document.getElementById("sProdKw").value!=searchKeyNotes)
    { //alert("Please enter a key word!");
        var strKeyword=document.getElementById("sProdKw").value;
        if(strKeyword=="")
        {
            alert(searchKeyAlert);
            document.getElementById("sProdKw").focus();
            return;
        }
        var url="/ennew/Products/Products_list.asp?sProdKw="+strKeyword;
        window.location=url;
    }
    else
    {
       alert(searchKeyAlert);
	   return ;
    }
}


function  enterkey(oEvent)
{
	if(getBs()=='Firefox'){
		KeyID = oEvent.which;
		}
	else{
		KeyID =oEvent.keyCode;
		}
if(KeyID==13) 
{
	doSearchKeyword();	
}
	
//alert('asdfas');
//if(event.keyCode==13   &&   event.srcElement.type!="BUTTON"   &&   event.srcElement.type!="SUBMIT") 
//{
//doSearchKeyword();	
//}
//document.getElementById("btnSearch").click();
}   


// Add to favorite
function bookmarksite(title, url){
	if (document.all)
	window.external.AddFavorite(url, title);
	else if (window.sidebar)
	window.sidebar.addPanel(title, url, "")
}


// Set home page

function setHomepage()
{
 if (document.all)
    {
        document.body.style.behavior='url(#default#homepage)';
 		document.body.setHomePage('http://www.sunivo.com/ennew/');
     }
    else if (window.sidebar)
    {
		if(window.netscape)
		{
				 try
				{  
					netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
				 }  
				 catch (e)  
				 {  
                alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true"); 
				 }
		} 
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.sunivo.com/ennew/');
 }
}


// Get user browser type.
function getBs() 
{ 
     var OsObject = ""; 
    if(navigator.userAgent.indexOf("MSIE")>0) { 
         return "MSIE"; 
    } 
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ 
         return "Firefox"; 
    } 
    if(isSafari=navigator.userAgent.indexOf("Safari")>0) { 
         return "Safari"; 
    } 
    if(isCamino=navigator.userAgent.indexOf("Camino")>0){ 
         return "Camino"; 
    } 
    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){ 
         return "Gecko"; 
    } 
} 

//page number 
function ChangeCurPageID(){
	
	var goPage = document.getElementById("SinP_gotoPage").value;
	//alert(goPage);
	var aimURL=document.getElementById("SinP_gotoPage_url").innerHTML;
	aimURL = aimURL.replace("{pageNo}",goPage);
	//alert(aimURL);
	if (goPage=='') {
	alert("Please input a page Number!");
		document.getElementById("SinP_gotoPage").focus();
	}else{
		location=aimURL;
	}
	
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

