if (document.images) {
  img01 = new Image();
  img01b = new Image();
  img01.src = "electricianshuddersfield/navbar2_01.gif";
  img01b.src = "electricianshuddersfield/navbar_01.gif";
  
  img01active = new Image();
  img01activeb = new Image();
  img01active.src = "electricianshuddersfield/navbarActive_01.gif";
  img01activeb.src = "electricianshuddersfield/navbarActive2_01.gif";  

  img02 = new Image();
  img02b = new Image();
  img02.src = "electricianshuddersfield/navbar2_02.gif";
  img02b.src = "electricianshuddersfield/navbar_02.gif";
  
  img02active = new Image();
  img02activeb = new Image();
  img02active.src = "electricianshuddersfield/navbarActive_02.gif";
  img02activeb.src = "electricianshuddersfield/navbarActive2_02.gif";   
  
  img03 = new Image();
  img03b = new Image();
  img03.src = "electricianshuddersfield/navbar2_03.gif";
  img03b.src = "electricianshuddersfield/navbar_03.gif";  
  
  img03active = new Image();
  img03activeb = new Image();
  img03active.src = "electricianshuddersfield/navbarActive_03.gif";
  img03activeb.src = "electricianshuddersfield/navbarActive2_03.gif";   
  
  img04 = new Image();
  img04b = new Image();
  img04.src = "electricianshuddersfield/navbar2_04.gif";
  img04b.src = "electricianshuddersfield/navbar_04.gif";   
  
  img04active = new Image();
  img04activeb = new Image();
  img04active.src = "electricianshuddersfield/navbarActive_04.gif";
  img04activeb.src = "electricianshuddersfield/navbarActive2_04.gif";   
  
  img05 = new Image();
  img05b = new Image();
  img05.src = "electricianshuddersfield/navbar2_05.gif";
  img05b.src = "electricianshuddersfield/navbar_05.gif";   
  
  img05active = new Image();
  img05activeb = new Image();
  img05active.src = "electricianshuddersfield/navbarActive_05.gif";
  img05activeb.src = "electricianshuddersfield/navbarActive2_05.gif";   
  
  img06 = new Image();
  img06b = new Image();
  img06.src = "electricianshuddersfield/navbar2_06.gif";
  img06b.src = "electricianshuddersfield/navbar_06.gif";
  
  img06active = new Image();
  img06activeb = new Image();
  img06active.src = "electricianshuddersfield/navbarActive_06.gif";
  img06activeb.src = "electricianshuddersfield/navbarActive2_06.gif";   
  
  img07 = new Image();
  img07b = new Image();
  img07.src = "electricianshuddersfield/navbar2_07.gif";
  img07b.src = "electricianshuddersfield/navbar_07.gif";  
  
  img07active = new Image();
  img07activeb = new Image();
  img07active.src = "electricianshuddersfield/navbarActive_07.gif";
  img07activeb.src = "electricianshuddersfield/navbarActive2_07.gif";   
  
  img08 = new Image();
  img08b = new Image();
  img08.src = "electricianshuddersfield/navbar2_08.gif";
  img08b.src = "electricianshuddersfield/navbar_08.gif";  

  img08active = new Image();
  img08activeb = new Image();
  img08active.src = "electricianshuddersfield/navbarActive_08.gif";
  img08activeb.src = "electricianshuddersfield/navbarActive2_08.gif"; 
  
}
function on(name) {
	if (document.images) {
		fullname = eval(name + "b");
		document[name].src = fullname.src;
	}
}
function off(name) {
  if (document.images) {
    fullname = eval(name);
	if (fullname.complete) {
      document[name].src = fullname.src;
	}
  }
}


function validateQuote()
{

   if(document.getElementById('contactname').value == "")
   {
      alert('Please enter your name.');
   }
   else
   {
	   if(document.getElementById('contacttel').value == "")
	   {
	      alert('Please enter your contact telephone number.');
	   }
	   else
	   {
	      document.getElementById('ORDER').submit();
	   }
   }

}

function submitForm()
{

   if(document.getElementById('cname').value == "")
   {
      alert('Please enter your name.');
   }
   else
   {
	   if(document.getElementById('email').value == "")
	   {
	      alert('Please enter your email.');
	   }
	   else
	   {
		   if(document.getElementById('enquiry').value == "")
		   {
		      alert('Please enter an enquiry.');
		   }
		   else
		   {
			  checkEmailAddress();
		   }
	   }
   }

}


function checkEmailAddress()
{
emailString = document.getElementById('email').value;
atPos = emailString.indexOf("@")
dotPos = emailString.lastIndexOf(".")

	if(atPos == -1 || dotPos == -1)
	{
	   alert("Please check the email address you have entered appears to be invalid.");
	}
	else
	{
	   if(atPos > dotPos)
	   {
	   alert("Please check the email address you have entered appears to be invalid.");
	   }
	   else
	   {
	      if(dotPos - atPos == 1)
	      {
	      alert("Please check the email address you have entered appears to be invalid.");
	      }
	      else
	      {
	         document.getElementById('CONTACT').submit();
	      }
	   }
	}

}


/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Steve Chipman | http://slayeroffice.com/ */

// constants to define the title of the alert and button text.
var ALERT_TITLE = "FREE QUOTATION";
var ALERT_BUTTON_TEXT = "Close";

// over-ride the alert method only if this a newer browser.
// Older browser will see standard alerts
if(document.getElementById) {
  window.alert = function(txt) {
    createCustomAlert(txt);
  }
}

function createCustomAlert(txt) {
  // shortcut reference to the document object
  d = document;

  // if the modalContainer object already exists in the DOM, bail out.
  if(d.getElementById("modalContainer")) return;

  // create the modalContainer div as a child of the BODY element
  mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
  mObj.id = "modalContainer";
   // make sure its as tall as it needs to be to overlay all the content on the page
  mObj.style.height = document.documentElement.scrollHeight + "px";

  // create the DIV that will be the alert 
  alertObj = mObj.appendChild(d.createElement("div"));
  alertObj.id = "alertBox";
  // MSIE doesnt treat position:fixed correctly, so this compensates for positioning the alert
  if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
  // center the alert box
  alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";

  // create an H1 element as the title bar
  h1 = alertObj.appendChild(d.createElement("h1"));
  h1.appendChild(d.createTextNode(ALERT_TITLE));

  // create a paragraph element to contain the txt argument
  msg = alertObj.appendChild(d.createElement("p"));
  msg.innerHTML = txt;
  
  // create an anchor element to use as the confirmation button.
  btn = alertObj.appendChild(d.createElement("a"));
  btn.id = "closeBtn";
  btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
  btn.href = "#";
  // set up the onclick event to remove the alert when the anchor is clicked
  btn.onclick = function() { removeCustomAlert();return false; }
}

// removes the custom alert from the DOM
function removeCustomAlert() {
  document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}
