﻿
<!--
    var Menu1SubMenu = new Array();
	var session=0;
	var seed;
	var AcctError=false;
	var param=0;
	var ft = new Array();	
	var qty = new Array();
	var price = new Array();
	var vat = new Array();
	var total = new Array();
	var gtotal;
	var gvat;
	Menu1SubMenu[0]=new Array();
    Menu1SubMenu[1]=new Array();
    Menu1SubMenu[2]=new Array();
    Menu1SubMenu[3]=new Array();    
    Menu1SubMenu[4]=new Array();    
    Menu1SubMenu[0][0]="TarquinBar";    
    Menu1SubMenu[1][0]="ParentBar";
    Menu1SubMenu[1][1]="ParentHome";
    Menu1SubMenu[1][2]="ParentCatA";
    Menu1SubMenu[1][3]="ParentCat1";    
    Menu1SubMenu[1][4]="ParentCat2";     
    Menu1SubMenu[1][5]="ParentCat3";    
    Menu1SubMenu[1][6]="ParentCat4";    
    Menu1SubMenu[1][7]="ParentCat5";      
    Menu1SubMenu[1][8]="ParentCat6";     
    Menu1SubMenu[1][9]="ParentCat7"; 
    Menu1SubMenu[1][10]="Stockists";   
    Menu1SubMenu[1][11]="Catalogue";    
    Menu1SubMenu[2][0]="EducatorBar";
    Menu1SubMenu[2][1]="EducatorHome";
    Menu1SubMenu[2][2]="ParentCatC";    
    Menu1SubMenu[2][3]="ParentCat8";     
    Menu1SubMenu[2][4]="ParentCat9";     
    Menu1SubMenu[2][5]="ParentCat10";         
    Menu1SubMenu[2][6]="ParentCat11";   
    Menu1SubMenu[2][7]="ParentCat12";    
    Menu1SubMenu[2][8]="ParentCat13";    
    Menu1SubMenu[2][9]="ParentCat14";   
    Menu1SubMenu[2][10]="EStockists"; 
    Menu1SubMenu[2][11]="ECatalogue";       
    Menu1SubMenu[3][0]="TradeBar";
    Menu1SubMenu[3][1]="TradeHome";    
    Menu1SubMenu[3][2]="TStockists";    
    Menu1SubMenu[3][3]="TCatalogue";    
    Menu1SubMenu[3][4]="THowTo";    
    Menu1SubMenu[3][5]="TTerms";    
    Menu1SubMenu[3][6]="TFeedback";    
    Menu1SubMenu[3][7]="TInt";    
    Menu1SubMenu[3][8]="ParentCatB";    
    Menu1SubMenu[4][0]="ShopBar";
    
    var Menu1SubFunction = new Array();
    Menu1SubFunction[0] = new Array();
    Menu1SubFunction[1] = new Array();
    Menu1SubFunction[2] = new Array();
    Menu1SubFunction[3] = new Array();    
    Menu1SubFunction[4] = new Array();        
    Menu1SubFunction[1][1] = {
            "caller": ParentPromo,
            "State": false
            };
    Menu1SubFunction[1][3] = {
            "caller": ParentCat1,
            "State": false
            };            
    Menu1SubFunction[1][4] = {
            "caller": ParentCat2,
            "State": false
            };               
    Menu1SubFunction[1][5] = {
            "caller": ParentCat3,
            "State": false
            };                         
    Menu1SubFunction[1][6] = {
            "caller": ParentCat4,
            "State": false
            };               
    Menu1SubFunction[1][7] = {
            "caller": ParentCat5,
            "State": false
            };             
    Menu1SubFunction[1][8] = {
            "caller": ParentCat6,
            "State": false
            };              
    Menu1SubFunction[1][9] = {
            "caller": ParentCat7,
            "State": false
            }; 
    Menu1SubFunction[1][10] = {
            "caller": LnItem,
            "State": false
            };              
    Menu1SubFunction[1][11] = {
            "caller": Catalogue,
            "State": false
            };             
    Menu1SubFunction[2][1] = {
            "caller": EducatorPromo,
            "State": false
            };  
    Menu1SubFunction[2][3] = {
            "caller": ParentCat8,
            "State": false
            };                       
    Menu1SubFunction[2][4] = {
            "caller": ParentCat9,
            "State": false
            };               
    Menu1SubFunction[2][5] = {
            "caller": ParentCat10,
            "State": false
            };                           
    Menu1SubFunction[2][6] = {
            "caller": ParentCat11,
            "State": false
            };                   
    Menu1SubFunction[2][7] = {
            "caller": ParentCat12,
            "State": false
            };               
    Menu1SubFunction[2][8] = {
            "caller": ParentCat13,
            "State": false
            };              
    Menu1SubFunction[2][9] = {
            "caller": ParentCat14,
            "State": false
            };             
    Menu1SubFunction[2][10] = {
            "caller": LnItem2,
            "State": false
            };          
    Menu1SubFunction[2][11] = {
            "caller": ECatalogue,
            "State": false
            };                    
    Menu1SubFunction[3][1] = {
            "caller": TradePromo,
            "State": false
            };              
    Menu1SubFunction[3][2] = {
            "caller": LnItem3,
            "State": false
            };              
    Menu1SubFunction[3][3] = {
            "caller": TCatalogue,
            "State": false
            };              
    Menu1SubFunction[3][4] = {
            "caller": THowTo,
            "State": false
            };               
    Menu1SubFunction[3][5] = {
            "caller": TTerms,
            "State": false
            };               
    Menu1SubFunction[3][6] = {
            "caller": TFeedback,
            "State": false
            };
    Menu1SubFunction[3][7] = {
            "caller": TInt,
            "State": false
            };            
    Menu1SubFunction[4][0] = {
            "caller": shop,
            "State": false
            };                     
    var Menu1ButtonNames = new Array();
    Menu1ButtonNames[0]=new Array();
    Menu1ButtonNames[1]=new Array();    
    Menu1ButtonNames[2]=new Array();    
    Menu1ButtonNames[3]=new Array();      
    Menu1ButtonNames[4]=new Array();      
    Menu1ButtonNames[0][0]="tarbtn";    
    Menu1ButtonNames[0][1]="TarBtn1";
    Menu1ButtonNames[0][2]="TarBtn2";    
    Menu1ButtonNames[1][0]="parbtn";
    Menu1ButtonNames[1][1]="SideBtnNews";
    Menu1ButtonNames[1][2]="SideBtnSearch";
    Menu1ButtonNames[1][3]="SideCatHome1";
    Menu1ButtonNames[1][4]="SideCatHome2";    
    Menu1ButtonNames[1][5]="SideCatHome3";       
    Menu1ButtonNames[1][6]="SideCatHome4";     
    Menu1ButtonNames[1][7]="SideCatHome5";      
    Menu1ButtonNames[1][8]="SideCatHome6";     
    Menu1ButtonNames[1][9]="SideCatHome7";     
    Menu1ButtonNames[1][10]="SideBtnStockists"; 
    Menu1ButtonNames[1][11]="SideBtnCatalogue";     
    Menu1ButtonNames[2][0]="educator";
    Menu1ButtonNames[2][1]="ESideBtnNews";    
    Menu1ButtonNames[2][2]="ESideBtnSearch"; 
    Menu1ButtonNames[2][3]="SideCatHome8";       
    Menu1ButtonNames[2][4]="SideCatHome9";    
    Menu1ButtonNames[2][5]="SideCatHome10";      
    Menu1ButtonNames[2][6]="SideCatHome11";          
    Menu1ButtonNames[2][7]="SideCatHome12";    
    Menu1ButtonNames[2][8]="SideCatHome13";
    Menu1ButtonNames[2][9]="SideCatHome14";    
    Menu1ButtonNames[2][10]="ESideBtnStockists";    
    Menu1ButtonNames[2][11]="ESideBtnCatalogue";     
    Menu1ButtonNames[3][0]="trade";
    Menu1ButtonNames[3][1]="TSideBtnNews";    
    Menu1ButtonNames[3][2]="TSideBtnStockist";        
    Menu1ButtonNames[3][3]="TSideBtnCatalogue";      
    Menu1ButtonNames[3][4]="TSideBtnHowTo";     
    Menu1ButtonNames[3][5]="TSideBtnTerms";      
    Menu1ButtonNames[3][6]="TSideBtnFeedback";      
    Menu1ButtonNames[3][7]="TSideBtnTInt";  
    Menu1ButtonNames[3][8]="TSideBtnSearch";            
    Menu1ButtonNames[4][0]="shop";
    var Menu1Buttons = new Array();
    Menu1Buttons[0]=new Array();
    Menu1Buttons[1]=new Array();
    Menu1Buttons[2]=new Array();    
    Menu1Buttons[3]=new Array();        
    Menu1Buttons[4]=new Array();    
    Menu1Buttons[0][0]="images/TarquinLogoBtn";    
    Menu1Buttons[0][1]="images/ParentsImage";        
    Menu1Buttons[0][2]="images/TeachersImage";     
    Menu1Buttons[1][0]="images/TopBtnHome";
    Menu1Buttons[1][1]="images/SideBtnNews"
    Menu1Buttons[1][2]="images/SideBtnSearch";
    Menu1Buttons[1][3]="images/SideCatHome1";    
    Menu1Buttons[1][4]="images/SideCatHome2";        
    Menu1Buttons[1][5]="images/SideCatHome3";       
    Menu1Buttons[1][6]="images/SideCatHome4";      
    Menu1Buttons[1][7]="images/SideCatHome5";    
    Menu1Buttons[1][8]="images/SideCatHome6";     
    Menu1Buttons[1][9]="images/SideCatHome7";     
    Menu1Buttons[1][10]="images/SideBtnStockists";
    Menu1Buttons[1][11]="images/SideBtnCatalogue";    
    Menu1Buttons[2][0]="images/TopBtnEducation";
    Menu1Buttons[2][1]="images/ESideBtnNews";    
    Menu1Buttons[2][2]="images/ESideBtnSearch";    
    Menu1Buttons[2][3]="images/SideCatHome8";     
    Menu1Buttons[2][4]="images/SideCatHome9";    
    Menu1Buttons[2][5]="images/SideCatHome10";      
    Menu1Buttons[2][6]="images/SideCatHome11";          
    Menu1Buttons[2][7]="images/SideCatHome12";
    Menu1Buttons[2][8]="images/SideCatHome13";    
    Menu1Buttons[2][9]="images/SideCatHome14";    
    Menu1Buttons[2][10]="images/SideBtnStockists"; 
    Menu1Buttons[2][11]="images/SideBtnCatalogue";           
    Menu1Buttons[3][0]="images/TopBtnTrade";
    Menu1Buttons[3][1]="images/TSideBtnNews";        
    Menu1Buttons[3][2]="images/TSideBtnStockist";    
    Menu1Buttons[3][3]="images/SideBtnCatalogue";               
    Menu1Buttons[3][4]="images/TSideBtnTHowTo";     
    Menu1Buttons[3][5]="images/SideBtnTTerms";      
    Menu1Buttons[3][6]="images/SideBtnTFeedback";
    Menu1Buttons[3][7]="images/TSideBtnTInt";    
    Menu1Buttons[3][8]="images/TSideBtnSearch";     
    Menu1Buttons[4][0]="images/TopBtnShop";    
    var Menu1Pressed = new Array();
    for ( var i=0; i < 11; i++)
    {
        Menu1Pressed[i]=new Array(11);
        for (var o=0; o<Menu1Pressed[i].length; o++)
        {
            Menu1Pressed[i][o]=false;
        }
    }; 
    Menu1Pressed[0][0]=true;
    Menu1Pressed[1][1]=true;
    Menu1Pressed[2][1]=true;    
    Menu1Pressed[3][1]=true;        
    var Menu1Hover = new Array();
    for ( var i=0; i < 11; i++)
    {
        Menu1Hover[i]=new Array(11);
        for (var o=0; o<Menu1Hover[i].length;o++)
        {
            Menu1Hover[i][o]=false;
        }
    };  
    var lastbtn;
   /*for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        for (var o=0; o<Menu1ButtonNames[i].length;o++)
        {    
            if (Menu1SubFunction[i][o]&&!Menu1SubFunction[i][o].state)
            {
                Menu1SubFunction[i][o].caller(Menu1SubFunction[i][o]);
            }
          }
    }
    */
    //ajaxFunction();
   function asize()
   {
        var height= document.body.offsetHeight;
        var width= document.body.offsetWidth;
        
   }
