﻿window.onload = function(e) {
	if (navigator.userAgent.indexOf("Safari") >= 0) {
		document.getElementById('content_container').style.minHeight = '840px';
	}
}

function swapLayer(whichDirection) {
	if (whichDirection == "over") {
		document.getElementById('nav_container').style.zIndex = 999;
		document.getElementById('content').style.zIndex = 99;
		document.getElementById('callouts').style.zIndex = 99;
	} else {
		document.getElementById('nav_container').style.zIndex = 99;
		document.getElementById('content').style.zIndex = 999;
		document.getElementById('callouts').style.zIndex = 999;
	}
}

function rollover(whichImage, status) {
	if (status)
		document.getElementById(whichImage).setAttribute("src", "images/" + whichImage + "_on.gif");
	else
		document.getElementById(whichImage).setAttribute("src", "images/" + whichImage + "_off.gif");
}

function showGame(whichGame, gameHeight) {
	boxWidth = 768;
	boxHeight = gameHeight;

	screenWidth = document.all?document.body.clientWidth:window.innerWidth;
	screenHeight = document.all?document.body.clientHeight:window.innerHeight;

	xPos = (screenWidth - boxWidth) * 0.5;
	yPos = (screenHeight - boxHeight) * 0.5;

	var game_win = window.open('game-' + whichGame + '.html','game_window','width=768,height=' + gameHeight + ',toolbar=0,menubar=0,resizable=0,status=0,location=0,directories=0,copyhistory=0,scrollbars=0,screenX=' + xPos + ',screenY=' + yPos + ',top=' + yPos + ',left=' + xPos);
	game_win.focus();
}

var addthis_config = {
	username: "pncchristmaspriceindex",
	ui_click: true,
	ui_offset_left: -139,
	ui_offset_top: -5,
	ui_header_color: "#600",
	ui_hover_direction: 1,
	services_compact: "facebook,twitter,myspace,delicious,digg,reddit,email,favorites",
	services_expanded: "facebook,twitter,myspace,delicious,digg,reddit,email,favorites"	
}

function showAddThis() {
	addthis_open(document.body, 'more', '[URL]', '[TITLE]');
}

var showSpinCookie;

function setShowSpin() {
	var cookiename = "spin=";
	var cookievalue = "";
	
	offset = document.cookie.indexOf(cookiename);
	
	if (offset != -1) {
		showSpinCookie = "false";
		document.cookie = "spin=false";
	}
	else {
		showSpinCookie = "true";
		document.cookie = "spin=true";
	}
}