if (document.images)
{
            // Active Images
            view_cart_on = new Image(); 
            view_cart_on.src = "images/nav/view_cart_on.jpg";

            // Inactive Images
            view_cart_off = new Image(); 
            view_cart_off.src = "images/nav/view_cart_off.jpg";


            // Active Images
            profile_view_on = new Image(); 
            profile_view_on.src = "images/icons/profile_on.jpg";

            // Inactive Images
            profile_view_off = new Image(); 
            profile_view_off.src = "images/icons/profile_off.jpg";

            // Active Images
            front_view_on = new Image(); 
            front_view_on.src = "images/icons/front_on.jpg";

            // Inactive Images
            front_view_off = new Image(); 
            front_view_off.src = "images/icons/front_off.jpg";




						/* secondary navigation */
            // Active Images
            news_on = new Image(); 
            news_on.src = "images/sub_nav/news_on.jpg";

            // Inactive Images
            news_off = new Image(); 
            news_off.src = "images/sub_nav/news_off.jpg";

            // Active Images
            tips_on = new Image(); 
            tips_on.src = "images/sub_nav/tips_on.jpg";

            // Inactive Images
            tips_off = new Image(); 
            tips_off.src = "images/sub_nav/tips_off.jpg";

            // Active Images
            toms_photography_on = new Image(); 
            toms_photography_on.src = "images/sub_nav/toms_photography_on.jpg";

            // Inactive Images
            toms_photography_off = new Image(); 
            toms_photography_off.src = "images/sub_nav/toms_photography_off.jpg";

            // Active Images
            about_us_on = new Image(); 
            about_us_on.src = "images/sub_nav/about_us_on.jpg";

            // Inactive Images
            about_us_off = new Image(); 
            about_us_off.src = "images/sub_nav/about_us_off.jpg";

            // Active Images
            videos_on = new Image(); 
            videos_on.src = "images/sub_nav/videos_on.jpg";

            // Inactive Images
            videos_off = new Image(); 
            videos_off.src = "images/sub_nav/videos_off.jpg";

            // Active Images
            contact_on = new Image(); 
            contact_on.src = "images/sub_nav/contact_on.jpg";

            // Inactive Images
            contact_off = new Image(); 
            contact_off.src = "images/sub_nav/contact_off.jpg";




            // Active Images
            a_message_from_tom_on = new Image(); 
            a_message_from_tom_on.src = "images/sub_nav/sub_nav/a_message_from_tom_on.jpg";

            // Inactive Images
            a_message_from_tom_off = new Image(); 
            a_message_from_tom_off.src = "images/sub_nav/sub_nav/a_message_from_tom_off.jpg";

            // Active Images
            yo_yos_in_outer_and_inner_space_on = new Image(); 
            yo_yos_in_outer_and_inner_space_on.src = "images/sub_nav/sub_nav/yo_yos_in_outer_and_inner_space_on.jpg";

            // Inactive Images
            yo_yos_in_outer_and_inner_space_off = new Image(); 
            yo_yos_in_outer_and_inner_space_off.src = "images/sub_nav/sub_nav/yo_yos_in_outer_and_inner_space_off.jpg";

            // Active Images
            who_we_are_on = new Image(); 
            who_we_are_on.src = "images/sub_nav/sub_nav/who_we_are_on.jpg";

            // Inactive Images
            who_we_are_off = new Image(); 
            who_we_are_off.src = "images/sub_nav/sub_nav/who_we_are_off.jpg";

            // Active Images
            what_we_care_about_on = new Image(); 
            what_we_care_about_on.src = "images/sub_nav/sub_nav/what_we_care_about_on.jpg";

            // Inactive Images
            what_we_care_about_off = new Image(); 
            what_we_care_about_off.src = "images/sub_nav/sub_nav/what_we_care_about_off.jpg";

            // Active Images
            the_big_yo_on = new Image(); 
            the_big_yo_on.src = "images/sub_nav/sub_nav/the_big_yo_on.jpg";

            // Inactive Images
            the_big_yo_off = new Image(); 
            the_big_yo_off.src = "images/sub_nav/sub_nav/the_big_yo_off.jpg";

            // Active Images
            the_worlds_first_take_apart_yo_yo_on = new Image(); 
            the_worlds_first_take_apart_yo_yo_on.src = "images/sub_nav/sub_nav/the_worlds_first_take_apart_yo_yo_on.jpg";

            // Inactive Images
            the_worlds_first_take_apart_yo_yo_off = new Image(); 
            the_worlds_first_take_apart_yo_yo_off.src = "images/sub_nav/sub_nav/the_worlds_first_take_apart_yo_yo_off.jpg";
            

            // Active Images
            the_worlds_first_ball_bearing_yo_yo_on = new Image(); 
            the_worlds_first_ball_bearing_yo_yo_on.src = "images/sub_nav/sub_nav/the_worlds_first_ball_bearing_yo_yo_on.jpg";

            // Inactive Images
            the_worlds_first_ball_bearing_yo_yo_off = new Image(); 
            the_worlds_first_ball_bearing_yo_yo_off.src = "images/sub_nav/sub_nav/the_worlds_first_ball_bearing_yo_yo_off.jpg";



						/* Featured Panels */
            // Active Images
            special_items_panel_on = new Image(); 
            special_items_panel_on.src = "images/panels/special_items_on.jpg";

						// Inactive Images
            special_items_panel_off = new Image(); 
            special_items_panel_off.src = "images/panels/special_items_off.jpg";

            // Active Images
            special_offers_panel_on = new Image(); 
            special_offers_panel_on.src = "images/panels/special_offers_on.jpg";

            // Active Images
            special_offers_panel_off = new Image(); 
            special_offers_panel_off.src = "images/panels/special_offers_off.jpg";

            // Active Images
            toms_photo_gallery_panel_on = new Image(); 
            toms_photo_gallery_panel_on.src = "images/panels/toms_photo_gallery_on.jpg";

            // Active Images
            toms_photo_gallery_panel_off = new Image(); 
            toms_photo_gallery_panel_off.src = "images/panels/toms_photo_gallery_off.jpg";



						/* product nav "more" */
						// Inactive Images
            more_off = new Image(); 
            more_off.src = "images/container/more_off.jpg";

            // Active Images
            more_on = new Image(); 
            more_on.src = "images/container/more_on.jpg";

}


