function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		id04_12_over = newImage("imagesEC/LeftNav_Home_over.gif");
		id04_13_over = newImage("imagesEC/LeftNav_Products_over.gif");
		id04_14_over = newImage("imagesEC/LeftNav_Resources_over.gif");
		id04_15_over = newImage("imagesEC/LeftNav_Contact_over.gif");
		id04_16_over = newImage("imagesEC/LeftNav_Learnmore_over.gif");
		id04_17_over = newImage("imagesEC/LeftNav_Media_over.gif");
                id04_18_over = newImage("imagesEC/LeftNav_Audit_over.gif");
                id04_19_over = newImage("imagesEC/LeftNav_Eco-en-ergy_over.gif");
		preloadFlag = true;
	}
}

var preloadFlag = false;
function preloadImagesFR() {
	if (document.images) {
		id04fr_12_over = newImage("images/LeftNav_HomeFR_over.gif");
		id04fr_13_over = newImage("images/LeftNav_PostFR_over.gif");
		id04fr_14_over = newImage("images/LeftNav_MembersFR_over.gif");
		id04fr_15_over = newImage("images/LeftNav_SellingFR_over.gif");
		id04fr_16_over = newImage("images/LeftNav_RegulationsFR_over.gif");
		id04fr_17_over = newImage("images/LeftNav_ContactFR_over.gif");
		id04fr_18_over = newImage("images/LeftNav_FAQFR_over.gif");
		id04fr_19_over = newImage("images/LeftNav_PrivacyFR_over.gif");
		id04fr_20_over = newImage("images/LeftNav_TermsFR_over.gif");
		id04fr_21_over = newImage("images/LeftNav_AdvertiseFR_Over.gif");
		id04fr_22_over = newImage("images/LeftNav_LinksFR_Over.gif");
		preloadFlag = true;
	}
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


//Exisiting Code starts here




function popUp(URL,NewWidth,NewHeight) {
	day = new Date();
	id = day.getTime();
	window.open(URL, id,'toolbar=0,scrollbars=1,location=0,status=0,menubar=0,resizable=1,width=' + NewWidth + ',height=' + NewHeight + ',left=10,top=10');
}

function popUpFlash(URL,NewWidth,NewHeight) {
	day = new Date();
	id = day.getTime();
	window.open(URL, id,'toolbar=0,scrollbars=0,location=0,status=0,menubar=0,resizable=1,width=' + NewWidth + ',height=' + NewHeight + ',left=60,top=60');
}

function popupSizedWindow(width, height, theURL, winName){
    if (width+0 == 0){
width=700;
    }
    if (height+0 == 0){
height=400;
    }
 		var features = 'scrollbars=yes,resizable=yes,width='+width+', height='+height;
    window.open(theURL,winName,features);
}



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_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_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_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function Form1_Validator(theForm)
{

// check to see if the city field is blank
if (theForm.txtCity.value == "")
{
alert("You must enter a City/Town.");
theForm.txtCity.focus();
return (false);
}

// check to see if the city field is < 2
if (theForm.txtCity.value.length < 2)
{
alert("You must enter a City name greater than 1 letter");
theForm.txtCity.focus();
return (false);
}

// check to see if the province is correct
if (theForm.txtProvince.selectedIndex == "")
{
alert("You must enter a Province/Territory.");
theForm.txtProvince.focus();
return (false);
}

// check to see if the title field is blank
if (theForm.txtTitle.value == "")
{
alert("You must enter a Title.");
theForm.txtTitle.focus();
return (false);
}

// check to see if the description is blank
if (theForm.txtDescription.value == "")
{
alert("You must enter a Description.");
theForm.txtDescription.focus();
return (false);
}

// check to see if the field is > 2000
if (theForm.txtDescription.value.length > 2000)
{
alert("You must only have 2000 characters in your description");
theForm.txtDescription.focus();
return (false);
}

// check to see if the description is blank
if (theForm.txtAddress.value == "")
{
alert("You must enter an Address.");
theForm.txtAddress.focus();
return (false);
}

// check to see if the description is blank
if (theForm.txtCityMap.value == "")
{
alert("You must enter a City/Town.");
theForm.txtCityMap.focus();
return (false);
}

// check if email field is blank
if (theForm.txtEmail.value == "")
{
alert("Please enter a value for the \"E-mail Address\" field.");
theForm.txtEmail.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.txtEmail.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("The \"E-Mail Address\" field must contain an \"@\" and a \".\".");
theForm.txtEmail.focus();
return (false);
}



//alertsay = "First page validations have succeeded. "
//alertsay = alertsay + "Continue to the final page."
//alert(alertsay);
return (true);
}


function FormContact_Validator(theForm)
{

// check to see if the subject is correct
if (theForm.txtSubject.selectedIndex == "")
{
alert("Please choose a subject.");
theForm.txtSubject.focus();
return (false);
}

// check to see if the desciprtion field is blank
if (theForm.txtDescription.value == "")
{
alert("You must enter a message.");
theForm.txtDescription.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.txtEmail.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("The \"E-Mail Address\" field must contain an \"@\" and a \".\".");
theForm.txtEmail.focus();
return (false);
}

return (true);
}


function FormContact_ValidatorAd(theForm)
{


// check to see if the desciprtion field is blank
if (theForm.txtDescription.value == "")
{
alert("You must enter a message.");
theForm.txtDescription.focus();
return (false);
}

// test if valid email address, must have @ and .
var checkEmail = "@.";
var checkStr = theForm.txtEmail.value;
var EmailValid = false;
var EmailAt = false;
var EmailPeriod = false;
for (i = 0;  i < checkStr.length;  i++)
{
ch = checkStr.charAt(i);
for (j = 0;  j < checkEmail.length;  j++)
{
if (ch == checkEmail.charAt(j) && ch == "@")
EmailAt = true;
if (ch == checkEmail.charAt(j) && ch == ".")
EmailPeriod = true;
	  if (EmailAt && EmailPeriod)
		break;
	  if (j == checkEmail.length)
		break;
	}
	// if both the @ and . were in the string
if (EmailAt && EmailPeriod)
{
		EmailValid = true
		break;
	}
}
if (!EmailValid)
{
alert("The \"E-Mail Address\" field must contain an \"@\" and a \".\".");
theForm.txtEmail.focus();
return (false);
}

return (true);
}



  
//function disableselect(e){
//return (false);
//} 
  
//function reEnable(){
//return (true);
//} 
  
//if IE4+
//document.onselectstart=new Function ("return false");
  
//if NS6
//if (window.sidebar){
//document.onmousedown=disableselect;
//document.onclick=reEnable;
//}



function popupSizedWindow(width, height, theURL, winName){
    if (width+0 == 0){
width=700;
    }
    if (height+0 == 0){
height=400;
    }
 		var features = 'scrollbars=yes,resizable=yes,width='+width+', height='+height;
    window.open(theURL,winName,features);
}






