﻿// JScript File
function addToFavs(title, url)
{
      if (window.external || window.all)
        {
            window.external.addfavorite(url, title);
        }  
      else if (window.sidebar)
	    {
	        window.sidebar.addPanel(title, url, "");
	    }
	  else
	    {
	      alert("Press Ctrl+D to bookmark: " + title);
	    }
}
//Displays a help box associated with a control
//In order for this function to work, you must have...
//1. Control (id = address)
//2. Control with id and "_help" appended to the id (id = address_help) with text you would like to display
//3. Control with id "helpbox," where the text will be displayed
function displayHelp(helpObj)
    {
        var obj = document.getElementById(helpObj + "_help");
        var displayObj = document.getElementById("helpbox");
        
        if (displayObj != null && obj != null)
        {
            displayObj.innerHTML = obj.innerHTML;
            displayObj.style.display = '';
        }
        else if(displayObj != null)
        {
            displayObj.style.display = 'none';
        }
     }
     
//Takes two parameters: 
//Control: name of the control that needs to be hidden/shown
//Textcontrol: name of the control that will hold the show/hide text.
function ShowHide(control, textControl)
{
    var obj = document.getElementById(control);
    var objText = document.getElementById(textControl);
    if (obj.style.display == "")
    {
        obj.style.display = "none";
        objText.innerHTML = "Show";
        return;
    }
    
    obj.style.display = "";  
    objText.innerHTML = "Hide";      
}

function enableDisable(text, destinationControl)
{
    var destObj = document.getElementById(destinationControl);
    if (text.length == 0)
    {
        destObj.disabled  = 'true';
    }
    return;
}

function SwapImage(controlName, imagePath)
{
    document.getElementById(controlName).src = imagePath;
}

/*function removeText()
{
     alert("Press Ctrl+D to bookmark: ");
}*/
