

/***********************************************
* CONTRACTIBLE HEADERS SCRIPT START *
***********************************************/

var enablepersist="on" //Enable saving state of content structure using session cookies? (on/off)
var collapseprevious="yes" //Collapse previously open content when opening present? (yes/no)

if (document.getElementById){
document.write('<style type="text/css">')
document.write('.switchcontent{display:none;}')
document.write('</style>')
}

function getElementbyClass(classname){
ccollect=new Array()
var inc=0
var alltags=document.all? document.all : document.getElementsByTagName("*")
for (i=0; i<alltags.length; i++){
if (alltags[i].className==classname)
ccollect[inc++]=alltags[i]
}
}

function contractcontent(omit){
var inc=0
while (ccollect[inc]){
if (ccollect[inc].id!=omit)
ccollect[inc].style.display="none"
inc++
}
}

function expandcontent(cid){
if (typeof ccollect!="undefined"){
if (collapseprevious=="yes")
contractcontent(cid)
document.getElementById(cid).style.display=(document.getElementById(cid).style.display!="block")? "block" : "none"
}
}

function revivecontent(){
contractcontent("omitnothing")
selectedItem=getselectedItem()
selectedComponents=selectedItem.split("|")
for (i=0; i<selectedComponents.length-1; i++)
document.getElementById(selectedComponents[i]).style.display="block"
}

