function GenerateGetElement()
{
	if (document.getElementById) return function(id) { return document.getElementById(id); }
	else if (document.all) return function(id) { return document.all[id]; }
	else if (document.layers) return function(id) { document.layers[id]; }
}
var GetElement;
GetElement = GenerateGetElement();

function roll(element, type)
{
    if (element != null)
    {
        var old = element.src;

        var newsrc = ""; 
        if (type == "on")
            newsrc = old.replace("_off", "_on");
        else 
            newsrc = old.replace("_on", "_off");  

        element.src = newsrc;    
    }
}

/*
function ShowGalleryImage(strImageSource)
{
    GetElement("imgMainGalleryImage").src = strImageSource;
}
*/

function ShowGalleryImage(strMainImageElement, strMainImageSource)
{
    //Update Main Image
    GetElement(strMainImageElement).src = strMainImageSource;
}

//ShowGalleryImage
//e.g. Input: 'imgPrivateSuite', 'images/lgPrivate2.jpg', this, 'thPrivate2,thPrivate3,thXXXX0'
//Notes: Quick Configuration over Convention Implementation
function ShowGalleryImage(strMainImageElement, strMainImageSource, OnObject, Off_ID_List)
{
	//Update the Main Image
    GetElement(strMainImageElement).src = strMainImageSource;
	
	//Turn all thumbnails off
	TurnThumbnailsOff(Off_ID_List);
	
	//Turn the clicked thumbnail image on
	roll(OnObject, 'on');
}

function TurnThumbnailsOff(Off_ID_List)
{
	var OffArray = Off_ID_List.split(",");
	var Index = 0;
	var Element;
	
	for(Index=0; Index < OffArray.length; Index++)
	{
		Element = document.getElementById(OffArray[Index]);
		roll(Element, 'off');
	}
}

function ClearCommentBox(tb)  
{   
    if (tb.value=="Please write additional requests here.")
        tb.value="";
}
function RestoreCommentBox(tb) 
{
    if (tb.value=="")
        tb.value="Please write additional requests here.";
}

//function SetUniqueRadioButton(nameregex, current)
//{
//      re = new RegExp(nameregex);
//      for(i = 0; i < document.forms[0].elements.length; i++)
//      {
//            elm = document.forms[0].elements[i]
//            if (elm.type == 'radio')
//            {
//                  if (re.test(elm.name))
//                  {
//                          elm.checked = false;
//                  }
//             }
//      }
//      current.checked = true;
//}