﻿ /****************************************** 
** Title........: Animated Equity 
** Filename.....: jpx.js
** Author.......: Uwe Nausner
** Modified by..: Uwe Nausner 
** Version......: 1.5
** Notes........: JotPal-file JScript File
** File Created.: 04/22/2009
** Last changed.: 06/28/2010
********************************************/


//===== Email validation ====================

function validateEmail(form_id,email) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   var address = document.forms[form_id].elements[email].value;
   if(reg.test(address) == false) {
      alert('Invalid Email Address');
      return false;
   }
}

//===========================================



function setFocus(thisfield) {
  document.getElementById(thisfield).focus();
}


//===== ME submit and save functions ==================

function savemeSubmit() {
	document.getElementById("meData").submit()
}


function emailSubmit() {
	document.getElementById("meEmail").submit()
}

//===========================================



//===== Password validation =================

function changePass() {
	
	theForm = document.getElementById("mePassword");
	
	desc_num = theForm.user_password_n.value;
	
	current_pass = theForm.user_password_x.value;
	old_pass_enc = MD5(theForm.user_password.value);

	if (theForm.user_password.value == "") {
   		alert('Please enter your old password.');
		theForm.user_password.focus();
		return (false);
	
	} else if (theForm.user_password_n.value == "") {
   		alert('Please enter a new password.'+current_pass);
		theForm.user_password_n.focus();
		return (false);
	
	} else if (desc_num.length < 6) {
   		alert('Password must be more then 5 characters long. -- Please try again.');
		theForm.user_password_n.focus();
		return (false);
	
	} else if (theForm.user_password_c.value == "") {
   		alert('Please confirm your new password.');
		theForm.user_password_c.focus();
		return (false);
	
	} else if (theForm.user_password_n.value != theForm.user_password_c.value) {
   		alert('New Password and Confirmation did not match. -- Please try again.');
		theForm.user_password_c.focus();
		return (false);

	} else if (current_pass != old_pass_enc) {
   		alert('The old password that you entered is not correct. -- Please try again.');
		theForm.user_password.focus();
		return (false);
	
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}
	
	if (r==true) {	
			
		document.getElementById("mePassword").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}

//===========================================


//===== Forgot Password validation =================

function forgot_Validator(theForm) {

	theForm = document.getElementById("forgot_form");

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

	//var emexist = email_validation('ax=eval&em='+theForm.e_mail_n.value);
				
	if (theForm.e_mail_n.value == "") {
   				
   		alert('Please enter your email address.');
		theForm.e_mail_n.focus();
		return (false);
	
	}
	
	if(reg.test(theForm.e_mail_n.value) == false) {
		alert('Invalid Email Address');
		theForm.e_mail_n.focus();
		return false;
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}
	
	if (r==true) {	
			
		document.getElementById("forgot_form").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}
//=================================================


//===== New Email validation =================

function changeEmail() {
	
	theForm = document.getElementById("meEmail");
	
	current_email = theForm.user_email.value;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	
	if(reg.test(theForm.user_email_n.value) == false) {
		alert('Invalid Email Address');
		theForm.user_email_n.focus();
		return false;
	}

	if(reg.test(theForm.user_email_c.value) == false) {
		alert('Invalid Confirmation Email Address');
		theForm.user_email_c.focus();
		return false;
	}

	if (theForm.user_email_n.value == "") {
   		alert('Please enter the new email.');
		theForm.user_email_n.focus();
		return (false);
	
	} else if (theForm.user_email_c.value == "") {
   		alert('Please confirm your new email.');
		theForm.user_email_c.focus();
		return (false);

	} else if (theForm.user_email_n.value != theForm.user_email_c.value) {
   		alert('New Email and Confirmation did not match. -- Please try again.');
		theForm.user_email_c.focus();
		return (false);
			
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}
	
	if (r==true) {	
			
		document.getElementById("meEmail").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}

//===========================================




//===== Signup Form validation =================

function signupForm() {
	
	theForm = document.getElementById("signup_form");

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;

	var emexist = email_validation('ax=eval&em='+theForm.e_mail_n.value);

	if (theForm.first_name.value == "") {
   		alert('Please enter your First Name.');
		theForm.first_name.focus();
		return (false);
	}

	if (theForm.last_name.value == "") {
   		alert('Please enter your Last Name.');
		theForm.last_name.focus();
		return (false);
	}

	if (theForm.e_mail_n.value == "") {
   		alert('Please enter your E-mail.');
		theForm.e_mail_n.focus();
		return (false);
	}

	if (theForm.e_mail_c.value == "") {
   		alert('Please enter a conformation email.');
		theForm.e_mail_c.focus();
		return (false);
	}

	if (theForm.cp2.checked == false) {
   		alert('Please confirm that you accept our Terms of Use.');
		theForm.cp2.focus();
		return (false);
	}
	
	if(reg.test(theForm.e_mail_n.value) == false) {
		alert('Invalid Email Address');
		theForm.e_mail_n.focus();
		return false;
	}

	if(emexist == true) {
		alert('This Email Address is already taken. Please use another Email.');
		theForm.e_mail_n.focus();
		return false;
	}
	
	
	'The email you have entered is either invalid or already exists in our system. Please check the address. If you already have an account and have forgotten your password, please use the link below the password entry box on the home page to recover your password.'
	if(reg.test(theForm.e_mail_c.value) == false) {
		alert('Invalid Confirmation Email Address');
		theForm.e_mail_c.focus();
		return false;

	} else if (theForm.e_mail_n.value != theForm.e_mail_c.value) {
   		alert('Email and Confirmation did not match. -- Please try again.');
		theForm.e_mail_c.focus();
		return (false);
			
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}

	
	if (r==true) {	
			
		document.getElementById("signup_form").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}


//----- If already a user ------------------------------
function signupFormP() {
	
	theForm = document.getElementById("signup_form");
	
	if (theForm.Password.value == "") {
   		alert('Please enter your password.');
		theForm.Password.focus();
		return (false);
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}

	
	if (r==true) {	
			
		document.getElementById("signup_form").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}


//----- If already a user ------------------------------
function acceptInvitation() {
	
	theForm = document.getElementById("accept_form");
	
	document.getElementById("accept_form").submit()

}

//===========================================


function setFocus(thisfield) {
  document.getElementById(thisfield).focus();
}





//===== JOT FILE ============================

function stepDir(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();

    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_dir_ax.php";
    obj.JSONArray.Querystring = url;
    obj.JSONArray.isEdit[0].value="directoryNavigation";//Textbox id for response
    obj.JSONArray.dependentType=0;//0->Textbox,1->drop downlist,2->default,3->Misc and so on
    obj.init();//Initiate the AjaxCall
 //  }
}

//============================================



//===== JOT JOT ===================================================================
//=================================================================================


//===== Image Roll over ======================

function roll_over(img_name, img_src)  {

	document[img_name].src = img_src;

}




//===== GOALS DISPLAY ====================================================

function goals_display(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();

    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_goals_ax.php";
    obj.JSONArray.Querystring = url;
    obj.JSONArray.isEdit[0].tagId="goals_display";//Textbox id for response
    obj.JSONArray.dependentType=0;//0->Textbox,1->drop downlist,2->default,3->Misc and so on
    obj.init();//Initiate the AjaxCall
 //  }
}


//----- Highlight -- select form field -------

function highlight(thisfield) {
	thisfield.value = "";
	thisfield.focus();
	thisfield.select();
}

function clickrecall(thisfield, defaulttext) {
	if (thisfield.value == "") {
		thisfield.value = defaulttext;
	}
}



//===== PITCH DISPLAY ====================================================

function pitch_display(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();

    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_pitch_ax.php";
    obj.JSONArray.Querystring = url;
    obj.JSONArray.isEdit[0].tagId="pitch_display";//Textbox id for response
    obj.init();//Initiate the AjaxCall

}

function email_validation(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();
	
    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_pitch_ax.php";
    obj.JSONArray.Querystring = url;//Textbox id for response
    obj.JSONArray.isEdit[0].tagId="emex";//Textbox id for response
	obj.init();

 	if (obj.data == "") {
 		return false;
 	} else {
  		return false;
	}	
}



//===== ACTIONS DISPLAY ====================================================

function actions_display(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();

    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_actions_ax.php";
    obj.JSONArray.Querystring = url;
    obj.JSONArray.isEdit[0].tagId="actions_display";//Textbox id for response
    obj.JSONArray.dependentType=0;//0->Textbox,1->drop downlist,2->default,3->Misc and so on
    obj.init();//Initiate the AjaxCall
 //  }
}





//===== ADMIN DISPLAY ====================================================

function admin_display(str) {

	var url="?"+str;
	url=url+"&sid="+Math.random();

    var obj = new AjaxClass(); //Object creation
    obj.JSONArray.CallPage = "/a_jax/jp_admin_ax.php";
    obj.JSONArray.Querystring = url;
    obj.JSONArray.isEdit[0].tagId="admin_display";//Textbox id for response
    obj.JSONArray.dependentType=0;//0->Textbox,1->drop downlist,2->default,3->Misc and so on
    obj.init();//Initiate the AjaxCall
 //  }
}




//----- New Action -- Process Form ------------------------

function actionNew(theForm,str) {

   // var basestr=str+"&u="+theForm.u.value+"&nav="+theForm.vie.value+"&ac_name="+theForm.ac_name.value+"&idx="+theForm.idx.value+"&ac_est="+theForm.ac_est.value;
    var basestr=str+"&u="+theForm.u.value+"&nav="+theForm.vie.value+"&ac_name="+theForm.ac_name.value+"&idx="+theForm.idx.value;

	desc_num = theForm.ac_name.value;
	
	if (theForm.ac_name.value == "" || theForm.ac_name.value == "Enter Action Name") {
   				
   				alert('Please enter a name for your action.');
				theForm.ac_name.focus();
				return (false);
	
	//} else if (theForm.ac_est.value == "" || theForm.ac_est.value == "0.0") {
   				
   	//			alert('Please enter the estimated time for this action.');
	//			theForm.st_est.focus();
	//			return (false);
   			
   	} else if (desc_num.length > 75) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 75 characters.');
				theForm.ac_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		actions_display(basestr+"&ax=ac&post=new_action&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- Edit Action -- Process Form ------------------------

function actionEdit(theForm,str) {

    var basestr=str+"&ac="+theForm.ac.value+"&u="+theForm.u.value+"&ac_name="+theForm.ac_name.value;
	desc_num = theForm.ac_name.value;
	
	if (theForm.ac_name.value == "" || theForm.ac_name.value == "Enter Action Name") {
   				
   				alert('Please enter a name for your action.');
				theForm.ac_name.focus();
				return (false);
	
	} else if (desc_num.length > 75) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 75 characters.');
				theForm.ac_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		actions_display(basestr+"&ax=ac&post=edit_action&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}




//----- DELETE Action -- Process Form ------------------------

function actionDelete(str,alertText) {

    var basestr=str+"&post=delete_action";
	var r=confirm('Are you sure you want to:\n '+alertText);

	if (r==true) {	
			
		actions_display(basestr+"&ax=ac&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- New Step (Task) -- Process Form ------------------------

function processForm(theForm,str) {

    var basestr=str+"&g="+theForm.g.value+"&nav="+theForm.vie.value+"&st_name="+theForm.st_name.value+"&idx="+theForm.idx.value+"&st_est="+theForm.st_est.value+"&lead="+theForm.lead.value;
	desc_num = theForm.st_name.value;
	
	if (theForm.st_name.value == "" || theForm.st_name.value == "Enter Step Name") {
   				
   				alert('Please enter a name for your step.');
				theForm.st_name.focus();
				return (false);
	
	} else if (theForm.st_est.value == "" || theForm.st_est.value == "0.0") {
   				
   				alert('Please enter the estimated time for this step.');
				theForm.st_est.focus();
				return (false);
   			
   	} else if (desc_num.length > 75) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 75 characters.');
				theForm.st_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		goals_display(basestr+"&ax=g&post=new_step&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- Edit Step -- Process Form ------------------------

function processStep(theForm,str) {

    var basestr=str+"&g="+theForm.g.value+"&t="+theForm.t.value+"&vie="+theForm.vie.value+"&st_name="+theForm.st_name.value+"&st_est="+theForm.st_est.value+"&lead="+theForm.lead.value;
	desc_num = theForm.st_name.value;
	
	if (theForm.st_name.value == "" || theForm.st_name.value == "Enter Step Name") {
   				
   				alert('Please enter a name for your step.');
				theForm.st_name.focus();
				return (false);
	
	} else if (theForm.st_est.value == "" || theForm.st_est.value == "0.0") {
   				
   				alert('Please enter the estimated time for this step.');
				theForm.st_est.focus();
				return (false);
   			
   	} else if (desc_num.length > 75) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 75 characters.');
				theForm.st_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		goals_display(basestr+"&ax=g&post=edit_step&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- DELETE Step -- Process Form ------------------------

function deleteStep(str,alertText) {

    var basestr=str+"&post=delete_step";
	var r=confirm('Are you sure you want to:\n '+alertText+'\n WARNING:\nThis will delete all related Log entries!');

	if (r==true) {	
			
		goals_display(basestr+"&ax=g&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}







//----- New Goal -- Process Form ------------------------

function newGoal(theForm,str) {

    var basestr=str+"&g="+theForm.g.value+"&nav="+theForm.nav.value+"&g_name="+theForm.g_name.value+"&g_lead="+theForm.lead.value+"&idx="+theForm.idx.value+"&day="+theForm.day.value+"&mon="+theForm.mon.value+"&yea="+theForm.yea.value;
	desc_num = theForm.g_name.value;
	
	if (theForm.g_name.value == "" || theForm.g_name.value == "Enter Goal Name") {
   				
   				alert('Please enter a name for your goal.');
				theForm.g_name.focus();
				return (false);
   			
   	} else if (desc_num.length > 150) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 150 characters.');
				theForm.g_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		goals_display(basestr+"&ax=g&post=new_goal&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}


//----- Edit Goal -- Process Form ------------------------

function editGoal(theForm,str) {

    var basestr=str+"&g="+theForm.g.value+"&nav="+theForm.nav.value+"&g_name="+theForm.g_name.value+"&g_lead="+theForm.lead.value+"&idx="+theForm.idx.value+"&day="+theForm.day.value+"&mon="+theForm.mon.value+"&yea="+theForm.yea.value;
	desc_num = theForm.g_name.value;
	
	if (theForm.g_name.value == "" || theForm.g_name.value == "Enter Goal Name") {
   				
   				alert('Please enter a name for your goal.');
				theForm.g_name.focus();
				return (false);
   			
   	} else if (desc_num.length > 150) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 150 characters.');
				theForm.g_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		goals_display(basestr+"&ax=g&post=edit_goal&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}




//----- DELETE Goal -- Process Form ------------------------

function deleteGoal(str,alertText) {

    var basestr=str+"&post=delete_goal";
	var r=confirm('Are you sure you want to:\n '+alertText+'\n WARNING:\nThis will delete all related Steps and Log entries!');

	if (r==true) {	
			
		goals_display(basestr+"&ax=g&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}





//----- New Log -- Process Form ------------------------


function processLogs(theForm,str) {

    var basestr=str+"&g="+theForm.g.value+"&t="+theForm.t.value+"&nav="+theForm.vie.value+"&log_name="+theForm.log_name.value+"&st_name="+theForm.st_name.value+"&act="+theForm.act.value;
	desc_num = theForm.log_name.value;
	
	if (theForm.log_name.value == "" || theForm.log_name.value == "Enter short work description.") {
   				
   				alert('Please enter a discription for this log.');
				theForm.log_name.focus();
				return (false);
	
	} else if (theForm.act.value == "" || theForm.act.value == "0.0") {
   				
   				alert('Please enter the actual time worked.');
				theForm.act.focus();
				return (false);
   			
   	} else if (desc_num.length > 400) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 400 characters.');
				theForm.log_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		goals_display(basestr+"&ax=g&post=new_log&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}




//----- New Action Log -- Process Form ------------------------


function processLogsAC(theForm,str) {

    var basestr=str+"&u="+theForm.u.value+"&ac="+theForm.ac.value+"&nav="+theForm.vie.value+"&log_name="+theForm.log_name.value+"&ac_name="+theForm.ac_name.value+"&act="+theForm.act.value;
	desc_num = theForm.log_name.value;
	
	if (theForm.log_name.value == "" || theForm.log_name.value == "Enter short work description.") {
   				
   				alert('Please enter a discription for this log.');
				theForm.log_name.focus();
				return (false);
	
	} else if (theForm.act.value == "" || theForm.act.value == "0.0") {
   				
   				alert('Please enter the actual time worked.');
				theForm.act.focus();
				return (false);
   			
   	} else if (desc_num.length > 400) {

				alert('Your submission is '+desc_num.length+' characters long. The limit is 400 characters.');
				theForm.log_name.focus();
				return (false);		
	
	} else {
	
		var r=true;

	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		actions_display(basestr+"&ax=ac&post=new_log&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- NEW TEAM create -- Process Form ------------------------

function create_teamForm(theForm,str,alertText) {

    var basestr=str+"&new_team_name="+theForm.new_team_name.value+"&team_id="+theForm.team_id.value+"&post="+theForm.post.value;
	
	if (theForm.new_team_name.value == "" || theForm.new_team_name.value == "Enter name of a new team") {
   				
   				alert('Please enter a name for your new team.');
				theForm.new_team_name.focus();
				return (false);
   			
  	} else {
	
		//var r=true;
		var r=confirm('Are you sure you want to '+alertText);


	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		admin_display(basestr+"&ax=intm&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- INVITE -- Process Form ------------------------

function inviteForm(theForm,str,alertText) {

    var basestr=str+"&invite_email="+theForm.invite_email.value+"&team_id="+theForm.team_id.value+"&cur_tid="+theForm.cur_tid.value+"&form_mode="+theForm.form_mode.value+"&post="+theForm.post.value;

	var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	var address = theForm.invite_email.value;
	
	if(reg.test(address) == false) {
		alert('Invalid Email Address');
		theForm.invite_email.focus();
		return (false);
	}


	
	if (theForm.invite_email.value == "" || theForm.invite_email.value == "Invitee email address") {
   				
   				alert('Please enter the email address for your invitee.');
				theForm.invite_email.focus();
				return (false);
   			
  	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);


	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		admin_display(basestr+"&ax=intm&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- INVITE pay -- Process Form ------------------------

function invite_payForm(theForm,str) {

    var basestr=str+"&cur_tid="+theForm.cur_tid.value+"&you_pay="+theForm.you_pay.value+"&thy_pay="+theForm.thy_pay.value+"&form_mode="+theForm.form_mode.value+"&post="+theForm.post.value;
	
	var r=true;

	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		admin_display(basestr+"&ax=intm&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}




//----- ADMIN -- Process Form ------------------------ Team name limit 28 char

function adminForm(theForm,str,alertText) {

    var basestr=str+"&team_name="+theForm.team_name.value+"&new_owner="+theForm.new_owner.value+"&team_id="+theForm.team_id.value+"&post="+theForm.post.value;
	desc_num = theForm.team_name.value;
	
	if (theForm.team_name.value == "") {
   				
   				alert('Please enter a name for your team.');
				theForm.team_name.focus();
				return (false);
   			
   	} else if (desc_num.length > 28) {

				alert('Your submission is '+desc_num.length+' characters long. Team names are limited to 28 characters.');
				theForm.team_name.focus();
				return (false);		
	
	} else {
	
		//var r=true;
		var r=confirm('Are you sure you want to '+alertText);


	}
	
	if (r==true) {	
			
		//manageGroups_display(basestr+"&ax=f&post_g=sv&sid="+Math.random());
		admin_display(basestr+"&ax=adm&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}



//----- STATUS set -- Process ------------------------

var confirmMesg  = "Press OK if you want to";

function statusSet(theLink, alertText) {	
	
	if (confirmMesg == "" || typeof(window.opera) != "undefined") {
    return true;
	}

	var is_confirmed = confirm(confirmMesg + ": " + alertText);
	if (is_confirmed) {
		
		goals_display(theLink);
		//theLink.href;
    }
	
	return (true);
	//return is_confirmed;
} // end of the "confirmLink()" function



//----- actions STATUS set -- Process ------------------------

var confirmMesg  = "Press OK if you want to";

function statusSetAC(theLink, alertText) {	
	
	if (confirmMesg == "" || typeof(window.opera) != "undefined") {
    return true;
	}

	var is_confirmed = confirm(confirmMesg + ": " + alertText);
	if (is_confirmed) {
		
		actions_display(theLink);
		//theLink.href;
    }
	
	return (true);
	//return is_confirmed;
} // end of the "confirmLink()" function



//----- Show a message ------------------------
//messageShow(\'noauth\')

function messageShow(str) {

 	if ( str == "noauth") {
   				
   				alert('Sorry -- You are not authorized to use this function.');
				return (false);
	
	}
	return (true);
}



//============================================
//============================================



//===== CREATE A TEAM -- Process FUNCTIONS =============================================================
//======================================================================================================

//----- OWNER -- Record new team owner and team name ----------------------------

function newTeamOwner(theForm,str) {

    var basestr=str+"&t_name="+theForm.t_name.value+"&new_owner="+theForm.new_owner.value+"&team_id="+theForm.team_id.value+"&post="+theForm.post.value;
	desc_num = theForm.t_name.value;
	
	if (theForm.t_name.value == "" || theForm.t_name.value == "Enter New Team Name") {
   				
   				alert('Please enter a name for your team.');
				theForm.t_name.focus();
				return (false);
   			
   	} else if (desc_num.length > 28) {

				alert('Your submission is '+desc_num.length+' characters long. Team names are limited to 28 characters.');
				theForm.t_name.focus();
				return (false);		
	
	} else {
	
		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);


	}
	
	if (r==true) {	
			
		admin_display(basestr+"&ax=ctm&sid="+Math.random());
		return (true);
	
	} else {

		return (false);
		
	}
}


//======================================================================================================
//======================================================================================================



//===== CONTACT FORM validator ============================================

function contactValidator() {

	var theForm = document.getElementById("send_conta");

	if (theForm.Ename.value == "") {
   		alert('Please enter your name into the "Name:" field.');
		theForm.Ename.focus();
		return (false);
	}
					
	if (theForm.Email.value == "") {
   		alert('Please enter your email address into the "E-Mail:" field.');
		theForm.Email.focus();
		return (false);
	}

	if (theForm.Esubject.value == "") {
   		alert('Please enter a subject into the "Subject:" field.');
		theForm.Esubject.focus();
		return (false);
	}

	if (theForm.Emessage.value == "") {
   		alert('Please enter a message into the "Message:" field.');
		theForm.Emessage.focus();
		return (false);
	//}
	
	//if (theForm.Ephone.value == "") {
   	//	alert('Please enter your phone number into the "Phone:" field.');
	//	theForm.Ephone.focus();
	//	return (false);
	
	} else {

		var r=true;
		//var r=confirm('Are you sure you want to '+alertText);
	}
	
	if (r==true) {	
			
		document.getElementById("send_conta").submit()
		return (true);
	
	} else {

		return (false);
		
	}
}

//=======================================================================