function init(stream)
{
	qty =[];
	price =[];
	total = [];
	if (stream!="") 
	{
	
		var gy = stream.split(",");
		var vt;
		for (i=0; i<gy.length; i++)
		{
			var pair = new Array;
			pair = gy[i].split("'");
			qty[i]=pair[0];
			price[i]=pair[1];
			vat[i]=pair[2];
			total[i]=0;
		}	
		qtotal=0;
		gvat=0;
		for (x in total)
		{
			total[x]=(Number(price[x]*qty[x])+Number(vat[x]));
			vt=Number(vat[x]);
			change("vat"+x,"£"+vt.toFixed(2));
			change("total"+x,"£"+total[x].toFixed(2));
			qtotal+=total[x];	
			gvat+=Number(vat[x]);
		}
		change("GTotal","£"+qtotal.toFixed(2));	
		change("GVat","£"+gvat.toFixed(2));			
	}
}
function cqty(name,i)
{
	var it="document.forms.basket.qty"+name+".value";
	qty[name]=eval(it);
	qty[name]=Math.floor(qty[name]);

	if (isNaN(qty[name]))
	{
		alert("Error:Please enter a number");
		qty[name]=0;
	}
	it=it+"=qty[name]";
	eval(it);
	total[name]=price[name]*qty[name];
	change("total"+name,"£"+total[name].toFixed(2));
	qtotal=0;
	for (x in total)
	{
		qtotal+=total[x];
	}
	change("GTotal","£"+qtotal.toFixed(2));
	pqty(i,qty[name]);
}

