﻿var PostalTimer

function HomeClick() {
    window.location = "index.html";
}
function OurSportsClick() {
    window.location = "oursports.html";
}
function GalleryClick() {
    window.location = "gallery.html";
}
function FacilitiesClick() {
    window.location = "facilities.html";
}
function ContactUsClick() {
    window.location = "contactus.html";
}
function FixtureClick() {
    window.open("http://actionsport.spawtz.com/SpawtzSkin/Fixtures/LeagueList.aspx?VenueId=1", "_blank");
}
function GetCricketForm() {
    window.open("Documents/CricketNomFormSUMMER2011.pdf", "_blank");
}
function GetNetballForm() {
    window.open("Documents/NetballNomFormSummer2011.pdf", "_blank");
}
function GetSoccerForm() {
    window.open("Documents/EdenvaleNomForm2010.pdf", "_blank");
}
function GetSoccerRules() {
    window.open("Documents/SoccerRuleBook.pdf", "_blank");
}
function GetHockeyForm() {
    window.open("Documents/HockeyNomFormSummer2011.pdf", "_blank");
}
function GetHockeyRules() {
    window.open("Documents/HockeyRuleBook.pdf", "_blank");
}
function getDocHeight() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollHeight, D.documentElement.scrollHeight),
        Math.max(D.body.offsetHeight, D.documentElement.offsetHeight),
        Math.max(D.body.clientHeight, D.documentElement.clientHeight)
    );
}
function getDocWidth() {
    var D = document;
    return Math.max(
        Math.max(D.body.scrollWidth, D.documentElement.scrollWidth),
        Math.max(D.body.offsetWidth, D.documentElement.offsetWidth),
        Math.max(D.body.clientWidth, D.documentElement.clientWidth)
    );
}
function GalleryInit() {
//    var oTable = document.getElementById("tblGalleries");
//    while (oTable.rows.length > 0) {
//        oTable.deleteRow(oTable.rows.length - 1);
//    }
//    var oTableRow = "";
//    var oCell = "";
//    var sTable = "";
//    var nGalleryID  = 0;
//    
//    for (ni = 0; ni < 7; ni++) {
//        nGalleryID++;
//        oTableRow = oTable.insertRow(ni);
//        oCell = oTableRow.insertCell(0);
//        sTable = "<div align='center'><table border='0' cellspacing='1' cellpadding='0' style='width:240px;'><tr>";
//        if (nGalleryID == 1) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>Finals 27 February 2011</label></td>";
//        } else if (nGalleryID == 2) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>Finals 1 March 2011</label></td>";
//        } else if (nGalleryID == 3) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>Finals 4 February 2011</label></td>";
//        } else if (nGalleryID == 4) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>1 July 2011</label></td>";
//        } else if (nGalleryID == 5) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>3 July 2011</label></td>";
//        } else if (nGalleryID == 6) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>5 July 2011</label></td>";
//        } else if (nGalleryID == 7) {
//            sTable = sTable + "<td valign='top' style='width:200px;'><lable id='lblGallery" + nGalleryID + "'>8 July 2011</label></td>";
//        }
//        sTable = sTable + "<td><table border='0' cellspacing='1' cellpadding='0' class='GalleryTable' onclick='GetGallery(" + nGalleryID + ");'><tr>";
//        sTable = sTable + "<td><img alt='' src='Images/Gallery" + nGalleryID + ".jpg'/></td>";
//        sTable = sTable + "</tr></table></td>";
//        sTable = sTable + "</tr></table></div>";
//        oCell.innerHTML = sTable;
//    }
    
    GetGallery(7); 
}
function GetGallery(nGalleryID) {
    if (nGalleryID == 1) {
        document.getElementById("lblOfImageNo").innerHTML = 201;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: Finals 27 February 2011";
    } else if (nGalleryID == 2) {
        document.getElementById("lblOfImageNo").innerHTML = 96;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: Finals 1 March 2011";
    } else if (nGalleryID == 3) {
        document.getElementById("lblOfImageNo").innerHTML = 124;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: Finals 4 March 2011";
    } else if (nGalleryID == 4) {
        document.getElementById("lblOfImageNo").innerHTML = 84;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: 1 July 2011";
    }  else if (nGalleryID == 5) {
        document.getElementById("lblOfImageNo").innerHTML = 140;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: 3 July 2011";
    }  else if (nGalleryID == 6) {
        document.getElementById("lblOfImageNo").innerHTML = 40;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: 5 July 2011";
    }  else if (nGalleryID == 7) {
        document.getElementById("lblOfImageNo").innerHTML = 73;
        document.getElementById("lblSelGallery").innerHTML = "Selected Gallery: 8 July 2011";
    }    
    document.getElementById("hGalleryID").value = nGalleryID;
    
    EnlargeGallery(nGalleryID, 1);

}
function EnlargeGallery(nGalleryID, nPhoto) {
    $('#imgEnlargeLoading').insertAfter('#imgEnlargeLoaded'); 
    $('#imgEnlargeLoading').show();
    $('#imgEnlargeLoaded').hide();
    if (nPhoto == 1) {
        document.getElementById("imgLeftArrow").style.visibility = "hidden";
    } else {
        document.getElementById("imgLeftArrow").style.visibility = "visible";
    }
    var nTotalImages = 0;
    nTotalImages = document.getElementById("lblOfImageNo").innerHTML;
    if (nPhoto < nTotalImages) {
        document.getElementById("imgRightArrow").style.visibility = "visible";
    } else {
        document.getElementById("imgRightArrow").style.visibility = "hidden";
    }
    document.getElementById("hPhotoNumber").value = nPhoto;
    document.getElementById("lblImageNo").innerHTML = nPhoto; 
    var d = new Date();
    if (nGalleryID < 4) {  
        document.getElementById("imgEnlargeImage").src = "Images/Gallery" + nGalleryID + "/Actioncricket" + document.getElementById("hPhotoNumber").value + ".jpg?a=" + d;
    } else {
        document.getElementById("imgEnlargeImage").src = "Images/Gallery" + nGalleryID + "/Eaglesactionsportsreduced" + document.getElementById("hPhotoNumber").value + ".jpg?a=" + d;
    }
}
function HideGalleryLoading() {
    $('#imgEnlargeLoading').insertAfter('#imgEnlargeLoaded'); 
    $('#imgEnlargeLoading').hide();
    $('#imgEnlargeLoaded').show();
}
function LeftImage() {
    var nNewPhoto = 0;
    nNewPhoto = document.getElementById("hPhotoNumber").value;
    nNewPhoto--;
    EnlargeGallery(document.getElementById("hGalleryID").value, nNewPhoto);
}
function RightImage() {
    var nNewPhoto = 0;
    nNewPhoto = document.getElementById("hPhotoNumber").value;
    nNewPhoto++;
    EnlargeGallery(document.getElementById("hGalleryID").value, nNewPhoto);
}

var m=30;
var n=850;
var speed=6;
var r;
var l;
function ScrollRightArrow() {
    document.getElementById('portfoliodiv1').style.left = m + 'px';
    m--;
    var oRight = 850 - m;
    if (m < 0) {
    //    document.getElementById('divleftarrow').style.visibility = "visible";
    }
    if (oRight > 1500) {
    //    document.getElementById('divrightarrow').style.visibility = "hidden";
        clearTimeout(r);
        return;
    }
    r = setTimeout('ScrollRightArrow()',speed);
} 
function StopRightArrow() {
    clearTimeout(r);
}
function ScrollLeftArrow() {
    document.getElementById('portfoliodiv1').style.left = m + 'px';
    m++;
    var oRight = 850 - m;
    if (oRight < 1500) {
    //    document.getElementById('divrightarrow').style.visibility = "visible";
    }
    if (m >= 30) {
    //    document.getElementById('divleftarrow').style.visibility = "hidden";
        clearTimeout(l);
        return;
    } else {
    //    document.getElementById('divleftarrow').style.visibility = "visible";
    }
    
    l = setTimeout('ScrollLeftArrow()',speed);
} 
function StopLeftArrow() {
    clearTimeout(l);
}



