
function validateForm()
{
var oForm = document.forms["petition"]

if (document.forms["petition"]["add"].checked == false)
  {
  alert("You must check the box indicating that you want your company name added to the list.");
  return false;
  }

var x=document.forms["petition"]["company"].value
if (x==null || x=="")
  {
  alert("Company name must be filled out");
  return false;
  }

	var x=document.forms["petition"]["address"].value
if (x==null || x=="")
  {
  alert("Address must be filled out");
  return false;
  }

	var x=document.forms["petition"]["name"].value
if (x==null || x=="")
  {
  alert("Contact Person must be filled out");
  return false;
  }

	var x=document.forms["petition"]["email"].value
if (x==null || x=="")
  {
  alert("Contact Email must be filled out");
  return false;
  }

		var x=document.forms["petition"]["phone"].value
if (x==null || x=="")
  {
  alert("Contact Phone number must be filled out");
  return false;
  }


if (document.forms["petition"]["public"].checked == false)
  {
  alert("This letter and the names of the Companies and People signing the letter MUST be public. If you agree to these terms, please check the box confirming 'My Support Can Be Made Public'.");
  return false;
  }
	
var x=document.forms["petition"]["email"].value
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
  {
  alert("Please enter a valid e-mail address");
  return false;
  }	

	 oForm.submit()	
	
}

function Show(sId)
{
 var oNode = document.getElementById(sId)
 if (oNode.style.display=="block")
 		oNode.style.display="none"
 else if (oNode.style.display=="none")
 		oNode.style.display="block"
 else
 		 oNode.style.display="block"
}

var sFilter="";
var sMoz="";
var sOpacity="";
function NoFilter(sId)
{
 var oNode = document.getElementById(sId)

 if (oNode)
 {

  sFilter=oNode.style.filter;
  sMoz=oNode.style.opacity;

 oNode.style.filter="alpha(opacity=100)"
 oNode.style.opacity="1"
// oNode.style.-moz-opacity="1"
 
 }

}

function ReFilter(sId,sVal)
{
 var oNode = document.getElementById(sId)
 if (oNode)
 {

 oNode.style.filter="alpha(opacity="+sVal+")"
 oNode.style.opacity="."+sVal
// oNode.style.-moz-opacity=".100"
 
 }

}

/*
onerror=handleErr
var txt=""

function handleErr(msg,url,l)
{
txt="There was an error on this page.\n\n"
txt+="Error: " + msg + "\n"
txt+="URL: " + url + "\n"
txt+="Line: " + l + "\n\n"
txt+="Click OK to continue.\n\n"
alert(txt)
return true
}
*/

function ShowHideById(elementID,bDrag) {
  if (document.getElementById(elementID).style.display=='none'||document.getElementById(elementID).style.display=='')
  {document.getElementById(elementID).style.display='block'}
  else
  {document.getElementById(elementID).style.display='none'}
}


function expandById(elementID){
document.getElementById(elementID).style.display='none'
}

function expandById(elementID){
document.getElementById(elementID).style.display='block'
}

var newwindow;
function OpenInNewWindow(img,title,lheight,lwidth)
{
	newwindow=window.open("",'name','left=40,top=60,height=1,width=1,scrollbars=1');
	if (window.focus) {newwindow.focus()}

	newwindow.document.write("<HTML>")
	newwindow.document.write("<TITLE>"+title+"</TITLE>")
	newwindow.document.write("<BODY>")
	newwindow.document.write("<p align='center'><img src='"+img+"'></p>")
	newwindow.document.write("</BODY>")
	newwindow.document.write("</HTML>")
	newwindow.resizeBy(lwidth-60,lheight-76)

}

var newwindow2;
function OpenInNewWindow2(text,title)
{
	newwindow2=window.open("",'name','left=40,top=60,height=200,width=300,scrollbars=1');
	if (window.focus) {newwindow2.focus()}

	newwindow2.document.write("<HTML>")
	newwindow2.document.write("<TITLE>"+title+"</TITLE>")
	newwindow2.document.write("<BODY>")
	newwindow2.document.write("<h3>"+title+"</h3>")
	newwindow2.document.write("<p>"+text+"</p>")
	newwindow2.document.write("</BODY>")
	newwindow2.document.write("</HTML>")
}

var urlwindow;
function OpenUrlInNewWindow(url,lheight,lwidth)
{
	urlwindow=window.open(url,'name','height=1,width=1,scrollbars=1');
	urlwindow.resizeTo(lwidth,lheight);
	if (window.focus) {urlwindow.focus()}
}

function help_popup(form,context)
{
var file="help_popup.php?form=" + form+"&context="+context;
window.open(file,"Help","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=550,height=200,location=no,directories=no,scrollbars=yes");
}

function colorLinks(oClickedLink)
{
 	//this clears the colors from all the main header links and colors in the clicked link
  oClickedLink.style.color='#FF9933'
  oLinkHeader = document.getElementById('header-links')
  oLinks = oLinkHeader.getElementsByTagName('a')
  oLinks[0].style.color='#FFFFFF';
  oLinks[1].style.color='#FFFFFF';
  oLinks[2].style.color='#FFFFFF';
  oLinks[3].style.color='#FFFFFF';
//  oLinks[4].style.color='#FFFFFF';
//  oLinks[5].style.color='#FFFFFF';
  oClickedLink.style.color='#FF9933'
 
}