function get_cookie(Name) { 
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { 
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function getselectedItem(){
if (get_cookie(window.location.pathname) != ""){
selectedItem=get_cookie(window.location.pathname)
return selectedItem
}
else
return ""
}

function saveswitchstate(){
var inc=0, selectedItem=""
while (ccollect[inc]){
if (ccollect[inc].style.display=="block")
selectedItem+=ccollect[inc].id+"|"
inc++
}

document.cookie=window.location.pathname+"="+selectedItem
}

function do_onload(){
uniqueidn=window.location.pathname+"firsttimeload"
getElementbyClass("switchcontent")
if (enablepersist=="on" && typeof ccollect!="undefined"){
document.cookie=(get_cookie(uniqueidn)=="")? uniqueidn+"=1" : uniqueidn+"=0" 
firsttimeload=(get_cookie(uniqueidn)==1)? 1 : 0 //check if this is 1st page load
if (!firsttimeload)
revivecontent()
}
}


if (window.addEventListener)
window.addEventListener("load", do_onload, false)
else if (window.attachEvent)
window.attachEvent("onload", do_onload)
else if (document.getElementById)
window.onload=do_onload

if (enablepersist=="on" && document.getElementById)
window.onunload=saveswitchstate


/***********************************************
* CONTRACTIBLE HEADERS SCRIPT END *
***********************************************/

/***********************************************
* JUMP MENU SCRIPT START *
***********************************************/

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.0
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->

/***********************************************
* JUMP MENU SCRIPT END *
***********************************************/

/***********************************************
* FORMS SCRIPT START *
***********************************************/

<!-- BROCHURE REQUEST CODE --> 

function resetBrochure() {
document.brochure.email.value="";
document.brochure.name.value="";
document.brochure.address1.value="";
document.brochure.address2.value="";
document.brochure.town.value="";
document.brochure.county.value="";
document.brochure.postcode.value="";
}

function validateBrochure() {

if (document.brochure.name.value.length==0) {
alert("Please enter your name");
return false;
}

if (document.brochure.email.value.length==0) {
alert("Please enter your email address");
return false;
}

if (document.brochure.address1.value.length==0) {
alert("Please enter the first line of your address");
return false;
}

if (document.brochure.postcode.value.length==0) {
alert("Please enter your postcode");
return false;
}

document.brochure.submit()
return true;
}

<!-- END OF BROCHURE REQUEST CODE --> 


<!-- PRODUCT QUESTION CODE --> 

function resetMessage() {
document.message.name.value="";
document.message.email.value="";
document.message.question.value="";
}

function validateMessage() {

if (document.message.name.value.length==0) {
alert("Please enter your name");
return false;
}

if (document.message.email.value.length==0) {
alert("Please enter your email address");
return false;
}

if (document.message.question.value.length==0) {
alert("Please enter your question");
return false;
}

document.message.submit()
return true;
}

<!-- END OF PRODUCT QUESTION CODE -->



<!-- PRICE LIST REQUEST CODE --> 

function resetPricelist() {
document.pricelist.email.value="";
}

function validatePricelist() {

if (document.pricelist.email.value.length==0) {
alert("please enter your email address");
return false;
}

document.pricelist.submit()
return true;
}

<!-- END OF PRICE LIST REQUEST CODE --> 

/***********************************************
* FORMS SCRIPT END *
***********************************************/

/***********************************************
* FUNCTIONS SCRIPT START *
***********************************************/

function MM_preloadImages()
{ //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

var x,y;
function getWindowWidth()
{
  if (self.innerHeight) // all except Explorer
  {
    x = self.innerWidth;
    y = self.innerHeight;
  }
  else if (document.documentElement && document.documentElement.clientHeight)
    // Explorer 6 Strict Mode
  {
    x = document.documentElement.clientWidth;
    y = document.documentElement.clientHeight;
  }
  else if (document.body) // other Explorers
  {
    x = document.body.clientWidth;
    y = document.body.clientHeight;
  }
}

function swapGallery(myImage,myText)
{
  document.getElementById("picDescription").innerHTML = myText;
  document.getElementById("gallery").src = myImage;
}
function swapImage(myImage,newImage) { document.getElementById(myImage).src = newImage; }

function showPopup(myPage,myExtras,winWidth,winHeight)
{
  //centre on screen
  getWindowWidth();
  var winLeft = (x / 2) - (winWidth/2);
  var winTop = (y / 2) - (winHeight/2);
  
  newPage = "popups/"+myPage+".php";
  if (myExtras != "") { newPage += "?" + myExtras; }
  informationPopup = window.open(newPage,'informationPopup','width='+winWidth+',height='+winHeight+',resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left='+winLeft+',top='+winTop);
  if (window.focus) { informationPopup.focus(); }
}

function showFirewall()
{
  var winWidth=758
  var winHeight=443;
  //centre on screen
  getWindowWidth();
  var winLeft = (x / 2) - (winWidth/2);
  var winTop = (y / 2) - (winHeight/2);
  
  firewallPopup = window.open('firewallmain.php','firewallPopup','width='+winWidth+',height='+winHeight+',resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0,left='+winLeft+',top='+winTop);
  if (window.focus) { firewallPopup.focus(); }
}

/***********************************************
* FUNCTIONS SCRIPT END *
***********************************************/


/***********************************************
* HORIZONTAL MENU SCRIPT START *
***********************************************/

//Contents for menu 1
var menu1=new Array()
menu1[0]='<a href="http://www.firesonline.co.uk/acatalog/Aarrow-Stoves.html">Aarrow Stoves</a>'
menu1[1]='<a href="http://www.firesonline.co.uk/acatalog/Aga-Stoves.html">Aga Stoves</a>'
menu1[2]='<a href="http://www.firesonline.co.uk/acatalog/Bohemia-Stoves.html">Bohemia Stoves</a>'
menu1[3]='<a href="http://www.firesonline.co.uk/acatalog/Charnwood-Stoves.html">Charnwood Stoves</a>'
menu1[4]='<a href="http://www.firesonline.co.uk/acatalog/Dimplex-Stoves.html">Dimplex Stoves</a>'
menu1[5]='<a href="http://www.firesonline.co.uk/acatalog/Dovre-Stoves.html">Dovre Stoves</a>'
menu1[6]='<a href="http://www.firesonline.co.uk/acatalog/Dunsley-Stoves.html">Dunsley Stoves</a>'
menu1[7]='<a href="http://www.firesonline.co.uk/acatalog/Esse-Stoves.html">Esse Stoves</a>'
menu1[8]='<a href="http://www.firesonline.co.uk/acatalog/Firebelly-Stoves.html">Firebelly Stoves</a>'
menu1[9]='<a href="http://www.firesonline.co.uk/acatalog/Firewarm-Stoves.html">Firewarm Stoves</a>'
menu1[10]='<a href="http://www.firesonline.co.uk/acatalog/Gazco-Stoves.html">Gazco Stoves</a>'
menu1[11]='<a href="http://www.firesonline.co.uk/acatalog/HS-Gas-Stoves.html">HS Gas Stoves</a>'
menu1[12]='<a href="http://www.firesonline.co.uk/acatalog/Hunter-Stoves.html">Hunter Stoves</a>'
menu1[13]='<a href="http://www.firesonline.co.uk/acatalog/Jotul-Stoves.html">Jotul Stoves</a>'
menu1[14]='<a href="http://www.firesonline.co.uk/acatalog/Morso-Stoves.html">Morso Stoves</a>'
menu1[15]='<a href="http://www.firesonline.co.uk/acatalog/Redfyre-Stoves.html">Redfyre Stoves</a>'
menu1[16]='<a href="http://www.firesonline.co.uk/acatalog/Stovax-Stoves.html">Stovax Stoves</a>'
menu1[17]='<a href="http://www.firesonline.co.uk/acatalog/Stovax-Riva-Stoves.html">Stovax Riva Stoves</a>'
menu1[18]='<a href="http://www.firesonline.co.uk/acatalog/Tiger-Stoves.html">Tiger Stoves</a>'
menu1[19]='<a href="http://www.firesonline.co.uk/acatalog/Town&Country-Stoves.html">Town & Country Stoves</a>'
menu1[20]='<a href="http://www.firesonline.co.uk/acatalog/Vermont-Stoves.html">Vermont Castings Stoves</a>'
menu1[21]='<a href="http://www.firesonline.co.uk/acatalog/Villager-Stoves.html">Villager Stoves</a>'
menu1[22]='<a href="http://www.firesonline.co.uk/acatalog/Westfire-Stoves.html">Westfire Stoves</a>'
menu1[23]='<a href="http://www.firesonline.co.uk/acatalog/Yeoman-Stoves.html">Yeoman Stoves</a>'

//Contents for menu 2
var menu2=new Array()
menu2[0]='<a href="http://www.firesonline.co.uk/acatalog/Buyers_Guide.html">Buyers Guide</a>'
menu2[1]='<a href="http://www.firesonline.co.uk/acatalog/Stove-Building-Regulations.html">Building Regulations</a>'
menu2[2]='<a href="http://www.firesonline.co.uk/acatalog/Installation_Guide.html">Installers</a>'
menu2[3]='<a href="http://www.firesonline.co.uk/acatalog/Knowledge_Base.html">Knowledge Base</a>'

//Contents for menu 3
var menu3=new Array()
menu3[0]='<a href="http://www.firesonline.co.uk/acatalog/About_Us.html">About Us</a>'
menu3[1]='<a href="http://www.firesonline.co.uk/acatalog/Frequently_Asked_Questions.html">FAQ</a>'
menu3[2]='<a href="http://www.firesonline.co.uk/acatalog/Delivery_Information.html">Deliveries</a>'
menu3[3]='<a href="http://www.firesonline.co.uk/acatalog/Returns.html">Returns</a>'
menu3[4]='<a href="http://www.firesonline.co.uk/acatalog/Testimonials.html">Testimonials</a>'
menu3[5]='<a href="http://www.firesonline.co.uk/acatalog/info.html">Terms &amp; Conditions</a>'
menu3[6]='<a href="http://www.firesonline.co.uk/acatalog/Links.html">Links</a>'

		
var menuwidth='170px' //default menu width
var menubgcolor='#ffffff'  //menu bgcolor
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var hidemenu_onclick="yes" //hide menu when user clicks within menu?

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

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

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


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

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

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

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


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

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

return clickreturnvalue()
}

function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}

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

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

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

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

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

if (hidemenu_onclick=="yes")
document.onclick=hidemenu


/***********************************************
* HORIZONTAL MENU SCRIPT END *
***********************************************/
;
