///////////IDENTIFY BROWSER/////////////////////////
if (navigator.appName.indexOf("Netscape")!=-1){isNS=true}else{isNS=false}
if (navigator.appName.indexOf("Microsoft Internet Explorer")!=-1){isIE=true}else{isIE=false}
bVer = parseInt(navigator.appVersion)
if(isNS && bVer==4){ns4=true}else{ns4=false}	
///////////////////////////////////////////////////////

////////////////DROPDOWN MENU//////////////////////////////////////////////////////////////
<!--//--><![CDATA[//><!--

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//--><!]]>

function adjust_menu(){
if(document.body.clientWidth>800){
add_width=(document.body.clientWidth-800)/5
if(add_width>50){add_width=50}
w1=document.getElementById("1").offsetWidth+add_width
document.getElementById("1").style.width=w1+"px"
w2=document.getElementById("2").offsetWidth+add_width
document.getElementById("2").style.width=w2+"px"
w3=document.getElementById("3").offsetWidth+add_width
document.getElementById("3").style.width=w3+"px"
w4=document.getElementById("4").offsetWidth+add_width
document.getElementById("4").style.width=w4+"px"
w5=document.getElementById("5").offsetWidth+add_width
document.getElementById("5").style.width=w5+"px"
document.getElementById("nav").style.left="210px"
if(document.getElementById("page_title").offsetWidth+755<document.body.clientWidth){
document.getElementById("page_title").style.top="40px"
document.getElementById("page_title").style.left="750px"
}
}
}
////////////////////////////////////////////////////////////////////////////

///////////////////PLACE FOOTER//////////////////////////////////////////////
function place_footer(){
WindowHeight=document.body.clientHeight
documentHeight=document.body.scrollHeight
if(documentHeight<WindowHeight){footerPos=WindowHeight-58}else{footerPos=documentHeight-58}
document.getElementById("footer").style.top=footerPos+"px"
document.getElementById("footer").style.visibility="visible"
}
////////////////////////////////////////////////////////////////////////////////////////

///////////////////IMAGE & DIV SWAPPING FUNCTIONS////////////////////////////////////////////////////////////////
function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}
/* Functions that swaps images. */
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

/* Functions that handle preload. */
function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function swapImage(tag,src) {
	document.getElementById(tag).src=src
}

function swap(divTag)//function to switch descriptions
{
newdom=eval(docObj+divTag+styleObj)
if(ie4 || ns6){olddom.visibility="hidden";newdom.visibility="visible"}
if(ns4){olddom.visibility="hide";newdom.visibility="show"}
olddom=newdom
}
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////RUN STATUS BAR MESSAGES/////////////////////
message=new Array()
function populatemessage()
{
this.message=""
this.startDate=""
this.endDate=""
}

function runMarquee()
{
messageQualifies=false
if(window.document)
{
	for(i=message.length-1;i>=0;i-=1)
	{
			if(message[i] && message[i]!="")
			{
			startTargetDate=new Date(message[i].startDate);endTargetDate=new Date(message[i].endDate);count=0;
			if(startTargetDate.getTime()<now.getTime() && now.getTime()<endTargetDate.getTime()){messageQualifies=true;statusMessage=message[i].message;count=0;break}
			}
		}
if(messageQualifies){statusMarquee()}
}
}

function statusMarquee()
{
count=count+1
window.status=statusMessage
statusMessage=statusMessage.substring(1,statusMessage.length)+statusMessage.substring(0,1)
if (count<=3*statusMessage.length){setTimeout("statusMarquee()",150)}
}
///////////////////////////////////////////////////////////////////

////////////////////////SPAM RESISTANT EMAIL///////////////////////
alphabet="abcdefghijklmnopqrstuvwxyz@:"
thisdomain="igolf.on.ca"

//TO ASSEMBLE EMAIL ADDRESS FOR ANY PURPOSE
function assemble_ema(alias,domainname){
if(domainname==""){domainname=thisdomain}
address=alias+alphabet.charAt(26)+domainname
return address
}

//TO PRINT EMAIL LINK
function eml(alias,domainname,extension,display,screentip){
if(display==""){display=assemble_ema(alias,domainname);}
document.write("<a href='"+alphabet.charAt(12)+alphabet.charAt(0)+alphabet.charAt(8)+alphabet.charAt(11)+alphabet.charAt(19)+alphabet.charAt(14)+alphabet.charAt(27)+assemble_ema(alias,domainname)+extension+"' title='"+screentip+"'>"+display+"</a>")
}

