// This is library of common javascript functions

var sActiveDiv = "Products";
var appVersion = parseInt(navigator.appVersion);
var isMozilla  = (navigator.appName == "Mozilla");
var isNS       = (navigator.appName == "Netscape") | isMozilla;
var isIE       = (navigator.appName.indexOf("Microsoft") != -1);
var isIE4      = ( isIE  && (appVersion >= 4) )
var isNS5      = ( isNS  && (appVersion >= 5) )
var isIE5      = ( isIE4 && ( (appVersion >= 5) || (navigator.appVersion.indexOf("MSIE 5.0") != -1)) )

    function CookieCheck() {
//         if (!document.cookie.length) { alert("You must enable cookies for this site to function properly"); }
    }
    
    function GetCookie() {
//         if (!document.cookie.length) { alert("You must enable cookies for this site to function properly"); }
//         else {
//             document.write(document.cookie);
//             return document.cookie
//         }
    }
    
    function GetSessionID() {
//         if (!document.cookie.length) { alert("You must enable cookies for this site to function properly"); }
//         else {
//             var myCookies = document.cookie.split("; ");
//             for (var i=0; i < myCookies.length; i++) {
//                 var myArray = myCookies[i].split("=");
// //                alert("Cookie: " + myArray[0].toString() + ":" + myArray[1].toString());
//                 if (myArray[0] == "PHPSESSID") {
//                     if (myArray[1] != "undefined") {
//                         return myArray[1];
//                     }
//                 }
//             }
//             var myArray = document.cookie.split("=");
//             if (myArray[0] == "PHPSESSID") {
//                 if (myArray[1] != "undefined") {
//                     return myArray[1];
//                 }
//             }
//         }
//         return "";
    }
    
    function PopupWindow(sURL) {
    	window.open(sURL, 'edit', 'height=1,width=1,left=0,top=3000,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,copyhistory=no,resizable=yes')
    }

    function Initialize() {
        if (document.forms.length > 0) {
    	    document.formLogin.sUsername.focus();
        }
    }
    
    function ValidateLogin() {
    	Initialize();
    	if ((document.formLogin.sUsername.value == "") || (document.formLogin.sPassword.value == "")) { alert("Username and Password required"); return false; }
    	return true;
    }
    function ForgotPassword() {
    	Initialize();
    	if (document.formLogin.sUsername.value == "") { alert("Please enter Username and try again"); }
    	else { document.location = '/forgot.password.php?sUsername=' + document.formLogin.sUsername.value; }
    }

    function showtip(current,e,text) {
    
        if (document.all||document.getElementById) {
            thetitle=text.split('<br>')
            if (thetitle.length>1) {
                thetitles=''
                for (i=0;i<thetitle.length;i++)
                    thetitles+=thetitle[i]
                current.title=thetitles
            }
            else
                current.title=text
        } else if (document.layers) {
            document.tooltip.document.write('<layer bgColor="white" style="border:1 solid black;font-size:12;">'+text+'</layer>')
            document.tooltip.document.close()
            document.tooltip.left=e.pageX+5
            document.tooltip.top=e.pageY+5
            document.tooltip.visibility="show"
        }
    }
    
    function selectText(current,e) {
        current.focus();
        current.select();
    }
    
    function GetData(sDivID)
    {
    	document.getElementById(sActiveDiv).style.visibility = "hidden";
    	document.getElementById(sDivID).style.visibility = "visible";
    	sActiveDiv = sDivID;
    }

    function showDiv(sDivID) {
    	document.getElementById(sActiveDiv).style.visibility = "hidden";
    	document.getElementById(sDivID).style.visibility = "visible";
    	sActiveDiv = sDivID;
    }


