//Jesse Jackson Jr. JavaScript Document
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_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 placeImage(x,mode)
{
		if(x==1 && mode=="in")
		{
			document.getElementById("volunteer").style.backgroundImage = "url(grfx/btnVolunteerOver.gif)";
			document.getElementById("volunteer").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}
		else if(x==1 && mode=="out")
		{
			document.getElementById("volunteer").style.backgroundImage = "url(grfx/btnVolunteerOut.gif)";
			document.getElementById("volunteer").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}
		else if(x==2 && mode=="in")
		{
			document.getElementById("join").style.backgroundImage = "url(grfx/btnJoinOver.gif)";
			document.getElementById("join").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}	
	
		else if(x==2 && mode=="out")
		{
			document.getElementById("join").style.backgroundImage = "url(grfx/btnJoinOut.gif)";
			document.getElementById("join").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}
	
	
	else if(x==3 && mode=="in")
		{
			document.getElementById("attend").style.backgroundImage = "url(grfx/btnAttendOver.gif)";
			document.getElementById("attend").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}	
	
		else if(x==3 && mode=="out")
		{
			document.getElementById("attend").style.backgroundImage = "url(grfx/btnAttendOut.gif)";
			document.getElementById("attend").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}
	
	
	else if(x==4 && mode=="in")
		{
			document.getElementById("submit").style.backgroundImage = "url(grfx/btnSubmitOver.gif)";
			document.getElementById("submit").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}	
	
		else if(x==4 && mode=="out")
		{
			document.getElementById("submit").style.backgroundImage = "url(grfx/btnSubmitOut.gif)";
			document.getElementById("submit").style.backgroundRepeat = "no-repeat";
			//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
		}
	
}
function loadImages()
{
	document.getElementById("volunteer").style.backgroundImage = "url(grfx/btnVolunteerOut.gif)";
	document.getElementById("volunteer").style.backgroundRepeat = "no-repeat";
	//document.getElementById("volunteer").style.backgroundAttachment = "fixed";
	document.getElementById("join").style.backgroundImage = "url(grfx/btnJoinOut.gif)";
	document.getElementById("join").style.backgroundRepeat = "no-repeat";
	
	document.getElementById("attend").style.backgroundImage = "url(grfx/btnAttendOut.gif)";
	document.getElementById("attend").style.backgroundRepeat = "no-repeat";
	
	document.getElementById("submit").style.backgroundImage = "url(grfx/btnSubmitOut.gif)";
	document.getElementById("submit").style.backgroundRepeat = "no-repeat";
}

function mytrim(val)
{
		val1 = "";
		val2="";
		ctrr = 0;
		lngth = val.length;
		for (i=0; i<lngth; i++)
		{
		if (val.charCodeAt(i) != 32)
		{
		for(j=i;j<lngth;j++)
		{
		if (val.charCodeAt(j) != 13 && val.charCodeAt(j) != 10 )
			{
			val1 += val.charAt(j);
			}
		}
		break;
		}
		}
		if (val1 != "")
		{
		lngth = val1.length
		ctrr=lngth;
		for (k=0; k<lngth; k++)
		{
		ctrr=ctrr-1;
		if (val1.charCodeAt(ctrr) != 32)
		{
		for(l=0;l<lngth-k;l++)
		{
		val2 += val1.charAt(l);
		}
		val1=val2;
		break;
		}
		}
		}
		return val1;
}
function IsNumeric(sText)
 {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

 }
 function chkemail(email)
{
	var emailvalid=true;

		if (email.value.length < 5)
		{
			emailvalid=false;
		}
		else
		{

			var flag = "false";
			var flag1 = "false";
			var flag2="true";
			for (var i = 1; i < email.value.length; i++)
			{
				var ch = email.value.substring(i, i + 1);
				if (ch == ".")
				{
					flag = "true";
				}
				if (ch == "@")
				{
					flag1 = "true";
				}
				if (ch==" ")
				{
					flag2="false";
				}

			}
			if (flag == "false" || flag1 == "false" || flag2 == "false")
			{
				emailvalid=false;
			}
		}
		return emailvalid;
}

