var c=0;
var t;
function timedCount()
{
document.getElementById('txt').value=5-c;
c=c+1;
t=setTimeout("timedCount()",1000);
if (c < 5)
{
document.getElementById('wm').innerHTML="<font size='4' color='blue'><b> Count-Down to Action<b>";
}

if (c > 5) 
{
document.getElementById('wm').innerHTML="<font size='5' color='blue'><b> Help Your Union!!<b>";
document.getElementById('txt').value='Get Involved!!';
}
if (c > 8)
{
document.getElementById('wm').innerHTML="<font  size='7'color='red'><b> Support The Employee Free Choice Act! <b>";
}
if (c > 11)
{
document.getElementById('wm').innerHTML="<font size='5' color='blue'><b> Get Involved!!<b>";
}
if (c > 14)
{
document.getElementById('wm').innerHTML="<font  size='7'color='red'><b> More Information Soon!!<b>";
}
if (c > 20)
{
document.getElementById('wm').innerHTML="<font size='5' color='blue'><b> You are Going to Be Redirected to Our Main Site<b>";
}
if (c > 24)
{
t=0
c=24
window.location = "HTTP://www.ibewlu380.com";
}

}

function submitCount()
{

c=c+1;
t=setTimeout("submitCount()",1000);
if (c < 5)
{

document.getElementById('wm').innerHTML="<font size='3' color='blue'><b><a href='HTTP://www.lu380ibew.com/FileUpload.html'>Click here to Return to File Submission Page</a><br /><br /><a href='HTTP://www.ibewlu380.com'>Click here to go to www.IBEWLU380.com</a><br /><br /><b> <font size='4' color='blue'><b> Thanks For Participating<b>";
}


if (c > 5) 
{

document.getElementById('wm').innerHTML="<font size='3' color='blue'><b><a href='HTTP://www.lu380ibew.com/FileUpload.html'>Click here to Return to File Submission Page</a><br /><br /><a href='HTTP://www.ibewlu380.com'>Click here to go to www.IBEWLU380.com</a><br /><br /><b><font size='5' color='blue'><b> Deadline For Submissions is November 30Th, 2009!!<b>";
}
if (c > 11)
{
document.getElementById('wm').innerHTML="<font size='3' color='blue'><b><a href='HTTP://www.lu380ibew.com/FileUpload.html'>Click here to Return to File Submission Page</a><br /><br /><a href='HTTP://www.ibewlu380.com'>Click here to go to www.IBEWLU380.com</a><br /><br /><b><font size='5' color='blue'><b> Vote Deadline is January 31, 2009!!<b>";
}
if (c > 14)
{
document.getElementById('wm').innerHTML="<font size='3' color='blue'><b><a href='HTTP://www.lu380ibew.com/FileUpload.html'>Click here to Return to File Submission Page</a><br /><br /><a href='HTTP://www.ibewlu380.com'>Click here to go to www.IBEWLU380.com</a><br /><br /><b><font  size='7'color='red'><b> Good Luck!!!!<b>";
}
if (c > 20)
{
document.getElementById('wm').innerHTML="<font size='4' color='blue'><b><a href='HTTP://www.lu380ibew.com/FileUpload.html'>Click here to Return to File Submission Page</a><br /><br /><a href='HTTP://www.ibewlu380.com'>Click Here to go to www.IBEWLU380.com</a><br /><b>";
}
if (c > 40)
{
t=0
c=40
window.location = "HTTP://www.ibewlu380.com";
}

}

window.onload = initForms;

function initForms() {
	for (var i=0; i< document.forms.length; i++) {
		document.forms[i].onsubmit = function() {return validForm();}
	}
}

function validForm() {
	var allGood = true;
	var allTags = document.getElementsByTagName("*");

	for (var i=0; i<allTags.length; i++) {
		if (!validTag(allTags[i])) {
			allGood = false;
		}
	}
	return allGood;

	function validTag(thisTag) {
		var outClass = "";
		var allClasses = thisTag.className.split(" ");
	
		for (var j=0; j<allClasses.length; j++) {
			outClass += validBasedOnClass(allClasses[j]) + " ";
		}
	
		thisTag.className = outClass;
	
		if (outClass.indexOf("invalid") > -1) {
			invalidLabel();
			thisTag.focus();
			if (thisTag.nodeName == "INPUT") {
				thisTag.select();
			}
			return false;
		}
		return true;
		
		function validBasedOnClass(thisClass) {
			var classBack = "";
		
			switch(thisClass) {
				case "":
				case "invalid":
					break;
				case "reqd":
					if (allGood && thisTag.value == "") classBack = "invalid ";
					classBack += thisClass;
					break;
				case "email":
					if (allGood && !validEmail(thisTag.value)){ classBack = "invalid ";
					}
					classBack += thisClass;
					break;

				case "phone":
					if (allGood && !validPhone(thisTag.value)){ classBack = "invalid ";
					}
					classBack += thisClass;
					break;
				default:
					if (allGood && !crossCheck(thisTag,thisClass)) classBack = "invalid ";
					classBack += thisClass;
			}
			return classBack;
		}
		
		function validEmail(email) {
			if (email == ""){
			return false;
			}
			var re = /^\w+([\.-]?\w+)*@\w+([.-]?w+)*(\.\w{2,4})+$/;
			return re.test(email);
		}
		
		function validPhone(phoneNum) {
			var re = /^\(?(\d{3})\)?[\.\-\/ ]?(\d{3})[\.\-\/ ]?(\d{4})$/;

			var phoneArray = re.exec(phoneNum);
			if (phoneArray) {
				document.getElementById("phone").value = "(" + phoneArray[1] + ") " + phoneArray[2] + "-" + phoneArray[3];
				return true;
			}
			return false;
		}		

		function crossCheck(inTag,otherFieldID) {
			if (!document.getElementById(otherFieldID)) return false;
			return (inTag.value == document.getElementById(otherFieldID).value);
		}
		
		function invalidLabel() {
			if (document.getElementById("FIELDSET")) {
				document.getElementById("FIELDSET").className += " invalid";
				document.getElementById("LEGEND").className += " invalid";
			}
			
			
			
			
		}
	}
}

						
