<!--

    sfHover = function()
    {	
    		var sfEls2, sfEls;
    		
        // horizontal menu
        if (document.getElementById("nav"))
      		sfEls = document.getElementById("nav").getElementsByTagName("LI");
      	else
      		sfEls = false;
      		
      	if (sfEls)
      	{
	      	for (var i = 0; i < sfEls.length; i++)
	        {
	        		sfEls[i].onmouseover = function()
	            {
	        			   this.className += " sfhover";
	        		}
	        		
	            sfEls[i].onmouseout = function()
	            {
	        			   this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
	        		}
	      	}
				}
				
				// vertical menu
				if (document.getElementById("vertical"))
	      	sfEls2 = document.getElementById("vertical").getElementsByTagName("LI");
      	else
      		sfEls2 = false;
      		
      	if (sfEls2)
      	{
	        for (var i = 0; i < sfEls2.length; i++)
	        {
	        		sfEls2[i].onmouseover = function()
	            {
	        			   this.className += " sfhover";
	        		}
	        		
	            sfEls2[i].onmouseout = function()
	            {
	        			   this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
	        		}
	      	}
	      }
    }
    
    if (window.attachEvent) window.attachEvent("onload", sfHover);

    // clear text and add text to the default field
    function clearText(thefield, doNotRestore)
    {
          if (thefield.defaultValue == thefield.value)
          {
              thefield.value = '';
          }
    } 

    // Clear default value on submission
    function clearDefaultValue(theElement)
    {
      if (theElement.value == theElement.defaultValue)
      {
        theElement.value = '';
      }
    }

    // onBlur event    
    function addText(thefield, dontRestore)
    {
          if (!dontRestore)
          {
              // if the field is blank (by being clicked)
              if (thefield.value == "")
              {
                    // set it to the default value
                    thefield.value = thefield.defaultValue;
              }
          }
    } 
    
    // simple add to favourites 
    // supports top three browsers
    function addToFavourites()
    {
        var title = "Simply Home Office"; 
        
        var url = "http://www.simplyhomeoffice.com";
        
        if (window.sidebar) // Mozilla Firefox Bookmark 
        { 
            window.sidebar.addPanel(title, url, "");
        }
        else if(window.external) // IE Favorites
        { 
            window.external.AddFavorite(url, title);
        }
        else if(window.opera && window.print) // Opera Hotlist
        {
            return true;
        }
    } 
    
    function change(id, num, direction, divname)
    {
        var dir = 1;
        var showid = divname + 0;
        var hideid = divname + id;

        if (direction == 'left')
        {
            dir = -1;
        }
        
        if ((id + dir) < 0)
        {
            showid = divname + (num - 1);
            if (num == 1)
            {
                hideid = -1;
            }
        }
        else if((id + dir) >= num)
        {
            showid = divname+0;
            if(num == 1)
            {
                hideid = -1;
            }
        }
        else
        {
            showid = divname + (id + dir);
        }
        
        document.getElementById(showid).className = 'displayBlock';
        document.getElementById(hideid).className = 'hideBlock';
    }
    
    function debug(name, value)
    {
        alert(name + ": " + value);
    }
    
    function changePhotoPage(itemsPerPage, id, page)
    {   
        // debug("id", id);
        var showDiv = ("photo" + id);
        var divID;
    		if (page)
    		{
          for (var i = 1; i <= page; i++)
	        {
	        		divID = "photo" + (i * itemsPerPage);
	        		if (document.getElementById(divID))
	        		{
		            document.getElementById(divID).className = 'hideBlock';
		          }
	        }
	      }
        if (document.getElementById(showDiv))
        {
        	document.getElementById(showDiv).className = 'showPhotoBlock';
        }
    }
    
    function showBigPhoto(fileToOpen)
    {
        try {
          window.open(fileToOpen, '_blank', 'scrollbars = yes');           
        }
        catch (e) {
          alert("No popup " + e);
        }
    }
    
    function wishListCallback()
		{
				if (sendHttpRequest)
				{
					var theResponse = sendHttpRequest.responseText();
	
					if (theResponse != -1)
					{
						if (theResponse == -2)
						{
								alert("This item is already in your wishlist.");
						}
						else
						{
								document.getElementById("wishListContainer").innerHTML = theResponse;
								alert("Your wishlist has been updated.");
						}
						return false;
					}
				}
		}
    
    var xmlHttp
    
    function showHint(str)
    {
        if (str.length == 0)
        {
            document.getElementById("txtHint").innerHTML = ""
            return
        }
        xmlHttp = GetXmlHttpObject()
        if (xmlHttp == null)
        {
            alert ("Browser does not support HTTP Request")
            return
        }
        var url = "gethint.asp"
        url = url + "?q=" + str
        url = url + "&sid=" + Math.random()
        xmlHttp.onreadystatechange = stateChanged
        xmlHttp.open("GET",url,true)
        xmlHttp.send(null)
    }
    
    function stateChanged()
    {
        if (xmlHttp.readyState == 4 || 
						xmlHttp.readyState == "complete")
        {
            document.getElementById("txtHint").innerHTML = xmlHttp.responseText
        }
    }
    
    function GetXmlHttpObject()
    {
        var objXMLHttp = null;
        
				if (window.XMLHttpRequest)
            objXMLHttp = new XMLHttpRequest()
        else if (window.ActiveXObject)
            objXMLHttp = new ActiveXObject("Microsoft.XMLHTTP")

        return objXMLHttp
    }
    
    /* Begin: Product images functions */

    function changeImageSourceSize(theImageToBe)
    {
        if (document.getElementById("topImage")) // If we can find the element in the document
        {
            document.getElementById("topImage").src = theImageToBe.replace('_t65', '_t280'); // Replace the image with new image and assign new image to existing image file placeholder.
        }
    }
    
    function loadRangeImage(photoFile, theWidth, theHeight)
    {
				// Take the margin into account
				theWidth 	= parseInt(theWidth) + 10;
				theHeight = parseInt(theHeight) + 10;
				
    		try {
        	newWindow = window.open(photoFile, 'name', 'height=' + theHeight + ', width=' + theWidth); // Load the new window
        }
        catch (e) {
        	alert("Error: Could not initiate the loading of the popup window"); //  + e 
        }
		}
    
    function openShowPopupWindow(fileToOpen, productID, photoFile, originalFilename)
    {   
        // Remove the thumbnail size from the filename
        photoFile = photoFile.replace('_t280', '');
        
        // Remove the thumbnail size from the filename for the page comparision
        originalFilename = originalFilename.replace('_t280', '');
        // Remove the path from the image source
        originalFilename = originalFilename.substr(originalFilename.lastIndexOf('/') + 1, originalFilename.length);
        
        // Try and load the popup window
        try
        {
            // The new window
            window.open(fileToOpen + '?id=' + productID + '&photo=' + photoFile + '&name=' + originalFilename, '_blank', 'scrollbars = yes'); 
        }
        catch (e)
        {
            // Show a simple error for the user
            alert("Error: Could not initiate the loading of the popup window"); //  + e 
        }
    }

    /* End: Product images functions */
    
-->