function pqty(line,val)
{
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch(e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        {
			show(false,'Wait'); 
			results = xmlHttp.responseText.split('||');
			login=results[0];
			response=results[1];
			stream=results[2];			
			if (login == 3)
			{

				var sText="Session=";
		        document.cookie=sText;		
				GetSession();
				change("ShopBar",response);
				
			}
			else
			{
				change("ShopBar",response);
				if (login == 2)	init(stream);
			}
		}
      }
    }
  show(true,'Wait');  
  var rand_no = Math.random();
  var param="?Session="+session+"&r="+rand_no+"&Type=5"+"&line="+line+"&Qty="+val;
  var url="requestsCGI14/Release/requestsCGI.exe";
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.setRequestHeader('Cache-Control', 'No-cache');
  xmlHttp.send(null);
}


function delline(line)
{
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch(e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        {
			show(false,'Wait'); 
			results = xmlHttp.responseText.split('||');
			login=results[0];
			response=results[1];
			stream=results[2];			
			if (login == 3)
			{

				var sText="Session=";
		        document.cookie=sText;		
				GetSession();
				change("ShopBar",response);
				
			}
			else
			{
				change("ShopBar",response);
				if (login == 2)	init(stream);
			}
		}
      }
    }
  show(true,'Wait');  
  var rand_no = Math.random();
  var param="?Session="+session+"&r="+rand_no+"&Type=4"+"&line="+line;
  var url="requestsCGI14/Release/requestsCGI.exe";
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.setRequestHeader('Cache-Control', 'No-cache');
  xmlHttp.send(null);
}
 
function ajaxFunction(url,Change,PDetails)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Change,xmlHttp.responseText);
      }
    }
  var param=PDetails;
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}    
function CatFunction(SearchString,Dest,Cat)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Dest,xmlHttp.responseText);
      }
    }
  var url="requestsCGI7/Release/requestsCGI.exe";
  var param="?Search="+SearchString;
  url=url+param+"&Category="+Cat;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function pglink(SearchString,Dest)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Dest,xmlHttp.responseText);
      }
    }
  var url=SearchString;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
    
function SearchFunction(SearchString,Dest)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Dest,xmlHttp.responseText);
      }
    }
  var url="requestsCGI6/Release/requestsCGI.exe";
  var param="?Search="+SearchString;
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}    

function ProductFunction(SearchString,Dest)
{
var xmlHttp;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Dest,xmlHttp.responseText);
      }
    }
  var url="requestsCGI8/Release/requestsCGI.exe";
  var param="?Search="+SearchString;
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}    
function BasketFunction(sku)
{
  var xmlHttp;
  try
  {
  // Firefox, Opera 8.0+, Safari
       xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
  // Internet Explorer
  try
    {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
    xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        show(true,"addedicon");
		setTimeout("show(false,'addedicon');",1000);	
      }
    }
	var rand_no = Math.random();
    var url="requestsCGI16/Release/requestsCGI.exe";
    var param="?SKU="+sku+"&Session="+session+"&r="+rand_no;
    url=url+param;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);

}
function PreviewFunction(SearchString,Dest)
{
  var xmlHttp;
  try
  {
  // Firefox, Opera 8.0+, Safari
       xmlHttp=new XMLHttpRequest();
  }
  catch (e)
  {
  // Internet Explorer
  try
    {
       xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
    xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        change(Dest,xmlHttp.responseText);
      }
    }
    var url="requestsCGI11/Release/requestsCGI.exe";
    var param="?SKU="+SearchString;
    url=url+param;
    xmlHttp.open("GET",url,true);
    xmlHttp.send(null);
}    




