var linkText = new Array(6);
  linkText[0] = "Interactive Directory of Golf Courses offering savings with the Greens\' Fee Passport";
  linkText[1] = "Learn of the increadible Savings to be enjoyed with the Greens\' Fee Passport";
  linkText[2] = "Order your copy of the Greens\' Fee Passport Right Now!";
  linkText[3] = "Contact the Greens\' Fee Passport";
  linkText[4] = "See a list of Retailers associated with the Greens\' Fee Passport";
  linkText[5] = "Learn more about the Free Cart Program";
  linkText[6] = "Greens\' Fee Passport Home";
  linkText[7] = "Read what real people are saying about the Greens\' Fee Passport.";
  linkText[8] = "Click here to check for more offers now available in the Member\'s Club.";
  linkText[9] = "Courses, click here to login!";
  linkText[10] = "If you have received a VIP notice from one of our participating clubs you may login here!";
  linkText[11] = "Greens\' Fee Passport now available in Hamilton, Mississauga, Scarborough and Whitby locations only.";
  linkText[12] = "Courses, click here to apply <b>NOW!</b>";
  linkText[13] = "Click here to download the 2009 brochure.";
  linkText[14] = "Click here to view our collection golf related images.";
  linkText[15] = "Click here to view our collection golf related video clips.";
  linkText[16] = "";
  linkText[17] = "";
  linkText[18] = "";
  linkText[19] = "";
  linkText[20] = "";
defaultStatus = '';
var theDate;
var theTime;

// try to get rid of these also. //
var nPrice=64.95;
var allClear=1;
var snp=0;
///////////////////////////////////

/* 	function getNowTime
	This function returns the current date or time depending on the argument passed.
	Use this code to add the date and time to your page
	<script language="JavaScript" type="text/javascript">
	<!--
		document.writeln(getNowTime('date'));
	-->
	</script>
*/
function getNowTime(which) {
	 var d, numD, numM, Y
	 arrMonth = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
	 d = new Date(); numD = d.getDate(); numM = d.getMonth(); y = d.getFullYear(); ampm = "am"; tH = d.getHours();
	 if(tH>12) { tH = tH-12; ampm = "pm"; }
	 if(tH==12) {ampm = "pm"};
	 tM = d.getMinutes();
	 if(tM<10) {tM = "0"+tM+""};
	 theDate = arrMonth[numM]+" "+numD+", "+y+""; theTime = tH+":"+tM+" "+ampm+"";
	 if (which=="date") {
		 return theDate;
	 } else if (which=="time") {
		 return theTime;
	 }
}

/* predefined Dreamweaver functions.  These save time and work in most browsers */
function MM_displayStatusMsg(msgStr)  { //v3.0
	status=msgStr; document.MM_returnValue = true;
}

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;
}
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;
}

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];}}
}

// trying to get rid of these. //
function hilite(Ordinal) {
	//alert("hilite");
}

function lowlite(Ordinal) {
	//alert("lowlite");
}
////////////////////////////////

// open_win() will open a new "popup" window with only a titlebar.  And center it on the screen.
function open_win(url, pName, pWidth, pHeight) {
	var x=screen.availWidth, y=screen.availHeight, scollers="scrollbars=no,";
	x = (x-pWidth)/2; y = (y-pHeight)/2;
	if (parseInt(pWidth)>screen.availWidth) {pWidth = (screen.availWidth);x=0;scollers="scrollbars=1,"}
	if (parseInt(pHeight)>screen.availHeight) {pHeight = (screen.availHeight-34);y=0;pWidth=pWidth+17;scollers="scrollbars=1,"}
	if (pName=='') {pName = 'pop'}
	var newWin = window.open(url,pName,scollers+'toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,copyhistory=no,width='+pWidth+',height='+pHeight+',left='+x+',top='+y+'');
	newWin.focus();
}

// Opne a basic link window.
function open_basic(url) {
	myWin = window.open(url, "gfp_link");
	myWin.focus();
}

/* Launch the Member's Club login page.
generally all uses of this have set the height and width to 750 X 1000 */
function open_members_club_win(url, pName) {
	var url = url+'?u_name=u&p_word=p'; pHeight = screen.availHeight; pWidth = screen.availWidth;
	document.location.href = url+'?u_name=u&p_word=p';
}

