/* 
Hiki Solutions (2007)
Title   : General JS functions
Auhtor  : David Collins
Version : 1.1 (03 Jan 2008)

Do not re-distribute.
*/

/* Find Control ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
function HikiFindControl(theControlID)
{
    var Control = document.getElementById(theControlID);
    
    if (Control!=null)
        return Control;
        
    for(i=0; i<document.getElementsByTagName("input").length; i++)
    {
        Control = document.getElementsByTagName("input")[i];
        var id = Control.id;
        if (id.length > theControlID.length)
        {
            if (theControlID == (id.substring(id.length-theControlID.length,id.length)))
            {
                return Control;
            }
        }
    }
    return null;
}

/* Find Control ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */

function HikiShowHideControl(theControlID)
{
    theControl = HikiFindControl(theControlID);
    if(theControl!=null)
    {
        if(theControl.style.display=='none')
        {
            theControl.style.display='block';
        }
        else
        {
            theControl.style.display='none';
        }
    }
}
function HikiShowControl(theControlID)
{
    theControl = HikiFindControl(theControlID);
    if(theControl!=null)
    {
    	theControl.style.display='block';
    }
}
function HikiHideControl(theControlID)
{
    theControl = HikiFindControl(theControlID);
    if(theControl!=null)
    {
    	theControl.style.display='none';
    }
}
function HikiSwitchImage(theControl,ImageName)
{
    //theControl = HikiFindControl(theControlID);
    if(theControl!=null)
    {
	s = theControl.src;
	theControl.src = s.substring(0,s.lastIndexOf('/')+1) + ImageName;
    }
}
