        // function to update/create a new session cookie for 
		// the current domain, where the name of the cookie 
		// is 'name' and the data stored in the cookie is in 
		// the 'value'
		function SetCookie(name, value) {
			document.cookie = name + "=" + escape(value);	
		}
		var cookieString = 'copperfry=20 inch copper pan:prodblank,' +
		'greenfry=20 inch green pan:prodblank,' +
		'silverfry=20 inch silver pan with cover:product1,' +
		'redfry=20 inch red pan:prodblank';
thisPage=0;	
imgOnArray=new Array(5);
imgOffArray=new Array(5);
imgArray=new Array(5);
visArray=new Array(5);
lArray=new Array(5);

imgArray=Array("home.gif","news.gif","done.gif","help.gif","java.gif","forum.gif");
imgOnArray=Array("home_hov.gif","news_hov.gif","done_hov.gif","help_hov.gif","java_hov.gif","forum_hov.gif");
imgOffArray=Array("home_on.gif","news_on.gif","done_on.gif","help_on.gif","java_on.gif","forum_on.gif");
lArray=Array("index.html","page2.html","page3.html","page4.html","page5.html","page6.html",document.location,document.location);
visArray=Array(true,false,false,false,false,false,false,false);

myFont=10;
tempArray=new Array();
pArray=new Array();          /*This array is used by the cart list*/
if(document.getElementById){
    standardBrowser=true;}