/* ORDERING functions 
Need to centralize these and make one function that will handle all situations
Pass parameters/arguments to deal with wich item.*/
function open_order(pWhichType) {
	var url = "https://secure1.brinkster.com/greensfee/index.asp?p=0", name = "orderwin", pWidth = 660, pHeight = 1000;

	switch (pWhichType) {
		case "regular": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=default"; break;
		case "special": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=default"; break;
		case "golfnuts": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=default"; break;
		case "code":
			var c = document.order_code.code.value;
			switch (c.toUpperCase()) {
				case "": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=default"; break;
				case " ": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=default"; break;
				case "CAWGOLFER": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=CAWGOLFER"; break;
				case "RENEW": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=RENEW"; break;
				case "MARLIES2010": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=MARLIES2010"; break;
				case "ROJO2010": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=ROJO2010"; break;
				case "ONTGOLF2010": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=ONTGOLF2010"; break;
				case "GIFT110": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=GIFT110"; break;
				case "IBMGOLFER": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=IBMGOLFER"; break;
				case "MASTERS": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=MASTERS"; break;
				case "DOFASCO": url = "https://secure1.brinkster.com/greensfee/orderLogin.aspx?id=DOFASCO"; break;
				default: alert("Sorry, the code you've entered is not recognized \r\nby our system or it has expired. Please try again.");	url = ""; break;
			}
			break;
/*		case "regular": url = "https://secure1.brinkster.com/greensfee/index.asp?p=0"; break;
		case "special": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
		case "golfnuts": url = "https://secure1.brinkster.com/greensfee/index.asp?p=5"; break;
		case "code":
			var c = document.order_code.code.value;
			switch (c.toUpperCase()) {
				//case "GFP2009": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
				//case "LIMITED": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
				//case "SPRING": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
				//case "MASTERS": url = "https://secure1.brinkster.com/greensfee/index.asp?p=8"; break;
				//case "OLDFRIEND": url = "https://secure1.brinkster.com/greensfee/index.asp?p=6"; break;
				case "": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
				case " ": url = "https://secure1.brinkster.com/greensfee/index.asp?p=4"; break;
				case "CAWGOLFER": url = "https://secure1.brinkster.com/greensfee/index.asp?p=6"; break;
				case "NOHST2010": url = "https://secure1.brinkster.com/greensfee/index.asp?p=7"; break;
				case "RENEW": url = "https://secure1.brinkster.com/greensfee/index.asp?p=8"; break;
				default: alert("Sorry, the code you've entered is not recognized \r\nby our system or it has expired. Please try again.");	url = ""; break;
			}
			break;
*/		default: 
			url = "https://secure1.brinkster.com/greensfee/index.asp?p=0";
		break;
	}
	if (url!="") {
		open_win(url, name, pWidth, pHeight);
	}
}

// Function to test the search field to eliminate empty searches.
function check_search_name() {
  var obj = document.search_name;
  var svName = obj.what.value;
	if (svName=="") {
		 alert("Please enter some text criteria to seach against.");
	} else {
		 obj.submit();
	}
}

// for event viewer
function previewEvent(pWho) {
	var xx = screen.availWidth, yy = screen.availHeight, width = 760, height=585, x, y;
	x = (xx/2)-(width/2); y = (yy/2)-(height/2);
	var newWin = window.open('event_viewer.asp?id='+pWho,'events','scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,width='+width+',height='+height+',left='+x+',top='+y);
	newWin.focus();
}
function previewAllEvents() {
	/*var xx = screen.availWidth, yy = screen.availHeight, width = 760, height=585, x, y;
	x = (xx/2)-(width/2); y = (yy/2)-(height/2);
	var newWin = window.open('event_viewer_home.asp','events','scrollbars=no,toolbar=no,location=no,directories=no,status=no,menubar=no,copyhistory=no,width='+width+',height='+height+',left='+x+',top='+y);
	newWin.focus();*/
	popLayer('event_viewer_home.asp',760,585);
}
// for member coupons feature
function openRegion(pID) {
	// all in one
	for (var i=0;i<regArray.length;i++) {
		if (regArray[i]==parseInt(pID)) { showElement(regArray[i]) } else { hideElement(regArray[i]) }
	}
}
function openCourse(cID) {
	for (var i=0;i<courseArray.length;i++) {
		if (courseArray[i]==cID) {
			showElement(courseArray[i])
		} else {
			hideElement(courseArray[i]) 
		}
	}
}

