//author: Michael Tutino (2tno design inc.) August 20, 2005

//member link random photo
var randomnumber=Math.floor(Math.random()*3);

function fprod(){
	if (randomnumber==0){
		parent.document.location.href="memberlogin.asp";
	}
	if (randomnumber==1){	
		parent.document.location.href="memberlogin.asp";
	}
	if (randomnumber==2){
		parent.document.location.href="memberlogin.asp";
	}
}
// end member link random photo


// Home page Main Photo Rotation
var arImg = new Array();
 var arRef = new Array();
                     
 arRef[0] = 'course.asp';
 arImg[0] = 'images/homephotorotation/mainphoto0.jpg'
    
 arRef[1] = 'facilities.asp';
 arImg[1] = 'images/homephotorotation/mainphoto1.jpg'
  
 arRef[2] = 'membership.asp';
 arImg[2] = 'images/homephotorotation/mainphoto2.jpg'
  
 arRef[3] = 'membership.asp';
 arImg[3] = 'images/homephotorotation/mainphoto3.jpg'  
 
 arRef[4] = 'membership.asp';
 arImg[4] = 'images/homephotorotation/mainphoto4.jpg' 
 
 arRef[5] = 'facilities.asp';
 arImg[5] = 'images/homephotorotation/mainphoto5.jpg'
 
 arRef[6] = 'facilities.asp';
 arImg[6] = 'images/homephotorotation/mainphoto6.jpg'
 
 arRef[7] = 'facilities.asp';
 arImg[7] = 'images/homephotorotation/mainphoto7.jpg' 
 
 arRef[8] = 'course.asp';
 arImg[8] = 'images/homephotorotation/mainphoto8.jpg'
  
 arRef[9] = 'course.asp';
 arImg[9] = 'images/homephotorotation/mainphoto9.jpg'
 
 var intMax = arImg.length;
 var dateObj = new Date();
 var intIndex = dateObj.getSeconds() % intMax;
 var intIndex = (intIndex % intMax);
// var intIndex = (intIndex % 2) * 2;
// var intIndex = (intIndex % 2);
// var intIndex = 0 ;

// <a href="javascript:linkImage();"><img name="imgIndex" alt="Click Here" src="" border="0" width="224px" height="407px"></a>
function writeImage() {
  document.write('<a href="javascript:linkImage();">')
  document.write('<img name="imgIndex" alt="Click Here" src="');
  document.write(arImg[intIndex]);
  document.write('" border="0" width="489px" height="203px"></a>');
}

 var intTimeout = 10000;

function rotateImage() {
  // Workaround strange Explorer issue with GTEQ
  if (++intIndex >= intMax) intIndex = 0;
  document.images['imgIndex'].src = arImg[intIndex];
  window.setTimeout('rotateImage();',intTimeout);
  }

function linkImage() {
  location=arRef[intIndex]
  }

// end of Home page Photo Rotation



function newurlwindow() { //v2.0
  window.open("http://#","weber","status=yes,scrollbars=yes,width=400,height=400");
}

// current date function

function timer(whatdate) {
var thedate = new Date()
var month = thedate.getMonth()
var year = thedate.getFullYear()
var daynum = thedate.getDate()
if (whatdate == "fulldate"){
   var thisday = ((month + 1) + " - " + daynum + " - " + year)
   return thisday}
else if (whatdate == "currentyear"){
   return year}
 else {
    return "Code Error MT001"}
}

// end current date function

// misc functions

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

// end

//GHIN Form validation
function isReady(form) {
    if (form.ghin.value != "") return true;
	    else { 
    alert("Field cannot be blank.  Please enter your USGA GHIN Number here.");
    form.ghin.focus();
    return false;
    }
}
//end form validation


// Drop NAV Scripts.. also used for show and hide

// Drop Navigation
function toggleClamShellMenu(objectID) {
	if (isAll || isID) {
		domStyle = findDOM(objectID,1);
		if (domStyle.display =='block')  domStyle.display='none';
		else domStyle.display='block';
	}
	else {
		destination = objectID + '.html';
		self.location = destination;
	}
	return;
}


function showMenu(objectID) {
	if (isAll || isID) {
		domStyle = findDOM(objectID,1);
		domStyle.display='block';
	}
	else {
		destination = objectID + '.html';
		self.location = destination;
	}
	return;
}

function hideMenu(objectID) {
	if (isAll || isID) {
		domStyle = findDOM(objectID,1);
		domStyle.display='none';
	}
	else {
		destination = objectID + '.html';
		self.location = destination;
	}
	return;
}

// end Drop NAV

// The Find DOM
// JavaScript Document
// Global find doc obj model

var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;


if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}

// End Find DOM




