function init()
{
    getUrlVars();
}
function checkSubmission()
{
    //initCSA();
    if (document.getElementById("submitted").value == "submitted")
    {
        showdiv( " ", " ", " ", "contact" );
        //alert('test');
        document.getElementById('contactContent').style.visibility = 'hidden';
            
            
        document.getElementById("thankyouContent").style.visibility = 'visible';
    }
    //getUrlVars();
}

function checkIE()
{

    isOldIE = 0;
    var theBrowser=navigator.appVersion.toLowerCase();
    if ( theBrowser.indexOf('msie') != -1 )
    {
        tmpVar = theBrowser.split('msie');
        tmpVar1 = tmpVar[1].split(';');
        theVersion = tmpVar1[0].split('.');
        if ( theVersion[0] < 7 )
        {
            isOldIE = 1;
            alert(theVersion[0]);
        }
    }
    

}

function initCSA()
{
    theCoords=getAnchorPosition('floatAnchor');
    //alert(theCoords.x);
    document.getElementById('floatingContainerRight').style.backgroundPosition = "-200px 0px";
    document.getElementById('floatingContainerRight').style.left = theCoords.x + 800 + "px";
    document.getElementById('floatingContainerRight').style.top = theCoords.y + "px";
    document.getElementById('floatingContainerRight').style.visibility = "visible";
    
    document.getElementById('floatingContainer').style.backgroundPosition = "200px 0px";
    document.getElementById('floatingContainer').style.left = theCoords.x - 200 + "px";
    document.getElementById('floatingContainer').style.top = theCoords.y + "px";
    document.getElementById('floatingContainer').style.visibility = "visible";
}

function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
    for(var i in hashes)
    {
        hash = hashes[i].split('=');
        if(hash[0] == 'pID')
        {
           if (hash[1] == '2')
           {
               showdiv('labelsContent', 'labelsLink', 'labelsSelector', 'labels');
           }else if (hash[1] == '3')
           {
               showdiv('distributionContent', 'distributionLink', 'distributionSelector', 'distribution');
           }else if (hash[1] == '4')
           {
               showdiv('contactContent', 'contactLink', 'contactSelector', 'contact');
           }
        }
    }
}

function showdiv2( theDiv, theAnch, theType, theAlt )
{
    if (document.getElementById)
    { // DOM3 = IE5, NS6
        isOldIE = 0;
        var theBrowser=navigator.appVersion.toLowerCase();
        if ( theBrowser.indexOf('msie') != -1 )
        {
            tmpVar = theBrowser.split('msie');
            tmpVar1 = tmpVar[1].split(';');
            theVersion = tmpVar1[0].split('.');
            
            if ( theVersion[0] < 7 )
            {
                isOldIE = 1;
                //alert(theVersion[0]);
            }
        }
        theCoords = getAnchorPosition( theAnch )
        document.getElementById(theDiv).style.visibility = 'visible';
        document.getElementById(theDiv).style.display = "block";
        document.getElementById(theDiv).style.position = "absolute";
        
        if ( theType == "1" )
        {
            if ( theAnch == "a05" )
            {
                document.getElementById(theDiv).style.backgroundImage = "url('img/products/" + theAnch + "Pop.png')";
                if ( isOldIE == 1 )
                {
                    document.getElementById(theDiv).style.backgroundImage = "none";
                    document.getElementById(theDiv).innerHTML = "<span style=\"width:270px;height:185px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/products/" + theAnch + "Pop.png');\"><img style=\"filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" src=\"img/products/" + theAnch + "Pop.png\" width=\"270\" height=\"185\" border=\"0\" alt=\"\"></span>";
                }
                theCoords.x = theCoords.x - 140;
            }else{
                document.getElementById(theDiv).style.backgroundImage = "url('img/products/" + theAnch + "Pop.png')";
                if ( isOldIE == 1 )
                {
                    document.getElementById(theDiv).style.backgroundImage = "none";
                    document.getElementById(theDiv).innerHTML = "<span style=\"width:270px;height:185px;display:inline-block;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/products/" + theAnch + "Pop.png');\"><img style=\"filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);\" src=\"img/products/" + theAnch + "Pop.png\" width=\"270\" height=\"185\" border=\"0\" alt=\"\"></span>";
                }
            }
            
            document.getElementById(theDiv).style.left = theCoords.x + "px";
            document.getElementById(theDiv).style.top = theCoords.y - 180 + "px";
        }else{
            if ( theType == "2" )
            {
                document.getElementById(theDiv).style.left = theCoords.x - 15 + "px";
                document.getElementById(theDiv).style.top = theCoords.y + 7 + "px";
                //document.getElementById('theMainPicHolder').style.backgroundImage = "url('img/products/" + theAlt + "')";
                document.getElementById('theMainPicHolder').style.backgroundImage = "url('" + theAlt + "')";

                document.getElementById('tmpHolder').innerHTML = document.getElementById('prodTxtContainer').innerHTML;
                document.getElementById('prodTxtContainer').innerHTML=document.getElementById(theAnch + 'Text').innerHTML;
            }
        }
    }else{
    if (document.layers)
        { // Netscape 4
            //document.theDiv.visibility = 'visible'; - Do Nothing
    }else
        { // IE 4
            //document.all.theDiv.style.visibility = 'visible'; - Do Nothing
        }
    }
}