// Function to 'activate' the image.
function imgOn(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_on.src");
        }
}

// Function to 'deactivate' the image.
function imgOff(imgName) {
        if (document.images) {
            document[imgName].src = eval(imgName + "_off.src");
        }
}

// General
function isValidEmail(str) {
   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}


// Send contact_us form
function sendContactUs(theElement){

	var theForm = theElement.form, z = 0;
	var contactUsName = document.getElementById('contact_us_name').value;
	var contactUsEmail = document.getElementById('contact_us_email').value;
	var contactUsBody = document.getElementById('contact_us_body').value;
		
	var errorFlag = 0;
	var elems;

	var url;
	var response;
	
	// creates a new XMLHttpRequest object to talk to the web server
	var xmlHttp = false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e2) {
	    xmlHttp = false;
	  }
	}
	@end @*/

	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
	  xmlHttp = new XMLHttpRequest();
	}


	//alert(contactUsName);
	//alert(contactUsEmail);
	//alert(contactUsBody);
	
	if(contactUsName == ""){
		alert("Name is missing. Please enter a valid name.");
		errorFlag = 1;
	}

	if(!isValidEmail(contactUsEmail)){
		alert("Invalid email address. Please enter a valid email address.");
		errorFlag = 1;
	}
	
	if(contactUsBody == ""){
		alert("Body of the message is missing. Please enter a valid message.");
		errorFlag = 1;
	}
		
	if(errorFlag == 0){

	  // build URL to connect to
	  url = "send.php?type=contact_us&name=" + escape(contactUsName) + "&email=" + escape(contactUsEmail) + "&body=" + escape(contactUsBody);
		//alert("before open" + url);
		
	  // open a connection to the server
	  xmlHttp.open("POST", url, true);
	
		//alert("before status: " + url);
		
	  // setup a function for the server to run when it is done
	  xmlHttp.onreadystatechange = getSendState;

		//alert("after status: " + url);

	  // send the request
	  xmlHttp.send(null);
	
		alert("Thank you for contacting us.");
		document.getElementById('contact_us_name').value = "";
		document.getElementById('contact_us_email').value = "";
		document.getElementById('contact_us_body').value = "";

	}
	
	
	function getSendState() {
			
	
		  if (xmlHttp.readyState == 4) {

				 // if "OK"
				if (xmlHttp.status != 200)
				{
					alert("Problem updating.")
				} else {
	
			    response = xmlHttp.responseText;
			    //alert(response);
	
				} // end status check
	    
		  } // end readyState check
	
		} // end getSubscribeState()	
	
}