function maplink(SearchString,Dest)
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
          preloadImages();
          change(Dest,xmlHttp.responseText);
      }
    }
  var url=SearchString;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function THowTo()
{
    maplink("THowTo.html","THowTo");
}
function TTerms()
{
    maplink("TTerms.html","TTerms");
}
function TFeedback()
{
    maplink("TFeedback.html","TFeedback");
}
function shop()
{
    CheckSession();
 // maplink("login.html","ShopBar");
}
function TInt()
{
    maplink("TInt.html","TInt");
}
function Catalogue()
{
    change("ECatalogue","");
    change("TCatalogue","");    
    maplink("Catalogue.html","Catalogue");
}
function ECatalogue()
{
    change("Catalogue","");
    change("TCatalogue","");    
    maplink("Catalogue.html","ECatalogue");
}
function TCatalogue()
{
    change("Catalogue","");
    change("ECatalogue","");    
    maplink("TCatalogue.html","TCatalogue");
}
function NewAccount()
{
	maplink("NewAccount.html","ShopBar");
}
function CatSend()
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        document.forms.Catalogue.Email.value="";
        document.forms.Catalogue.Name.value="";
        document.forms.Catalogue.Address1.value="";
        document.forms.Catalogue.Address2.value="";        
        document.forms.Catalogue.Address3.value="";        
        document.forms.Catalogue.Address4.value="";        
        document.forms.Catalogue.Country.value="";
        document.forms.Catalogue.Phone.value="";
        document.forms.Catalogue.Design.value="0";        
        document.forms.Catalogue.Booklist.value="0";
        document.forms.Catalogue.Maths.value="0";        
        show(false,'Design');
        show(false,'Maths');  
        show(false,'Booklist');
        show(true,'CatOrdered');
        setTimeout("show(false,'CatOrdered');",5000);
      }
    }
  var param="?EMAIL="+document.forms.Catalogue.Email.value+
             "&Name="+document.forms.Catalogue.Name.value+
             "&Address1="+document.forms.Catalogue.Address1.value+
             "&Address2="+document.forms.Catalogue.Address2.value+
             "&Address3="+document.forms.Catalogue.Address3.value+
             "&Address4="+document.forms.Catalogue.Address4.value+
             "&Country="+document.forms.Catalogue.Country.value+             
             "&Phone="+document.forms.Catalogue.Phone.value+             
             "&Design="+document.forms.Catalogue.Design.value+
             "&Maths="+document.forms.Catalogue.Maths.value+             
             "&Booklist="+document.forms.Catalogue.Booklist.value;
  url="requestsCGI10/Release/requestsCGI.exe";             
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}
function FeedSend()
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
        document.forms.TFeedback.Feedmail.value="";
        document.forms.TFeedback.Feedback.value="";
        show(true,'FeedSubmitted');
        setTimeout("show(false,'FeedSubmitted');",5000);
      }
    }
  var param="?EMAIL="+document.forms.TFeedback.Feedmail.value+
             "&Feedback="+document.forms.TFeedback.Feedback.value;
  url="requestsCGI12/Release/requestsCGI.exe";             
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.send(null);
}

