﻿// JScript File

function checkForError() {
    for(i=0; i<document.main.elements.length; i++){
        if (document.main.elements[i].name.length > 15) {
            if (document.main.elements[i].name.substr(0,15) == 'hidErrorMessage') {
                if (document.main.elements[i].value.length > 0) {
                    popUpErrorPage();
                    break;
                }
            }
        }
    }
}

function popUpInfo(URL) {
    window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=800,height=650,left=100,top=100');
}

function popUpPDF() {
    window.open('PDFOpener.aspx', '', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=1000,height=800,left=10,top=10');
}

function popUpErrorPage() {
	window.open("errorPage.aspx", '', 'toolbar=0,scrollbars=none,location=0,statusbar=0,menubar=0,resizable=0,width=408,height=339,left=300,top=300');
}

function getPrint(print_area){
    var myHtml = '';

    myHtml = '<HTML><HEAD><title>Print Preview</title>';
    myHtml = myHtml + '	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
    myHtml = myHtml + '	<style media="all" type="text/css">@import"css/all.css";</style>';
    myHtml = myHtml + '<!--[if IE]><style media="all" type="text/css">@import"css/ie7.css";</style><![endif]-->';
    myHtml = myHtml + '<base target="_self"></HEAD>';
    myHtml = myHtml + '<body MS_POSITIONING="GridLayout" bottomMargin="0"';
    myHtml = myHtml + ' leftMargin="0" topMargin="0" rightMargin="0">';
    myHtml = myHtml + '<form method="post">';
    myHtml = myHtml + '<TABLE width=100%><TR><TD></TD></TR><TR><TD align=right>';
    myHtml = myHtml + '</TD></TR><TR><TD></TD></TR></TABLE>';
    myHtml = myHtml + document.getElementById(print_area).innerHTML;
    myHtml = myHtml + '</form></body></HTML>';
    document.getElementById("hidHTML").value = encodeURI(myHtml);
} 

function viewPDF(pdf) {
    document.getElementById("hidPDF").value = pdf;
    document.main.submit();
}

if (document.layers) document.captureEvents(Event.MOUSEMOVE); 
document.onmousemove=mtrack; 
var ent; // Our floating div 
var posx=0; // Our mouseX 
var posy=0; // Our mouseY 
var offsetX=10; // Offset X away from mouse 
var offsetY=20; // Offset Y 
var popUp = false; // Is it showing right now??! 

// Run upon load 
function init() { 
// Set up div we will use to hover our text 
ent = document.createElement("div"); 
// Change these to customise your popup 
ent.style.color = "#000000"; 
ent.style.font = "normal xx-small verdana"; 
ent.style.padding = "3px 3px 3px 3px"; 
ent.style.background = "#EFEAEA"; 
ent.style.border = "1px solid black"; 
// Don't, however, change these 
ent.style.left = -100+"px"; 
ent.style.top = -100+"px"; 
ent.style.position = 'absolute'; 
ent.innerHTML = ''; 
ent.style.zIndex = 9999; 
document.getElementById("thepage").appendChild(ent); 
} 
// Keeps mouse x and y in posx and posy 

function mtrack(e) { 
if (popUp) { 
if (!e) var e = window.event; 
if (e.pageX || e.pageY) { 
posx = e.pageX; 
posy = e.pageY; 
} 
else if (e.clientX || e.clientY) { 
posx = e.clientX + document.body.scrollLeft; 
posy = e.clientY + document.body.scrollTop; 
} 
if (ent) {
    ent.style.left = posx + offsetX+"px"; 
    ent.style.top = posy + offsetY+"px"; 
}
} 
} 
// Change floating div to correct text on mouseover 

function doText(t, e, pos) { 
    if (pos=='left') {
        offsetX = -160;
    } else { 
        offsetX = 10;
    }
    popUp = true; 
    var hid = document.getElementById(e)
    if (ent) {
        if (hid) {
            ent.innerHTML = hid.value; 
        } else {
            ent.innerHTML = t; 
        }
    }
} 
// Change back to nothing 

function doClear() { 
popUp = false; 
if (ent) {
    ent.style.left = -100+"px"; 
    ent.style.top = -100+"px"; 
    ent.innerHTML = ""; 
}
} 
