// JavaScript Document
// DISABLEDS IE AUTO FILL
  if(window.attachEvent)
    window.attachEvent("onload",setListeners);

  function setListeners(){
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++){
      inputList[i].attachEvent("onpropertychange",restoreStyles);
      inputList[i].style.backgroundColor = "";
    }
    selectList = document.getElementsByTagName("SELECT");
    for(i=0;i<selectList.length;i++){
      selectList[i].attachEvent("onpropertychange",restoreStyles);
      selectList[i].style.backgroundColor = "";
    }
  }

  function restoreStyles(){
    if(event.srcElement.style.backgroundColor != "")
      event.srcElement.style.backgroundColor = "";
  }
  
//RESIZE BROWSER TO FULL SCREEN
if (window != top) top.location.href = location.href;
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight);

//CREATES POP-UP WINDOW
function popupRules() { //v2.0
  window.open('rules.html','rules','width=700,height=500, scrollbars=1 , left='+(screen.width-700)/2+',top='+(screen.height-500)/2+'');
}


//CREATES POP-UP WINDOW
function popupPrize() { //v2.0
  window.open('prizes.html','rules','width=750,height=501, left='+(screen.width-750)/2+',top='+(screen.height-501)/2+'');
}


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;
}




//FORM VALIDATOR
function ValidateForm()
{
	
	
	
	
	
	if (MM_findObj("firstname").value == "") {
		alert("Please Enter Your First Name.");
		MM_findObj("firstname").focus();
		return false;
	}

	
    if (MM_findObj("lastname").value == "") {
		alert("Please Enter Your Last Name.");
		MM_findObj("lastname").focus();
		return false;
	}

	var at = MM_findObj("email").value.indexOf("@");
	var dot = MM_findObj("email").value.lastIndexOf(".");
	if (at < 1 || dot <= at) {
		alert("Please Enter Your Correct Email.");
		MM_findObj("email").focus();
		return false;
	}
	

   if (MM_findObj("gender").selectedIndex == 0){
		alert("Please Enter Your Gender.");
		MM_findObj("gender").focus();
		return false;
	}	

   
   	if (MM_findObj("age").selectedIndex == 0){
		alert("Please Enter Your Age.");
		MM_findObj("age").focus();
		return false;
	}



 	if (MM_findObj("address").value == "") {
		alert("Please Enter Your Address.");
		MM_findObj("address").focus();
		return false;
	}

	
	
	
	
    if (MM_findObj("city").value == "") {
		alert("Please Enter Your City.");
		MM_findObj("city").focus();
		return false;
	}

	
    if (MM_findObj("state").selectedIndex == 0) {
		alert("Please Enter Your State.");
		MM_findObj("state").focus();
		return false;
	}
	

    if (MM_findObj("zipcode").value == ""){
		alert("Please Enter Your Zip Code.");
		MM_findObj("zipcode").focus();
		return false;
	}

	
	if (MM_findObj("phone").value == ""){
		alert("Please Enter Your Phone Number.");
		MM_findObj("phone").focus();
		return false;
	}
	

    
	if (document.EnterSweeps.getmobilenews.checked==true && MM_findObj("mobilephone").value == "Enter Mobile Phone Here") {
	alert("Please Enter Your Mobile Phone Number.");
	MM_findObj("mobilephone").focus();
	return false;
	}
	
	
	
	else{
	return true;
    }

}	