function hideElement(pID) {
	var x = document.getElementById(pID);
	if (x!=null) {x.style.display = 'none'}
}
function showElement(pID) {
	var x = document.getElementById(pID);
	if (x!=null) {x.style.display = 'block'}
}

function get_coupon_info(pId, pCid) {
	if (pId == 'none') {
		var pHeight = 320;
		newWin = window.open('../members/members_view_coupons_info.asp?cid='+pCid,'cyber_coupon_info','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=470,height='+pHeight);
	} else {
		var pHeight = 320;
		newWin = window.open('../members/course_view_coupons_info.asp?id='+pId+'&cid='+pCid,'cyber_coupon_info','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=470,height='+pHeight);
	}
	newWin.focus();
}

function open_info(pURL,pNAME,pWIDTH,pHEIGHT) {
	open_win(pURL,pNAME,496,545);
}
function writeSWF(pFile, pID, pWidth, pHeight, pVars) {
	var x = "";
	if (pWidth!='' && pHeight!="") {
		x += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="'+pID+'" width="'+pWidth+'" height="'+pHeight+'" align="middle">';
	} else {
		x += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="'+pID+'" align="middle">';
	}
	x += '<param name="allowScriptAccess" value="sameDomain" />';
	x += '<param name="movie" value="'+pFile+'"/>';
	x += '<param name="quality" value="high"/>';
	x += '<param name="wmode" value="transparent"/>';
	x += '<param name="menu" value="false"/>';
	x += '<param name="flashvars" value="'+pVars+'"/>';
	if (pWidth!='' && pHeight!="") {
		x += '<embed src="'+pFile+'" flashvars="'+pVars+'" width="'+pWidth+'" height="'+pHeight+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false" name="'+pID+'"/>';
	} else {
		x += '<embed src="'+pFile+'" flashvars="'+pVars+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" menu="false" name="'+pID+'"/>';
	}
	x += '</object>';
	//?Write this to the page.
	document.writeln(x);
}

function goto(pURL) {
	document.location.href = pURL;
}

function do_login_reg() {
	var l=document.login;
	//alert(l.u_name.value+" "+l.p_word.value);
	if (l.u_name.value!=""&&l.p_word.value!="") {
		l.action = "registration_do_login.asp";
	} else {
		l.action = "registration_1a.asp";
	}
	l.submit();
}

function check_phone_number(pObj) {
  		 var x,i,j,h;
			 var m=0;
  		 var y = "1234567890";
  		 //var obj = document.printf[pObj];
		 obj = pObj;
  		 var obLen = (obj.value.length-1);
  		 var obArr = new Array();
  		 for (i=0;i<=obLen;i++) {
    	 		 x = obj.value.charAt(i);
    			 if (y.indexOf(x)>=0) {
    			 		obArr[m] = x;
    					m++;
    			 }
  		 }
  		 if (obArr.length!=10) {
  		 		alert('Please limit the entry to a phone number with area code.\r\nThank you.');
				allClear=0;
				obj.value = '';
				obj.focus();
  		 } else {
  		 	   h = "(";
      		 for (j=0;j<=(obArr.length-1);j++) {
      		 		 if (j<=2) {
      				 		h += obArr[j];
      						if (j==2) {h += ") "}
      				 } else if (j<=5) {
      				 	  h += obArr[j];
      						if (j==5) {h += "-"}
      				 } else if (j<=9) {
      				 	  h += obArr[j];
      				 }
      		 }
  		 }
			 if (obArr.length==10) {
			 		obj.value=h;
					allClear=1;
			 }
}

function check_reg_fill() {
	var o = document.userdata, err = "";
	if (o.f_name.value=="") { err = "Please fill in your first name.\r\n" }
	if (o.l_name.value=="") { err = "Please fill in your last name.\r\n" }
	if (o.street.value=="") { err = "Please fill in your street address.\r\n" }
	if (o.city.value=="") { err = "Please enter the city that you live in.\r\n" }
	if (o.prov_state.value=="") { err = "Please enter the province or state that you live in.\r\n" }
	if (o.postal_zip.value=="") { err = "Please enter your postal code.\r\n" }
	if (o.phone_home.value=="" && o.phone_cell.value=="" && o.phone_bus.value=="") { err = "Please enter at least one phone number.\r\n" }
	if (o.email.value=="") { err = "Please enter your email address.\r\n" }
	if (err == "") {
		// good to go
		o.submit();
	} else {
		alert(err);
	}
}

