// Copyright Acro Media Inc. 1998-2006, www.acromediainc.com

function copyrightYear(){
	if(document.getElementById('insertYear')) document.getElementById('insertYear').innerHTML = new Date().getFullYear();
}


function externalLinks(){
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		if (anchors[i].getAttribute("href") && anchors[i].getAttribute("rel") == "external") anchors[i].target = "_blank";
	}
}


//Checks to see if safari is on, boolean
var detect = navigator.userAgent.toLowerCase();
var safStatus,thestring;
function checkSafari(){
	if (checkIt('safari')) safStatus = true;
	else safStatus = false;
	function checkIt(string){
		place = detect.indexOf(string) + 1;
		return place;
	}
}

//Popup Prize
var newWin;
var popup = {
	open : function( pArgs ){return this.named( pArgs.url, pArgs.w, pArgs.h, pArgs.y, pArgs.x, pArgs.scroll, pArgs.resize, pArgs.name, pArgs.pos );},
	named : function(url, width, height, top, left, scroll, resize, name, position){
		if(!scroll) scroll = "no";
		if(!resize) resize = "no";
		if(!name) name = "popup";
		if(!width || !height){
			if(!scroll)	scroll = "yes";
			if(!resize) resize = "yes";
		}
		if(!width) width = screen.availWidth;
		if(!height) height = screen.availHeight;
		if(!top || top == "center") top = (screen.availHeight / 2 - height / 2);
		if(!left || left == "center") left = (screen.availWidth / 2 - width / 2);
		newWin = window.open(url,name,"toolbar=no,menubar=0,width="+width+",height="+height+",top="+top+",left="+left+",scrollbars="+scroll+",resizable="+resize);
		(position == "behind") ? setTimeout('newWin.blur();',100) : setTimeout('newWin.focus();',100);
	}
}

function popupBYOGWindow () {
	popup.open({url:"/byog.htm", w:662, h:449});
	return false;
}

siteOnLoad = function (){
	checkSafari();
	copyrightYear();
	externalLinks();
	SBDrawCart.init();
	SBDrawMenu();
}

function addLoadEvent(func){
	var oldOnLoad = window.onload;
	if(typeof window.onload != 'function'){
		window.onload = func;
	}
	else{
		window.onload = function(){
			oldOnLoad();
			func();
		}
	}
}


addLoadEvent(siteOnLoad);

