$(document).ready(function(){
	$("img.rollover").hover(
	 function(){ this.src = this.src.replace("_off","_on"); },
	 function(){ this.src = this.src.replace("_on","_off"); }
	);
});

function submitContest(){
	loaderContainer = document.getElementById('loader');
	loaderContainer.style.display = "block";
	clearBtn = document.getElementById('clearMedia');
	clearBtn.setAttribute('disabled', 'disabled');
	addPhotoBtn = document.getElementById('addPhoto');
	addPhotoBtn.setAttribute('disabled', 'disabled');
	
	formContainer = document.getElementById('contest-form');
	formContainer.submit();
	return false;
}

function submitForm(){
	formContainer = document.getElementById('contest-form');
	formContainer.submit();
	return false;	
}

function resetMedia(){
	mediaContainer = document.getElementById("mediaInput");
	mediaContainer.innerHTML = '<li><label for="video">VIDEO UPLOAD</label><input class="file" type="file" name="video" /> <span style="font-size:10px;">(20 MB max)</span></li><li><label for="image">PHOTO UPLOAD</label><input class="file" type="file" name="image[]" /> <span style="font-size:10px;">(1 MB max)</span></li>';
	moreContainer = document.getElementById('morePhotos');
	moreContainer.innerHTML = '';
	addPhotoBtn = document.getElementById("addPhoto");
	addPhotoBtn.removeAttribute('disabled', 'disabled');
	inputCount = 0;
}

inputCount = 0;
function addAnotherPhoto() {
	inputCount++;
	div = document.getElementById('morePhotos');
	if(inputCount < 5){
		div.innerHTML += '<li><label for="image">PHOTO UPLOAD</label><input class="file" type="file" name="image[]" /></li>';
	}else{
		addPhotoBtn = document.getElementById('addPhoto');
		addPhotoBtn.setAttribute('disabled', 'disabled');
	}
}

/* DISABLE GOOGLE */
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jon Jensen | http://code.jenseng.com/google/ */

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 != "#a0d0ff"){
    event.srcElement.style.backgroundColor = "#a0d0ff"; /* color of choice for AutoFill */
    document.all['googleblurb'].style.display = "block";
  }
}