function emptyvalueSignUp(x1) {

 if(x1.value=="Email" || x1.value=="Zip Code") {
  pretext1=x1.value;
  	
  x1.style.color='#000000';
  x1.value="";
 } else {

  switch(x1.name) {
  
	case "c__sValue":
    pretext1="Email";
    break;
   case "cf_4__sValue":
    pretext1="Zip Code";
    break;
   
   default: pretext1="";
  }
 }
}



function emptyvalue(x1) {

 if(x1.value=="First Name" || x1.value=="Last Name"  || x1.value=="Email Address" || x1.value=="Street Address" || x1.value=="City" || x1.value=="Cell Phone" || x1.value=="Zip Code"  || x1.value=="Event Name" || x1.value=="Event Date" || x1.value=="Event Time") {
  pretext=x1.value;
  	
  x1.style.color='#000000';
  x1.value="";
 } else {

  switch(x1.name) {
  
	case "firstname":
    pretext="First Name";
    break;
   case "lastname":
    pretext="Last Name";
    break;
   case "email":
    pretext="Email Address";
    break;
   case "address":
    pretext="Street Address";
    break;	
  
   case "city":
    pretext="City";
    break;
	
	 case "zip":
    pretext="Zip Code";
    break;
   case "phone":
    pretext="Cell Phone";
    break;
	
	
  
   default: pretext="";
  }
 }
}

function fillvalue(x1) {
 if (x1.value=="") {
  x1.style.color = '#000000';
  x1.value = pretext;
 }
}

