if(top!= self) top.location.href = self.location.href;
// JavaScript Document
var googleWindow = 0;
var popUpWin=0;
var enewsWindow = 0;
var privacyWindow = 0;
var resWindow = 0;
var seasonsWindow = 0;

/***************************/
function emailCheck(email)
{
	var re = new RegExp("^[A-Za-z0-9_-]+[A-Za-z0-9_\.\-]*[A-Za-z0-9_-]+@[A-Za-z0-9_-]+[A-Za-z0-9\.-]*\\.[a-zA-Z]{2,4}$","i");
	
	if(!re.test(email))
	{
		return false;
	}
	else return true;
}
//use the following var to remember an image's original src value
//the imageRoll function will constantly update this value, allowing the imageOut function to use its current value
var imageSourceValue = '';

function imageRoll(imageObject)
{
	//store the current src value
	imageSourceValue = imageObject.src;
	//grab the directory from the src attribute
	var folderIndex = imageObject.src.lastIndexOf("/");
	var theDirectory = imageObject.src.substring(0,folderIndex+1);//returns the DIR in the form http://domain.com/folder
	//test for image file type, jpg v. gif
	var extIndex = imageObject.src.lastIndexOf(".");
	
	var theFileName = imageObject.src.substring(folderIndex+1,extIndex);//returns the filename in the form NAME
	var theFileType = imageObject.src.substring(imageObject.src.length-(imageObject.src.length-extIndex-1));//grab the extension
	
	imageObject.src=theDirectory+'/'+theFileName+'-on.'+theFileType;
}


function imageOut(imageObject)
{
	//retrieve the original image src attribute
	imageObject.src = imageSourceValue;
}


