// Browser detect in previous js file.  Then redirect if IE 6 and older
if(BrowserDetect.browser.toLowerCase() == "explorer" && BrowserDetect.version < 7){
	window.open('error/errorOldBrowser.cfm', 'upgrade', config='height=600, width=485, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
}

// set and maintain background aspect ratio, fit to window
var resizeBg = function(){ 
	var h = self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; 
	var w = self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; 
	var elem = document.getElementById('backgroundImage'); 
	if(w > h){ 
			elem.width = w; 
			elem.height = w; 
	}else{ 
			elem.height = h; 
			elem.width = h; 
	} 
} 

// Flash handling
var playFlash = "true";
AC_FL_RunContent = 0;

// flip between background view and website view
function tripVisible(cssID,elemState){ 
	if (document.getElementById){ 
	document.getElementById(cssID).style.visibility=elemState; 
	} 
}
function tripDisplay(cssID,elemState){ 
	if (document.getElementById){ 
	document.getElementById(cssID).style.display=elemState; 
	} 
}

// maintain background viewing-state page-to-page, using onDOMReady 
window.onDOMReady = DOMReady  

function DOMReady(fn) { 
	if(document.addEventListener) 
		document.addEventListener("DOMContentLoaded", fn, false);  
	// IE 
	else 
		document.onreadystatechange = function() { 
			checkReadyState(fn); 
		} 
	}  

function checkReadyState(fn) { 
	if(document.readyState == "interactive") 
		fn(); 
	}  

window.onDOMReady( 
    function() { 
		if(window.location.href.indexOf('showImage')!=-1){
			tripVisible('page','hidden'); 
			tripVisible('backgroundCaption','visible'); 
			tripDisplay('flipSite','inline'); 
			tripDisplay('flipBackground','none');
		} 
    } 
);

// window pop handler
function PopThis(sURL, nHeight, nWidth)
	{
		if(nHeight == null)
			nHeight = 480;
		if(nWidth == null)
			nWidth = 600;
	
		focusMe = window.open(sURL, 'scwWindow', config='height='+nHeight+', width=' + nWidth + ', titlebar=no, toolbar=no, menubar=no, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
		focusMe.focus();
	}
