function toggleOn(divId) {
	var el = document.getElementById(divId);
	el.style.display = 'block';el.style.display = 'block';
}
function toggleOff(divId) {
	var el = document.getElementById(divId);
	el.style.display = 'none';el.style.display = 'none';
}
function toggle(divId) {
	var el = document.getElementById(divId);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function displayContent(contentUrl) {
	resizeBlanket();
	centerWidth('popUp');
	/*if (document.all) {
		toggleOn('blanket');
		toggleOn('popUp');
	} else {*/
		$("#blanket").fadeIn("slow");
		$("#popUp").fadeIn("slow");
	/*}*/
	getContent('pageContent2',contentUrl);
}
function loadContent(contentUrl) {
	getContent('pageContent2',contentUrl);
}
function close() {
	/*if (document.all) {
		toggleOff('blanket');
		toggleOff('popUp');
	} else {*/
		$("#blanket").fadeOut("slow");
		$("#popUp").fadeOut("slow");
	/*}*/
}
function getContent(id,url)	{
	var xmlhttp;
	if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari
	} else if (window.ActiveXObject) {	xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");  // code for IE6, IE5
	} else { alert("Your browser does not support XMLHTTP!");}
	xmlhttp.onreadystatechange=function(){
		if(xmlhttp.readyState==4){
			document.getElementById(id).innerHTML=xmlhttp.responseText;
		}
	}
	xmlhttp.open("GET",url,true);
	xmlhttp.send(null);
}
function resizeBlanket() {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
}
function centerWidth(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerWidth;
	} else {
		viewportwidth = document.documentElement.clientWidth;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-460;
	popUpDiv.style.left = window_width + 'px';
}
$(document).ready(
	function(){
		
		
		resizeBlanket();
		centerWidth('popUp');
		$('ul#slideshow').innerfade({
			speed: 1000, //also 'slow'
			timeout: 5000,
			type: 'sequence', //'or 'random', 'random_start', or 'sequence'
			containerheight: '351px'
		});		
	}
);
$(window).resize(function() {
    resizeBlanket();
	centerWidth('popUp');
});
$(window).scroll(function() {
    resizeBlanket();
	centerWidth('popUp');
});

