// Menu system for IE6

startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById("nav");
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName=="LI") {
node.onmouseover=function() {
this.className+=" over";
  }
  node.onmouseout=function() {
  this.className=this.className.replace(" over", "");
   }
   }
  }
 }
}
window.onload=startList;



function replayIntroMovie()
{
        document.getElementById('center_image').innerHTML = '<object width="711" height="357" type="application/x-shockwave-flash" data="Intro.swf" id="flashMovieObj"><param value="Intro.swf" name="movie" id="flashMovieParam"/><param value="transparent" name="wmode" /> </object>';
}

function forceStaticMovie()
{
	document.getElementById('center_image').innerHTML = '<object width="711" height="357" type="application/x-shockwave-flash" data="IntroStop.swf" id="flashMovieObj"><param value="IntroStop.swf" name="movie" id="flashMovieParam"/><param value="transparent" name="wmode" /> </object>';
}


function OpenBYOB()
{
  window.open('http://www.enigin.net/popups/byob.php','BYOB','height=700,width=550, menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no');
}
function OpenEniOpp()
{
window.open('http://www.enigin.net/popups/opportunity.php','EniOpp','height=500,width=550, menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no');
}
function OpenEmaps()
{
window.open('http://www.enigin.net/popups/energymaps.php','EniMaps','height=500,width=550, menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no');
}
function OpenVideo()
{
  window.open('http://www.enigin.net/popups/training-video.php','Video','height=600,width=550, menubar=no,scrollbars=yes,status=no,toolbar=no,fullscreen=no');
}
function OpenESproducts()
{
window.open('http://www.enigin.net/popups/esppop.php','ESproducts','height=500,width=550, menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no');
}
function OpenWebinar()
{
window.open('http://www.enigin.net/popups/webinar.php','Webinar','height=500,width=550, menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no');
}
function OpenQuest()
{
window.open('http://www.enigin.net/popups/questionare.php','Quest','height=600,width=900, menubar=no,scrollbars=no,status=no,toolbar=no,fullscreen=no');
}

// Validation with alert message
function ValidateRequiredFields()
{
var FieldList = RequiredFields.split(",")
var BadList = new Array();
for(var i = 0; i < FieldList.length; i++) {
	var s = eval('document.' + FormName + '.' + FieldList[i] + '.value');
	s = StripSpacesFromEnds(s);
	if(s.length < 1) { BadList.push(FieldList[i]); }
	}
if(BadList.length < 1) { return true; }
var ess = new String();
if(BadList.length > 1) { ess = 's'; }
var ahh = new String();
if(BadList.length > 1) { ahh = ' are'; }
if (BadList.length == 1) { ahh = ' is'; }
var message = new String('Please ensure that you complete all fields marked with a *\nThe following field' + ess + ahh + ' required before we can process your enquiry:\n');
for(var i = 0; i < BadList.length; i++) {message += '\n' + BadList[i]; }
alert(message);
return false;
}

function StripSpacesFromEnds(s)
{
while((s.indexOf(' ',0) == 0) && (s.length> 1)) {
	s = s.substring(1,s.length);
	}
while((s.lastIndexOf(' ') == (s.length - 1)) && (s.length> 1)) {
	s = s.substring(0,(s.length - 1));
	}
if((s.indexOf(' ',0) == 0) && (s.length == 1)) { s = ''; }
return s;
}



function validateEmailForm(_form)
{
	if ( _form.first_name.value.length == 0 )
	{
		alert("Please enter your firstname");
		return false;
	}

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

	return true;
}
