function toggleOn(div_id) {
	var el = document.getElementById(div_id);
	el.style.display = 'block';el.style.display = 'block';
}
function toggleOff(div_id) {
	var el = document.getElementById(div_id);
	el.style.display = 'none';el.style.display = 'none';
}
function displayContent(contentUrl) {
	blanket_size('hello');
	window_pos('popUp1');
	if (document.all) {
		toggleOn('blanket');
		toggleOn('popUp1');
	} else {
		$("#blanket").fadeIn("slow");
		$("#popUp1").fadeIn("slow")
	}
	getContent('pageContent',contentUrl);
}
function displayContent2(contentUrl) {
	blanket_size('hello');
	window_pos2('popUp2');
	if (document.all) {
		toggleOn('blanket');
		toggleOn('popUp2');
	} else {
		$("#blanket").fadeIn("slow");
		$("#popUp2").fadeIn("slow")
	}
	getContent('pageContent2',contentUrl);
}
function loadContent(contentUrl) {
	getContent('pageContent',contentUrl);
}

function close() {
	if (document.all) {
		toggleOff('blanket');
		toggleOff('popUp1');
	} else {
		$("#blanket").fadeOut("slow");
		$("#popUp1").fadeOut("slow");
	}	
}
function close2() {
	if (document.all) {
		toggleOff('blanket');
		toggleOff('popUp2');
	} else {
		$("#blanket").fadeOut("slow");
		$("#popUp2").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 blanket_size(popUpDivVar) {
	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';
	/*var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150; //150 is half popups height
	popUpDiv.style.top = popUpDiv_height + 'px';*/
}
function window_pos(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-433;
	popUpDiv.style.left = window_width + 'px';
}
function window_pos2(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-330;
	popUpDiv.style.left = window_width + 'px';
}
$(document).ready(
	function(){
		/*$('#news').innerfade({
			animationtype: 'slide',
			speed: 750,
			timeout: 2000,
			type: 'random',
			containerheight: '1em'
		});*/		
		$('ul#flash').innerfade({
			speed: 1000,
			timeout: 5000,
			type: 'sequence',
			containerheight: '351px'
		});		
		/*$('.fade').innerfade({
			speed: 1000,
			timeout: 6000,
			type: 'random_start',
			containerheight: '1.5em'
		});		
		$('.adi').innerfade({
			speed: 'slow',
			timeout: 5000,
			type: 'random',
			containerheight: '150px'
		});*/	
	}
);
$(window).resize(function() {
    blanket_size('hello');
	window_pos('popUp1');
});
$(function(){
	$('.fadein img:gt(0)').hide();
	setInterval(function(){$('.fadein :first-child').fadeOut().next('img').fadeIn().end().appendTo('.fadein');}, 3000);
});
