/*
	Base javascript code to be referenced from all pages
	Author: MFP
	Version: $Id: fcbasescript.js,v 1.6 2003/07/24 20:22:51 atg Exp $
*/

function openWin (winURL,winName,winParams) 
{
	var popWindow = open(winURL,winName,winParams);
	if (popWindow.opener == null) popWindow.opener = self;
	if (window.focus) popWindow.focus();
}

function cartPopupWin(url, width, height) {
	  if (width == null)
	  	width = 510;
	  if (height == null)
	  	height = 500;
	  	
      winStats='height=' + height + ',width=' + width + ',status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,directories=no';
   if (navigator.appName.indexOf("Microsoft")>=0) {
      winStats+=',left=50,top=50'
      
    }else{
      winStats+=',screenX=50,screenY=50' 
    }
    popWin=window.open(url,"FranklinCovey",winStats)     
    popWin.focus();
}

function openQuote(url){
	newwindow2=open('/cgi-bin/shopping/priority.cgi?sc=Quote_of_the_day&url=http%3a%2f%2fwww.franklincovey.com%2fquote%2fquote.html%3fc%3dFooter_Quote_of_the_day',"one2e","scrollbars=yes,toolbar=no,directories=no,menubar=no,resizable=no,status=no,width=411,height=175");
	if (window.focus) {
		newwindow2.focus();
	}
}

function jumpCategory(formname, selectname) {
	/*
	Given a formname and a select element name this script assumes that the 
	select element contains options whos values are urls and directs accordingly
	*/
	var selectObj = document.forms[formname].elements[selectname];
	var which = selectObj[selectObj.selectedIndex].value;
	if (which != "") document.location.href=which;
}

function noCookies(){
		alert("Cookies are required to use the FranklinCovey Shopping web site.");
		//document.location = '/shopping/nocookies.html';
		document.location = 'http://www.franklincovey.com/';
}

function testCookies(){
	if(document.cookie){
		var cookieoff = "ATG=";
		document.cookie = cookieoff;
		//alert("Stall");
		var cookieval = "ATG=true";
		document.cookie = cookieval;
		if(document.cookie.indexOf(cookieval) == -1)
			noCookies();
	} else {
			noCookies();
	}
}

if (document.images) 
{
	tabOnLeft = new Image(); tabOnLeft.src = "/images/www/tab_images/left_tab_on.gif"; 
	tabOnRight = new Image(); tabOnRight.src = "/images/www/tab_images/right_tab_on.gif"; 
	tabOffLeft = new Image(); tabOffLeft.src = "/images/www/tab_images/left_tab_off.gif"; 
	tabOffRight = new Image(); tabOffRight.src = "/images/www/tab_images/right_tab_off.gif"; 
}

function swapTab(whichImages, on)
{
	if (on)
	{
		
		document.images[whichImages+"_left"].src=tabOnLeft.src;
		document.images[whichImages+"_right"].src=tabOnRight.src;
	}
	else
	{
		document.images[whichImages+"_left"].src=tabOffLeft.src;
		document.images[whichImages+"_right"].src=tabOffRight.src;
	}
}
