﻿function getInnerHeight(iframe)
{
    var d=iframe.contentWindow ?
    iframe.contentWindow.document :
    iframe.contentDocument;
    var h=0;
    if(d){
    if(d.documentElement && d.compatMode &&
    d.compatMode=="CSS1Compat")
    h=d.documentElement.scrollHeight;
    else if(d.body)
    h=d.body.scrollHeight;
    if(h) h+=getInsets(d);
    }
    document.getElementById('imgDiv').style.display='none';
    document.getElementById('mainFrame').style.visibility='visible';
     var frameheight="500px";
    if(h>500) frameheight=h+"px";
    return frameheight;
    //return (h||300)+"px"; //300 is a default value
}

function getInsets(d)
{
    if(d.body.currentStyle)
    with (d.body.currentStyle)
    return (parseInt(marginTop)||0) +
    (parseInt(marginBottom)||0) +
    (parseInt(paddingTop)||0) +
    (parseInt(paddingBottom)||0);
    if(d.defaultView && d.defaultView.getComputedStyle)
    with (d.defaultView)
    return parseInt(getComputedStyle(d.body,"").
    getPropertyValue("margin-top"))+
    parseInt(getComputedStyle(d.body,"").
    getPropertyValue("margin-bottom"))+
    parseInt(getComputedStyle(d.body,"").
    getPropertyValue("padding-top"))+
    parseInt(getComputedStyle(d.body,"").
    getPropertyValue("padding-bottom"));
    return 0;
}

    function setPage(url)
    {   
        if(url.indexOf("home.aspx") != -1 || url.indexOf("jobs.aspx") != -1 || url.indexOf("sitemap.aspx") != -1
          || url.indexOf("news.aspx") != -1  || url.indexOf("mailus.aspx") != -1 || url.indexOf("search.aspx") != -1  )
        {
             document.getElementById('trCareer').style.display="block";
             document.getElementById('tdTypes').innerHTML='&nbsp;';
        }
        else
        {
             document.getElementById('trCareer').style.display="none";
        }
        var ifrme = document.getElementById('mainFrame');
        ifrme.src=url;
        ifrme.style.visibility='hidden';
        ifrme.style.width = ifrme.src == "home.aspx" ? "675px" : "100%";
        document.getElementById('imgDiv').style.display='block';
       
    }
        
function subscribe(txtbox,flag)
        {
            var emailBox = document.getElementById('txtEmail');
            var emailTxt = emailBox.value;
            if(emailTxt == "")
            {
                alert("Enter a valid Email Address");
            }
            else
            {
                var ind = emailTxt.lastIndexOf(".");
                if(((emailTxt.lastIndexOf("."))-(emailTxt.lastIndexOf("@"))<=1) || (emailTxt.indexOf(".")<=0) || (emailTxt.indexOf("@")<=0) || (emailTxt.substring(ind+1,ind+2)==""))
                {
                    alert("Enter a valid Email Address in 'abc@xyz.com' format");
                    emailBox.value = "";
                    document.getElementById(txtbox).focus();
                }
                else
                {
                    var redirectURL = "message.aspx?youremail="+emailTxt+"&subscribe="+flag;
                    emailBox.value = "";
                    setPage(redirectURL)
                }
            }
        }

function displaymenu()
{
    document.getElementById("leftmenuau").style.display="none";
    var leftmenu=document.getElementById("leftmenu");
    if (leftmenu.style.display == "none")
    {
        leftmenu.style.display='block';
    }
    else
    {
        leftmenu.style.display='none';
    }
}

function displayMenu2()
{
    document.getElementById("leftmenu").style.display="none";
    var leftmenu2=document.getElementById("leftmenuau");
    if (leftmenu2.style.display == "none")
    {
        leftmenu2.style.display='block';
    }
    else
    {
        leftmenu2.style.display='none';
    }
}
  
     
     
     
function ShowSubMenu(id,rowval)
{
   for(i=1;i<=rowval; i++)
    {
        var trval="trMenu"+i;        
        document.getElementById(trval).style.display = "none";
        
    }
    var idval="trMenu"+id;     
    if(document.getElementById(idval).style.display == "block")
    {
        document.getElementById(idval).style.display = "none";
    }
    else
    {
        document.getElementById(idval).style.display = "block";
    }
} 


var cAnchor;
function changeColor(cName,issubmenu)
{
    if(!cAnchor)
    {
        cAnchor = event.srcElement;
        cAnchor.className = cName;
    }
    else
    {
        cAnchor.className = "atag1";
        var tAnchor = event.srcElement;
        tAnchor.className= cName;
        cAnchor = tAnchor;
        if(issubmenu==1)
        {
            document.getElementById('spanPnS').style.color="#004272";
        }
        else
        {
            document.getElementById('spanPnS').style.color="#949393";
        }
        if(issubmenu==2)
        {
            document.getElementById('tdAbUS').style.color="#004272";
        }
        else
        {
            document.getElementById('tdAbUS').style.color="#949393";
        }
    }
}