// google pop up window
function popEnewsSignup(emailAddress)
{
	var top = 20;
	var left = 20;
	var width = 700;
	var height = 550;
	
  if(typeof(emailAddress) == "undefined")
  {
	  var emailAddress = document.eNewsForm.email.value;
  }
  
  if(enewsWindow)
  {
    if(!enewsWindow.closed) enewsWindow.close();
  }

	enewsWindow = open('http://www.mirrorlakeinn.com/enews.cfm?email='+emailAddress, 'enewsWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popPrivacy()
{
  if(privacyWindow)
  {
    if(!privacyWindow.closed) privacyWindow.close();
  }

	privacyWindow = open('http://www.mirrorlakeinn.com/privacy.htm', 'privacyWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=yes,copyhistory=yes,width=700,height=840,left=10,top=10,screenX=10,screenY=10');
}
function popPerfect()
{
  if(perfectWindow)
  {
    if(!privacyWindow.closed) perfectWindow.close();
  }

	perfectWindow = open('http://www.mirrorlakeinn.com/photoContestGallery.cfm', 'perfectWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=yes,copyhistory=yes,width=700,height=840,left=10,top=10,screenX=10,screenY=10');
}
//******************************************************
function popUpWindow(URLStr, left, top, width, height)
{
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();

  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popCommentForm()
{
	var top = 20;
	var left = 20;
	var width = 652;
	var height = 352;
	
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }

	popUpWin = open('http://www.mirrorlakeinn.com/comments.cfm', 'enewsWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=0,resizable=0,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popPackages(id)
{
	var top = 20;
	var left = 20;
	var width = 680;
	var height = 575;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();

  }
  popUpWin = open('http://www.mirrorlakeinn.com/packagesPop.cfm?id='+id, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}


function popOnlineRes()
{
	var top = 20;
	var left = 20;
	var width = 680;
	var height = 575;
	

  if(resWindow)
  {
    if(!resWindow.closed) resWindow.close();

  }
  
  resWindow = open('http://www.mirrorlakeinn.com/resInfo.cfm', 'resWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');

	

}

function popSeasons()
{
	var top = 20;
	var left = 20;
	var width = 680;
	var height = 575;
  if(seasonsWindow)
  {
    if(!seasonsWindow.closed) seasonsWindow.close();

  }
  seasonsWindow = open('http://www.mirrorlakeinn.com/seasons.cfm', 'seasonsWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popGroundsMap()
{
	var top = 10;
	var left = 10;
	var width = 1020;
	var height = 697;
  if(seasonsWindow)
  {
    if(!seasonsWindow.closed) seasonsWindow.close();

  }
  seasonsWindow = open('http://www.mirrorlakeinn.com/groundsMap.htm', 'seasonsWindow', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=1,resizable=1,copyhistory=0,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}
	
function openMemories(url)
{
	var top = 20;
	var left = 20;
	var width = 800;
	var height = 600;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  
  var theMemoriesPage = "http://mirrorlakeinnmemories.com/";
  if(typeof url != "undefined")//add the page name that was passed (gallery.cfm OR shareYOurMemory.cfm)
  {
	  theMemoriesPage = theMemoriesPage+url;
  }
	  
  
  popUpWin = open(theMemoriesPage, 'popUpWin', 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=1,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

var cottageWin = 0;
function openCottageChat()
{
	var top = 20;
	var left = 20;
	var width = 800;
	var height = 600;
  if(cottageWin)
  {
    if(!cottageWin.closed) cottageWin.close();

  }
  cottageWin = open('http://www.mirrorlakeinn.com/theCottageChatGateway.cfm', 'cottageWin', 'toolbar=1,location=1,directories=1,status=1,menubar=1,scrollbars=1,resizable=1,copyhistory=1,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function resortsAndLodgesPhoneDisplay()
{

	if(typeof updatePhone == "function")
	{
		//updatePhone();
		//return displayPhone('(518) 523-2544',3);
		return updatePhone();
	}
}

// JavaScript Document

BROWSER_DOM = (document.getElementById || document.all) ? true : false;
BROWSER_NS = (document.layers) ? true : false;

function BHG_preloadImages() {
  var d=document; if(d.images){ if(!d.BHG_p) d.BHG_p=new Array();
    var i,j=d.BHG_p.length,a=BHG_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.BHG_p[j]=new Image; d.BHG_p[j++].src=a[i];}}
}

function BHG_swapImgRestore() {
  var i,x,a=document.BHG_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function BHG_findObj(n, d) {
  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=BHG_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function BHG_swapImage() {
  var i,j=0,x,a=BHG_swapImage.arguments; document.BHG_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=BHG_findObj(a[i]))!=null){document.BHG_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function BHG_reloadPage(init) {
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.BHG_pgW=innerWidth; document.BHG_pgH=innerHeight; onresize=BHG_reloadPage; }}
  else if (innerWidth!=document.BHG_pgW || innerHeight!=document.BHG_pgH) location.reload();
}
BHG_reloadPage(true);

function BHG_showHideLayers() {
  var i,p,v,obj,args=BHG_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=BHG_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; }
}

function BHG_changeProp(objName,x,theProp,theValue) {
  var obj = BHG_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function NewWindow(URL,name,width,height) {
   	HorizPos = 0;
   	VertPos = 0;
   
   	if(screen){
	   	HorizPos = (screen.width-width) / 2;
	   	VertPos = (screen.height-height) / 2;
	   	
   	}
 	
   	varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=yes,menubar=yes,resizeable=no');
	varPopupWin.focus(); 
}

function NewWindow2(URL,name,width,height) {
   HorizPos = 0;
   VertPos = 0;
   
   if(screen){
   HorizPos = (screen.width-width) / 2;
   VertPos = (screen.height-height) / 2;
   }

   varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=no,toolbar=no,menubar=no,resizeable=no');
   varPopupWin.focus(); 
}

function Admin_NewWindow(URL,name,width,height) {
   HorizPos = 0;
   VertPos = 0;
   
   if(screen){
   HorizPos = (screen.width-width) / 2;
   VertPos = (screen.height-height) / 2;
   }

   varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=no,menubar=no,resizeable=no');
   varPopupWin.focus(); 
}
function MM_findObj(n, d) {
	  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_swapImage() {
	  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() {
	  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() {
	 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 loadem(relative,file) {
	MM_preloadImages(relative+'images/nav_'+file+'_home_f2.gif',relative+'images/nav_'+file+'_aboutus_f2.gif',relative+'images/nav_'+file+'_portfolio_f2.gif',relative+'images/nav_'+file+'_services_f2.gif',relative+'images/nav_'+file+'_resources_f2.gif',relative+'images/nav_'+file+'_news_f2.gif',relative+'images/nav_'+file+'_employment_f2.gif',relative+'images/nav_'+file+'_contactus_f2.gif');	
}
	
function pophelp(URL,name,width,height) {
   HorizPos = 0;
   VertPos = 0;
   
   if(screen){
   HorizPos = (screen.width-width) / 2;
   VertPos = (screen.height-height) / 2;
   }

   varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=no,menubar=no,resizeable=no');
   varPopupWin.focus(); 
   
   return false;
}


function fixLinks()
{
  if (!document.getElementsByTagName) return null;
  var server = document.location.hostname;
  var anchors = document.getElementsByTagName("a");
  for(var i=0; i < anchors.length; i++)
  {
    var a = anchors[i];
    var href = a.href;
    var id = a.id;
    var title = a.title;
    if (href.indexOf("#header") != -1) { // back to top
      a.className = "alt";
    } else if ((href.indexOf("#") != -1) && (href.indexOf("header") == -1)) { // jump ref
      var index = href.indexOf("#") + 1;
      href = "javascript:show('" + href.substring(index) + "');";
      a.setAttribute("href",href);
    }
  }
}

function hideDivs(exempt)
{
  if (!document.getElementsByTagName) return null;
  if (!exempt) exempt = "";
  var divs = document.getElementsByTagName("div");
  for(var i=0; i < divs.length; i++)
  {
    var div = divs[i];
    var id = div.id;
   
    alert(id+"|"+id.indexOf("nav_")+"|"+id.indexOf(exempt)+"|"+exempt);
    
    if (((id.indexOf("nav_")==-1)||(id.indexOf(exempt) == 4))||((id != "header") && (id != "footer") && (id != "featuredevents") && (id != "event_cms") && (id != exempt)))
    {
	 div.className = "hidden";
    }
  }
}

function show(what)
{
  if (!document.getElementById) return null;
  showWhat = document.getElementById(what);
  showWhat.className = "";
  hideDivs(what);
}

function sendFocus(what)
{
  var obj = document.getElementById(what);
  obj.focus();
}

function open_window(href)
{
  var width = parseInt(screen.availWidth * .8);
  var height = parseInt(screen.availHeight * .8);
  var x = parseInt((screen.availWidth/2) - (width/2));
  var y = parseInt((screen.availHeight/2) - (height/2));
  var windowFeatures = "width=" + width + ",height=" + height + ",left=" + x +",screenX=" + x +",top=" + y + ",screenY=" + y;
  var openWindow = this.open(href, "Popup", windowFeatures);
}

function Revelate(theContainer) {
	this._objectId;
	this.theContainerID = theContainer;
	this._containerObj = false;
	this.closeAll = false;
	this.tagSwap = "<dd>";
	this.openTracker = new Array();
	this._debug = true;
	this._execute = true;
	this.hideClass = "hide";
	this.moreClass = "more";
	this._constructor = function() { 
		if((this._containerObj = document.getElementById(this.theContainerID))==false) {
			this._execute = false;
			if(this._debug) {
				alert('could not detect the container in which you have instantiated this class!');
			}
		}
	}
	this.show = function(theOpen) {
		this._objectId = theOpen;
		if(this._execute) {
			if(this.openTracker[theOpen]) {
				this.hide(theOpen);
			} else {
				if(theObj = document.getElementById(this._objectId)) {
					if(this.closeAll==true) {
						this.closeAll();
					}
					this.trackOpen(theObj.className);
					tempS = theObj.className;
					tempS = tempS.replace(this.hideClass,"")
					theObj.className = this._trim(tempS);					
					
					if(edward = document.getElementById(this.moreClass)){
						edsClass = edward.className;						
						edsClass = edsClass.replace(this.moreClass,this.hideClass);
						edward.className = this._trim(edsClass);
					}
					
				} else if(this._debug) {
					alert('could not detect the object in which you wish to show!');
				}
			}
		}
		
	}
	this.trackOpen = function(theClassName) {
		this.openTracker[this._objectId] = theClassName;
	}
	this.closeAll = function() {
		for(openJ in this.openTracker) {
			if(theTempO = document.getElementById(openJ)) {
				if(this.openTracker[openJ].length>0) {
					theTempO.className = this.hideClass;
				} else {
					theTempO.className = " " + this.hideClass;
				}
				delete this.openTracker[openJ];
			}
			
		}
		if(edward = document.getElementById(this.moreClass)){
			edsClass = edward.className;						
			edsClass = edsClass.replace(this.hideClass,this.moreClass);
			edward.className = this._trim(edsClass);
			}
	}
	this.hide = function(theClose) {
		if(this.closeAll) {
			this.closeAll();
		}
		if(theTempO = document.getElementById(theClose)) {
			if(this.openTracker[theClose]) {
				theTempO.className = this.hideClass;
			} else {
				theTempO.className = " " + this.hideClass;
			}
			delete this.openTracker[theClose];
		}
	}
	this._trim = function(sInString) {
	  sInString = sInString.replace( /^\s+/g, "" );// strip leading
	  return sInString.replace( /\s+$/g, "" );// strip trailing
	}
	
	this.showAll = function(container){
		containerClass = document.getElementById(container).className;
		divs = document.getElementById(container).getElementsByTagName("div");		
		if(containerClass == "shown"){
			document.getElementById(container).className = "";
		}else{
			document.getElementById(container).className = "shown";
		}
		for(i=0; i < divs.length; i++){
			if(containerClass == "shown"){
				divs[i].className = "hide";
			}else{
				divs[i].className = "";
			}
		}
		
	}
	
	
}
	

function popwin(URL,name,width,height) {
   HorizPos = 0;
   VertPos = 0;
   if(screen){
	   HorizPos = (screen.width-width) / 2;
	   VertPos = (screen.height-height) / 2;
   }
   varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=no,menubar=no,resizeable=no');
   varPopupWin.focus(); 
}



myRevelation = new Revelate("detailnotes");


var loadedPackagesPage = true;
function hideFormFields()//called by the DHTML nav when user is on this page
{
	document.getElementById("month1").style.visibility = "hidden";
	document.getElementById("categoryID").style.visibility = "hidden";
	document.getElementById("day1").style.visibility = "hidden";
	document.getElementById("year1").style.visibility = "hidden";
	
}

function showFormFields()//called by the DHTML nav when user is on this page
{
	document.getElementById("month1").style.visibility = "visible";
	document.getElementById("categoryID").style.visibility = "visible";
	document.getElementById("day1").style.visibility = "visible";
	document.getElementById("year1").style.visibility = "visible";
}


//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:166B1BCA-3F9C-11CF-8075-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}


function rand(number) {
	return Math.ceil(Math.random()*number);
}



function outgoing_links()
{

	var links = document.getElementsByTagName("a");
	var urlRe = new RegExp("http:\/\/((www\.)?)([a-zA-Z0-9\\_\\-\\.]*)\.([a-zA-Z]{1,5})/");
	for(var i=0;i<links.length;i++) 
    {
    	if (links[i].onclick == undefined)
		{
        	fullPath = links[i].href.toLowerCase();
			last4 = fullPath.substring(fullPath.length-4, fullPath.length);
			last5 = fullPath.substring(fullPath.length-5, fullPath.length);
			
            if (links[i].href.toLowerCase().indexOf("mailto:") > -1)
           	{
            	links[i].onclick=function()
                {
				  href = this.href.toLowerCase();
                  emailLink = href.replace("mailto:","");
               	  pageTracker._trackEvent('Mails', 'Click', emailLink);
                };
           	}
            else if(links[i].href.toLowerCase().indexOf("mirrorlakeinn.com") == -1 && urlRe.test(links[i].href))
            {
				
				
            	links[i].onclick=function()
                {
					href = this.href.toLowerCase();
               		re = /^https?:\/\/(www\.)?([^/]+)?/i;
					href.match( re );
					domainOnly =  RegExp.$2;
					pageTracker._trackEvent('Outgoing links', 'Click', domainOnly);
                };
				
           	}
            else if( (last4 == ".pdf") || (last4 == "epdf") )
           	{
				
                   
            	links[i].onclick=function()
                {
					href = this.href.toLowerCase();
                	splhref = href.split('/');
                	fileOnly = splhref[splhref.length-1];
                	pageTracker._trackEvent('Downloads', 'PDF', fileOnly); 
                };
             }
             else if( (last4==".doc") )
            {
				
                   
                links[i].onclick=function()
                {
					href = this.href.toLowerCase();
                	splhref = href.split('/');
                	fileOnly = splhref[splhref.length-1];
                    pageTracker._trackEvent('Downloads', 'DOC', fileOnly); 
                };
             }
			 else if( (last4==".xls") )
            {
				
                    
                links[i].onclick=function()
                {
					href = this.href.toLowerCase();
                	splhref = href.split('/');
                	fileOnly = splhref[splhref.length-1];
                    pageTracker._trackEvent('Downloads', 'XLS', fileOnly); 
                };
             }
			     
		}
	}
}

function sidebar_link_tracking(category)
{
	var links = document.getElementById("packages_sidebar").getElementsByTagName("a");
	var urlRe = new RegExp("http:\/\/((www\.)?)([a-zA-Z0-9\\_\\-\\.]*)\.([a-zA-Z]{1,5})/");
	for(var i=0;i<links.length;i++) 
    {
    	links[i].onclick=function()
		{
			href = this.href.toLowerCase();
			newlocation = this.href;
			this.removeAttribute("href");
			
			re = /^https?:\/\/(www\.)?([^/]+)?/i;
			href.match( re );
			domainOnly =  RegExp.$2;
			pageTracker._trackEvent('Packages Sidebar', 'Impressions', category);
			pageTracker._trackEvent('Packages Sidebar', 'Click - '+category,href);
			
									
			if(href.indexOf("mirrorlakeinn.com") == -1 && urlRe.test(href))
				pageTracker._trackEvent('Outgoing links', 'Click', domainOnly);
			
			setTimeout('document.location = "' + newlocation + '"', 200);
				
		};
	}
}


window.onload = function()
{
	outgoing_links();	
	if (document.getElementById("packages_sidebar") != null)
		sidebar_link_tracking(document.getElementById("packages_sidebar").className);
}


function SetClickTracksCookie()
{
	var thisCookie = GetCookie("CLICKTRACKSCOOKIE");
	if( thisCookie == null)
	{
		//Setup the random cookie value
		var myValue = new Date();
		var randNum = rand(100);		
		myValue = myValue.toGMTString() + "_" + randNum;

		//Setup the expiry date to expire in 2010
		var expiryDate = new Date();
		var date2010 = "Fri, 31 Dec 2030 23:00:00 EST";
		var dt = Date.parse(date2010);

		expiryDate.setTime(dt);

		SetCookie("CLICKTRACKSCOOKIE", myValue, expiryDate, "/", window.location.hostname);
	}
}


// ---------------------------------------------------------------
    //  Cookie Functions - Second Helping  (21-Jan-96)
    //  Written by:  Bill Dortch, hIdaho Design <BDORTCH@NETW.COM>
    //  The following functions are released to the public domain.
    //
    //  The Second Helping version of the cookie functions dispenses with
    //  my encode and decode functions, in favor of JavaScript's new built-in
    //  escape and unescape functions, which do more complete encoding, and
    //  which are probably much faster.
    //
    //  The new version also extends the SetCookie function, though in
    //  a backward-compatible manner, so if you used the First Helping of
    //  cookie functions as they were written, you will not need to change any
    //  code, unless you want to take advantage of the new capabilities.
    //
    //  The following changes were made to SetCookie:
    //
    //  1.  The expires parameter is now optional - that is, you can omit
    //      it instead of passing it null to expire the cookie at the end
    //      of the current session.
    //
    //  2.  An optional path parameter has been added.
    //
    //  3.  An optional domain parameter has been added.
    //
    //  4.  An optional secure parameter has been added.
    //
    //  For information on the significance of these parameters, and
    //  and on cookies in general, please refer to the official cookie
    //  spec, at:
    //
    //      http://www.netscape.com/newsref/std/cookie_spec.html    
    //
    //
    // "Internal" function to return the decoded value of a cookie
    //
    function getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }

    //
    //  Function to return the value of the cookie specified by "name".
    //    name - String object containing the cookie name.
    //    returns - String object containing the cookie value, or null if
    //      the cookie does not exist.
    //
    function GetCookie (name) {
      var arg = name + "=";
      var alen = arg.length;
      var clen = document.cookie.length;
      var i = 0;
      while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
          return getCookieVal (j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break; 
      }
      return null;
    }

    //
    //  Function to create or update a cookie.
    //    name - String object object containing the cookie name.
    //    value - String object containing the cookie value.  May contain
    //      any valid string characters.
    //    [expires] - Date object containing the expiration data of the cookie.  If
    //      omitted or null, expires the cookie at the end of the current session.
    //    [path] - String object indicating the path for which the cookie is valid.
    //      If omitted or null, uses the path of the calling document.
    //    [domain] - String object indicating the domain for which the cookie is
    //      valid.  If omitted or null, uses the domain of the calling document.
    //    [secure] - Boolean (true/false) value indicating whether cookie transmission
    //      requires a secure channel (HTTPS).  
    //
    //  The first two parameters are required.  The others, if supplied, must
    //  be passed in the order listed above.  To omit an unused optional field,
    //  use null as a place holder.  For example, to call SetCookie using name,
    //  value and path, you would code:
    //
    //      SetCookie ("myCookieName", "myCookieValue", null, "/");
    //
    //  Note that trailing omitted parameters do not require a placeholder.
    //
    //  To set a secure cookie for path "/myPath", that expires after the
    //  current session, you might code:
    //
    //      SetCookie (myCookieVar, cookieValueVar, null, "/myPath", null, true);
    //
    function SetCookie (name, value) {
      var argv = SetCookie.arguments;
      var argc = SetCookie.arguments.length;
      var expires = (argc > 2) ? argv[2] : null;
      var path = (argc > 3) ? argv[3] : null;
      var domain = (argc > 4) ? argv[4] : null;
      var secure = (argc > 5) ? argv[5] : false;
      document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
    }

    //  Function to delete a cookie. (Sets expiration date to current date/time)
    //    name - String object containing the cookie name
    //
    function DeleteCookie (name) {
      var exp = new Date();
      exp.setTime (exp.getTime() - 1);  // This cookie is history
      var cval = GetCookie (name);
      document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
    }

//---------------------------------------------------------------------------------------------



//Call the SetClickTracksCookie() function

SetClickTracksCookie();