function LnItem()
{
    change("EStockists","");
    maplink("UKMap.html","Stockists");
}
function LnItem2()
{
    change("Stockists","");
    maplink("UKMap.html","EStockists");
}
function LnItem3()
{
    change("TStockists","");
    maplink("TStockist.html","TStockists");
}
function ParentCat1(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Homerec","ParentCatDest1","1");
        //change("ParentHome",ajaxFunction());    
    }
} 
function ParentCat2(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Home3-11","ParentCatDest2","2");
        //change("ParentHome",ajaxFunction());    
    }
}     
function ParentCat3(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Home11-18","ParentCatDest3","3");
        //change("ParentHome",ajaxFunction());    
    }
}     
function ParentCat4(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Homeart","ParentCatDest4","4");
        //change("ParentHome",ajaxFunction());    
    }
}   
function ParentCat5(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Homescience","ParentCatDest5","5");
        //change("ParentHome",ajaxFunction());    
    }
}   
function ParentCat6(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Homehistory","ParentCatDest6","6");
        //change("ParentHome",ajaxFunction());    
    }
}   
function ParentCat7(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("homeillusion","ParentCatDest7","7");
        //change("ParentHome",ajaxFunction());    
    }
}   
function ParentCat8(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Edposters","ParentCatDest8","8");
    }
}   
function ParentCat9(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Ed3-11","ParentCatDest9","9");
    }
}   
function ParentCat10(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Ed11-18","ParentCatDest10","10");
    }
}   
function ParentCat11(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Edart","ParentCatDest11","11");
    }
}   
function ParentCat12(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Edsci","ParentCatDest12","12");
    }
}   
function ParentCat13(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Edhist","ParentCatDest13","13");
    }
}   
function ParentCat14(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        CatFunction("Edillusion","ParentCatDest14","14");
    }
}   
function ParentCatA(parent)
{
        CatFunction(document.forms.PSrch.SearchInfo.value,"ParentCatDestA","A");
}
function ParentCatB(parent)
{
        CatFunction(document.forms.TSrch.TradeInfo.value,"ParentCatDestB","B");
}
function ParentCatC(parent)
{
        CatFunction(document.forms.ESrch.EducationInfo.value,"ParentCatDestC","C");
}
function ParentPromo(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        ajaxFunction("requestsCGI5/Release/requestsCGI.exe","ParentHomeDest","?News=1");
    }
} 
function EducatorPromo(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        ajaxFunction("requestsCGI5/Release/requestsCGI.exe","EducatorHomeDest","?News=2");
    }
} 
function TradePromo(parent)
{
    if (!parent.state)
    {
        parent.state=true;
        ajaxFunction("requestsCGI5/Release/requestsCGI.exe","TradeHomeDest","?News=3");
    }
} 
function PNews(obj)
{
    var obj2="PNews"+obj;
    document.images[obj2].src="images/"+obj+".jpg";  
    change("PNewsDet",'<IMG border="0" src="images/spinney.gif" alt="" style="position: absolute; top: 50px; left: 250px;"');
    ajaxFunction("requestsCGI9/Release/requestsCGI.exe","PNewsDet","?SKU="+obj);    
}
function ENews(obj)
{
    var obj2="ENews"+obj;
    document.images[obj2].src="images/"+obj+".jpg";    
    change("NewsDet",'<IMG border="0" src="images/spinney.gif" alt="" style="position: absolute; top: 50px; left: 250px;"');    
    ajaxFunction("requestsCGI9/Release/requestsCGI.exe","NewsDet","?SKU="+obj);        
}
function TNews(obj)
{
    var obj2="TNews"+obj;
    document.images[obj2].src="images/"+obj+".jpg";    
    change("TNewsDet",'<IMG border="0" src="images/spinney.gif" alt="" style="position: absolute; top: 50px; left: 250px;"');    
    ajaxFunction("requestsCGI9/Release/requestsCGI.exe","TNewsDet","?SKU="+obj);        
}
function Menu1clickit(passedButton)
{
    for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        //for (var o=0; o<Menu1ButtonNames[i].length;o++)
        //{
            if (Menu1ButtonNames[i][0]==passedButton)
            {
                Menu1Pressed[i][0]=true;
            }
            else
            {
                Menu1Pressed[i][0]=false;
            }
        //}
    }
    Menu1Buttonstates();
    Menu1Panelstates();
}
function Menu1Subclickit(passedButton)
{
    var column=null;
    for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        for (var o=1; o<Menu1ButtonNames[i].length;o++)
        {
            if (Menu1ButtonNames[i][o]==passedButton)
            {
                column=i;
            }
        }
    }    
    for (var o=1; o<Menu1ButtonNames[column].length;o++)
    {
        if (Menu1ButtonNames[column][o]==passedButton)
        {
            Menu1Pressed[column][o]=true;
        }
        else
        {
            Menu1Pressed[column][o]=false;
        }
    }

    Menu1Buttonstates();
    Menu1Panelstates();
}
function genbutton(obj,action)
{
    if (action=="Pressed")
    {
      obj.state="Pressed";
      document.images[obj].src="images/submitPressed.gif";
    }
    if (action=="Hover"&&obj.state!="Pressed")
    {
      document.images[obj].src="images/submitHover.gif";  
    }
    if (action=="Mouseout")
    {
       document.images[obj].src="images/submit.gif";
    }
}
function delbutton(obj,action)
{
    if (action=="Pressed")
    {
      obj.state="Pressed";
      document.images[obj].src="images/ConfirmOrderPressed.jpg";
    }
    if (action=="Hover"&&obj.state!="Pressed")
    {
      document.images[obj].src="images/ConfirmOrderHover.jpg";  
    }
    if (action=="Mouseout")
    {
       document.images[obj].src="images/ConfirmOrder.jpg";
    }
}
function Acctbutton(obj,action)
{
    if (action=="Pressed")
    {
      obj.state="Pressed";
      document.images[obj].src="images/AcctOrderPressed.jpg";
    }
    if (action=="Hover"&&obj.state!="Pressed")
    {
      document.images[obj].src="images/AcctOrderHover.jpg";  
    }
    if (action=="Mouseout")
    {
       document.images[obj].src="images/AcctOrder.jpg";
    }
}
function Processbutton(obj,action)
{
    if (action=="Pressed")
    {
      obj.state="Pressed";
      document.images[obj].src="images/ProcessOrderPressed.jpg";
    }
    if (action=="Hover"&&obj.state!="Pressed")
    {
      document.images[obj].src="images/ProcessOrderHover.jpg";  
    }
    if (action=="Mouseout")
    {
       document.images[obj].src="images/ProcessOrder.jpg";
    }
}
function Creditbutton(obj,action)
{
    if (action=="Pressed")
    {
      obj.state="Pressed";
      document.images[obj].src="images/CreditOrderPressed.jpg";
    }
    if (action=="Hover"&&obj.state!="Pressed")
    {
      document.images[obj].src="images/CreditOrderHover.jpg";  
    }
    if (action=="Mouseout")
    {
       document.images[obj].src="images/CreditOrder.jpg";
    }
}
function Menu1Buttonstates()
{
    for (var i=0;i<Menu1ButtonNames.length;i++)
    //for (var i=0;i<2;i++)    
    {
        for (var o=0; o<Menu1ButtonNames[i].length;o++)
        {
            var button=Menu1ButtonNames[i][o];
            if (Menu1Pressed[i][o]==true)
            {
                document.images[button].src=Menu1Buttons[i][o]+"Pressed.gif";
                continue;
            }
            else
            {
               document.images[button].src=Menu1Buttons[i][o]+".gif";
               if (Menu1SubMenu[i][o])
               {
                   show(false,Menu1SubMenu[i][o]);     
               }
            }
            if (Menu1Hover[i][o]==true)
            {
                document.images[button].src=Menu1Buttons[i][o]+"Hover.gif";
            }
        }
    }
}
function Menu1Panelstates()
{
    for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        for (var o=0; o<Menu1ButtonNames[i].length;o++)
        {
            var button=Menu1ButtonNames[i][o];
            if (Menu1Pressed[i][o]==true)
            {
                 if (Menu1Pressed[i][0]==true && Menu1Pressed[i][o]==true)
                {
                    if (Menu1SubMenu[i][o])
                    {
                        show(true,Menu1SubMenu[i][o]);
                        if (Menu1SubFunction[i][o]&&!Menu1SubFunction[i][o].state)
                        {
                            Menu1SubFunction[i][o].caller(Menu1SubFunction[i][o]);
                        }
                    }
                }
                else
                {
                    if (Menu1SubMenu[i][o])
                    {                
                        show(false,Menu1SubMenu[i][o]);
                    }
                }
                continue;
            }
            else
            {
                if (Menu1SubMenu[i][o])
               {
                    show(false,Menu1SubMenu[i][o]);     
               }
            }
        }
    }
}
function Menu1btnmouseout(passedButton)
{
    for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        for (var o=0; o<Menu1ButtonNames[i].length;o++)
        {    
            if (Menu1ButtonNames[i][o]==passedButton)
            {
                Menu1Hover[i][o]=0;
            }
        }
    }
   Menu1Buttonstates();
}