//TO PRINT EMAIL BUTTON
function emb(alias,domainname,extension,button_label){
if(button_label==""){button_label="Send Email"}
document.write("<form><input type='button' value='"+button_label+"' onmouseup=\"location.href='"+alphabet.charAt(12)+alphabet.charAt(0)+alphabet.charAt(8)+alphabet.charAt(11)+alphabet.charAt(19)+alphabet.charAt(14)+alphabet.charAt(27)+assemble_ema(alias,domainname)+extension+"'\"></form>")
}

//CREATE OPTION TAG TO PLACE EMAIL LINK IN SELECTION BOX
function oml(alias,domainname,extension,display){
if(domainname==""){domainname=thisdomain}
if(display==""){display=assemble_ema(alias,domainname);}
document.write("<option value='"+alphabet.charAt(12)+alphabet.charAt(0)+alphabet.charAt(8)+alphabet.charAt(11)+alphabet.charAt(19)+alphabet.charAt(14)+alphabet.charAt(27)+assemble_ema(alias,domainname)+extension+"'>"+display+"</option>")
}
////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////TIME DATE FUNCTIONS///////////////////////////
var oneMinute=60*1000
var oneHour=oneMinute*60
var oneDay=oneHour*24
var oneWeek=oneDay*7
var count=0,update
var now=new Date();//get present date and time
var daysleft=0
var earlybird
var dom
var dayName= new Array("Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthName= new Array("December","January","February","March","April","May","June","July","August","September","October","November","December")
	

if (now.getMonth()==0 || now.getMonth>9){earlybird=true}
if (now.getMonth()>=2 && now.getMonth<10){earlybird=false}
if (now.getMonth()==1){
	if(now.getDate()<=15){earlybird=true}else{earlybird=false}
						}
if(now.getMonth()==1){daysleft=15-now.getDate()}
if(now.getMonth()==0){daysleft=46-now.getDate()}
if(now.getMonth()==11){daysleft=77-now.getDate()}
if(now.getMonth()==10){daysleft=107-now.getDate()} 
//the number 81 calculated from mar 15--------
//if(daysleft>0 && daysleft<=53){frontpage_message="<font size='+1'><b>Iroquois Golf Club offers discounts on Memberships until February 15.</b><br>Only "+daysleft+ " days remain!</font><br>"}else{
//if(daysleft>0 && daysleft>53){daysleft=daysleft-53;frontpage_message="<img src='images/evergreeenswag-a.gif' border='0'><img src='images/evergreeenswag-a.gif' border='0'><br><font color='#cc0033' size='+1'><b>Only "+daysleft+" days left until Christmas.</b><br>Discounted Iroquois Golf Club memberships make excellent gift ideas!</font><br>"}else{
frontpage_message=""
//}}

function get_modified_date()
{
var modifiedDate =  new Date(document.lastModified)
if(parseInt(navigator.appVersion)>=4){
		theyear=modifiedDate.getFullYear();if(theyear<2000){theyear=theyear+100}
										}else{
									theyear=modifiedDate.getYear();if (theyear<100){theyear=2000+theyear}
												}
update=monthName[modifiedDate.getMonth()+1]+" "+ modifiedDate.getDate() +", "+theyear
return update
}	

function get_current_date(){
current_date=monthName[now.getMonth()+1]+" "+ now.getDate() +", "+now.getFullYear()
return current_date
}	

function get_expiry_date(delay){
target_date=new Date
target_date.setTime(now.getTime()+delay*oneDay)
expiry_date=monthName[target_date.getMonth()+1]+" "+ target_date.getDate() +", "+target_date.getFullYear()
return expiry_date
}
/////////////////////////////////////////////////////////




var olddom,oldNum
var photo=new Array("photos/iroqmap.gif","photos/hole1.jpg","photos/hole2.jpg","photos/hole3.jpg","photos/hole4.jpg","photos/hole5.jpg","photos/hole6.jpg","photos/hole7.jpg","photos/hole17.jpg","photos/hole18.jpg","photos/hole10.jpg","photos/hole11.jpg","photos/hole12.jpg","photos/hole13.jpg","photos/hole14.jpg","photos/hole15.jpg","photos/hole16.jpg","photos/hole8.jpg","photos/hole9.jpg")
var divTag=new Array("instructions","d1","d2","d3","d4","d5","d6","d7","d8","d9","d10","d11","d12","d13","d14","d15","d16","d17","d18")

function init(){
olddom=eval(docObj+"instructions" +styleObj)
}

function imageSwap(imgTag,Num)
{
if (document.images)
{
	if(Num=="adv")
	{
	Num=oldNum+1
	if(Num>18){Num=1}
	}
	
	if(Num=="rev")
	{
	Num=oldNum-1
	if(Num<1){Num=18}
	}
	
	imgTag.src=photo[Num];swap(divTag[Num])
	oldNum=Num
}
}

/////////////////COMMON FUNCTIONS///////////////////////////
function window_open(url,windowName,properties)
{
   if (window.document)
   {
	x=window.open(url,windowName,properties)
	x.focus()
	}else{
   top.location.href=url
   }
}
//////////////////////////////////////////////

////////////ANIMATION/////////////////////////

function animate(){	
	done=false
	if(suiteLeft>suiteEnd+5){
	suiteLeft -=5;
	document.getElementById("bill").style.left = suiteLeft + "px"
	}else{
	document.getElementById("bill").style.left = suiteEnd + "px"
	}
	if(specialLeft>specialEnd+5){
	specialLeft -=5;
	document.getElementById("special").style.left = specialLeft + "px";
	}else{
	document.getElementById("special").style.left = specialEnd + "px";
	done=true
	}
if(!done){setTimeout("animate()",20)}
}

function position_layers(){
width=document.body.clientWidth;
height=document.body.clientHeight;
center = parseInt(width/2);
vcenter = parseInt(height/2);
x1=x2=x3=center+120
if(center<410){
document.getElementById("course").style.width="530px"
document.getElementById("history").style.width="230px"
x1=220
x2=center+30
}
y3=vcenter+130-document.getElementById("history").offsetHeight
y2=y3-document.getElementById("nature").offsetHeight-30
y1=y2-document.getElementById("course").offsetHeight-30
if(y1>150){
y2=y2-20
y1=y1-40
}else if(y1<105){
y1=105
y2=110+document.getElementById("course").offsetHeight
}
document.getElementById("course").style.left=x1+"px"
document.getElementById("course").style.top=y1+"px"
document.getElementById("nature").style.left=x2+"px"
document.getElementById("nature").style.top=y2+"px"
document.getElementById("history").style.left=x3+"px"
document.getElementById("history").style.top=y3+"px"
layeropacityc=0;layeropacityh=0;layeropacityn=0;
max1=95;max2=.95;
buildOpacityc();setTimeout("buildOpacityh()",2000);setTimeout("buildOpacityn()",4000);
}

function buildOpacityc(){
if(document.getElementById("course").filters){
if(document.getElementById("course").filters.item(0).opacity <max1){
document.getElementById("course").filters.item(0).opacity += 1
setTimeout("buildOpacityc()",60)
}
}else if(document.getElementById("course").style.opacity){
if(layeropacityc<max2){
layeropacityc +=.01;
document.getElementById("course").style.opacity = layeropacityc;
setTimeout("buildOpacityc()",60)
}
}
}

function buildOpacityh(){
if(document.getElementById("history").filters){
if(document.getElementById("history").filters.item(0).opacity <max1){
document.getElementById("history").filters.item(0).opacity += 1
setTimeout("buildOpacityh()",60)
}
}else if(document.getElementById("history").style.opacity){
if(layeropacityh<max2){
layeropacityh +=.01;
document.getElementById("history").style.opacity = layeropacityh;
setTimeout("buildOpacityh()",60)
}
}
}

function buildOpacityn(){
if(document.getElementById("nature").filters){
if(document.getElementById("nature").filters.item(0).opacity <max1){
document.getElementById("nature").filters.item(0).opacity += 1
setTimeout("buildOpacityn()",60)
}
}else if(document.getElementById("nature").style.opacity){
if(layeropacityn<max2){
layeropacityn +=.01;
document.getElementById("nature").style.opacity = layeropacityn;
setTimeout("buildOpacityn()",60)
}
}
}

