﻿
var Display =
{
    SwapImage:
    function (img, imagePath) {
        img.src = imagePath;
    },
    CheckForSearch:
    function (e) {
        var keyID = (window.event) ? event.keyCode : e.keyCode;
        if (keyID == 13) Display.SubmitSearch();
    },
    SubmitSearch:
    function () {
        document.forms[0].submit();
    },
    MailPage:
    function () {
        var mailTo = "mailto:?subject=Check out this Children's Hospital and Health System web page: " + document.title;
        mailTo += "&body=You can view it at " + window.location.href;
        window.location.href = mailTo;
    },
    PrintPage:
    function (docID) {
        Display.NewWindow('/display/PageLayoutPublic2011Print.asp?DocID=' + docID + '&amp;ThisPage=' + location.url, '', '580', '540', 'yes');
    },
    NewWindow:
    function (mypage, myname, w, h, scroll) {
        var winl = (screen.width - w) / 2;
        var wint = (screen.height - h) / 2;
        winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
        win = window.open(mypage, myname, winprops)
        if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
    },
    Print:
    function () {
		if(window.print)
			window.print();
		else 
			alert("Printing Instructions:\n\n - If you are using a Macintosh, please select \"Print\" from the \"File\" menu.\n - If you are using Windows, right click the page and select \"Print\" from the pop-up menu.");
	}
}