function btnMenu1Hover(passedButton)
{
    for (var i=0;i<Menu1ButtonNames.length;i++)
    {
        for (var o=0; o<Menu1ButtonNames[i].length;o++)
        {
            if (Menu1ButtonNames[i][o]==passedButton)
            {
                Menu1Hover[i][o]=true;
            }
            else
            {
                Menu1Hover[i][o]=false;
            }
        }
    }
    Menu1Buttonstates();
}
function CatSide(image,description,cat,sku,DetailedDesc, Price, Detail,Preview)
{
    var line="<DIV style='position: relative; margin-left: 0; margin-right: auto; width: 200px; margin-top: 0px; margin-bottom: auto; height: 167px'><table border='0'><tr valign='middle'><td width='200pixels'; height='167px'; align='center';><IMG border='0' src='"+image+"'></td></tr></table></DIV>"
    change("CatSide"+cat,line);
    change("CatText"+cat,description);
    change("CatDetail"+cat,DetailedDesc);
    change("Price"+cat,Price);
    if (Detail=='1')
    {
        change("Zoom"+cat,"<A HREF='#'><img src='images/DetailIcon.gif' height='33px' width='33px' border='0' onclick='Zoom("+sku+")';></A>");	 
    }
    else
    {
        change("Zoom"+cat,"");	 
    }
    if (Preview=='1')
    {
        change("Preview"+cat,"<A HREF='#'><img src='images/PreviewIcon.gif' height='33px' width='33px' border='0' onclick='Preview("+sku+")';></A>");	 
    }
    else
    {
        change("Preview"+cat,"");	 
    }    
    change("Basket"+cat,"<img src='images/BasketIcon.gif' height='33px' width='33px' border='0' onclick='BasketFunction("+sku+")';>");
    
    var btn=cat+sku+"btn";
    var btn2=cat+sku+"btn2";    
    if (document.images[lastbtn]) document.images[lastbtn].src="images/ImageBck.gif";    
    document.images[btn].src="images/ImageBckPressed.gif";
    lastbtn=btn;
}
function Zoom(sku)
{
    show(true,'ProductDetail');
    show(true,'ProductNav');    
    ProductFunction(sku,"ProductText");
}
function Preview(sku)
{
    show(true,'ProductDetail');
    show(true,'ProductPreview');
    PreviewFunction(sku,'ReviewText');  
}
function ProductClick(Close)
{
    document.images[Close].src="images/CloseBtnPressed.gif";
    show(false,'ProductDetail');
    if (Close=='Close')   show(false,'ProductNav');    
    if (Close=='RClose')   show(false,'ProductPreview');        

}
function show(sw,obj)
{
    var vis = (sw ? 'inherit' : 'hidden');
    if (document.getElementById)
        document.getElementById(obj).style.visibility = vis;
    else if (document.all)
        document.all[obj].style.visibility = vis;
    else if (document.layers)
        document.layers[obj].style.visibility = vis;
}
function change(obj,content)
{
    if (document.getElementById)
        document.getElementById(obj).innerHTML=content;
    else if (document.all)
        document.all[obj].innerHtml=content;
    else if (document.layers)
        document.layers[obj].innerHtml=content;
}
// -->
function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function feedvalid()
{
    show(false,"FeedEmailMark");
    show(false,"FeedMark");    
    var error=false; 
    if (document.forms.TFeedback.Feedmail.value=="")
    {
        feederror("Feedmail");
        error=true;
    }
    if (document.forms.TFeedback.Feedback.value=="")
    {
        feederror("Feedback");
        error=true;        
    }
    if (error==false)
    {
        document.forms.TFeedback.submit();
    }
}