///////
// menu
///////
// contents for menu1
var menu1=new Array();
menu1[0]='<a href="index.php?page=a_message_from_tom" onMouseOver="imgOn(\'a_message_from_tom\')" onMouseOut="imgOff(\'a_message_from_tom\')"><img src="images/sub_nav/sub_nav/a_message_from_tom_off.jpg" name="a_message_from_tom" border="0" width="200" height="19" alt="A Message from Tom" /></a>';
menu1[1]='<a href="index.php?page=yo_yos_in_outer_and_inner_space" onMouseOver="imgOn(\'yo_yos_in_outer_and_inner_space\')" onMouseOut="imgOff(\'yo_yos_in_outer_and_inner_space\')"><img src="images/sub_nav/sub_nav/yo_yos_in_outer_and_inner_space_off.jpg" name="yo_yos_in_outer_and_inner_space" border="0" width="200" height="19" alt="Yo-Yos in Outer and Inner Space" /></a>';
menu1[2]='<a href="index.php?page=who_we_are" onMouseOver="imgOn(\'who_we_are\')" onMouseOut="imgOff(\'who_we_are\')"><img src="images/sub_nav/sub_nav/who_we_are_off.jpg" name="who_we_are" border="0" width="200" height="19" alt="Who We Are" /></a>';
menu1[3]='<a href="index.php?page=what_we_care_about" onMouseOver="imgOn(\'what_we_care_about\')" onMouseOut="imgOff(\'what_we_care_about\')"><img src="images/sub_nav/sub_nav/what_we_care_about_off.jpg" name="what_we_care_about" border="0" width="200" height="19" alt="What We Care About" /></a>';
menu1[4]='<a href="index.php?page=the_big_yo" onMouseOver="imgOn(\'the_big_yo\')" onMouseOut="imgOff(\'the_big_yo\')"><img src="images/sub_nav/sub_nav/the_big_yo_off.jpg" name="the_big_yo" border="0" width="200" height="19" alt="The Big YO" /></a>';
menu1[5]='<a href="index.php?page=the_worlds_first_take_apart_yo_yo" onMouseOver="imgOn(\'the_worlds_first_take_apart_yo_yo\')" onMouseOut="imgOff(\'the_worlds_first_take_apart_yo_yo\')"><img src="images/sub_nav/sub_nav/the_worlds_first_take_apart_yo_yo_off.jpg" name="the_worlds_first_take_apart_yo_yo" border="0" width="200" height="19" alt="The Worlds First Take Apart Yo-Yo" /></a>';
menu1[6]='<a href="index.php?page=the_worlds_first_ball_bearing_yo_yo" onMouseOver="imgOn(\'the_worlds_first_ball_bearing_yo_yo\')" onMouseOut="imgOff(\'the_worlds_first_ball_bearing_yo_yo\')"><img src="images/sub_nav/sub_nav/the_worlds_first_ball_bearing_yo_yo_off.jpg" name="the_worlds_first_ball_bearing_yo_yo" border="0" width="200" height="19" alt="The Worlds First Ball Bearing Yo-Yo" /></a>';
		
var menuwidth='200px'; //default menu width
var menubgcolor='#d1d3e0';  //menu bgcolor
var disappeardelay=250;  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes"; //hide menu when user clicks within menu?

// no further editting needed
var ie4=document.all;
var ns6=document.getElementById&&!document.all;

if (ie4||ns6)
	document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>');

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, menuwidth){

	if (ie4||ns6){
		dropmenuobj.style.left=dropmenuobj.style.top="-500px";
	}
	
	if (menuwidth!=""){
		dropmenuobj.widthobj=dropmenuobj.style;
		dropmenuobj.widthobj.width=menuwidth;
	}
	
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover"){
		obj.visibility=visible;
	}
	else if (e.type=="click"){
		obj.visibility=hidden;
	}

}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body;
}

function clearbrowseredge(obj, whichedge){

	var edgeoffset=0;

	if (whichedge=="rightedge"){
	var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15;
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth;

	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth;
}
else{
	var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset;
	var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18;
	dropmenuobj.contentmeasure=dropmenuobj.offsetHeight;
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}


function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
	
	return clickreturnvalue()
}
	
