//==============================================================================
//==============================================================================

//------------------------------------------------------------------------------
function setNav(item) {

        var image = eval('window.parent.frames["nav"].document.' + window.parent.g_currentNavItem);

        if (window.parent.g_currentNavItem != item) {

	        image.src = './images/_nav_' + window.parent.g_currentNavItem + '.gif';
        } else {
	        image.src = './images/_nav_' + window.parent.g_currentNavItem + '_hi.gif';
        }

	window.parent.g_currentNavItem = item;
}

//------------------------------------------------------------------------------
function defaultNav(item) {

        var imageOld = eval('window.parent.frames["nav"].document.' + window.parent.g_currentNavItem);
        var imageNew = eval('window.parent.frames["nav"].document.' + item);

        imageOld.src = './images/_nav_' + window.parent.g_currentNavItem + '.gif';
        imageNew.src = './images/_nav_' + item + '_hi.gif';

        window.parent.g_currentNavItem = item;
}

//------------------------------------------------------------------------------
function touchNav(item, image, toggle){

        var source = './images/_nav_' + item;

        if (toggle == 'hi') {
                source += '_hi.gif';
        } else {

                if (item == window.parent.g_currentNavItem) {

                        source += '_hi.gif';
                } else {
	                source += '.gif';
                }
        }
	image.src = source;
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function holeURLPopup(hole) {


        var width       = 400;
        var height      = 422;

        // Set a title
        var title = "Hole Preview";
        var holeURL = "./_popup_hole_" + hole + ".html";

        // Set window dimensions and center in screen
        var iWndWidth      = parseInt(width);
        var iWndHeight     = parseInt(height);
        var iWndLeft       = ((screen.width / 2)  - (iWndWidth /2));
        var iWndTop        = ((screen.height / 2) - (iWndHeight /2));

        // Create basic window
        var wndHole 	   = window.open(holeURL, "holeURLPopup",
					 "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=1,resizable=0,width=" + iWndWidth+ ",height=" + iWndHeight+ ",left=" + iWndLeft+ ",top=" + iWndTop);

        wndHole.focus();
        return(0);
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function galleryPopup(picture, pictureWidth, pictureHeight, title) {

        // Set window dimensions and center in screen
	var iWndWidth      = parseInt(pictureWidth) + (30 * 2);
	var iWndHeight     = parseInt(pictureHeight) + (30 * 2) + 15;

        var iWndLeft       = ((screen.width / 2)  - (iWndWidth /2));
        var iWndTop        = ((screen.height / 2) - (iWndHeight /2));

        // Create basic window
        var wndAlert;
	wndAlert = window.open("", "popupGallery",
					 "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,copyhistory=1,resizable=0,width=" + iWndWidth+ ",height=" + iWndHeight+ ",left=" + iWndLeft+ ",top=" + iWndTop);

        // Output HTML content to window
	wndAlert.document.write('<html>');
	wndAlert.document.write('<head>');
	// wndAlert.document.write('<title>' + title + '</title>');
	wndAlert.document.write('<title>Gallery Picture</title>');
        wndAlert.document.write('<link rel="STYLESHEET" type="text/css" href="./ogc_style.css">');
	wndAlert.document.write('</head>');
	wndAlert.document.write('<body bgcolor="#004000" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" text="#000000">');
        wndAlert.document.write('<table cellpadding="0" cellspacing="0" border="0" width="100%">');
        wndAlert.document.write('<tr><td>&nbsp;</td></tr>');
        wndAlert.document.write('<tr height="100%" valign="center"><td align="middle">');
	wndAlert.document.write('<img id="OGC" src="' + picture + '" title="' + title + '"  width="' + pictureWidth + '" height="' + pictureHeight + '" border="1" name="GalleryPic" alt=""><p><font class="gallerytitle">' + title + '</font>');
	wndAlert.document.write('</td></tr>');
        wndAlert.document.write('<tr><td>&nbsp;</td></tr>');
        wndAlert.document.write('<tr><td bgcolor="#001400"><table width="100%" cellspacing="0" border="0" width="100%"><tr class="footer"><td>&nbsp;</td><td align="left">www.osbornegolfclub.co.uk</td><td>&nbsp;</td><td align="right"><a class="gallerytitle" href="JavaScript:window.close()">[close]</a></td><td>&nbsp;</td></tr></table></td></tr>');
        wndAlert.document.write('</table>');
	wndAlert.document.write('</body>');
	wndAlert.document.write('</html>');

        wndAlert.focus();

        return(0);
}

//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function mapHighLight(hole) {

	document.all[hole].className = "hole_hi";
}


//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function mapLowLight(hole) {

	document.all[hole].className = "hole_low";
}


//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
function getFormattedDate() {

        var months = [	"January",
                        "February",
                        "March",
                        "April",
                        "May",
                        "June",
                        "July",
                        "August",
                        "September",
                        "October",
                        "November",
                        "December"
			];

        var days = [    "Sunday",
			"Monday",
			"Tuesday",
			"Wednesday",
			"Thursday",
			"Friday",
			"Saturday"
			];

        var now = new Date();
        var result = "";
        var fraction = "";
        switch(now.getDate()) {
                case 1: 	fraction = "st"; break;
                case 21: 	fraction = "st"; break;
                case 31: 	fraction = "st"; break;
                case 2: 	fraction = "nd"; break;
                case 22: 	fraction = "nd"; break;
                case 3: 	fraction = "rd"; break;
                case 23: 	fraction = "rd"; break;
                default: 	fraction = "th"; break;
        }

        result += days[now.getDay()] + ", ";
        result += now.getDate() + fraction +" ";
        result += months[now.getMonth()] + " ";
        result += now.getYear();

        return(result);
}

//==============================================================================
//==============================================================================
