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

rarebrick.rezURL = 'https://www.reservations-page.com/C00138/h00110/be.ashx';

rarebrick.useFlash = function() {
	//return false;
	return(swfobject.hasFlashPlayerVersion("9.0.0"));
}

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

rarebrick.initHtmlView = function() {
	if(rarebrick.useFlash() == true) return;
	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');
}



//iframe popup window functions begin here

rarebrick.iframePop = function(url,w,h,top,left) { 
	//these are the default values if none are passed in
	if(!w) w = 500;
	if(!h) h = 300;
	if(!top) top = 200;
	if(!left) left = 200;
	rarebrick.iframeTop = top;
	rarebrick.iframeLeft = left;
	
	var iframe = document.getElementById('iframe');
	var iframeFrame = document.getElementById('iframeFrame');
	iframeFrame.src = url;
	
	iframeFrame.style.width = w+'px';
	iframeFrame.style.height = h+'px';
	iframe.style.visibility = 'visible';
	
	rarebrick.iframeSetCoords();
}

rarebrick.iframeSetCoords = function() {
	var iframe = document.getElementById('iframe');
	iframe.style.top = (rarebrick.iframeTop + f_scrollTop())  +'px';
	iframe.style.left = rarebrick.iframeLeft+'px';
}
rarebrick.iframeClose = function() {
	var iframe = document.getElementById('iframe');
	iframe.style.visibility = 'hidden'
}

function f_scrollTop() {
	return f_filterResults (
		window.pageYOffset ? window.pageYOffset : 0,
		document.documentElement ? document.documentElement.scrollTop : 0,
		document.body ? document.body.scrollTop : 0
	);
}

function f_filterResults(n_win, n_docel, n_body) {
	var n_result = n_win ? n_win : 0;
	if (n_docel && (!n_result || (n_result > n_docel)))
		n_result = n_docel;
	return n_body && (!n_result || (n_result > n_body)) ? n_body : n_result;
}
