if(!hiddenpond) var hiddenpond = new Object();
if(!rarebrick) var rarebrick = new Object();

rarebrick.headerHeight = 535;
rarebrick.isIntro = false;

var flashQuery = swfobject.getQueryParamValue('flash');
if(flashQuery == 'true' || flashQuery == 'false') {
	if(flashQuery == 'true') {
		hiddenpond.flash = true;
	} else if(flashQuery == 'false') {
		hiddenpond.flash = false;
	}
	//document.cookie = 'flash=' + hiddenpond.flash;
	rarebrick.setCookie('flash', hiddenpond.flash);
} else {
	var flashCookie = rarebrick.getCookieVal('flash');
	if(flashCookie != '') hiddenpond.flash = (flashCookie == 'true');
	else hiddenpond.flash = true;
}

var gaQuery = swfobject.getQueryParamValue('ga');
if(gaQuery == 'true' || gaQuery == 'false') {
	if(gaQuery == 'true') {
		hiddenpond.ga = true;
	} else if(gaQuery == 'false') {
		hiddenpond.ga = false;
	}
	rarebrick.setCookie('ga', hiddenpond.ga, 5000);
} else {
	var gaCookie = rarebrick.getCookieVal('ga');
	if(gaCookie != '') hiddenpond.ga = (gaCookie == 'true');
	else hiddenpond.ga = true;
}

hiddenpond.useFlash = function() {
	return(hiddenpond.flash && swfobject.hasFlashPlayerVersion("9.0.0"));
}

rarebrick.popup = function(theURL,winName,features) {
  window.open(theURL,winName,features);
}

rarebrick.initHtmlView = function() {
	var out = '';
	var foundOne = false;
	var ss = document.getElementById('slideshow');
	if(ss) {
		//alert('html' + ss.childNodes.length);
		for(var i=0; i<ss.childNodes.length; i++) {
			var child = ss.childNodes[i];
			out = out + child.nodeName + '\n';
			if(child.nodeName.toLowerCase() == 'img') {
				if(foundOne==true) child.style.display = 'none';
				foundOne = true;
				child.onclick = rarebrick.nextSlideImage;
			}
		}
	}
}

rarebrick.nextSlideImage = function() {
	var ss = document.getElementById('slideshow');
	if(ss) {
		var foundOne = false;
		var firstChild;
		for(var i=0; i<ss.childNodes.length; i++) {
			var child = ss.childNodes[i];
			if(child.nodeName.toLowerCase() == 'img') {
				if(!firstChild) firstChild = child;
				if(foundOne == true) {
					child.style.display = 'inline';
					return;
				}
				if(child.style.display != 'none') {
					child.style.display = 'none';
					foundOne = true;
				}
			}
		}
		firstChild.style.display = 'inline';
	}
}

function emailSignup() {
	rarebrick.popup('http://visitor.constantcontact.com/d.jsp?m=1102230229696&p=oi','emailsignup','menubar=yes,resizable=yes,width=375,height=420');
}

function directionsPopup() {
	rarebrick.popup('directions_popup.htm','directions','menubar=yes,resizable=yes,width=500,height=500,scrollbars=yes');
}

if(!hiddenpond.useFlash()) swfobject.addDomLoadEvent(rarebrick.trackPageview);
if(!hiddenpond.useFlash()) swfobject.addDomLoadEvent(rarebrick.initHtmlView);