function changeInputType(id,type){
	var focus_val = '';
	var blur_val = '';
	var curr_input = document.getElementById(id);
	// create new input
	var new_input = document.createElement('input');
	new_input.type = type;
	if(type == 'password'){
		new_input.value = '';
		blur_val = 'text';
	} else {
		new_input.value = id.replace(/_/," ");
		focus_val = 'password';
	}
	new_input.className = 'text';
	new_input.name = id;
	new_input.id = id;
	
	if(type == 'password'){
		//new_input.setAttribute("onblur","if(this.value == '') changeInputType('login_pass','" + blur_val + "');");
		new_input.onblur = function(){if(this.value == '') changeInputType(id,blur_val);}
	} else {
		//new_input.setAttribute("onfocus","if(this.value == 'password') changeInputType('login_pass','" + focus_val + "');");
		new_input.onfocus = function(){if(this.value == id.replace(/_/," ")) changeInputType(id,focus_val);}
	}
	curr_input.parentNode.replaceChild(new_input,curr_input);
	if(type == 'password'){
		setTimeout("document.getElementById('" + id + "').focus();", 100);
	}
}

function submit_search(){
	document.getElementById('set_q').value = document.getElementById('get_q').value;
	document.getElementById('cse-search-box').submit();
}

function openPlayer(player,filename){
	if(player == "video"){
		width = 640;
		height = 525;
	} else {
		width = 640;
		height = 43;
	}
	window.open("/include/popup_player.php?vars=" + player + "," + filename,player + "_player","menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,height=" + height + ",width=" + width + ",resizable=yes,fullscreen=no");
}

function checkOptinSubmit(){
	var fname = document.getElementById("LeadGen_ContactForm_14432_m0_FirstName").value;
	var lname = document.getElementById("LeadGen_ContactForm_14432_m0_LastName").value;
	var email = document.getElementById("LeadGen_ContactForm_14432_m0_Email").value;
	
	if(fname != "" && fname != 'first' && lname != "" && lname != "last" && email != "" && email != "email"){
		return true;
	} else {
		alert("First name, last name and email are required.");
		return false;
	}
}

function checkForAlert(){
	if(document.getElementById('alerts')){
		alertTimeout = setTimeout("animatedcollapse.hide('alerts');", 10000);
	}
}