// Image rollovers
function highlight(img_name,new_img) {
	document.images(img_name).src=new_img;
}

// Popup windows
// Usage: <a onclick="popUp(this.href); return false;" href="link.aspx">Link text</a>
function popUp(url) {
	fnOpenWindow(url,'HeartLandExpressPopUp',400,400);
}
function strOpenWindowFeatures(iWindowWidth, iWindowHeight) {
	var iMouseX = 10;
	var iMouseY = 10;
	if ( window.event != null ) {
		iMouseX = window.event.screenX;
		iMouseY = window.event.screenY; }
	var iScreenX = window.screen.availWidth;
	var iScreenY = window.screen.availHeight;
	var iWindowLeft = iMouseX;
	if ( iWindowLeft + iWindowWidth > iScreenX ) { iWindowLeft = iMouseX - iWindowWidth - 10; }
	if ( iWindowLeft < 10 ) { iWindowLeft = 10; }
	var iWindowTop = iMouseY;
	if ( iWindowTop + iWindowHeight > iScreenY - 50 ) { iWindowTop = iMouseY - iWindowHeight - 60; }
	if ( iWindowTop < 10 ) { iWindowTop = 10; }
	return "width=" + iWindowWidth + ", height=" + iWindowHeight + ", left=" + iWindowLeft + ", top=" + iWindowTop + ", resizable=yes";
}
function fnOpenWindow(strWindowURL, strWindowName, iWindowWidth, iWindowHeight) {
	var objNewWindow = window.open(strWindowURL, strWindowName, strOpenWindowFeatures(iWindowWidth, iWindowHeight), false);
	if ( objNewWindow != null ) {
		objNewWindow.focus();
	}
}

// Random top images
function templateOneRandomImage() {
    var randomNum = randomNumber(15);
    document.write("<img src=\"/_imgs/content/Templ_3/" + randomNum + "_lev3.jpg\" width=\"399\" height=\"166\" alt=\"\" />");
}
function templateTwoRandomImage() {
    var randomNum = randomNumber(6);
    var randomLet = randomLetter(4);
    document.write("<img src=\"/_imgs/content/Templ_2/" + randomNum + randomLet + "_lev2.jpg\" width=\"640\" height=\"114\" alt=\"\" />");
}
function templateThreeRandomImage() {
	// 1, 2, 3, 4, 5 = 5 numbers
	var randomNum = randomNumber(6);
	// a, b, c, d = 4 letters
	var randomLet = randomLetter(4);	
	document.write("<img src=\"/_imgs/content/Templ_1/" + randomNum + randomLet + "_lev1.jpg\" width=\"765\" height=\"166\" alt=\"\" />");
}
function randomNumber(numberQuantity) {
    var numberQuantity;
    var randomNum = Math.ceil(Math.random() * numberQuantity);
    return randomNum;
}
function randomLetter(letterQuantity) {
    var letterQuantity;
    var randomLet = Math.ceil(Math.random() * letterQuantity);
    switch (randomLet) {
        case 1:
        randomLet = "a";
        break;        
        case 2:
        randomLet = "b";
        break;        
        case 3:
        randomLet = "c";
        break;        
        case 4:
        randomLet = "d";
        break;        
        default:
        randomLet = "a";
        break;
    }
    return randomLet;
}