if(standardBrowser){	


//This style of including function information was copied from the ECA FAQ authored by Michelle Hoyle
          /********************************************************
		  * Function:getCookieValues(cookieName)                  *
		  * Purpose : To return the values from any named cookie  *
		  *			:if unsuccessful a string is returned         *
		  * Input   : A string/string variable for the cookie name*
		  * Output  : The unescaped value stored in the cookie    *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me from         *
		  * 		 scratch initially to get the font size value *
		  *			 and later to get the values from the visited *
		  *			 cookie. The methods of extracting values from*
		  *			 cookies was largely based on the info in the * 
		  * 		 course book N&S. But I did not copy this     *
		  *			 function from the book.			 		  *
		  ********************************************************/
  function getCookieValues(cookieName){
    cArray=document.cookie.split("; ");							   //separate document.cookie using a semi colon
    for(n=0;n<cArray.length;n++){								   //go through each part of previous result
        thisCookie=cArray[n];									   //get cookie number n ready to compare
        thisC=thisCookie.split("=");							   //split the cookie into name and value using an equals sign
        if(thisC[0]==cookieName){								   //check left hand side of result for cookieName ([0])
            return unescape(thisC[1]);							   //if the name of the cookie is cookieName escape it and
        }		   												   //return its value ([1])
    }
    return "no Cookie with that name";							   //otherwise return this string
}


          /********************************************************
		  * Function: checkForCookie(cName)                       *
		  * Purpose :This function checks if the given name is a  * 
		  *			cookie. It uses the result of the function	  *
		  *         getCookieValues to determine if the cookie    *
		  *			exists.It returns true or false				  *
		  * Input   :Cookie name as a string                      *
		  * Output  :true if cookie exists otherwise false  	  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to find out  *
		  *			whether a certain cookie exists               * 
		  ********************************************************/

	function checkForCookie(cName){	  			
         gc=getCookieValues(cName);					//Use result of function getCookieValues
	     if(gc=="no Cookie with that name"){			//if result is this String
	       return false;}   			 				//then return false because the cookie doesn't exist
	     else{
	       return true;								//otherwise return true
	     }   
        }
//************************************Font Functions*********************************************/
//A small function written by me to store the font size in the cookie
//uses the funtion SetCookie provided by A&B Pans
  function setFontCookie(fSize){
    SetCookie('myText',fSize);
  }

          /********************************************************
		  * Function:setFontValue()                               *
		  * Purpose : Gets value of font size from the myText 	  *
		  *		   cookie. If the cookie doesnt exist then it sets*
		  *			to a value of 10 using setFontCookie().       *
		  *			If it does exist then it gets and sets the 	  *
		  *			the value from thisCookie to an integer.  	  *
		  *			The document section identified as "middle" is*
		  *			then obtained using the DOM. It's     style   * 
		  *			element's attribute, fontSize is set to the	  *
		  *			value that was in thisCookie        		  *
		  * Input   : None		  				  				  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me from         *
		  * 		 scratch to store the font size of "middle"	
		  *          Had to rewrite to deal with negative font sizes!
		  ********************************************************/
  function setFontValue(){
     if(!checkForCookie('myText')){
	    myFont=8;	
        setFontCookie(myFont);}
    thisCookie=getCookieValues('myText');   
    myFont=parseInt(thisCookie);   							//alert("value stored in cookie was: "+myFont);
	theMiddle=document.getElementById("middle");
	if(myFont<2){
	  myFont=2;
	  setFontCookie(myFont);
	  alert("Sorry but the size of the text can't be set to zero!")}
    theMiddle.style.fontSize=myFont+"pt";
}

          /********************************************************
		  * Function:changeText(way)                              *
		  * Purpose : When the customer clicks the Text+/Text-    *
		  *			link it increases the font size of Id "middle"*
		  *		   	It stores their choice in the myText cookie	  *
		  *			using the setFontCookie function then changes *
		  *			the style-sheet for "middle" to change its    *
		  *			font size.					 		   		  *
		  * Input   : A string "+" or "-"	  				  	  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to change 	  *
		  *			the font size of middle. the method of testing* 
		  *	      'way' was borrowed from Tony in the css forum at*
		  *		    http://www.csscreator.com/css-forum/	 	  *
		  *         It uses the 'way' parameter to denote an 	  *
		  *			increase or decrease to the font size.		  *
		  ********************************************************/
function changeText(way){
    if(way=="+"){
        myFont=myFont +2;
    }
    else{
        myFont=myFont-2;}
	if(myFont<2){
	    myFont=2;}  
    setFontCookie(myFont);
    theMiddle=document.getElementById("middle");
    theMiddle.style.fontSize=myFont+"pt";
}
//***********Functions to get and set visited links************************************************

          /********************************************************
		  * Function: setDynamicArray()                     	  *
		  * Purpose :This function makes a temporary array to hold*
		  *			values that indicate whether a page has been  *
		  *			or not. Each position in this array holds a	  *
		  *			boolean value. Its length is set to the length*
		  *			of visArray which holds the starting values of*
		  *			visited page links. As this is the home page  *
		  *			position 0 is always set to true.  			  *
		  * Input   :None                                         *
		  * Output  :the temporary array tempArray                *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to make a new*
		  *			array tempArray which holds visited values for*
		  *		    the session			  					   	  *
		  ********************************************************/

 function setDynamicArray(){
    thisNum=visArray.length;	   		 		     //get length of array from the length of visArray
    tempArray=new Array(thisNum);					 //create an array of this length					 
	tempArray=visArray;								 //make it the same as visArray
	return tempArray;								 //return the tempArray in case I need it
  }


    	  /********************************************************
		  * Function: resetCookie()                      		  *
		  * Purpose :This function uses function setDynamicArray  * 
		  * 		to make a new tempArray then it uses function *
		  *			SetCookie to make a new cookie called visited *
		  *			The values from tempArray are stored in this  *
		  *			new cookie.				  	  		 		  *
		  * Input   :None                                         *
		  * Output  :None                                   	  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to reset all *
		  *			the values of 'visited' to default values 	  *
		  *			which are stored in visArray	   			  *
		  ********************************************************/

	function resetCookie(){    
        //alert("resetting Cookie");			 			  
		setDynamicArray();		                //copy values from visArray into dynamic array	
    	SetCookie('visited',tempArray);			//copy values from dynamic array to a cookie
	}

		 

		  /********************************************************
		  * Function:  getVis()                                   *
		  * Purpose :This function takes the values from the	  * 
		  *			cookie and copies them to the tempArray		  *
		  * Input   :None                                   	  *
		  * Output  :the temporary array tempArray	  		 	  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to get the   *
		  *			from the cookie named 'visited' 
		  ********************************************************/

       function getVis(){			//before using this function a check should be made to make sure the cookie exists
        visitedCookie=getCookieValues('visited');          //get values from cookie
		vc=visitedCookie;								   //vc is easier to type
		vc=vc.split(",");								       //split result into an array
		if(vc[0]=="undefined"){							       //if the first value hasnt been set then reset the cookie
		  resetCookie();}								       //it can happen........
        for(n=0;n<visArray.length-1;n++){					   //loop for amount of links //last 2 are not used but......
		  tempArray[n]=vc[n];								   //copy each value into the temp array				     							       
		}								   		  	   		   //alert("visited cookie "+n+" value is "+vc[n]);
	    return tempArray;									   //return the tempArray which now holds values of visited cookie 
      } 
		  /********************************************************
		  * Function:  setVis()                                   *
		  * Purpose :This function takes the values from tempArray*
		  *		joins them and copies them to a string which it	  *
		  *	    then copies to the 'visited array'	    		  *	
		  *	    using the SetCookie function.     			      *
		  * Input   :None                                   	  *
		  * Output  :None		  		 		   	  			  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to set the   *
		  *			visited cookie's value to the values in the   *
		  *			tempArray 
		  ********************************************************/
    function setVis(){		 			  
      bigString="";
      len=visArray.length;		   		          //test  alert("going to make this cookie: "+unescape(tempArray));					   		 
	  bigString=tempArray.join(",");			  //test  alert("putting this value into big string "+bigString);								  			   			
      SetCookie('visited',bigString);		      //test  alert("using "+bigString);
    }	

		  /********************************************************
		  * Function:  changeTrue(num)                            *
		  * Purpose :This function changes the value at num       *
		  *			 position to true in tempArray then it copies *
		  *			 the values from tempArray to the 'visited'	  *
		  *			 cookie using the setVis function.			  *
		  * Input   :The position number to change to true	 	  *
		  * Output  :None		  		 		   	  			  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to set a     *
		  *         given position to true in the 'visited' cookie* 
		  ********************************************************/

 function changeTrue(num){  				//The tests here may illustrate to developers how their code may be tested
    tempArray=getVis();									//get stored values of visits from cookie and put in tempArray
	tempArray.length=visArray.length;				 	//test   alert("temp array before change "+num+" is "+tempArray[num]);
	tempArray[num]=true;								//test   alert("changed Number "+num+" into "+tempArray[num]); 													
	setVis();											//test   alert("I changed it to "+getVis());				 									
																			
  }		

		  /********************************************************
		  * Function:  setVisits()                                *
		  * Purpose :This function checks to see if a cookie for  *
		  *			visits has been created. If it hasnt then it  *
		  *			uses the function reset Cookie to make a new  *
		  *			cookie for visits. If a visits cookie exists  *
		  *			it gets the values for the tempArray from the *
		  *			cookie using the function getVis.	 	  	  *
		  * Input   : The name of the image 				  	  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 4th, 2005                              *
		  * Notes   :This function was written by me to setup the *
		  *         the temp Array and the cookie for visits      * 
		  ********************************************************/
 	function setVisits(){
      gcv=unescape(getCookieValues('visited'));
      if(gcv=="no Cookie with that name"||gcv.indexOf("undefined")>-1){//I added undefined when there was a problem with the cookie
        resetCookie();}
	  if(gcv!="no Cookie with that name"){
	    tempArray=getVis();  
	  }   
  }
//***********************Functions that use Images*************************************************
if (document.images){


//initialise the 5 images used in document
    img1=new Image;
	img2=new Image;
	img3=new Image;
	img4=new Image;
	img5=new Image;
	img6=new Image;
	
	//preload an image source for each image
	//because the image names supplied by A&B were not written with re-use in mind
	//the other images used have not been preloaded but this hardly effects the functionality
	//this could be changed at a later date however 
    for(n=0;n<=imgArray.length;n++){
	  img1.src="index/"+imgArray[0];
	  img2.src="index/"+imgArray[1];
	  img3.src="index/"+imgArray[2];
	  img4.src="index/"+imgArray[3];
	  img5.src="index/"+imgArray[4];
	  img6.src="index/"+imgArray[5];
	}
   
   		 /********************************************************
		  * Function:  changeAnImage(iNum,aName)                  *
		  * Purpose :This function uses the DOM array images to   *
		  *			change the images used in the document	 	  *
		  *		   It sets an image source using the passed values*
		  *		   for the array name and position.	 			  *
		  *		   It also sets all the attributes for the image  *
		  *		   to the correct values and sets the name of the *
		  *		   image by concatenation.	 	  	  	   	  	  *
		  * Input   : The position and name of array to use 	  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to set the   *
		  *         source of an image using the required array   *
		  *			and position number.	 	 		  		  * 
		  ********************************************************/
   
   		function changeAnImage(iNum,aName){
	      theImage="index/"+aName[iNum];
	      document.images[iNum].src=theImage;
          document.images[iNum].width="153";
          document.images[iNum].height="23";
          document.images[iNum].border="0";
          document.images[iNum].name="img"+iNum;    //could have made use of this more
	  	}
		
   		  /********************************************************
		  * Function:  imgOn(iName)                              *
		  * Purpose :When the customer mouses over an image on the*
		  * 		  nav bar the onMouseOver handler calls this  *
		  *			function passing its name as a parameter.	  *
 		  *		   This parameter is then searched using substring*
		  *		   to find the number of the image rolled over.	  *
		  *		   The number is decremented by one to find its   *
		  *		   position in the array. The tempArray is checked*
		  *		   to see if its true or false. The current image *
		  *		  is changed to use the correct array and position*
		  *		  using the changeAnImage function  	  		  * 
		  * Input   : The name of the image 				  	  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to change the*
		  *			image used by a link in the nav bar when it's *
		  *			image is moused over	 					  *
		  ********************************************************/

  function imgOn(iName){      
       var num=(iName.substring(3, 4));
	   visit=tempArray[num-1];
       if(visit=="true"){
	      aName=imgOnArray;
	   }
	   else{
	      aName=imgOffArray;
	   }
	  changeAnImage(num-1,aName);       
    }

   		  /********************************************************
		  * Function:  imgOff(iName)                              *
		  * Purpose :When the customer leaves an image on the	  *
		  * 		  nav bar the onMouseOut  handler calls this  *
		  *			function passing its name as a parameter.	  *
 		  *		   This parameter is then searched using substring*
		  *		   to find the number of the image  exited .	  *
		  *		   The number is decremented by one to find its   *
		  *		   position in the array. The tempArray is checked*
		  *		   to see if its true or false. The current image *
		  *		  is changed to use the correct array and position*
		  *		  using the changeAnImage function  	  		  * 
		  * Input   : The name of the image 				  	  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to change the*
		  *			image used by a link in the nav bar when it's *
		  *			image is exited by the mouse      	 		  *
		  ********************************************************/

      function imgOff(iName){
       var num=(iName.substring(3, 4));   
       visit=tempArray[num-1];
       if(visit=="true"){
	   	  aName=imgOffArray;
	   }
	   else{
	      aName=imgArray;
	   }
	  changeAnImage(num-1,aName);      
    }

   		  /********************************************************
		  * Function:  imgBeen(iName)                             *
		  * Purpose : When the customer clicks an image on the    *
		  * 		  nav bar the onClick handler calls this 	  *
		  *			function passing its name as a parameter.	  *
 		  *		   This parameter is then searched using substring*
		  *		   to find the number of the image clicked.		  *
		  *		   The number is decremented by one to find its   *
		  *		   position in the array. The function changeTrue *
		  *		   is used to set the cookie with the new visited *
		  *		   value. Finally the current image is changed to *
		  *		   an image in the imageOnArray at the correct    *
		  *		   position using the changeAnImage function  	  * 
		  * Input   : The name of the image 				  	  				  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to change the*
		  *			image used by a link in the nav bar when the  *
		  *			link has been visited
		  ********************************************************/
   		function imgBeen(iName){
           num=(iName.substring(3, 4));
	  	   no=num-1; 
	  	   changeTrue(no);  
	  	   changeAnImage(no,imgOnArray);    
    	 }

          /********************************************************
		  * Function: linkImages ()                               *
		  * Purpose : When the document loads, the links in the Nav*
		  *			bar have to show the customer what pages they *
		  *			have visited. A temporary variable is	      *
		  *			created to store the values. The tempArray 	  *
		  *			gets it's boolean values from visArray. 	  *
		  *			if a 'visited' cookie exists then the values  *
		  *		  in tempArray are overwritten with the 'visited' *
		  *       cookie value. It goes through tempArray looking *
		  *       for true or false. If the value in the tempArray*
		  *		  is true it uses the imgOnArray to get an image  *
		  *		  to display in the nav Bar.Otherwise it uses the *
		  *		  normal image in imgArray. At the end of each 	  *
		  *		  loop it uses the function changeImage to use the*
		  *		 array chosen and use the image at the nth postion * 
 		  *		 in that array.
		  * Input   : None  				  	  				  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to control   *
		  *			which image is used for each link in the nav  *
		  *         nav bar. It looks in the tempArray for visited*
		  *			values but it only does this for the amount of*
		  *			images in the document. This enables the links*
		  *			that dont have images to be ignored ie Text+  *
		  *			and Text- in this case.	 			   		  *
		  ********************************************************/

  function linkImages(){
	  setDynamicArray();                         //set up new array to hold whether a page has been visited				
	  setVisits();                               //if no cookie set values from temp array else get values for temp array from cookie
      tempArray=getVis();						 //I like to have a new copy of temp array in the function 
	  for(n=0;n<document.images.length;n++){	 //only need positions with an image
        visit=tempArray[n];
        if(visit=="true"){	           			 //if the position has not been clicked i.e. visited (false)
		   aName=imgOnArray;					 //use the normal image
         }
         else{
		   aName=imgArray;      				 //otherwise use the black image to show its been visited
         }
		 changeAnImage(n,aName);   				 //change the nav bar to the correct image
       }
    }

}//end images
else { 
		  alert("Sorry, you need to have an image enabled browser\n for the correct display of this web site."); 		
	 }
//*************************************************************************************************

		  /********************************************************
		  * Function: linkNames()                                 *
		  * Purpose : The link locations for the page are inserted*
		  *         in the array lArray. This function uses that  *
		  *			array to set the links for the document.	  *
		  *			This makes all pages easier to maintain.      *   		  	   			  
		  * Input   : None  				  	  				  *
		  * Output  : None										  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 3rd, 2005                              *
		  * Notes   :This function was written by me to set the   *
		  *			links for the home page, initially.            *
		  *		    I adapted it later to make it work with any   *
		  *         page. This meant adding a new javascript      *
		  *			variable to each page. The thisPage variable  *
		  *         ensures that the links point to the correct   *
		  *        page. The function begins with a for loop which*
		  *        goes through each link with an image in the Nav*
		  *        Bar. It checks if the page number is 0 and if  *
		  *        it isnt theLink is set to point to the file at *
		  *        this position in lArray. It then checks if the *
		  *        number is greater than thisPage number. If it  *
		  *        is then theLink is changed to point to position*
		  *		   n+1 in the links array. By using the DOM to    *
		  *        set the links explicity using lArray means they*
		  *		    can be accessed in order. This makes it easier*
		  *			to change their images later. It uses the DOM *
		  *			links array to set the links. This makes it   *
		  *			easier for the developers to add more links   *
		  *			when required. The array at the start of 	  *
		  *			each page need to be changed to enable the Nav*   		 	  
		  *			bar to work properly. The HTML for the links  *
		  *		   also has to be ammended to allow the link/image* 
		  *        mouse events to function properly for each page*	   		  	  	  
		  ********************************************************/
   function linkNames(){
      for(n=0;n<lArray.length-3;n++){            //we dont want to deal with change text links   
	    if(thisPage!=0){						 //if thisPage is 0 we dont want a link here
		     theLink=lArray[n];	}			 	 //set the link name to the name in lArray[n]		
			 if(n>=thisPage){					 //we dont have a link to thisPage
			   theLink=lArray[n+1];				 //we need the link name at pos+1 in the array as thisPage is skipped	            
			}		  
		 document.links[n].href=theLink; 	 //Set this link in the document to go to the name now held in theLink		  	 
      }
   }
   
//functions for cart***********************************************************************************************
//check for cart cookie before calling these functions



		  /********************************************************
		  * Function:  setUpArray()                               
		  * Purpose : To get values from cart cookie and put them in the pans array
		  * Input   : none
		  * Output  : none
		  * Author  : Rosemary Wood                               
		  * Date    : July 15th, 2005                             
		  * Notes   : I wrote this function to get the cookie values when the 
		  *			page first loads. It is called from within the listItems div
		  *			The variable pArray must be declared in this external file
		  *			outside of any functioons. Keeping these global variable declarations
		  *			at the top of the page helps with maintenance as they can be found
		  *			easily when required.
		  *			
		  ********************************************************/

          function setUpArray(){//to get items from cookie and add to pArray
		  aList=getCookieValues('cart');  //get the string holding the pan names from the cart cookie 
		  pArray=aList.split(",");  	  //split the string into elements using the split(",") function call and store in pans Array
		} 
		 
		 //I wrote this function so that when the document loads it can be called from within the div with id "itemlist"
		 //This is how the cart items are displayed on the right of the page.I was quite surprised how small it turned out. Before
		  		
		 
		  /********************************************************
		  * Function:  listPans()                               
		  * Purpose : To display the items in the cart at the right hand side of page  
		  * Input   : none
		  * Output  : only to screen. The list of pans in cart is displayed
		  * Author  : Rosemary Wood                               
		  * Date    : July 15th, 2005                             
		  * Notes   : I wrote this function to display the pans list,
		  *			I was quite surprised how small it turned out. Before
		  *			I thought of using an array to store the strings it was 
		  *			much longer as it had to obtain the list using the DOM,
		  *			Limitations: This functions call must be located in the HTML
		  *			div with Id "right" and the nested div "itemlist"
		  *			Also the global arraypArray should be declared on this
		  *			page outside of any functions
		  ********************************************************/
		 
        function listPans(){		  	  			   //called from "right" div to list pans in cart
		   if(pArray[0]=="undefined"){pArray.length=0;}//just in case that horrid undefined string shows up
		   for(n=0;n<pArray.length;n++)				   //go through each item in the pans array
              document.writeln(pArray[n]+"<br>");	   //writing it out to the document at the position the call to this function is made from		  
		}	
		
		//this very small function can be called to empty the panArray and update the cookie with a null value
		function emptyPArray(){
		  pArray.length=0;
		  SetCookie('cart',pArray);
		} 
		
		 /********************************************************
		  * Function:  removeItem(panStr)                               
		  * Purpose : To remove an item from the customers cart list	  
		  * Input   : the name of the pan as a string to be removed
		  * Output  : none but it changes the array with the cart items,
		  *			the cookie that enables it to work on different pages
		  *			and the list of cart items at the right of the page   
		  * Author  : Rosemary Wood                               
		  * Date    : July 15th, 2005                             
		  * Notes   :This function was written by me to remove pans from
		  *			the cart list.
		  *			Unfortunately there was a small bug here that didnt
		  *			show up at once. If the image window was opened and then
		  *			the delete button was pressed then the delete didnt show up
		  *			in the cart till some other way of refreshing was done. Like 
		  *			leaving page and coming back. This is why I refresh the page twice
		  *			at end of function, this is just a quick fix as I have no time for 
		  *			this at the moment!!!
		  *	
		  ********************************************************/
		
		function removeItem(pString){

		   pLen=pArray.length; 	   
		   noMatch=true;
		   numSearches=0;
		   while(noMatch&&numSearches<pLen-1&&pLen>1){			 //if a match hasn't been found and the number of searches is less than the length of pan array 
		     
			  if(pArray[0]==pString){//look at first element of array and see if it matches the pString parameter
			    pArray.shift();		 //if it does remove it
				noMatch=false;		 //a match has been found so the while loop can be exited
			  }		 
			  else{				      //otherwise
				   pArray[pLen]=pArray[0];//add a string the same as the first string to the end of the array
				   pArray.shift();		  //remove first string in array		   
			  }
			numSearches++;
		    }
			var bigString=pArray.join(",");
			if(pLen==1&&pArray[0]==pString){pArray.shift();bigString="";}
			SetCookie('cart',bigString);
			
			//document.location=this.document.location;//if this code is used after large image is shown then page isn't refreshed
			document.location="product1.html";//refresh the page so item list shows pArray after delete	
			document.location="product1.html";//refresh the page so item list shows pArray after delete	
			
		}
		
		
		  /********************************************************
		  * Function:  addItems(panStr)                               
		  * Purpose : To add an item to the customers cart list	  
		  * Input   : the name of the pan as a string to be added
		  * Output  : none but it changes the array with the cart items,
		  *			the cookie that enables it to work on different pages
		  *			and the list of cart items on the right of the page   
		  * Author  : Rosemary Wood                               
		  * Date    : July 15th, 2005                             
		  * Notes   :This function was written by me to add pans to
		  *			the cart list.
		  *	
		  ********************************************************/
		
		function addItems(panStr){	//this function was written before remove items and uses nodes more	 
		    pString=document.createTextNode(panStr);	//create a text node to hold the pan name
			panList=document.getElementById("itemlist");//get a handle for the item list
			para=document.createElement("p");		//one good thing about it is, that it adds paragraph so list is formatted 	
		    para.appendChild(pString);				//better than the list pans function
		    panList.appendChild(para);				//pan list adds the paragraph holding the pan name
			var num=pArray.length;//the index after the last index of the array elements
			pArray[num]=panStr;				  		//add the name of the pan to the pans array 
			var bigString=pArray.join(",");			//convert the array to a string with commas 
			SetCookie('cart',bigString);			//copy the string to the cart
		}
		
		  /********************************************************
		  * Function:  doPan(which)                               *
		  * Purpose : To add or remove an item from the cart list *
		  * Input   : The pan name to be added/removed			  *
		  * Output  : None directly but it does cause the cart list
		  *			to be updated by calling other functions   	  *
		  * Author  : Rosemary Wood                               *
		  * Date    : July 15th, 2005                             *
		  * Notes   :This function was written by me to respond to*
		  *			the add or delete buttons being clicked. It replaces 
		  *			the old version of do Pans which was a horrendously
		  *			complicated function, which used the DOM more
		  *			and was only usable on one page.
		  *			This version calls other small functions to enable
		  *			session wide functionality. The other functions
		  *			set up a cookie and an array to handle the cart actions.
		  ********************************************************/
		function doPan(which){
		  var len=which.length;          //get the length of the button id that has been passed as parameter 'which'
		  panString=which.substring(3,5)+" inch "+which.substring(len-3,len-6)+"ing pan";//construct a string for name	    
		  if(which.indexOf("add")==0){           //if the id string has add at the start     
			  if(confirm("add "+panString+"?")){ //and the customer confirms they want to add it to the cart
			     addItems(panString);			 //call addItems function with the name of pan as a parameter
			     return;						 //exit this function		 
		      }
		   }	  
		   if(which.indexOf("del")==0){    		 //otherwise if the substring "del" is found at the start  
		   
					removeItem(panString);		 //call removeItem function with the name of pan as a parameter
					
				   return;			 			 //return to just after where the function was called	         
		    }
        }
   
}//end of standard browsers
else{
	   alert("This site adheres to the w3 recommendations which only newer browsers implement\n"+
	   "this Standard makes browsers stick to the standards set by the w3 org. Older browsers dont follow these standards\n"+
	   "so features in this web site may not function correctly in your dated browser. New up to date browsers\n"+
	   "are available for free and may be downloaded from the maker's site. Why not try a new version of \n "+
	   "Mozilla FireFox/ Netscape Navigator/ or even Internet Explorer? This will allow you to have a better \n"+
	   "browsing experience");
	 }
	      /********************************************************
		  * Function:  browserReport                             
		  * Purpose : When the document loads this function writes 
		  * a friendly report to the middle section of the page. It
		  * then gives a more technical information about the browsers
		  * version number and the users operating system etc.  
		  * Input   : The name of the image 				  	  				  
		  * Output  : None										  
		  * Author  : Rosemary Wood                               
		  * Date    : July 3rd, 2005                              
		  * Notes   :This function was written by me provide the
		  * browser and version information listed in the requirements 
		  * for the Home Page.
		  ********************************************************/
	 function browserReport(){
	    bType=navigator.appName;      //The navigator is a DOM object that contains info received from the user's browser
		if(document.getElementById){  //If the browser has a function called getElemensBytId then it must be a modern browser
  		   version=" new version";}	  //this string will be used in the string returned when the document does it's write
		else{
  		   version="n old version"}   //else it is an old fashioned browser that wont be able to use the DOM fully
		if(document.cookie){		  //this checks that the document can contain cookies
  	       dc=" with cookies enabled"}
		else{
  		   dc=" with cookies disabled"}
		if(document.images){ 		   //checks if the document has an images array
  		   di=" and images turned on.";}
		else{
  		   di=" and images turned off.";}
	    document.write("<p>You are using a"+version+" of "+bType+dc+di);//concatenates all these strings and variables and writes to the document
		document.write("<br>Version Information as Reported by Browser: "+navigator.userAgent);//writes out the whole of the userAgent string.
		
		//unfortunately different browsers deal with userAgent differently. It has a length of 3 in IE6 and 5 in netscape browsers
		//A split does not easily give the specific information required consistently for different browsers
		//A function/codeblock would have to be written for each different browser and this seems like a lot of effort
		//for very little information in return
	  }
	  function closeWin(){
		  panwin.close();
		}
		
	 function makeWindow(wName){
	    wName=window.open("","larger");   
	 
	 
	 }