function feederror(field)
{
    if (field=="Feedmail")
    {
        show(true,"FeedEmailMark");        
    }
    if (field=="Feedback")
    {
        show(true,"FeedMark");        
    }    
}
function DelSend()
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
  if(xmlHttp.readyState==4)
      {
        {
			show(false,'Wait'); 
			results = xmlHttp.responseText.split('||');
			login=results[0];
			response=results[1];
			stream=results[2];			
			if (login == 3)
			{

				var sText="Session=";
		        document.cookie=sText;		
				GetSession();
				change("ShopBar",response);
				
			}
			else
			{
				change("ShopBar",response);
				if (login == 2)	init(stream);
			}
		}
      }
    }
	 
 show(true,'Wait');  
  var rand_no = Math.random();
  var param="?Session="+session+"&r="+rand_no+"&Type=6&Name="+document.forms.Delivery.DelName.value+
             "&Organisation="+document.forms.Delivery.DelOrg.value+
             "&Street="+document.forms.Delivery.DelStreet.value+
             "&Town="+document.forms.Delivery.DelTown.value+             
             "&County="+document.forms.Delivery.DelCounty.value+             
             "&Post="+document.forms.Delivery.DelPost.value+
             "&Country="+document.forms.Delivery.DelCountry.value+             
			 "&Phone="+document.forms.Delivery.DelPhone.value+
			 "&Query=0&";
		
  var url="requestsCGI14/Release/requestsCGI.exe";
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.setRequestHeader('Cache-Control', 'No-cache');
  xmlHttp.send(null);
}
function AcctSend()
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {
             var ivalid;
			 ivalid=xmlHttp.responseText;
			 if (ivalid==1)
			 {
			 document.forms.NewAccount.email.value="";
             document.forms.NewAccount.Password.value="";
             document.forms.NewAccount.CPassword.value="";
             document.forms.NewAccount.Name.value="";
             document.forms.NewAccount.Organisation.value="";
             document.forms.NewAccount.Street.value="";
             document.forms.NewAccount.Town.value="";             
             document.forms.NewAccount.County.value="";            
             document.forms.NewAccount.Post.value="";
             document.forms.NewAccount.Country.value="";             
             document.forms.NewAccount.Account_0.value="";
			 document.forms.NewAccount.Account_1.value="";
			 document.forms.NewAccount.Phone.value="";
			 document.forms.NewAccount.Mobile.value="";		
			 maplink("AcctCreated.html","ShopBar");
			 }
			 else
	  		{
				show(false,"EmailError2");
			}
      }
    }

  var param="?email="+document.forms.NewAccount.email.value+
             "&Password="+hex_md5(document.forms.NewAccount.Password.value)+
             "&CPassword="+document.forms.NewAccount.CPassword.value+
             "&Name="+document.forms.NewAccount.Name.value+
             "&Organisation="+document.forms.NewAccount.Organisation.value+
             "&Street="+document.forms.NewAccount.Street.value+
             "&Town="+document.forms.NewAccount.Town.value+             
             "&County="+document.forms.NewAccount.County.value+             
             "&Post="+document.forms.NewAccount.Post.value+
             "&Country="+document.forms.NewAccount.Country.value+             
             "&Account_0="+document.forms.NewAccount.Account_0.value+
			 "&Account_1="+document.forms.NewAccount.Account_1.value+
			 "&Phone="+document.forms.NewAccount.Phone.value+
			 "&Mobile="+document.forms.NewAccount.Mobile.value+
			 "&Query=0&";
  url="requestsCGI15/Release/requestsCGI.exe";             
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.send(null);
}
function AcctConfirm(Confirm)
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
    if(xmlHttp.readyState==4)
      {

             //var ivalid;
			 //ivalid=xmlHttp.responseText;
			 passedButton="shop";
				for (var i=0;i<Menu1ButtonNames.length;i++)
				{
					//for (var o=0; o<Menu1ButtonNames[i].length;o++)
					//{
						if (Menu1ButtonNames[i][0]==passedButton)
						{
							Menu1Pressed[i][0]=true;
						}
						else
						{
							Menu1Pressed[i][0]=false;
						}
					//}
				}
				Menu1Buttonstates();	
				show(true,"ShopBar");
	            change("ShopBar",xmlHttp.responseText);            
      }
    }

  var param="?Query=1&Confirm="+Confirm;
  url="requestsCGI15/Release/requestsCGI.exe";             
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.send(null);
}
function acctvalid()
{
	// var AcctError=false;
	AcctError=false;
	show(false,"EmailError");
	show(false,"PasswordError");
	show(false,"CPasswordError");
	show(false,"Pmismatch");
	show(false,"NameError");
	show(false,"StreetError");
	show(false,"TownError");
	show(false,"CountyError");
	show(false,"PostError");	
	show(false,"CountryError");	
	if (document.forms.NewAccount.email.value=="")
	{
		Accterror("EmailError");
	}
	if (document.forms.NewAccount.Password.value=="")
	{
		Accterror("PasswordError");
	}
	if (document.forms.NewAccount.CPassword.value=="")
	{
		Accterror("CPasswordError");
	}
	else
	if (document.forms.NewAccount.Password.value != document.forms.NewAccount.CPassword.value)
	{
		Accterror("Pmismatch");
	}
	if (document.forms.NewAccount.Name.value=="")
	{
		Accterror("NameError");
	}	
	if (document.forms.NewAccount.Street.value=="")
	{
		Accterror("StreetError");
	}	
	if (document.forms.NewAccount.Town.value=="")
	{
		Accterror("TownError");
	}	
	if (document.forms.NewAccount.County.value=="")
	{
		Accterror("CountyError");
	}	
	if (document.forms.NewAccount.Post.value=="")
	{
		Accterror("PostError");
	}	
	if (document.forms.NewAccount.Country.value=="")
	{
		Accterror("CountryError");
	}		
	if (AcctError==false)
    {
        document.forms.NewAccount.submit();
    }
}
function Processvalid()
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
  if(xmlHttp.readyState==4)
      {
        {
			show(false,'Wait'); 
			results = xmlHttp.responseText;
			change("ShopBar",results);
		}
      }
    }
	 
  show(true,'Wait');  
  var rand_no = Math.random();
  var param="?Session="+session+"&r="+rand_no+"&Type=8";
  var url="requestsCGI14/Release/requestsCGI.exe";
  url=url+param;
  xmlHttp.open("GET",url,true);
  xmlHttp.setRequestHeader('Cache-Control', 'No-cache');
  xmlHttp.send(null);
}

function ByAcctvalid()
{
	//var AcctError=false;
	AcctError=false;
	show(false,"OrderRefError");	
	show(false,"NodeliveryError");
	if (document.forms.DelMethod.OrderRef.value=="")
	{
		Accterror("OrderRefError");
	}
	if ((!document.forms.DelMethod.Post[0].checked)&&(!document.forms.DelMethod.Post[1].checked))
	{
		Accterror("NodeliveryError");
	}

	if (AcctError==false)
    {
		ByAcctSend("A");
    }
}
function ByCreditvalid()
{
	//var AcctError=false;
	AcctError=false;
	show(false,"NodeliveryError");
	if ((!document.forms.DelMethod.Post[0].checked)&&(!document.forms.DelMethod.Post[1].checked))
	{
		Accterror("NodeliveryError");
	}

	if (AcctError==false)
    {
		ByAcctSend("C");
    }
}


