
function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


function CheckNewLetter(){
	//initialize
	var problem='no';
	var message='There is a problem with the following fields\n';

	if (document.newletter.letter_letter.value == 0){
		message+='Letter?\n';
		problem='yes';
	}
	if (document.newletter.png_image.value == 0 || document.newletter.png_image.selectedIndex == 0){
		message+='png image\n';
		problem='yes';
	}
	
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.newletter.letter_letter.value.match(alphaExp)){
		
	}else{
		message+='Must be a letter or number\n';
		problem='yes';
	}

	
	
	if(problem=='no'){
		return true;
	}else{
		alert(message);
		return false;
	}

}

function CheckNewUser(){
	//initialize
	var problem='no';
	var message='There is a problem with the following fields\n';

	if (document.new_user.user_first_name.value == 0){
		message+='First Name\n';
		problem='yes';
	}
	if (document.new_user.user_last_name.value == 0){
		message+='Last Name\n';
		problem='yes';
	}
	if (document.new_user.user_favorite_letter.value == 0){
		message+='Favorite Letter\n';
		problem='yes';
	}
	
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.new_user.user_favorite_letter.value.match(alphaExp)){
		
	}else{
		message+='Favorite letter/number must be a letter or number\n';
		problem='yes';
	}
	
	if (document.new_user.user_email.value == 0){
		message+='Email\n';
		problem='yes';
	}
	if (document.new_user.user_password.value == 0){
		message+='Password\n';
		problem='yes';
	}
	
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.new_user.user_password.value.match(alphaExp)){
		
	}else{
		message+='Password must contain only letters and numbers\n';
		problem='yes';
	}
	
	if (document.new_user.form_anti_bot.value == 0){
		message+='Anti-Spam Text\n';
		problem='yes';
	}
	if(document.new_user.user_url.value.length > 1){
		var the_headline_link=/\b^(http\:\/\/)/
		if (document.new_user.user_url.value.search(the_headline_link) == -1 ){
			message+='The URL must begin with http://\n';
			problem='yes';
		}
	}
	

	

	
	
	if(problem=='no'){
		return true;
	}else{
		alert(message);
		return false;
	}

}

function CheckEditProfile(){
	//initialize
	var problem='no';
	var message='There is a problem with the following fields\n';

	if (document.new_user.user_first_name.value == 0){
		message+='First Name\n';
		problem='yes';
	}
	if (document.new_user.user_last_name.value == 0){
		message+='Last Name\n';
		problem='yes';
	}
	if (document.new_user.user_favorite_letter.value == 0){
		message+='Favorite Letter\n';
		problem='yes';
	}
	if (document.new_user.user_email.value == 0){
		message+='Email\n';
		problem='yes';
	}
	if (document.new_user.user_password.value == 0){
		message+='Password\n';
		problem='yes';
	}
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.new_user.user_password.value.match(alphaExp)){
		
	}else{
		message+='Password must contain only letters and numbers\n';
		problem='yes';
	}
	
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.new_user.user_favorite_letter.value.match(alphaExp)){
		
	}else{
		message+='Favorite letter/number must be a letter or number\n';
		problem='yes';
	}
	
	
	
	if(document.new_user.user_url.value.length > 1){
		var the_headline_link=/\b^(http\:\/\/)/
		if (document.new_user.user_url.value.search(the_headline_link) == -1 ){
			message+='The URL must begin with http://\n';
			problem='yes';
		}
	}
	

	if(problem=='no'){
		return true;
	}else{
		alert(message);
		return false;
	}

}



function toggleBox(obj,thestate) {
	var el = document.getElementById(obj);
	if ( thestate == 0 ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = 'block';
	}
}

function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}


function toggleBox(obj,thestate) {
	var el = document.getElementById(obj);
	if ( thestate == 0 ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function switchMenu(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != "none" ) {
		el.style.display = 'none';
	}
	else {
		el.style.display = '';
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function adminCheckNewLetter(){
	//initialize
	var problem='no';
	var message='There is a problem with the following fields\n';

	if (document.newletter.letter_letter.value == 0){
		message+='Letter?\n';
		problem='yes';
	}

	
	// If the element's string matches the regular expression it is numbers and letters
	var alphaExp = /^[0-9a-zA-Z]+$/;
	if(document.newletter.letter_letter.value.match(alphaExp)){
		
	}else{
		message+='Must be a letter or number\n';
		problem='yes';
	}

	
	
	if(problem=='no'){
		return true;
	}else{
		alert(message);
		return false;
	}

}



