// JavaScript Document

//**********************************************************************
//
// MM_reloadPage
//
// this is a function that apparaently fixes a bug in NetscapeNavigator 4.0, where
// the page does not get redrawn when resized. 
//
// notice that this function is actually called after it is declared.
//
//**********************************************************************
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {
		if ((appName=="Netscape") && (parseInt(appVersion)==4)) {
	    document.MM_pgW = innerWidth; 
			document.MM_pgH = innerHeight; 
			onresize = MM_reloadPage; 
		}
	} else if (innerWidth != document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}


MM_reloadPage(true);


//**********************************************************************
//
// MM_openBrWindow
//
//**********************************************************************
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//**********************************************************************
//**********************************************************************


// used with masthead "Show Cart" button

var blnMainJump = true;


// called from "onClick" of main title table
//
function mainjump() {

//	window.location = 'home.php' ;	
	
	var result;
	if ( blnMainJump ) {
		//alert ("will do a main jump here to the home page");
		result = true;
		document.location.href = m_url_mainjump ;	

	} else {
		//alert ("this is INACTIVE - will NOT jump to main page");
		result = false;
	}
	blnMainJump = true;
	return result;
}

// onClick of ShowCart button
//
// we turn off the MainJump boolean, so that the cascaded "click" on the main page does not get engaged.
//
function cartjump() {
	blnMainJump = false;
}



//**********************************************************************


function imgOn(imgName) {
	if (!document.images) return;
	document.images[imgName].src = eval(imgName + "_on.src");
}

function imgOff(imgName) {
	if (!document.images) return;
	
	// the off image depends on which page is active.
	// if the oof image matches the page we are on, then the off image should be the "on" image
	//
	// the active page will be indicated by the variable "page_button".
	// if page_button == imgName, then we know that is the page we're on
	
	if ( page_button == imgName ) {
		source = imgName + "_on.src"
	} else {
		source = imgName + "_off.src"
	}
	document.images[imgName].src = eval(source);
}

function newImage( path ) {
	var i = new Image();
	i.src = path;
	return i;
}

function testjs() {
	alert('testjs ok!');
}

// this is run always at beginning of page

if (document.images) {

	var b_cfe_main_on  = newImage("cfe_images/cfe_logo_on.gif");
	var b_cfe_main_off = newImage("cfe_images/cfe_logo_off.gif");

	var but_showcart_on  = newImage("cfe_images/but_showcart_on.gif");
	var but_showcart_off = newImage("cfe_images/but_showcart_off.gif");


	var but_legal_pop_on  = newImage("cfe_images/tvbg_legal_pink_on.gif");
	var but_legal_pop_off = newImage("cfe_images/tvbg_legal_pink_off.gif");


	var but_tvbg_main_on  = newImage("cfe_images/but_tvbg_main_yel.gif");
	var but_tvbg_main_off = newImage("cfe_images/but_tvbg_main_blu.gif");

	var but_buy_on  = newImage("cfe_images/but_buy_on.gif");
	var but_buy_off = newImage("cfe_images/but_buy_off.gif");

	var but_using_on  = newImage("cfe_images/but_using_on.gif");
	var but_using_off = newImage("cfe_images/but_using_off.gif");

	var but_contact_on  = newImage("cfe_images/but_contact_on.gif");
	var but_contact_off = newImage("cfe_images/but_contact_off.gif");

	var but_warranty_on  = newImage("cfe_images/but_warranty_on.gif");
	var but_warranty_off = newImage("cfe_images/but_warranty_off.gif");

	var but_respons_on  = newImage("cfe_images/but_respons_on.gif");
	var but_respons_off = newImage("cfe_images/but_respons_off.gif");

	var but_faq_on  = newImage("cfe_images/but_common_on.gif");
	var but_faq_off = newImage("cfe_images/but_common_off.gif");

}



