// JavaScript Document


//this js listens for clicks on product gallery images

   simg = {
	   init: function() {
		   if (document.getElementById) {
			   allAnchors = document.getElementsByTagName('a');
			   if (allAnchors.length) {
				   for (var i = 0; i <allAnchors.length; i++) {
					   if (allAnchors[i].getAttributeNode('rel') && allAnchors[i].getAttributeNode('rel').value != '') {
						   allAnchors[i].onclick = simg.showImage;
					   }
				   }
			   }
		   }
	   },
	   showImage: function() {
		   var mainImage = document.getElementById('swap');
		   mainImage.src = this.getAttributeNode('rel').value;
		   return false;
	   },
	   addEvent: function(element, eventType, doFunction, useCapture) {
		   if (element.addEventListener) {
			   element.addEventListener(eventType, doFunction, useCapture);
			   return true;
		   } else if (element.attachEvent) {
			   var r = element.attachEvent('on' + eventType, doFunction);
			   return r;
		   } else {
			   element['on' + eventType] = doFunction;
		   }
	   }
   }
   simg.addEvent(window, 'load', simg.init, false);


function SelectCat(oSelect)
 {
   if(oSelect)
   {
	  var strUrl = oSelect.options[oSelect.options.selectedIndex].value;
	  if(strUrl != "")
	  {
		location.href = strUrl;
	  }
   }
 }
 
 
 // JavaScript Document
//contact form validation
	function ValidateContact()
{
		if ((document.contactform.firstname.value) == "")
		{
		alert("Please enter your name to continue.");
   		document.contactform.firstname.focus();	
		return false;
		}
		
		
		if ((document.contactform.company.value) == "")
		{
		alert("Please enter your company name to continue.");
   		document.contactform.company.focus();	
		return false;
		}
		
		
		if ((document.contactform.telephone.value) == "")
		{
		alert("Please enter your telephone number to continue.");
   		document.contactform.telephone.focus();	
		return false;
		}
		
		if ((document.contactform.email.value) == "")
		{
		alert("Please enter your email address so that we can get in touch.");
   		document.contactform.email.focus();	
		return false;
		}
		
		if ((document.contactform.comments.value) == "")
		{
		alert("Please enter your enquiry.");
   		document.contactform.comments.focus();	
		return false;
		}
		
}