﻿function AddToBookmark(title, location)
{
    if (document.all)
        window.external.AddFavorite(location, title);
    else if (window.sidebar)
        window.sidebar.addPanel(title, location, '');
}

function reportAbuse(handle)
{
    //alert('/Abuse?' + window.location);
    window.location = '/' + handle + '/Abuse?' + window.location;
}

function SearchSite(url, elemId)
{
    var elem = document.getElementById(elemId);
    window.location = url + escape(elem.value);
    return false;
}

function focusTextbox(elemId, initialValue, cssClass)
{
    var elem = document.getElementById(elemId);
    value = trimAll(elem.value);
    
    //clear out the textbox if the current value and initial value are the same
    if (value == initialValue)
        elem.value = "";
    
    //if cssClass is not empty, then set the class name
    if (cssClass != "")
        elem.className = cssClass;
}

function blurTextbox(elemId, initialValue, cssClass)
{
    //dont do anything anymore. ever again! I mean it
}

function trimAll(sString)
{
    while (sString.substring(0,1) == ' ')
        sString = sString.substring(1, sString.length);
        
    while (sString.substring(sString.length-1, sString.length) == ' ')
        sString = sString.substring(0,sString.length-1);
        
    return sString;
}

/*-- yellow google toolbar fix --*/

if (window.attachEvent)
{
   window.attachEvent("onload",setListeners);
}

function setListeners()
{
   inputList = document.getElementsByTagName("INPUT");
   for (i=0; i < inputList.length; ++i)
   {
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
   }
   selectList = document.getElementsByTagName("SELECT");
   for (i=0; i < selectList.length; ++i)
   {
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
   }
}

function restoreStyles()
{
   if (event.srcElement.style.backgroundColor != "")
   {
      event.srcElement.style.backgroundColor = "";
   }
}