﻿    function showsubmenu(id)
    { 
        var FVal = "", SVal = "", TVal = "";
        FVal = id.substr(0, 2); 
        if (id.length > 2)
            SVal = id.substr(2, 2);
        if (id.length > 4)
            TVal = id.substr(4, 2);
        changeMainMenuStyle(FVal); 
        for(var i=1;i<=15;i++) {
            if(parseInt(i) < 10)
                i = "0" + i; 
            if(document.getElementById("submnu"+i)!=null)
            { 
                if(i!=FVal)
                    document.getElementById("submnu"+i).style.display='none';           
                else
                    document.getElementById("submnu"+i).style.display='inline'; 
                       
            }
        } 
        for(var j=1;j<=16;j++)
        {
            if (parseInt(j) < 10)
                j = "0" + j; 
            if(document.getElementById("submnu"+FVal+j)!=null) {            
                if(j!=SVal)
                {
                    document.getElementById("submnu" + FVal + j).className = 'submenuUnsel';
                    if(document.getElementById("ssubmnu" + FVal + j)!=null)
                    document.getElementById("ssubmnu" + FVal + j).style.display = 'none';                 
                }
                else {
                   document.getElementById("submnu" + FVal + j).className = 'submenuSel';
                    if (document.getElementById("ssubmnu" + FVal + j) != null)
                    document.getElementById("ssubmnu" + FVal + j).style.display = 'inline';                     
                }
            }
        }

        for (var k = 1; k <= 16; k++) {
            if (parseInt(k) < 10)
                k = "0" + k; 
            if (document.getElementById("sssubmnu" + FVal + SVal + k) != null) {
                if (k != TVal) {
                    document.getElementById("sssubmnu" + FVal + SVal + k).className = 'tmenuUnsel';
                }
                else {
                    document.getElementById("sssubmnu" + FVal + SVal + k).className = 'tmenuSel';
                }
            }
        }       
    }
    
    function changeMainMenuStyle(id)
    {    
        for(var i=1;i<=11;i++)
        {
            if (parseInt(i) < 10)
                i = "0" + i; 
            if(i!=id)
                document.getElementById("mnut"+i).className = 'fmenuUnsel';//document.getElementById("img"+i).src="../images/m"+i+".gif";             
            else
                document.getElementById("mnut"+i).className = 'fmenuSel';//document.getElementById("img"+i).src="../images/m"+i+"on.gif";            
        }      
    }

//Bookmark function
function addBookmark(title, url) 
{
  if (window.sidebar) 
	{ // <strong class="highlight">firefox</strong>
		  window.sidebar.addPanel(title, url,"");
	}
  else if( document.all ) { //MSIE
			window.external.AddFavorite( url, title);
	} 
	else if(window.opera && window.print) { // Opera Hotlist 
			 var elem = document.createElement('a');
			 elem.setAttribute('href',url);
			 elem.setAttribute('title',title);
			 elem.setAttribute('rel','sidebar');
			 elem.click();
			 alert("Press Ctrl+D to bookmark This page"); 
	 }
	else {
		   alert("Sorry, your browser doesn't support this");
	}
}

function openwindowPopUp(url) 					
    { 
        var linkurl = url;
        var newWin = window.open(linkurl, 'acmlink');	
        newWin.focus();
    }
    function HideImage() {
        document.getElementById("LoadIMG").style.display = "none";
    }


    function ShowImage(evt, id) {
        CheckCharacter();
        isNumberKey(evt);
        if (document.getElementById(id).value.length == 2) {
            document.getElementById("LoadIMG").style.display = "inline";
            document.body.style.cursor = "pointer";
        }
    }
    function isNumberKey(evt) {
        var charCode = (evt.which) ? evt.which : event.keyCode
        if (charCode > 31 && (charCode < 48 || charCode > 57))
            return false;

        return true;
    }
    function CheckCharacter() {
        var keyCode = event.keyCode ? event.keyCode : event.which;
        if ((keyCode > 90 || keyCode < 65) && (keyCode > 122 || keyCode < 97) && (keyCode != 32))
            return false;
        else {
            var key = String.fromCharCode(keyCode);
            key = key.toUpperCase();
            event.keyCode = key.charCodeAt();
            return true;
        }
    }

    function validations() {

        var CompName = document.getElementById("GetQuotes1_TxtGetQuotes").value;
        if (CompName == "") {
            alert("Please enter a company name");
            document.getElementById("GetQuotes1_TxtGetQuotes").focus();
            return false;
        }
        else if (CompName != "") {
            if (CompName.length < 3) {
                alert("Please enter atleast 3 characters of the company name");
                document.getElementById("GetQuotes1_TxtGetQuotes").focus();
                return false;
            }
        }
        return true;
    }

    function CreateXmlHttpSch() {
        var XmlHttpSch;
        try {
            XmlHttpSch = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                XmlHttpSch = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (oc) {
                XmlHttpSch = null;

            }
        }
        if (!XmlHttpSch && typeof XMLHttpRequest != "undefined") {
            XmlHttpSch = new XMLHttpRequest();
        }
        return XmlHttpSch;
    }
    function CreateXmlHttp() {
        //Creating object of XMLHTTP in IE
        try {
            XmlHttp = new ActiveXObject("Msxml2.XmlHttp");
        }
        catch (e) {
            try {
                XmlHttp = new ActiveXObject("Microsoft.XmlHttp");
            }
            catch (oc) {
                XmlHttp = null;
            }
        }
        //Creating object of XMLHTTP in Mozilla and Safari 
        if (!XmlHttp && typeof XMLHttpRequest != "undefined") {
            XmlHttp = new XMLHttpRequest();
        }
    }   