﻿/* Print the current page */
function printit(){  
  if (window.print) {
    window.print() ;  
  } else {
    var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
    document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    WebBrowser1.ExecWB(6, 1);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
  }
}

/* Popup a window */
function popupWindow(url, width, height)
{
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=" + width + ",height=" + height + "');");
}

/* Add the current site into the users favourites */
function addToFavourites(url, title)
{
    if (window.sidebar)
    {
        // firefox
	    window.sidebar.addPanel(title, url, "");
	}
    else if(window.opera && window.print)
    { 
        // opera
	    var elem = document.createElement('a');
	    elem.setAttribute('href',url);
	    elem.setAttribute('title',title);
	    elem.setAttribute('rel','sidebar');
	    elem.click();
    } 
    else if(document.all)
    {
        // ie
	    window.external.AddFavorite(url, title);
    }
}

/* Make sure that text entered into a box is convereted to uppercase */
function toUpper(ctrl)
{   
    var t = ctrl.value;
    ctrl.value = t.toUpperCase(); 
}