function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

if (hidemenu_onclick=="yes")
	document.onclick=hidemenu
	
	
	
function shiftProductNav(direction){

	//alert ("direction: " + direction);
	//alert ("lastProductID: " + lastProductID);

	var productsOnNav = 6;
	
	for(position=1 ; position <= productsOnNav; position++){
		//alert(position);
		
		getNewProduct(direction, position);
		
			
	}
	
	getLastProductPosition(direction, position);
	

}	
	
	
function getNewProduct(direction, position){

	/*var theForm = theElement.form, z = 0;
	var contactUsName = document.getElementById('contact_us_name').value;
	var contactUsEmail = document.getElementById('contact_us_email').value;
	var contactUsBody = document.getElementById('contact_us_body').value;
		
	var errorFlag = 0;
	var elems;

	var url;
	var response;*/
	
	//alert ("direction: " + direction);
	//alert ("direction: " + position);
	
	// creates a new XMLHttpRequest object to talk to the web server
	var xmlHttp = false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e2) {
	    xmlHttp = false;
	  }
	}
	@end @*/

	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
	  xmlHttp = new XMLHttpRequest();
	}


	//alert(contactUsName);
	//alert(contactUsEmail);
	//alert(contactUsBody);
	
	
	  // build URL to connect to
	  url = "ajax_gets.php?type=shift_" + direction + "&last_product_id=" + escape(lastProductID) + "&position=" + escape(position);
		//alert("before open: " + url);
		
	  // open a connection to the server
	  xmlHttp.open("POST", url, true);
	
		//alert("before status: " + url);
		
	  // setup a function for the server to run when it is done
	  xmlHttp.onreadystatechange = shiftProductNavState;

		//alert("after status: " + url);

	  // send the request
	  xmlHttp.send(null);
	
	
	
	function shiftProductNavState() {
			
			//alert("position: " + position);
	
		  if (xmlHttp.readyState == 4) {

				 // if "OK"
				if (xmlHttp.status != 200)
				{
					alert("Problem updating.")
				} else {
					
			    response = xmlHttp.responseText;
			    //alert(response);
			    //alert(document.getElementById('position_'+position).innerHTML);
			    document.getElementById('position_'+position).innerHTML = response;
			    //alert(position);
	
				} // end status check
	    
		  } // end readyState check
	
		} // end getSubscribeState()	
	
}


function getLastProductPosition(direction, position){

	/*var theForm = theElement.form, z = 0;
	var contactUsName = document.getElementById('contact_us_name').value;
	var contactUsEmail = document.getElementById('contact_us_email').value;
	var contactUsBody = document.getElementById('contact_us_body').value;
		
	var errorFlag = 0;
	var elems;

	var url;
	var response;*/
	
	//alert ("direction: " + direction);
	//alert ("direction: " + position);
	
	// creates a new XMLHttpRequest object to talk to the web server
	var xmlHttp = false;
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)
	try {
	  xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	  try {
	    xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	  } catch (e2) {
	    xmlHttp = false;
	  }
	}
	@end @*/

	if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
	  xmlHttp = new XMLHttpRequest();
	}


	//alert(contactUsName);
	//alert(contactUsEmail);
	//alert(contactUsBody);
	
	
	  // build URL to connect to
	  url = "ajax_gets.php?type=last_position_" + direction + "&last_product_id=" + escape(lastProductID) + "&position=" + escape(position);
		//alert("before open: " + url);
		
	  // open a connection to the server
	  xmlHttp.open("POST", url, true);
	
		//alert("before status: " + url);
		
	  // setup a function for the server to run when it is done
	  xmlHttp.onreadystatechange = getLastProductPositionState;

		//alert("after status: " + url);

	  // send the request
	  xmlHttp.send(null);
	
	
	
	function getLastProductPositionState() {
			
	
		  if (xmlHttp.readyState == 4) {

				 // if "OK"
				if (xmlHttp.status != 200)
				{
					alert("Problem updating.")
				} else {
	
			    response = xmlHttp.responseText;
			    //alert(response);
			    lastProductID = response;
			    //alert(lastProductID);
			    
	
				} // end status check
	    
		  } // end readyState check
	
		} // end getSubscribeState()	
	
}