function preloadImages(){
	if(document.images){							// if the browser can handle images
		var imgFiles = preloadImages.arguments;		// # of arguments sent to function
		var preloadArray = new Array();				// Create new array called preLoadArray to store images

		for(var i=0; i<imgFiles.length; i++){		// loop for # of arguments sent to function
			preloadArray[i] = new Image;				// add slot for new Image to array
			preloadArray[i].src = imgFiles[i];		// fill slot with image file
		}
	}
}

function swapImage() {
	var i                                   // just initializing for the loop below
	var j=0                                 // used as position in swapArray[]
	var objStr                              // will become the first (NC) or second (IE) argument passed
	var obj                                 // will become the processed objStr
	var swapArray=new Array                 // Create new array called swapArray to store images
	var oldArray=document.DD_swapImgData;   // oldArray stores the previous rollover.  swapImageData is 
	
	for (i=0; i < (swapImage.arguments.length-2); i+=3) {
		objStr = swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];          // objStr becomes the first argument if Netscape,
                                                                                        // or it becomes the second argument if Microsoft.
        if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||         // tests for existence of layers
			(objStr.indexOf('document.all[')   ==0 && document.all   ==null)){      
			objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);  // changes objStr to include '.layers' if needed
		}
		obj = eval(objStr);                                                             // cuz objStr is just characters, not real value
		if(obj != null){                                                                // Does an object [images] by this name (objStr) exist?
			swapArray[j++] = obj;                                                         // put the object (document.start) to be changed into swapArray[0]
			swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];  // put current image.src or oldArray[1] into swapArray[1]
			obj.src = swapImage.arguments[i+2];                                           // set new src = arg[i+2] (the filename of new image.src)
		}
	}
	document.DD_swapImgData = swapArray; //used for restore                           // put current swapArray into swapImageData
}


function swapImgRestore() {
	if (document.DD_swapImgData != null){                                           // make sure swapImageData (most recent swapArray) isn't empty
		for (var i=0; i<(document.DD_swapImgData.length-1); i+=2){                    // do the loop for as many times as images that need to be restored
			document.DD_swapImgData[i].src = document.DD_swapImgData[i+1];              // get the image [name] to be restored from array[i]
		}
	}
}




function pageHeader(thePage, theHeadline){
	
	// Default value; probably replaced by if statement
	// ...or later on using 'theHeadline' argument
	headline = "The Learning Bug";
	
	// Catalog is always an active link
	if(thePage == "catalog"){
		headline = "Catalog";
		catalogLink = "<a href='http://www.azlearningbug.com/catalog/index.php' target='_top' class='currentHeaderLink'>Catalog</a>";
	}else{
		catalogLink = "<a href='http://www.azlearningbug.com/catalog/index.php' target='_top' class='headerLink'>Catalog</a>";
	}
		
	// Workshops is always an active link
	if(thePage == "workshops" || thePage == "workshop"){
		headline = "Workshops";
		workshopLink = "<a href='http://www.azlearningbug.com/workshops/index.html' target='_top' class='currentHeaderLink'>Idea Corner</a>";
	}else{
		workshopLink = "<a href='http://www.azlearningbug.com/workshops/index.html' target='_top' class='headerLink'>Idea Corner</a>";
	}	
	
	// Wish Lists is always an active link
	if(thePage == "wishlists" || thePage == "wishlist" || thePage == "wish"){
		headline = "Wish Lists";
		wishListLink = "<a href='http://www.azlearningbug.com/wish/index.php' target='_top' class='currentHeaderLink'>Wish Lists</a>";
	}else{
		wishListLink = "<a href='http://www.azlearningbug.com/wish/index.php' target='_top' class='headerLink'>Wish Lists</a>";
	}
		
	if(thePage == "specials" || thePage == "special"){
		headline = "Specials";
		specialsLink = "<div class='currentHeader'>Specials</div>";
	}else{
		specialsLink = "<a href='http://www.azlearningbug.com/specials/index.html' target='_top' class='headerLink'>Specials</a>";
	}
	
	if(thePage == "specialorder" || thePage == "order" || thePage == "specialOrder"){
		headline = "Special Orders";
		specialOrderLink = "<div class='currentHeader'>Special Order</div>";
	}else{
		specialOrderLink = "<a href='http://www.azlearningbug.com/specialOrder/index.html' target='_top' class='headerLink'>Special Order</a>";
	}
	
	if(thePage == "contactus" || thePage == "contact"){
		headline = "Contact Us";
		contactLink = "<div class='currentHeader'>Contact Us</div>";
	}else{
		contactLink = "<a href='http://www.azlearningbug.com/contact/index.html' target='_top' class='headerLink'>Contact Us</a>";
	}
	
	if(thePage == "shopCart" || thePage == "shopcart"){
		headline = "Shopping List";
		catalogLink = "<a href='http://www.azlearningbug.com/catalog/index.html' target='_top' class='currentHeaderLink'>Catalog</a>";
	}
	
	
	
	// Use headline sent as argument (override default and if...else above)
	// allows links to be set by if...else, but still overwrite headline
	if(theHeadline != null){
		headline = theHeadline;
	}
	
	
	// actually write out the header now
	if(theHeadline != "NOHEADLINEONTHISPAGE"){
		header = "";
		addBug = "</td></tr></table>";
		header = header + "<div align='center'><table border='0' cellpadding='0' cellspacing='0'><tr><td>";
		header = header + "<table summary='Navigation Buttons' border='0' cellspacing='0' cellpadding='2'>";
		header = header + "<tr>";
		header = header + "<td colspan='11' align='center' valign='bottom'><div class='creamText' align='center'><font size='5'><strong>" + headline + "</strong></font></div></td>";
	}else{
		header = "";
		addBug = "</td></tr></table>";
		header = header + "<div align='center'>";
		header = header + "<table summary='Navigation Buttons' border='0' cellspacing='0' cellpadding='2'>";
	}
	
	header = header + "</tr>";
	header = header + "<tr>";

	header = header + "<td align='center' valign='top' nowrap>" + catalogLink + "</td>";
	header = header + "<td align='center' valign='top' nowrap>&#8226</td>";
	header = header + "<td align='center' valign='top' nowrap>" + workshopLink + "</td>";
	header = header + "<td align='center' valign='top' nowrap>&#8226</td>";
	header = header + "<td align='center' valign='top' nowrap>" + wishListLink + "</td>";
	header = header + "<td align='center' valign='top' nowrap>&#8226</td>";
	header = header + "<td align='center' valign='top' nowrap>" + specialsLink + "</td>";
	header = header + "<td align='center' valign='top' nowrap>&#8226</td>";
	header = header + "<td align='center' valign='top' nowrap>" + specialOrderLink + "</td>";
	header = header + "<td align='center' valign='top' nowrap>&#8226</td>";
	header = header + "<td align='center' valign='top' nowrap>" + contactLink + "</td>";
	
	header = header + "</tr>";
	header = header + "</table>";
	header = header + addBug
	header = header + "</div>";
	
	return(header);
}