

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_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_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function isBlank(s)
                           {
                             for(var i = 0; i < s.length; i++)
                                 {
                                   var c = s.charAt(i);
                                   if ( (c != ' ') && (c != '/n') && (c != '/t')) return false;
                                 }
                             return true;
                           }
       
function isEmpty(s)
                           {
                             return (( s == null) || (s.length == 0));
                           }



function validateSignUpForm()
                               {
                                  var msg = " ";
                                  var errors = " ";
                                  var el = document.signup;
								  
                         

                        if(el.firstname)
								{	                                  
                                  if (el.firstname.value=="" || isBlank(el.firstname.value) || isEmpty(el.firstname.value) )
                                     {
                                       errors += 'The First Name Field is required. ' ;
                                     } 
								}
									 
						if(el.lastname)
								{		 
								 if (el.lastname.value=="" || isBlank(el.lastname.value) || isEmpty(el.lastname.value) )
                                     {
                                       errors += 'The Last Name Field is required. ' ;
                                     }  
								}
						if(el.address1)
								{	
								 if (el.address1.value=="" || isBlank(el.address1.value) || isEmpty(el.address1.value) )
                                     {
                                       errors += 'Address1 field is required.  ' ;
                                     } 
								}
						if(el.city)
								{	 
								if (el.city.value=="" || isBlank(el.city.value) || isEmpty(el.city.value) )
                                     {
                                       errors += 'City field is required.  ' ;
                                     }  
								}
								
						if(el.state)
								{	                                  
                                  if (el.state.value=="" || isBlank(el.state.value) || isEmpty(el.state.value) )
                                     {
                                       errors += 'The State Field is required. ' ;
                                     } 
								}		
								
						if(el.zip)
							 {
								if (el.zip.value=="" || isBlank(el.zip.value) || isEmpty(el.zip.value) )
                                     {
                                       errors += 'Zip code field is required.  ' ;
                                     } 
							 }
									 
						if(el.dayphone)
							 {
								if (el.dayphone.value=="" || isBlank(el.dayphone.value) || isEmpty(el.dayphone.value) )
                                     {
                                       errors += 'Day time phone number field is required.  ' ;
                                     } 
							 }
							 
							 if(el.lastfour)
							 {
								if (el.lastfour.value=="" || isBlank(el.lastfour.value) || isEmpty(el.lastfour.value) )
                                     {
                                       errors += 'The last four digits of the Social Security Number are required.  ' ;
                                     } 
							 }
							 
							 if(el.passaccount)
								{	                                  
                                  if (el.passaccount.value=="" || isBlank(el.passaccount.value) || isEmpty(el.passaccount.value) )
                                     {
                                       errors += 'You must have an EnergyUnited Account to request a password for Account Information Log In. ' ;
                                     } 
								}
							
							
							
							 if(el.password1 && el.password2)
							 	{
 									                                  
                                  if (el.password1.value=="" || isBlank(el.password1.value) || isEmpty(el.password1.value) )
                                     {
                                       errors += 'You must enter your new password in the first password field. ' ;
                                     } 
								                                  
                                  if (el.password2.value=="" || isBlank(el.password2.value) || isEmpty(el.password2.value) )
                                     {
                                       errors += 'You must verify your new password by entering it in the second password field. ' ;
                                     } 
									 
								  if (el.password2.value!=el.password1.value )
                                     {
                                       errors += 'The two passwords you have entered do not match. ' ;
                                     } 
								}
							 
							 
	//these are not just text fields						 
					   if(el.Accept)
							{
												
									if (!el.Accept.checked)
									{
										errors += 'Indicating "yes" that you have read the Service Agreement and Warranty is required to order Triple Surge Guard.' ;
									}
							}
							
					  if(el.participation)
							{
									
									if(el.participation.value=="Other")
                                     {
										if(el.amount.value=="" || isBlank(el.amount.value) || isEmpty(el.amount.value) )
                                     		{
                                      	 		errors += 'Selecting a participation amount - in the Other Amount field - is required. ' ;
                                    		} 
                                     } 
												
							}
								if (errors==" ") return true;
                                  else{
                                  msg +="The form has not been submitted for the following reasons:";
                                  msg += errors;
                                  alert(msg);
                                  return false;}
						} 
								



function importXML()
{	
	
	if (document.implementation && document.implementation.createDocument)
	{
		xmlDoc = document.implementation.createDocument("", "", null);
		
	}
	else if (window.ActiveXObject)
	{
		xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		
 	}
	else
	{
		alert('Your browser can\'t handle this script');
		return;
	}
	xmlDoc.async=false;
	if (typeof xmlDoc!="undefined"){
	xmlDoc.load("./xml/press_releases.xml");
	}
	
}