function checkHover( theLink )
{
    if (document.getElementById(theLink + "Content").style.visibility != 'visible')
    {
        if (theLink == 'contact')
        {
            if (document.getElementById("thankyouContent").style.visibility != 'visible')
            {
                document.getElementById(theLink + "Link").setAttribute("class", theLink + "Header");
                document.getElementById(theLink + "Link").setAttribute("className", theLink + "Header");
            }
        }else{
            document.getElementById(theLink + "Link").setAttribute("class", theLink + "Header");
            document.getElementById(theLink + "Link").setAttribute("className", theLink + "Header");
        }
        
    }
}
function showdiv( theDiv, theLink, theSelect, theID )
{
    if (document.getElementById)
    {
        if (document.getElementById('welcomeContent').style.visibility == 'visible')
        {
            document.getElementById('welcomeContent').style.visibility = 'hidden';
            document.getElementById('welcomeLink').href = 'javascript:void(0)';
            document.getElementById('welcomeSelector').style.backgroundImage = "url('img/contentNotSelected.jpg')";
            document.getElementById('welcomeLink').setAttribute("class", "welcomeHeaderInActive");
            document.getElementById('welcomeLink').setAttribute("className", "welcomeHeaderInActive");
        }
        if (document.getElementById('labelsContent').style.visibility == 'visible')
        {
            document.getElementById('labelsContent').style.visibility = 'hidden';
            document.getElementById('labelsLink').href = 'javascript:void(0)';
            document.getElementById('labelsSelector').style.backgroundImage = "url('img/contentNotSelected.jpg')";
            document.getElementById('labelsLink').setAttribute("class", "labelsHeaderInActive");
            document.getElementById('labelsLink').setAttribute("className", "labelsHeaderInActive");
        }
        if (document.getElementById('distributionContent').style.visibility == 'visible')
        {
            document.getElementById('distributionContent').style.visibility = 'hidden';
            document.getElementById('distributionLink').href = 'javascript:void(0)';
            document.getElementById('distributionSelector').style.backgroundImage = "url('img/contentNotSelected.jpg')";
            document.getElementById('distributionLink').setAttribute("class", "distributionHeaderInActive");
            document.getElementById('distributionLink').setAttribute("className", "distributionHeaderInActive");
        }
        if (document.getElementById('contactContent').style.visibility == 'visible')
        {
            document.getElementById('contactContent').style.visibility = 'hidden';
            document.getElementById('contactLink').href = 'javascript:void(0)';
            document.getElementById('contactSelector').style.backgroundImage = "url('img/contentNotSelected.jpg')";
            document.getElementById('contactLink').setAttribute("class", "contactHeaderInActive");
            document.getElementById('contactLink').setAttribute("className", "contactHeaderInActive");
        }
        if (document.getElementById('thankyouContent').style.visibility == 'visible')
        {
            document.getElementById('thankyouContent').style.visibility = 'hidden';
            document.getElementById('contactLink').href = 'javascript:void(0)';
            document.getElementById('contactSelector').style.backgroundImage = "url('img/contentNotSelected.jpg')";
            document.getElementById('contactLink').setAttribute("class", "contactHeaderInActive");
            document.getElementById('contactLink').setAttribute("className", "contactHeaderInActive");
        }
        document.getElementById(theID + "Content").style.visibility = 'visible';
        document.getElementById(theID + "Link").removeAttribute("href");
        document.getElementById(theID + "Selector").style.backgroundImage = "url('img/contentSelected.jpg')";
        document.getElementById(theID + "Link").setAttribute("class", theID + "HeaderActive");
        document.getElementById(theID + "Link").setAttribute("className", theID + "HeaderActive");
    }else{
        // DO NOTHING....
    }

}


function hidediv( theDiv, theOld )
{
    if (document.getElementById)
    { // DOM3 = IE5, NS6
        document.getElementById(theDiv).style.visibility = 'hidden';
        if (document.getElementById('theMainPicHolder'))
        {
//            document.getElementById('theMainPicHolder').style.backgroundImage = "url('img/products/" + theOld + ".png')";
            document.getElementById('theMainPicHolder').style.backgroundImage = "url('" + theOld + "')";
            document.getElementById('prodTxtContainer').innerHTML = document.getElementById('tmpHolder').innerHTML;
        }
    }else{
        if (document.layers)
        { // Netscape 4 - Do Nothing
            //document.theDiv.visibility = 'hidden';
        }else{ // IE 4 - Do Nothing
            //document.all.theDiv.style.visibility = 'hidden';
        }
    }
}
function checkTheBox(theCkBox)
    {
        if (document.getElementById(theCkBox).checked==true)
        {
            document.getElementById(theCkBox).checked=false;
        }else{
            document.getElementById(theCkBox).checked=true;
        }
        //document.contactUsForm.contactckbox.checked=true;
        //document.testb.mycb[0].checked = true;
    }
function ulLink(theID)
{
    document.getElementById("lnk" + theID).style.textDecoration = 'underline';
    document.getElementById("pdf" + theID).style.backgroundImage = "url('img/adobeMarkHover.jpg')";
}
function clrLink(theID)
{
    document.getElementById("lnk" + theID).style.textDecoration = 'none';
    document.getElementById("pdf" + theID).style.backgroundImage = "url('img/adobeMark.jpg')";
}