function check_reg_fin() {
	var o = document.reg, err = "", whereVal="";
	for (var i=0; i<o.where.length; i++) {
		if(o.where[i].checked==true) { whereVal = o.where[i].value }
	}
	if (whereVal=="") { err += "Please select where you purchased your Greens\' Fee Passport.\r\n" }
	if (o.uniquecode.value=="") { err += "Please enter the number on your receipt.\r\n" }
	if (o.book_code.value=="") { err += "Please fill in number stamped on the inside of your Greens\' Fee Passport.\r\n" }
	// check GFP for proper values
	if (whereVal=="retailer"&&document.reg.retailer.value=="rjs") {
		if (parseInt(o.uniquecode.value)<47229) {
			err += "The receipt/order number you entered is not valid for online registration, please send in your registration card.";
		}
	}
	if (err == "") {
		// good to go
		o.submit();
		document.getElementById('subbtn').style.display = 'none';
		document.getElementById('plswait').style.display = 'block';
	} else {
		alert(err);
	}
}

function fix_postal_code(pField) {
	var x = pField.value, y="";
	// remove spaces
	for (var i=0; i<x.length; i++) {
		if (x.substring(i,(i+1))!=" ") { y += x.substring(i,(i+1)) }
	}
	x = "";
	// reformat
	for (var i=0; i<6; i++) {
		if (i==3) {
			x += " " + y.substring(i,(i+1))
		} else { 
			x += y.substring(i,(i+1))
		}
	}
	pField.value = x;
}

function addZero(pField) {
	var x = pField.value;
	switch (x.length) {
		case 1: x = "000"+x+""; break
		case 2: x = "00"+x+""; break
		case 3: x = "0"+x+""; break
	}
	pField.value = x;
}

function openNews() {
	//var cl = window.open('whatsnew.asp','wn','width=680,height=500,scrollbars=1');cl.focus();
	popLayer('whatsnew.asp', 680, 500);
}


function popLayer(page, width, height) {
	document.body.scrollTop=0;
	document.body.style.overflow = "hidden";
	var x = document.getElementById("popup"), z = document.getElementById("coverall"), y = "";
	if (z!=null) {
		z.style.display = "block";
	}
	if (x!=null) {
		y += '<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0"><tr><td>&nbsp;</td></tr>';
		y += '<tr><td align="center" valign="bottom" height="20">';
		y += '<table width="'+(width+4)+'" border="0" cellpadding="0" cellspacing="0"><tr><td width="12" height="25"><img src="img/pop_left.gif" width="12" height="25"/></td><td align="right" valign="middle" background="img/pop_rep.gif">';
		y += '<input type="button" value=" x " onclick="hidePop()"></td><td width="12" height="25"><img src="img/pop_right.gif" width="12" height="25"/></td></tr></table></td></tr>';
		y += '<tr><td valign="middle" align="center" height="'+height+'">';
		y += '<iframe class="popLayerInnerHTML" width="'+width+'" height="'+height+'" frameborder="0" marginheight="0" marginwidth="0" scrolling="auto" src="'+page+'"></iframe>';
		y += '</td></tr><tr><td>&nbsp;</td></tr></table>';
		x.innerHTML = y;
		x.style.display = "block";
	}
}

function hidePop() {
	var x = document.getElementById("popup"), z = document.getElementById("coverall");
	if (x!=null) {
		x.innerHTML = "";
		x.style.display = "none"
	}
	if (z!=null) { z.style.display = "none" }
	document.body.style.overflow = "auto";
}

function getHeight() {
  var myWidth = 0, myHeight = 0, result;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  //alert( 'Width = ' + myWidth );
  //alert( 'Height = ' + myHeight );
  // add the offset
  result = myHeight-70;
  return result
}

// The rollover code.
function rolloverPopup(pContent) {
	var x = document.getElementById("rolloverPop");
	if (x!=null) {
		//alert(mouseX+", "+mouseY);
		x.style.top = mouseY+22;
		x.style.left = mouseX-210;
		var y = document.getElementById("rolloverContent");
		if (y!=null) {
			y.innerHTML = pContent;
		}
		x.style.display = "block";
	} else {
		alert("no layer for rollover");
	}
}

