// Author: Al Sierra
// Version: 3.27.2009
// Description: JS for toolkit functions
nycs.toolkit = {};
nycs.toolkit.CheckToolKitStep1 =
	 function (){
		var emsg='';
		if(!nycs.main.ValidateString($('tk_event_name').value)){
			emsg+="You must enter an Event Name. \n";
		}
		if(!nycs.main.ValidateString($('tk_zip').value)){
			emsg+="You must enter a Zip Code. \n";
		}
		if(!nycs.main.ValidateString($('tk_date').value)){
			emsg+="You must enter a Date. \n";
		}
		if(!nycs.main.ValidateString($('tk_time').value)){
			emsg+="You must enter a Time. \n";
		}
		if(!nycs.main.ValidateString($('tk_event_type').value)){
			emsg+="You must select an Event Type. \n";
		}
		if (emsg!='') {
			alert(emsg);
			return false;
		} else {
			return true;
		}
	 }
nycs.toolkit.CheckToolKitStep3 =
	 function (){
		var emsg='';
		if(!nycs.main.ValidateEmail($('tk_email').value)){
			emsg+="Please Enter a Valid Sender Email \n";
		}
		var emails = $('tk_emails').value;
		if(emails == ''){
			emsg+="Please Enter a Valid Recipient Email\n";
		}else {
			var emailsarr = emails.split(',');
			for(var x =0;x<emailsarr.length;x++){
				if(!nycs.main.ValidateEmail(emailsarr[x])){
					emsg+="Invalid Recipient Email Format  \n";
					break;
				}
			}
		}
		if(!nycs.main.ValidateHtmlTags($('tk_personal_message').value)){
			emsg+="No HTML Tags allowed in the personal message \n";
		}
		if (emsg!='') {
			alert(emsg);
			return false;
		} else {
			return true;
		}
	 }
nycs.toolkit.ToggleCategory =
	 function (cat_id){
		if($('tk_cat_lists-'+cat_id).style.display == 'none'){
			$('tk_cat_lists-'+cat_id).style.display = 'block';
			$('tk_cat_image-'+cat_id).src = "../images/tk_arrow_down.png";
		} else {
			$('tk_cat_lists-'+cat_id).style.display = 'none';
			$('tk_cat_image-'+cat_id).src = "../images/tk_arrow_right.png";
		}
	 }
nycs.toolkit.RedirectStep3 =
	function (cmd,event,zip,date,time,time_type,event_type){
		window.location = 'toolkit.php?cmd='+cmd+'&event='+event+'&zip='+zip+'&date='+date+'&time='+time+'&time_type='+time_type+'&event_type='+event_type;
	}
nycs.toolkit.DisplayPersonalMessage =
	function (){
		$('tk_email_personal_lnk').style.display = 'none';
		$('tk_email_personal_head').style.display = 'block';
		$('tk_email_personal_txt').style.display = 'block';
	}