function fillvalueSignUp(x1) {
 if (x1.value=="") {
  x1.style.color = '#000000';
  x1.value = pretext1;
 }
}
function validateVoterShoutBox()
{
	if(mytrim(document.frmvotershoutbox.firstname.value)=="" || mytrim(document.frmvotershoutbox.firstname.value)=="First Name")
		{
			  alert("Please enter first name");
			  document.frmvotershoutbox.firstname.focus();
			  return false;
		}
		if(mytrim(document.frmvotershoutbox.lastname.value)=="" || mytrim(document.frmvotershoutbox.lastname.value)=="Last Name")
		{
			  alert("Please enter last name");
			  document.frmvotershoutbox.lastname.focus();
			  return false;
		}
		if(mytrim(document.frmvotershoutbox.address.value)=="" || mytrim(document.frmvotershoutbox.address.value)=="Street Address")
		{
			  alert("Please enter street address");
			  document.frmvotershoutbox.address.focus();
			  return false;
		}
		if(mytrim(document.frmvotershoutbox.selectstate.value)=="")
		{
			  alert("Please select state/province");
			  document.frmvotershoutbox.selectstate.focus();
			  return false;
		}
		if(mytrim(document.frmvotershoutbox.city.value)=="" || mytrim(document.frmvotershoutbox.city.value)=="City")
		{
			  alert("Please enter city");
			  document.frmvotershoutbox.city.focus();
			  return false;
		}
		
		var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
		if (!(chkFilter.test(document.frmvotershoutbox.email.value))) {
			  alert("Please enter a valid email address");
			  document.frmvotershoutbox.email.focus();
			  return false;
		}
		
		if (mytrim(document.frmvotershoutbox.comment.value)=="")
		{
			alert("Please enter comments below 1000 words.");
			document.frmvotershoutbox.comment.focus();
			return false;
			
		}
		if (document.frmvotershoutbox.comment.value.length>1000)
			{
				alert("Please enter comments below 1000 words.");
				document.frmvotershoutbox.comment.focus();
				return false;
			}
}
function validateVolunteer()
{
	if(mytrim(document.volunteer.firstname.value)=="" || mytrim(document.volunteer.firstname.value)=="First Name")
		{
			  alert("Please enter first name");
			  document.volunteer.firstname.focus();
			  return false;
		}
		if(mytrim(document.volunteer.lastname.value)=="" || mytrim(document.volunteer.lastname.value)=="Last Name")
		{
			  alert("Please enter last name");
			  document.volunteer.lastname.focus();
			  return false;
		}
		if(mytrim(document.volunteer.address.value)=="" || mytrim(document.volunteer.address.value)=="Street Address")
		{
			  alert("Please enter street address");
			  document.volunteer.address.focus();
			  return false;
		}
		if(mytrim(document.volunteer.state.value)=="")
		{
			  alert("Please select state/province");
			  document.volunteer.state.focus();
			  return false;
		}
		if(mytrim(document.volunteer.city.value)=="" || mytrim(document.volunteer.city.value)=="City")
		{
			  alert("Please enter city");
			  document.volunteer.city.focus();
			  return false;
		}
		if(mytrim(document.volunteer.zip.value)=="" || mytrim(document.volunteer.zip.value)=="Zip Code")
		{
			  alert("Please enter zip code");
			  document.volunteer.zip.focus();
			  return false;
		}
		if (!IsNumeric(document.volunteer.zip.value))
		{
			alert("Please enter valid zip");
			document.volunteer.zip.focus();
			return false;
		}
		if (document.volunteer.zip.value.length<5)
		{
			alert("Please enter valid zip");
			document.volunteer.zip.focus();
			return false;
		}
		var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
		if (!(chkFilter.test(document.volunteer.email.value))) {
			  alert("Please enter a valid email address");
			  document.volunteer.email.focus();
			  return false;
		}
		if(mytrim(document.volunteer.phone.value)=="" || mytrim(document.volunteer.phone.value)=="Cell Phone")
		{
			  alert("Please enter cell phone");
			  document.volunteer.phone.focus();
			  return false;
		}
		if (!IsNumeric(document.volunteer.phone.value))
		{
			alert("Please enter cell phone");
			document.volunteer.phone.focus();
			return false;
		}
		if (mytrim(document.volunteer.comments.value)=="")
		{
			alert("Please enter comments below 1000 words.");
			document.volunteer.comments.focus();
			return false;
			
		}
		if (document.volunteer.comments.value.length>1000)
			{
				alert("Please enter comments below 1000 words.");
				document.volunteer.comments.focus();
				return false;
			}
}
function ValidateEmailSignUp()
{
	var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
	if (!(chkFilter.test(document.IBNSubscribe.email__sValue.value))) {
		  alert("Please enter a valid email");
		  document.IBNSubscribe.email__sValue.focus();
		  return false;
	}
	if (mytrim(document.IBNSubscribe.cf_4__sValue.value)=="")
	{
		alert("Please Enter Zip");
		document.IBNSubscribe.cf_4__sValue.focus();
		return false;
	}
	if (!IsNumeric(document.IBNSubscribe.cf_4__sValue.value))
	{
		alert("Please enter valid zip");
		document.IBNSubscribe.cf_4__sValue.focus();
		return false;
	}
	if (document.IBNSubscribe.cf_4__sValue.value.length<5)
	{
		alert("Please enter valid zip");
		document.IBNSubscribe.cf_4__sValue.focus();
		return false;
	}
}
function validateContact()
{
	if(mytrim(document.contact.firstname.value)=="" || mytrim(document.contact.firstname.value)=="First Name")
		{
			  alert("Please enter first name");
			  document.contact.firstname.focus();
			  return false;
		}
		if(mytrim(document.contact.lastname.value)=="" || mytrim(document.contact.lastname.value)=="Last Name")
		{
			  alert("Please enter last name");
			  document.contact.lastname.focus();
			  return false;
		}
		if(mytrim(document.contact.address.value)=="" || mytrim(document.contact.address.value)=="Street Address")
		{
			  alert("Please enter street address");
			  document.contact.address.focus();
			  return false;
		}
		if(mytrim(document.contact.state.value)=="")
		{
			  alert("Please select state/province");
			  document.contact.state.focus();
			  return false;
		}
		if(mytrim(document.contact.city.value)=="" || mytrim(document.contact.city.value)=="City")
		{
			  alert("Please enter city");
			  document.contact.city.focus();
			  return false;
		}
		if(mytrim(document.contact.zip.value)=="" || mytrim(document.contact.zip.value)=="Zip Code")
		{
			  alert("Please enter zip code");
			  document.contact.zip.focus();
			  return false;
		}
		if (!IsNumeric(document.contact.zip.value))
		{
			alert("Please enter valid zip");
			document.contact.zip.focus();
			return false;
		}
		if (document.contact.zip.value.length<5)
		{
			alert("Please enter valid zip");
			document.contact.zip.focus();
			return false;
		}
		var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
		if (!(chkFilter.test(document.contact.email.value))) {
			  alert("Please enter a valid email address");
			  document.contact.email.focus();
			  return false;
		}
		if(mytrim(document.contact.phone.value)=="" || mytrim(document.contact.phone.value)=="Cell Phone")
		{
			  alert("Please enter cell phone");
			  document.contact.phone.focus();
			  return false;
		}
		if (!IsNumeric(document.contact.phone.value))
		{
			alert("Please enter cell phone");
			document.contact.phone.focus();
			return false;
		}
		if (mytrim(document.contact.comments.value)=="")
		{
			alert("Please enter comments below 1000 words.");
			document.contact.comments.focus();
			return false;
			
		}
		if (document.contact.comments.value.length>1000)
			{
				alert("Please enter comments below 1000 words.");
				document.contact.comments.focus();
				return false;
			}
}
function validateProblem()
{
	if(mytrim(document.problem.firstname.value)=="" || mytrim(document.problem.firstname.value)=="First Name")
		{
			  alert("Please enter first name");
			  document.problem.firstname.focus();
			  return false;
		}
		if(mytrim(document.problem.lastname.value)=="" || mytrim(document.problem.lastname.value)=="Last Name")
		{
			  alert("Please enter last name");
			  document.problem.lastname.focus();
			  return false;
		}
		if(mytrim(document.problem.address.value)=="" || mytrim(document.problem.address.value)=="Street Address")
		{
			  alert("Please enter street address");
			  document.problem.address.focus();
			  return false;
		}
		if(mytrim(document.problem.state.value)=="")
		{
			  alert("Please select state/province");
			  document.problem.state.focus();
			  return false;
		}
		if(mytrim(document.problem.city.value)=="" || mytrim(document.problem.city.value)=="City")
		{
			  alert("Please enter city");
			  document.problem.city.focus();
			  return false;
		}
		if(mytrim(document.problem.zip.value)=="" || mytrim(document.problem.zip.value)=="Zip Code")
		{
			  alert("Please enter zip code");
			  document.problem.zip.focus();
			  return false;
		}
		if (!IsNumeric(document.problem.zip.value))
		{
			alert("Please enter valid zip");
			document.problem.zip.focus();
			return false;
		}
		if (document.problem.zip.value.length<5)
		{
			alert("Please enter valid zip");
			document.problem.zip.focus();
			return false;
		}
		var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
		if (!(chkFilter.test(document.problem.email.value))) {
			  alert("Please enter a valid email address");
			  document.problem.email.focus();
			  return false;
		}
		if(mytrim(document.problem.phone.value)=="" || mytrim(document.problem.phone.value)=="Cell Phone")
		{
			  alert("Please enter cell phone");
			  document.problem.phone.focus();
			  return false;
		}
		if (!IsNumeric(document.problem.phone.value))
		{
			alert("Please enter cell phone");
			document.problem.phone.focus();
			return false;
		}
		if (mytrim(document.problem.comments.value)=="")
		{
			alert("Please enter comments below 1000 words.");
			document.problem.comments.focus();
			return false;
			
		}
		if (document.problem.comments.value.length>1000)
			{
				alert("Please enter comments below 1000 words.");
				document.problem.comments.focus();
				return false;
			}
}
function showdiv()
{
	var k,k1;
	var d = document.getElementById('txtcomments');
	k1=getPosition(d);
	k=k1.split(",");


	
	
	document.getElementById('smilies').style.position = "absolute";
	document.getElementById('smilies').style.top = k[1]+"px";
	document.getElementById('smilies').style.left = k[0]+"px";
	
		document.getElementById('smilies').style.visibility = 'visible'; 
	

}
function hidediv()
{
	document.getElementById('smilies').style.visibility = 'hidden'; 
}
function insertsmile(smile)
{
	var insertS;
	if (document.getElementById('txtcomments').value=="")
	{
		insertS=smile;
	}
	else
	{
		insertS=" "+smile;
	}	
	document.getElementById('txtcomments').value=document.getElementById('txtcomments').value+insertS;
	hidediv();
}
function getPosition(obj){
    var topValue= 0,leftValue= 0;
    while(obj){
	leftValue+= obj.offsetLeft;
	topValue+= obj.offsetTop;
	obj= obj.offsetParent;
    }
    finalvalue = leftValue + "," + topValue;
    return finalvalue;
}