function ByAcctSend(Type)
{
var xmlHttp;
try  {  xmlHttp=new XMLHttpRequest(); } catch (e)  { try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");   }
  catch (e) { try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }  catch (e) { alert("Your browser does not support AJAX!"); return false; }}}
  xmlHttp.onreadystatechange=function()
    {
  if(xmlHttp.readyState==4)
      {
        {
			show(false,'Wait'); 
			results = xmlHttp.responseText.split('||');
			login=results[0];
			response=results[1];
			stream=results[2];			
			if (login == 3)
			{

				var sText="Session=";
		        document.cookie=sText;		
				GetSession();
				change("ShopBar",response);
				
			}
			else
			{
				change("ShopBar",response);
				if (login == 2)	init(stream);
			}
		}
      }
    }
	 
  show(true,'Wait');  
  var rand_no = Math.random();
  var Postage;
  var PostAmt;
  if (document.forms.DelMethod.Post[0].checked)
  {
	  Postage=document.forms.DelMethod.Post[0].value;
  }
  if (document.forms.DelMethod.Post[1].checked)
  {
	  Postage=document.forms.DelMethod.Post[1].value;
  }
  var param="?Session="+session+"&r="+rand_no+"&Type=7"+"&OrderRef="+document.forms.DelMethod.OrderRef.value+"&Postage="+Postage+"&OrderType="+Type;
  var url="requestsCGI14/Release/requestsCGI.exe";
  url=url+param;
  xmlHttp.open("GET",url,false);
  xmlHttp.setRequestHeader('Cache-Control', 'No-cache');
  xmlHttp.send(null);
}

function addvalid()
{
	// var AcctError=false;
	AcctError=false;	
	show(false,"DelNameError");
	show(false,"DelStreetError");
	show(false,"DelTownError");
	show(false,"DelCountyError");
	show(false,"DelPostError");	
	show(false,"DelCountryError");	
	if (document.forms.Delivery.DelName.value=="")
	{
		Accterror("DelNameError");
	}	
	if (document.forms.Delivery.DelStreet.value=="")
	{
		Accterror("DelStreetError");
	}	
	if (document.forms.Delivery.DelTown.value=="")
	{
		Accterror("DelTownError");
	}	
	if (document.forms.Delivery.DelCounty.value=="")
	{
		Accterror("DelCountyError");
	}	
	if (document.forms.Delivery.DelPost.value=="")
	{
		Accterror("DelPostError");
	}	
	if (document.forms.Delivery.DelCountry.value=="")
	{
		Accterror("DelCountryError");
	}		
	if (AcctError==false)
    {
        document.forms.Delivery.submit();
    }
}

function Accterror(field)
{
        show(true,field); 
		AcctError=true;
}
function catvalid()
{
    show(false,"EmailMark");
    show(false,"NameMark");    
    show(false,"StreetMark");      
    show(false,"TownMark");    
    show(false,"CountyMark");      
    show(false,"PostMark");     
    show(false,"CountryMark");    
    var error=false; 
    if (document.forms.Catalogue.Email.value=="")
    {
        formerror("Email");
        error=true;
    }
    if (document.forms.Catalogue.Name.value=="")
    {
        formerror("Name");
        error=true;        
    }
    if (document.forms.Catalogue.Address1.value=="")
    {
        formerror("Address1");
        error=true;
    }
    if (document.forms.Catalogue.Address2.value=="")
    {
        formerror("Address2");
        error=true;
    }    
    if (document.forms.Catalogue.Address3.value=="")
    {
        formerror("Address3");
        error=true;
    }        
    if (document.forms.Catalogue.Address4.value=="")
    {
        formerror("Address4");
        error=true;
    }        
    if (document.forms.Catalogue.Country.value=="")
    {
        formerror("Country");
        error=true;
    }        
    if (error==false)
    {
        document.forms.Catalogue.submit();
    }
}
function formerror(field)
{
    if (field=="Email")
    {
        show(true,"EmailMark");        
    }
    if (field=="Name")
    {
        show(true,"NameMark");        
    }    
    if (field=="Address1")
    {
        show(true,"StreetMark");        
    }        
    if (field=="Address2")
    {
        show(true,"TownMark");        
    }            
    if (field=="Address3")
    {
        show(true,"CountyMark");        
    }          
    if (field=="Address4")
    {
        show(true,"PostMark");        
    }      
    if (field=="Country")
    {
        show(true,"CountryMark");        
    }       
}

function toggle(UpdateType)
{
    if (UpdateType=='Maths'&&document.forms.Catalogue.Maths.value=="0")
    {
        document.forms.Catalogue.Maths.value="1";
    }
    else
    if (UpdateType=='Maths'&&document.forms.Catalogue.Maths.value=="1")
    {
        document.forms.Catalogue.Maths.value="0";
    }

    if (UpdateType=='Design'&&document.forms.Catalogue.Design.value=="0")
    {
        document.forms.Catalogue.Design.value="1";
    }
    else
    if (UpdateType=='Design'&&document.forms.Catalogue.Design.value=="1")
    {
        document.forms.Catalogue.Design.value="0";
    }

    if (UpdateType=='Booklist'&&document.forms.Catalogue.Booklist.value=="0")
    {
        document.forms.Catalogue.Booklist.value="1";
    }
    else
    if (UpdateType=='Booklist'&&document.forms.Catalogue.Booklist.value=="1")
    {
        document.forms.Catalogue.Booklist.value="0";
    }

    
}
function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=4) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
			if (changeImages.arguments[i+2]) change("address", changeImages.arguments[i+3]);
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
	    UKMap_01_All = newImage("images/UKMap_01.gif");
		UKMap_01_Scotland_over = newImage("images/UKMap_01-Scotland_over.gif");
		UKMap_01_NorthEast_over = newImage("images/UKMap_01-NorthEast_over.gif");
		UKMap_01_Ireland_over = newImage("images/UKMap_01-Ireland_over.gif");
		UKMap_01_Wales_over = newImage("images/UKMap_01-Wales_over.gif");
		UKMap_01_Midlands_over = newImage("images/UKMap_01-Midlands_over.gif");
		UKMap_01_Southwest_over = newImage("images/UKMap_01-Southwest_over.gif");
		UKMap_01_SouthCentral_over = newImage("images/UKMap_01-SouthCentral_over.gif");
		UKMap_01_EastAnglia_over = newImage("images/UKMap_01-EastAnglia_over.gif");
		UKMap_01_SouthEast_over = newImage("images/UKMap_01-SouthEast_over.gif");
		UKMap_01_NorthWest_over = newImage("images/UKMap_01-NorthWest_over.gif");
		preloadFlag = true;
	}
}