// JavaScript Document
		var PAGE_ERROR = false;
		var ERROR = false;
		
		
function jsf_CreateDayTimeGroupSelection()
{
	$('#PROG_DAY_TIME').val('');
	var SELECTION = "";
	$('.chkDayTime').each(function()
								   	{
										if($(this).attr('id') == "program_daytime_dnm")
										{
											if($(this).attr('checked') == true)
											 {
												$('.chkDayTime').each(function()
																			   {
																				 $('#PROG_DAY_TIME').val("");  
																				 if($(this).attr('id') != "program_daytime_dnm")
																				  {
																					$(this).attr("disabled", true);
																					$(this).attr("checked",false);
																				  }
																			   });
												$('#PROG_DAY_TIME').val($(this).val());
											 }
											 else
											 {
												$('.chkDayTime').each(function()
																			   {
																				 if($(this).attr('id') != "program_daytime_dnm")
																				  {
																					$(this).attr("disabled", false);  
																				  }
																			   });
												$('#PROG_DAY_TIME').val("");
											 }
												 
											
											return;
										}
										
									});
	$('.chkDayTime').each(function()
									{ 
										// Test if a required field has no data then set the error flag to true and exit the loop.
										$('#PROG_DAY_TIME').val("");
										if($(this).attr('checked') == true)
										 {
											//$("#program_daytime_dnm").attr("disabled", true);  
											if(SELECTION.length == 0)
											 {
												SELECTION =  $(this).val();
											 }
											else
											 {
												 SELECTION +=   ", " + $(this).val();
											 }
										 }
									}); 
	$('#PROG_DAY_TIME').val(SELECTION);
	PAGE_ERROR=false;
	//$("#program_daytime_dnm").attr("disabled", false); 
}


function jsf_CreateAgeGroupSelection()
{
	$('#PROG_AGE').val('');
	var SELECTION = "";
	
	$('.chkAge').each(function()
									{ 
										// Test if a required field has no data then set the error flag to true and exit the loop.
										if($(this).attr('checked') == true)
										 {
											if(SELECTION.length == 0)
											 {
												SELECTION =  $(this).val();
											 }
											else
											 {
												 SELECTION +=   ", " + $(this).val();
											 }
										 }
									}); 
	$('#PROG_AGE').val(SELECTION);
	PAGE_ERROR=false;
}


function jsf_CreateCategoryGroupSelection()
{
	$('#PROG_CATEGORY').val('');
	var SELECTION = "";
	
	$('.chkCat').each(function()
									{ 
										// Test if a required field has no data then set the error flag to true and exit the loop.
										if($(this).attr('checked') == true)
										 {
											if($(this).val() == "Meeting")
											 {
												$("#PROG_VP").val('MT');

											 }
											else
											 {
												$("#PROG_VP").val('NA');	
											 }
											if(SELECTION.length == 0)
											 {
												SELECTION =  $(this).val();
												
											 }
											else
											 {
												 SELECTION +=   ", " + $(this).val();
											 }
										 }
									}); 

	$('#PROG_CATEGORY').val(SELECTION);
	PAGE_ERROR=false;
}

		

			function jsf_Next(_to)
			{
				$("#" + _to).show('fast');
				$("#accordion").accordion( "activate" , _to);
			}
			

			$(function(){
				// Tabs
				$('#tabs').tabs();

				$("#startup").accordion({ header: "h3", icons: icons });
					var icons = {
								header: "ui-icon-circle-arrow-e",
								headerSelected: "ui-icon-circle-arrow-s"	
								};
				
				
				
				// Dialog			
				$('#dialog').dialog({
					autoOpen: false,
					width: 400,
					height: 100,
					show: 'fold',
					//buttons: {"Ok": function() { $(this).dialog("close"); }, "Cancel": function() { $(this).dialog("close"); }}
					hide: 'fold'
					
				});


				$("#PROG_PRESENTER_CONTACT_PHONE").numeric();
				$("#PROG_PRESENTER_FAX").numeric();


				$("#div_Login").dialog({
									dialogClass: 'ui-state-default',		   
									draggable: false,
									autoOpen: true,
									width: 500,
									height: 200,
									modal:false
					
				});
	
		
				
				$(".ui-dialog-titlebar").addClass('ui-state-error');
				
				//hover states on the static widgets
				$('#dialog_link, ul#icons li').hover(
					function() { $(this).addClass('ui-state-hover'); }, 
					function() { $(this).removeClass('ui-state-hover'); }
				);
				$(".step").hide();
				$(".field").bind("keypress keyup", 
							function(e)
								{
									$(this).removeClass("required_error"); 
									
									//$(this).next().html('<small>Ok</small>');
									PAGE_ERROR=false;
									
								}
						);

				$(".field_sub").bind("keypress keyup", 
							function(e)
								{
									$(this).removeClass("required_error"); 
									
									//$(this).next().html('<small>Ok</small>');
									PAGE_ERROR=false;
									
								}
						);

				$('.chkDayTime').bind("change", 
												  function(e)
												  {
        											jsf_CreateDayTimeGroupSelection();
    												});	
				$('.chkAge').bind("change", 
											function(e)
												{
        											jsf_CreateAgeGroupSelection();
    											});	

				$('.chkCat').bind("click", 
											function(e)
												{
        											jsf_CreateCategoryGroupSelection();
    											});	


			});
			
			
			
			
			//jsf_CreateAgeGroupSelection()
			
			