function createTable(id_tag)
{
	var x = xmlDoc.getElementsByTagName(id_tag);
	var newEl = document.createElement('TABLE');
	newEl.setAttribute('width','100%');
	newEl.setAttribute('bgColor','#004231');
	newEl.setAttribute('cellPadding',3);
	newEl.setAttribute('border',3);
	var tmp = document.createElement('TBODY');
	newEl.appendChild(tmp);
	var row = document.createElement('TR');
	for (j=0;j<x[0].childNodes.length;j++)
	{
		if (x[0].childNodes[j].nodeType != 1) continue;
		var container = document.createElement('TH');
		var container_font = document.createElement('FONT');
						   container_font.setAttribute('color','white');
			container.appendChild(container_font);
		var theData = document.createTextNode(x[0].childNodes[j].nodeName);
		container_font.appendChild(theData);
                row.appendChild(container);
		
			
	}		
	tmp.appendChild(row);
	for (i=0;i<x.length;i++)
	{
		var row = document.createElement('TR');
		for (j=0;j<x[i].childNodes.length;j++)
		{
			if (x[i].childNodes[j].nodeType != 1) continue;
			var container = document.createElement('TD');
			var container_font = document.createElement('FONT');
							   container_font.setAttribute('color','white');
				container.appendChild(container_font);
			var theData = document.createTextNode(x[i].childNodes[j].firstChild.nodeValue);
			container_font.appendChild(theData);
			row.appendChild(container);	
			
		}
		tmp.appendChild(row);
	}
	document.getElementById('writeroot').appendChild(newEl);
}


function show(i)
{
var x = xmlDoc.getElementsByTagName(id_tag);
/*headline=(x[i].getElementsByTagName("HEADLINE")[0].childNodes[0].nodeValue);
dateline=(x[i].getElementsByTagName("DATELINE")[0].childNodes[0].nodeValue);*/
location=(x[i].getElementsByTagName("LOCATION")[0].childNodes[0].nodeValue);

txt=location;
document.getElementById("show").scr=txt;
}

function menuStyle2(menuItemId2)
{
		linkElement2 = document.getElementById(menuItemId2);
			
				linkElement2.style.backgroundColor = "#003F22";
				//linkElement.style.backgroundImage = "url('images/rightArrow.gif')";
				//linkElement2.style.backgroundImageRepeat = "no-repeat";
				linkElement2.style.color = "#FFF0FA";
				//linkElement.style.textDecoration = "underline";
				//linkElement.style.fontWeight = "bold";
				linkElement2.style.borderWidth = "1px";
				linkElement2.style.borderStyle = "solid";
				linkElement2.style.borderColor = "#003F22";
}

function menuStyleReturn(menuItemId3)
{
		linkElement3 = document.getElementById(menuItemId3);
			
				linkElement3.style.backgroundColor = "#FFFFFF";
				//linkElement.style.backgroundImage = "url('images/rightArrow.gif')";
				//linkElement3.style.backgroundImageRepeat = "no-repeat";
				linkElement3.style.color = "#003F22";
				//linkElement.style.textDecoration = "underline";
				//linkElement.style.fontWeight = "bold";
				linkElement3.style.borderWidth = "1px";
				linkElement3.style.borderStyle = "solid";
				linkElement3.style.borderColor = "#FFFFFF";
}

function menuStyleReturnGrey(menuItemId3)
{
		linkElement3 = document.getElementById(menuItemId3);
			
				linkElement3.style.backgroundColor = "#E9E9E9";
				//linkElement.style.backgroundImage = "url('images/rightArrow.gif')";
				//linkElement3.style.backgroundImageRepeat = "no-repeat";
				linkElement3.style.color = "#003F22";
				//linkElement.style.textDecoration = "underline";
				//linkElement.style.fontWeight = "bold";
				linkElement3.style.borderWidth = "1px";
				linkElement3.style.borderStyle = "solid";
				linkElement3.style.borderColor = "#E9E9E9";
} 


function menuStyleOver(menuItemId0)
{
	
	
		linkElement0 = document.getElementById(menuItemId0);
			
				linkElement0.style.backgroundColor = "#CCFFCC";
				//linkElement.style.backgroundImage = "url('images/rightArrow.gif')";
				//linkElement3.style.backgroundImageRepeat = "no-repeat";
				linkElement0.style.color = "#003F22";
				//linkElement.style.textDecoration = "underline";
				//linkElement.style.fontWeight = "bold";
				linkElement0.style.borderWidth = "1px";
				linkElement0.style.borderStyle = "solid";
				linkElement0.style.borderColor = "#07E989";
}

function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}