function rolloverPopupList(pContent) {
	var x = document.getElementById("rolloverPopList");
	if (x!=null) {
		//alert(mouseX+", "+mouseY);
		x.style.top = mouseY+22;
		x.style.left = mouseX+10;
		var y = document.getElementById("rolloverContent");
		if (y!=null) {
			y.innerHTML = pContent;
		}
		x.style.display = "block";
	} else {
		alert("no layer for rollover");
	}
}


function rollKill() {
	var x = document.getElementById("rolloverPop");
	if (x!=null) {
		var y = document.getElementById("rollContent");
		if (y!=null) {
			y.innerHTML = "";
		}
		x.style.display = "none";
	} else {
		alert("no layer for rollover");
	}
}

function rollKillList() {
	var x = document.getElementById("rolloverPopList");
	if (x!=null) {
		var y = document.getElementById("rollContent");
		if (y!=null) {
			y.innerHTML = "";
		}
		x.style.display = "none";
	} else {
		alert("no layer for rollover");
	}
}

var mouseX, mouseY;

function getMousePos(e) { //you need the 'e', although it does NOT need to be defined
	//NS
	if (document.layers||document.getElementById&&!document.all) {
		mouseX = e.pageX
		mouseY = e.pageY
	}
	//IE
	else if (document.all) {
		mouseX=window.event.clientX
		mouseY=window.event.clientY
	}
}

if(!window.captureEvents) document.onmousemove=getMousePos
if (window.captureEvents) {
	window.captureEvents(Event.MOUSEMOVE)
	window.onmousemove=getMousePos //e should not be defined
}
function galleryGetImage(pPath, myWidth, myHeight, myID) {
// get window details
  var winWidth = 0, winHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    winWidth = window.innerWidth;
    winHeight = window.innerHeight;
  } else if ( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    winWidth = document.documentElement.clientWidth;
    winHeight = document.documentElement.clientHeight;
  } else if ( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    winWidth = document.body.clientWidth;
    winHeight = document.body.clientHeight;
  }
  /*window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );*/

	myWidth = parseInt(myWidth);
	myHeight = parseInt(myHeight);
	var myWinWidth = myWidth;
	var myWinHeight = myHeight;
	var myRatio = (myWidth/myHeight); 
	if (winWidth<myWidth) {
		myWidth = winWidth-60;
		myHeight = myWidth/myRatio;
		myWinWidth = myWidth+30;
		myWinHeight = myHeight;
	}
	if (myWidth<400) {
		myWidth = 400;
		myWinWidth = 404;
		myHeight = myWidth/myRatio;
		myWinHeight = myHeight+4;
	}
	if (winHeight<myWinHeight) {
		myWinHeight = winHeight-60;
		// alertation here for scalling
		myHeight = myWinHeight;
		myWidth = myHeight*myRatio;
		myWinWidth = myWidth;
	}
	if (myHeight>myWinHeight && myWinWidth<(winWidth-20)) {
		myWinWidth = myWinWidth+20;
	}

	popLayer("../gallery/displayImage.asp?path="+pPath+"&width="+myWidth+"&height="+myHeight+"&id="+myID, myWinWidth, myWinHeight);
}

function galleryGetImagePop(pPath, myWidth, myHeight, myID) {
	myWidth = parseInt(myWidth);
	myHeight = parseInt(myHeight);
	var myWinWidth = myWidth;
	var myWinHeight = myHeight;
	var myRatio = (myWidth/myHeight); 
	if (screen.availWidth<myWidth) {
		myWidth = screen.availWidth-30;
		myHeight = myWidth/myRatio;
		myWinWidth = myWidth+30;
	}
	if (myWidth<400) {
		myWidth = 400;
		myWinWidth = 404;
		myHeight = myWidth/myRatio;
		myWinHeight = myHeight+4;
	}
	if (myHeight>(screen.availHeight-75)) {
		myWinWidth = myWinWidth+20;
	}

myWin = window.open("../gallery/displayImage.asp?path="+pPath+"&width="+myWidth+"&height="+myHeight+"&id="+myID+"&ispop=true", 'popimage', 'scrollbars=yes,toolbars=no,menu=no,status=no,width='+myWinWidth+',height='+myWinHeight);
	myWin.focus();
}

function galleryRoll(obj) {
	obj.style.borderColor = "green";
}

function galleryReturn(obj) {
	obj.style.borderColor = "#999999";
}

function getGallery(myID) {
	var x = document.getElementById(myID);
	if (x!=null) {
		if (x.style.display=="none") {
			showElement(myID);
		} else {
			hideElement(myID);
		}
	}
}
