﻿

function openGateWay()
{
    image = "url(" + getImgRoot() + "doorway.jpg)";
    document.getElementById('doorway').style.backgroundImage = image;
}

function closeGateWay()
{
    document.getElementById('doorway').style.backgroundImage = '';
}

function getImgRoot()
{
   fullURL = String(window.location).substr(7);
   imgRoot = 'http://' + fullURL.substr(0,fullURL.indexOf('/'));
   return imgRoot + "/Resources/img/";
}

function showMainHighlight()
{
    image = "url(" + getImgRoot() + "active" + document.getElementById('hiddenhelp').innerHTML + ".jpg)";
    document.getElementById('menuarea').style.backgroundImage = image;
}

function getImageSource(imgsrc)
{
    return imgsrc.substr(0,imgsrc.indexOf("/thumb")) + imgsrc.substr((imgsrc.indexOf("/thumb")+6));//we've removed everything after /thumb
}

function injectQuotes()
{
    aryClassElements = new Array(); 
    getElementsByClass( 'quote', document.body ); 
    for ( var i = 0; i < aryClassElements.length; i++ )
    { 
        //we want to inject some quotes around the contents of this        
        theStr = aryClassElements[i].innerHTML;
        //alert(theStr);
        theStr = theStr.substr(theStr.indexOf('>')+1);
        position = theStr.indexOf('</div>');
        if(position < 0)
        {
          position = theStr.indexOf('</DIV>');
        } 
        theStr = theStr.substr(0,position);
        imgRoot = getImgRoot();
        aryClassElements[i].innerHTML = '<div class="line"><img src="' + imgRoot + 'leftquote.png" class="leftquote">'
         + theStr + '<img src="' + imgRoot + 'rightquote.png" class="rightquote"></div>';
    }
}

function getElementsByClass( strClassName, obj )
{

    if ( obj.className == strClassName )
    {
        aryClassElements[aryClassElements.length] = obj;
    }
    for ( var i = 0; i < obj.childNodes.length; i++ )
    {
        getElementsByClass( strClassName, obj.childNodes[i] );
    }
}
