// JavaScript Document
//specify interval between slide (in mili seconds)
var slidespeed=4152

//specify images
var slideimages=new Array("images/1.jpg","images/2.jpg","images/3.jpg","images/5.jpg","images/6.jpg","images/7.jpg","images/8.jpg","images/9.jpg","images/10.jpg","images/11.jpg","images/12.jpg","images/13.jpg")

var imageholder=new Array()
var ie=document.all
for (i=0;i<slideimages.length;i++){
imageholder[i]=new Image()
imageholder[i].src=slideimages[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 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 nospam (a1,a2,a3,display) {
   var URL= 'mailto:' + a1 + '@' + a2 + '.' + a3;
   if (!display) window.location.href = URL;
   else return URL;
}

function nospam_new (a1,a2,a3,display) {
   var URL= 'mailto:' + a1 + '@' + a2 + '.' + a3 + '?subject=New website comments';
   if (!display) window.location.href = URL;
   else return URL;
}

function colorRow(elem, color) {
if (document.layers) {
  elem.oldcolor = elem.style.backgroundColor
  elem.style.backgroundColor=color;
 }
else{
  elem.oldcolor = elem.style.backgroundColor
  elem.style.backgroundColor=color;
  }
}
function recoverRow(elem) {
if (document.layers) 
elem.style.backgroundColor = color; // this should be modified for NN4
else{
  elem.style.backgroundColor=elem.oldcolor;
  }
}

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   alert("Your email address appears incorrect. Please enter it in the format 'abc@xyz.com'")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.sForm.EmailAddress
	var postalID=document.sForm.postal
	var skilltestingID=document.sForm.skilltesting
	var MonthlyNewsletterID=document.sForm.MonthlyNewsletter
	var MonthlySpecialsID=document.sForm.MonthlySpecials
	var WeeklySpecialsID=document.sForm.WeeklySpecials
	
	var postalPattern = /^[A-Z][0-9][A-Z][0-9][A-Z][0-9]$/;
	var postalRegExp = new RegExp(postalPattern);
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
		
	if (postalID.value==false){
		alert("Please enter your postal code")
		postalID.focus()
		return false
	}
	
	if (postalRegExp.test(document.sForm.postal.value) == false ) {
		alert( "Please enter your postal code in the format V1V1V1, with letters uppercase");
		postalID.focus()
		return false
		}
	
	if (skilltestingID.value!="choices"){
		alert("Please enter the verification code")
		skilltestingID.focus()
		return false
	}
	
	if	((document.sForm.MonthlyNewsletter.checked)||(document.sForm.MonthlySpecials.checked)||(document.sForm.WeeklySpecials.checked)){
		return true
		}
		else {
  		alert("Please enter your subscription preferences")
		document.sForm.MonthlyNewsletter.focus()
		return false
		}
	
	return true
 }
 
  function postalCheck()
{

if (document.myform.postal.value =="")
{
alert(" the field must be entered ");
}
if (postalRegExp.test(document.myform.postal.value) == false )
{
alert( "the field is invalid");
}
}
 
 
 
 function Validate_cForm(){
	var emailID=document.cForm.EmailAddress
	var nameID=document.cForm.Name
	var commentID=document.cForm.Comment
	var skilltestingID=document.cForm.skilltesting

	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please enter your email address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	
	if ((nameID.value==null)||(nameID.value=="")){
		alert("Please enter your name")
		nameID.focus()
		return false
	}
	
	if ((commentID.value==null)||(commentID.value=="")){
		alert("Please enter your comment or question")
		commentID.focus()
		return false
	}
	
	if (skilltestingID.value!="green"){
		alert("Please enter the verification code")
		skilltestingID.value=""
		skilltestingID.focus()
		return false
	}
	
	return true
 }
 
							   
										   
										 
									   
									   
									   
									     
										   
										   
										 
										 
										   
										   
										
									   
									   
									   
							 		   
									   								 
									 
								   
								 
							     
								 
				 			 
						   		   			 
