function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

if( screen ){ 
			availHeightCal = parseInt(screen.height);
			changepopLeftCal = parseInt(screen.width / 2) - 374; changepopTop = parseInt(screen.height / 2) - 273;
			availWidth = parseInt(screen.width);
			availHeight = parseInt(screen.height);
			}
if (availHeightCal <= 600) {
	popHeightCal = 525;
	}
if (availHeightCal > 601) {
	popHeightCal = 695;
	}
	
if (availWidth <= 832) {
	popWidth = 760;
	changepopLeftJob = 10; changepopTopJob = 0;
	}
if (availHeight <= 620) {
	popHeight = 529;}
if (availWidth >= 833) {
	popWidth = 900;
	changepopLeftJob = parseInt(screen.width / 2) - 450; changepopTopJob = parseInt(screen.height / 2) - 370;
	}
if (availHeight > 620) {
	popHeight = 626;
	}


var winCal = null
function openCal() {
	 //if (!winCal || !winCal.open || winCal.closed) {
	 if (!winCal || winCal.closed) {
 		winCal = window.open("",'Calendar','width=748,height='+popHeightCal+',left='+changepopLeftCal+',top=0,status=yes,scrollbars=yes,resizable=yes')
	}
	//winCal.location.href = "calendar.asp";
	winCal.location.href = "http://www.calendarwiz.com/cdceventscalendar"
	winCal.focus();
	return true
 }
 
var winDon = null
function openDonate() {
	 if (!winDon || !winDon.open || winDon.closed) {
 		winDon = window.open("",'Donation','width=748,height='+popHeightCal+',left='+changepopLeftCal+',top=0,status=yes,scrollbars=yes,resizable=yes')
	}
	winDon.location.href = "https://ssl58.chi.us.securedata.net/downtownelcajon.com/donation_form.asp";
	winDon.focus();
	return true
 }
 
var winShop = null
function openShop() {
	// only display the following message for IE 7 or earlier
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	if ((browser=="Microsoft Internet Explorer") && (version<8)) {
		var strMessage = getSSLMessage()
		strMessage = strMessage.replace("<u>", "")
		strMessage = strMessage.replace("</u>", "")
		alert(strMessage);
	}
	 if (!winShop || !winShop.open || winShop.closed) {
 		winShop = window.open("",'ShopAtCDC','width=748,height='+popHeightCal+',left='+changepopLeftCal+',top=0,status=yes,scrollbars=yes,resizable=yes')
	}
	winShop.location.href = "https://ssl58.chi.us.securedata.net/downtownelcajon.com/shop_form.asp";
	winShop.focus();
	return true
} 

function getSSLMessage() {
	var strText = "IMPORTANT NOTE: Internet Explorer (I.E.) version 7 and earlier may display a message that there is a problem with this website's security certificate."
	strText = strText + "  The certificate is provided by Digicert, Inc (www.digicert.com)."
	strText = strText + "  <u>Please be assured there is not a problem with the certificate and you can continue to use the Secure Online Donation form or Shop AT CDC form with full confidence in your current I.E. browser.</u>"
	strText = strText + "  Another option is you may upgrade to Internet Explorer 8 or use a browser other than Internet Explorer such as Firefox - to eliminate this security message."
	return strText;
}
 
function openCoupon(theURL) {
 window.open(theURL,'Coupon','menubar=yes,resizable=yes,width=650,height=500')
  }
  
 var winREHS = null
function openHotSheet() {
	 if (!winREHS || !winREHS.open || winREHS.closed) {
 		winREHS = window.open("",'HotSheet','width=748,height='+popHeightCal+',left='+changepopLeftCal+',top=0,status=yes,scrollbars=yes,resizable=yes')
	}
	winREHS.location.href = "pdf/REHS_020108.pdf";
	winREHS.focus();
	return true
 }
 
 
// changes pop window return link
function swapLink() { 
if (window.opener) setTimeout("self.close()",100);
if (window.opener == null) parent.location = "http://www.downtownelcajon.com";
}
function swapopener(newURL) { 
if (window.opener) {window.opener.document.location = newURL; 
setTimeout("window.opener.focus()",200);}
if (window.opener == null) {window.location = newURL;}
}


function openWhosJob(theURL) {
 jobWindow = window.open(theURL,'jobWindow','scrollbars=no,status=no,width='+popWidth+',height='+popHeight+',left='+changepopLeftJob+',top='+changepopTopJob+'');
 jobWindow.onLoad = jobWindow.focus();
 jobWindow = true;
  }
  
var jobWindow = false;  

if (jobWindow != false) {
	jobWindow.focus();
}

if( screen ){ 
	changepopLeftGT = parseInt(screen.width / 2) - 395; changepopTopGT = parseInt(screen.height / 2) - 240;
	availWidth = parseInt(screen.width);
	availHeight = parseInt(screen.height);
}


function openGIStutorial(theURL) {
 gisTraining = window.open(theURL,'gisTrainWin','scrollbars=no,status=no,width=790,height=472,left='+changepopLeftGT+',top='+changepopTopGT+'');
 gisTraining.onLoad = gisTraining.focus();
 gisTraining = true;
  }
  
var gisTraining = false;  

if (gisTraining != false) {
	gisTraining.focus();
}

