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 = "";  
    }
}


function popupDataColForm(url) {
    day = new Date();
    id = day.getTime();
    var iMyWidth;
    var iMyHeight;
    var screenWidth = 700;
    var screenHeight = 690;

    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (screen.width - screenWidth) / 2; //(window.screen.width / 2) - (75 + 10);

    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (screen.height - screenHeight) / 2;  //(window.screen.height / 2) - (100 + 50);

    //Open the window.
    //var win2 = window.open("filename.htm", "Window2", "status=no,height=200,width=150,resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");
    //win2.focus();

    eval("page" + id + " = window.open(url, '" + id + "', 'left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + screenWidth + ",height=" + screenHeight + "');");


    //eval("page" + id + " = window.open(url, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=550,height=505');");
}


function popUpData(url,sb) {
    day = new Date();
    id = day.getTime();
    var iMyWidth;
    var iMyHeight;
    var screenWidth = 700;
    var screenHeight = 690;

    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (screen.width - screenWidth) / 2; 

    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (screen.height - screenHeight) / 2;
    
    eval("page" + id + " = window.open(url, '" + id + "', 'left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=0,scrollbars=" + sb + ",location=0,statusbar=0,menubar=0,resizable=1,width=" + screenWidth + ",height=" + screenHeight + "');");
}

function popupPrintLink(linkId) {
    day = new Date();
    id = day.getTime();
    var iMyWidth;
    var iMyHeight;
    var screenWidth = 600;
    var screenHeight = 400;

    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (screen.width - screenWidth) / 2;

    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (screen.height - screenHeight) / 2;

    eval("page" + id + " = window.open('/actions/print/" + linkId + "/', '" + id + "', 'left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + screenWidth + ",height=" + screenHeight + "');");
}

/* 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);
    }
}
function addToFavourites(url, title) {
    if (window.sidebar) {
        window.sidebar.addPanel(title, url, "");
    } else if (document.all) {
        window.external.AddFavorite(url, title);
    } 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 {
        return true;
    }
}

function popupEmailToFriend(linkId) {
    day = new Date();
    id = day.getTime();

    var iMyWidth;
    var iMyHeight;
    var screenWidth = 600;
    var screenHeight = 400;

    //half the screen width minus half the new window width (plus 5 pixel borders).
    iMyWidth = (screen.width - screenWidth) / 2;

    //half the screen height minus half the new window height (plus title and status bars).
    iMyHeight = (screen.height - screenHeight) / 2;

    eval("page" + id + " = window.open('/actions/send_to_friend/" + linkId + "/', '" + id + "', 'left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=" + screenWidth + ",height=" + screenHeight + "');");
}

function toUpper(ctrl) {
    var t = ctrl.value;
    ctrl.value = t.toUpperCase();
}
function checkAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

