// JavaScript Document
function submitIt() {
    var theForm = document.forms["quote"];  
    if(validate()) {
        document.form1.submit();
    } else {
        return false;
    };
};

function validate() {
    var theForm = document.forms["quote"];  
	
	 

    //First Name
    var strfN = document.form1.fullName.value;
    if (strfN == "")
    {
        alert("Please enter your Full Name.");
        document.form1.fullName.focus();
        return false;
    };
	
	 //Company
    var strfN = document.form1.company.value;
    if (strfN == "")
    {
        alert("Please enter the name of your Company.");
        document.form1.company.focus();
        return false;
    };

	  
	
	 //Email
    var strEmail = document.form1.email.value;
    if (strEmail == "")
    {
        alert("Please enter your Email.");
        document.form1.email.focus();
        return false;
    }
    else if (!isEmail(strEmail))
    {
        alert("Please enter a valid Email.");
        document.form1.email.focus();
        return false;
    };
	
  //Phone
    var strfN = document.form1.phone.value;
    if (strfN == "")
    {
        alert("Please enter your Phone Number.");
        document.form1.phone.focus();
        return false;
    };
    
    return true;
	
};

function isEmail(strEmail)
{
	var re = /^([\w\.!#\$%\-+.]+@[A-Za-z0-9\-]+(\.[A-Za-z0-9\-]+)+)/
	return (re.test(strEmail));
};


function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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.01
  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 && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function changeTab(tabNum){
  for(var i=0; i < 15; i++){
    if(document.images["tab" + i]){
      var img = document.images["tab" + i];
      img.src = img.src1;
    };
    if(document.getElementById("featured" + i)){
      var div = document.getElementById("featured" + i);
      div.style.visibility = "hidden";
    };
    if(document.getElementById("featured" + i + "-text")){
      var div = document.getElementById("featured" + i + "-text");
      div.style.visibility = "hidden";
    };
  };
  document["tab" + tabNum].src = document["tab" + tabNum].src2.src;
  document.getElementById("featured" + tabNum).style.visibility = "visible";
  document.getElementById("featured" + tabNum + "-text").style.visibility = "visible";
};


function updateDivLocations()
{
  var a1 = document.getElementById("anchor1");
  var a1Pos = findPos(a1);

  var a2 = document.getElementById("anchor2");
  var a2Pos = findPos(a2);

  for(var i=0; i < 15; i++){
    if(document.getElementById("featured" + i)){
      var div = document.getElementById("featured" + i);
      div.style.left = a1Pos[0] + "px";
      div.style.top  = a1Pos[1] + "px";
    };
    if(document.getElementById("featured" + i + "-text")){
      var div = document.getElementById("featured" + i + "-text");
      div.style.left = a2Pos[0] + "px";
      div.style.top  = a2Pos[1] + "px";
    };
    //    if(document.getElementById("featured" + i + "-text")){
    //      var div = document.getElementById("featured" + i + "-text");
    //      div.style.visibility = "hidden";
    //    };
  };  
};





var rollover = new Rollover();
rollover.imageDirectory = "images/";
window.onload = function(){ rollover.init(); };

//================================================================== Rollover

function Rollover()
{
 this.imageDirectory = "";
 this.initSwitch     = false;
 this.old_onload     = null;
 if(window.onload != null) { this.old_onload = window.onload; };	
 this.reInit = function(){ this.initSwitch = false; this.old_onload = null; this.init(); };
}
Rollover.prototype.init = rolloverInit;


// ------------------------------------------------------ rolloverInit()
function rolloverInit() 
{

    if(this.old_onload != null ){ this.old_onload(); };    

    for(i=0;i<document.images.length;i++){

	var tempImgObj = document.images[i];
        var tempName = tempImgObj.name;

	if (tempName == ''){ continue; };  // load only images with names
        //    if (tempImgObj.src.indexOf("_on") != -1){ continue; };  // hack to skip images w/ "_on" state

        // get the image extention (.jpg/.gif)
        srcLen = tempImgObj.src.length - 3;
        srcExt = tempImgObj.src.substring(srcLen);

	//create _overs src
	var tempImgSrcStart = tempImgObj.src.lastIndexOf("/") + 1;
	if(tempImgSrcStart == -1){ tempImgSrcStart=0; }
	tempImgSrcEnd = tempImgObj.src.length - 4;
	var tempOverName = tempImgObj.src.substring(tempImgSrcStart, tempImgSrcEnd) + "_on";

	// create rollover image objects and append them as properties (src1,src2) to the original image
	tempImgObj.src1 = new Image(); 
	tempImgObj.src1 = document.images[i].src;
	tempImgObj.src2 = new Image();
	tempImgObj.src2.src = (this.imageDirectory + tempOverName + "." + srcExt);
    } // end i loop

this.initSwitch = true;    // turn switch on 

 changeTab(1);
 updateDivLocations();
} //end init()

window.onresize = updateDivLocations;

// ppk
function findPos(obj) {
  var curleft = curtop = 0;
  if (obj.offsetParent) {
    do {
      curleft += obj.offsetLeft;
      curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
  }
  return [curleft,curtop];
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
// -->

