 <script language="javascript">
 var img_src="<?php echo HTTP_SERVER.DIR_WS_ADMIN.'images/';?>";
 var lang=new Array();
 var attrib_icon=false;
    <?php 
    $languages = tep_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
    	echo "lang[".$i."]=".$languages[$i]['id'].";\n";
    }
    ?>  
  function startCallback_events() {
	  // make something useful before submit (onStart)
	  var error_result="";
	  var image_types=Array(".png",".jpg",".jpeg",".gif");
	  if(document.getElementById("action_type")) var action_type=document.getElementById("action_type").value;
	  var validate_form=false;
	  var frm=document.new_product;
	  var address="";
	  var icnt;
	  var quantity=0;
	  var categories_image=document.getElementById('events_categories_image');
	  if(action_type!=""){									
		 if(action_type=='new_category' || action_type=='edit_category'){				  	
				  	for(i=0;i<lang.length;i++) { 
				  		if(document.getElementById("categories_name["+lang[i]+"]") && document.getElementById("categories_name["+lang[i]+"]").value=="" || str_trim(document.getElementById("categories_name["+lang[i]+"]").value)=="") error_result='* <?php echo ERR_CATEGORY_NAME;?>\n';
					}	
				  	if (categories_image && categories_image.value!="" && !check_mime_type(categories_image,image_types))
						error_result+="* <?php echo ERR_IMAGE_UPLOAD_TYPE;?>\n";
					else if(categories_image && categories_image.value=="")
						validate_form=true;
		 }else if(action_type=='new' || action_type=='edit') { 
			if (document.new_product.elements["events_name["+lang[0]+"]"]){
			  for (icnt=0;icnt<lang.length;icnt++){	
				if ( (str_trim(document.new_product.elements["events_name["+lang[icnt]+"]"].value)==null) || (str_trim(document.new_product.elements["events_name["+lang[icnt]+"]"].value)=="") ){ 
				  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_EVENT_NAME); ?>\n";
				  break;
				}
			  } 
			} else if( (str_trim(document.new_product.events_name.value)==null) || (str_trim(document.new_product.events_name.value)=="") )  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_EVENT_NAME); ?>\n";
			var category_flag=true;
			for(i=0;i<document.getElementsByName('events_categories_ids[]').length;i++)
				if(document.getElementsByName('events_categories_ids[]')[i].checked==true)
					category_flag=false;
			if (category_flag==true)
						error_result+="<?php echo tep_db_input(TEXT_ERR_SELECT_CATEGORY); ?>\n";
			else if (document.new_product.events_wait_list.checked==true){
				   	   if (str_trim(document.new_product.waitsize_vip.value)=="" || str_trim(document.new_product.waitsize_firstcome.value)=="" || str_trim(document.new_product.waitsize_custom.value)=="")
						  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_WAITSIZE); ?>\n";
					   else if(isNaN(parseInt(document.new_product.waitsize_vip.value))==true || isNaN(parseInt(document.new_product.waitsize_firstcome.value))==true || isNaN(parseInt(document.new_product.waitsize_custom.value))==true)
						  error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_WAITSIZE); ?>\n";
					   else if(str_trim(document.new_product.waitfee_vip.value)=="")
						  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_WAITFEE); ?>\n";
					   else if (isNaN(parseInt(document.new_product.waitfee_vip.value))==true)
						  error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_WAITFEE); ?>\n";					  
			  }			
			 if (document.new_product.events_forward_period.checked==true){
			  if (str_trim(document.new_product.events_forward_length.value)=="")
				 error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_FORWARD_PERIOD); ?>\n";
			    else if(isNaN(parseInt(document.new_product.events_forward_length.value))==true)
				 error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_FORWARD_PERIOD); ?>\n";			   
			  }
			  for(i=0;i<document.new_product.link_service.length;i++){
				  if(document.new_product.link_service[i].checked){
					if(document.new_product.link_service[i].value=='L'){
						  if (parseInt(document.new_product.events_max_reserve.value)>getLocationSeats()) 
							 error_result+="<?php echo tep_db_input(TEXT_ERR_MAX_RESERVATIONS_GREATER); ?>\n";						  
					 } else if(document.new_product.link_service[i].value=='S'){
							if(document.new_product.sel_customers.options[document.new_product.sel_customers.selectedIndex].value=='nil')
								error_result+="<?php echo tep_db_input(TEXT_ERR_NO_BOOKINGS_EXIST);?>\n";
							else { 
								if(document.new_product.sel_services.selectedIndex<=0)
									error_result+="<?php echo tep_db_input(TEXT_ERR_SELECT_SERVICE);?>\n";
								else{
									var selectedindex=document.new_product.sel_services.selectedIndex;
									if (parseInt(document.new_product.events_max_reserve.value)>getServiceLocationSeats())
										error_result+="Only "+ getServiceLocationSeats() + " seats are available in selected service. \n";
								}	
							}
						}
						break;
					}	
			  }	
			   if (document.new_product.events_group_bookings.checked) {
					if (!isNumeric(parseInt(document.new_product.events_group_min.value),1) ||document.new_product.events_group_min.value<=0)
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MIN_VALUE); ?>\n";
					else if (!isNumeric(parseInt(document.new_product.events_group_max.value),1))
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MAX_VALUE); ?>\n";
					else if (parseInt(document.new_product.events_group_min.value)>parseInt(document.new_product.events_group_max.value))
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MIN_VALUE_GREATER); ?>\n";
					if(parseInt(document.new_product.events_group_max.value) >= parseInt(document.new_product.events_max_reserve.value))
						error_result+="<?php echo tep_db_input(TEXT_ERR_MAX_RESERVE_GREATER);?>\n" ;
		 	   }
		 	if (document.new_product.elements["events_image"] && document.new_product.elements["events_image"].value!="" && !check_mime_type(document.new_product.elements["events_image"],image_types))
				error_result+="<?php echo ERR_IMAGE_UPLOAD_TYPE;?>";				
	  		else if(document.new_product.elements["events_image"].value=="") 
	  			validate_form=true; 	
	  	}	  		
	  }		
	   if(action_type=='delete_category' || action_type=='move_category' || action_type=='delete' || action_type=='copy' || action_type=='move' || action_type=='attrib') validate_form=true;
	   if(error_result=="" && validate_form) {
	  	 ValidateForm();
	  	 return false;
	   }else if(error_result!=""){
	  	alert(error_result);
	  	return false;
	   }else if(error_result=="" && !validate_form) return true;									 	
  }
  
  function completeCallback_events(response) {  		  		  		
  		ValidateForm(response);
  	}
	//Js Upload End
    var option_array=new Array();
	var attributes_array=new Array();
	var values_arr=new Array();
	var pname="";
	var cname="";
	var attrb_cnt=0;
	var splt=Array()
	var tax_rates = new Array();;
	var is_attrb= '<?php echo str_replace(" ","_",TEXT_IS_ATTRIBUTES);?>';
	var image_types=Array(".png",".jpg",".jpeg",".gif");
	<?php 						
		  $tax_class_query = tep_db_query("SELECT tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");
		 while ($tax_class = tep_db_fetch_array($tax_class_query)) {
		 	 echo 'tax_rates["' . $tax_class['tax_class_id'] . '"] = ' . tep_get_tax_rate_value($tax_class['tax_class_id']) . ';' . "\n";			 
		 }	
	?>				 	
	function doRound(x, places) {
  		return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);
	}

	function getTaxRate() {
	  var selected_value = document.forms["new_product"].events_tax_class_id.selectedIndex;
	  var parameterVal = document.forms["new_product"].events_tax_class_id[selected_value].value;
	
	  if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {
		return tax_rates[parameterVal];
	  } else {
		return 0;
	  }
	  }
 function getLocationSeats(){
	  var selected_value = document.forms["new_product"].events_location.selectedIndex;
	  var parameterVal = document.forms["new_product"].events_location[selected_value].value;
	  if ( (parameterVal > 0) && (locations[parameterVal] > 0) ) {
	  
		return locations[parameterVal];
	  } else {
		return 0;
	  }
  }
 function getServiceLocationSeats(){
	  var selected_value = document.forms["new_product"].sel_services.selectedIndex;
	  var parameterVal = document.forms["new_product"].sel_services[selected_value].value;

	  if ( (parameterVal > 0) && (service_locations[parameterVal] > 0) ) {
		return service_locations[parameterVal];
	  } else {
		return 0;
	  }
  }


	function updateGross() {
	  var taxRate = getTaxRate();
	  var grossValue = document.forms["new_product"].events_fees_net.value;
	
	  if (taxRate > 0) {
		grossValue = grossValue * ((taxRate / 100) + 1);
	  }
	
	  document.forms["new_product"].events_fees_gross.value = doRound(grossValue, 4);
	}
	
	function updateNet() {
	  var taxRate = getTaxRate();
	  var netValue = document.forms["new_product"].events_fees_gross.value;
	
	  if (taxRate > 0) {
		netValue = netValue / ((taxRate / 100) + 1);
	  }
	
	  document.forms["new_product"].events_fees_net.value = doRound(netValue, 4);
	}
function do_quantity_check() {
  var attribute_quantity = document.forms["new_product"].attribute_quantity.value;
  var event_quantity = document.forms["new_product"].events_quantity.value;
  if (attribute_quantity > event_quantity){
   alert("Attribute Quantity exceeded");
	}
}
    function change(){
	var arr_text=Array();
	var arr_value=Array();
	var attrb_splt=Array();
	var cnt=0;
	var icnt=0;
	var parr_name="";
	var carr_name="";
	if(option_array.length>0 ){
		deleteoptions();
	  for(i=0;i<option_array.length;i++){
	 	cnt=i+1;
		attrb_splt=option_array[i].split("#");
		if(document.getElementById("option"+"["+cnt+"]").checked){
			arr_text=attrb_splt[2];
			arr_value=attrb_splt[1];
			addoptions(arr_text,arr_value,attrb_splt[0]);
			icnt++;
		}	
	}
	check_option_exists();
  }
}

function addoptions(textArr,valueArr,nameArr){
  var option = document.createElement('option');
  option.text = textArr;
  option.value = valueArr;
  document.getElementById('options'+nameArr).style.display="";
  var optionElement = document.getElementById('option_values'+nameArr);
  try {
	optionElement.add(option, null); // standards compliant; doesn't work in IE
  }
  catch(ex) {
	optionElement.add(option); // IE only
  }
}

function deleteoptions(){
var carr_name="";
	 for(i=0;i<attributes_array.length;i++){
		carr_name=document.getElementById('option_values'+attributes_array[i]);
		for (j = carr_name.length - 1; j>=0; j--) {
			carr_name.remove(j);
		}
	}
}

function check_option_exists(){
var carr_name="";
	 for(i=0;i<attributes_array.length;i++){
		carr_name=document.getElementById('option_values'+attributes_array[i]);
			if(carr_name.length<=0)
				document.getElementById('options'+attributes_array[i]).style.display="none";
	}
}

function do_action(action){
		var frm=document.new_product;
		var error_result="";
		var del_items="";
		var sIndex=frm.attribute_list.selectedIndex;
		switch(action){
			case "edit":
			case "add":
			if(subvalidateForm() == false) return;			
			var temp=getDetails();
			var pos;
			dateAdd=temp[1];
			dateAddText=temp[0];
				
				if (action=="edit") {
				if(sIndex<0) return;
					frm.attribute_list.remove(sIndex);
				}					
				var pos=get_position(dateAdd);
				var oOption = document.createElement("OPTION");
				oOption.text=dateAddText;
				oOption.value=dateAdd;
				if(frm.attribute_list.add.length==2){
				 frm.attribute_list.add(oOption,null);
				}	else {
				 frm.attribute_list.add(oOption,pos);
				}
				pos=frm.attribute_list.length;
				frm.attribute_list.selectedIndex=pos-1;
				frm.quantity.value='';
				frm.attrb_sku.value='';
				frm.attribute_status = '';									
				break;
				case "delete":
					if (sIndex<0) return;
					frm.attribute_list.remove(sIndex);
					if (sIndex>0 && sIndex<frm.attribute_list.length-1)
						sIndex=sIndex+1;
					else if (sIndex>0)
						sIndex=sIndex-1;
					else if (sIndex>=frm.attribute_list.length) sIndex=frm.attribute_list.length-1;
					frm.attribute_list.selectedIndex=sIndex;
					do_action('select');
					break;
				case "select":
					var attributes=Array();
					var attrb_splt=Array();
					var values=Array();
					var skew=Array();
					if(sIndex>=0){
						skew=frm.attribute_list.options[sIndex].value.split(' ');
						skew_value=skew[1];
						document.new_product.attrb_sku.value=skew_value.substr(4);
						skew_attr_value = skew[2];
						if(skew_attr_value.substr(7)==0){
							document.new_product.attribute_status[0].checked=false;
							document.new_product.attribute_status[1].checked=true;
						}else{
							document.new_product.attribute_status[0].checked=true;
							document.new_product.attribute_status[1].checked=false;
						}
						values=skew[0].split('#');
						attributes=values[0].split('-');
						for(i=0;i<attributes.length;i++){
							attrb_splt=attributes[i].split('{');
							document.getElementById("option_values"+attrb_splt[0]).value=attrb_splt[1].substring(0,(attrb_splt[1].length-1));
						}
						document.new_product.quantity.value=values[1];
					}
				return; 
			}
		} 
				
		function getDetails(){
			var carr_name="";
			var attrbAdd=Array();
			var attrb_text="";
			var attrb_value="";
			 for(i=0;i<attributes_array.length;i++){
				carr_name=document.getElementById('option_values'+attributes_array[i]);
				if(carr_name.length>0){
				attrb_text+=carr_name.options[carr_name.selectedIndex].text + ',';
				attrb_value+=attributes_array[i]+'{'+carr_name.options[carr_name.selectedIndex].value+'}-';
				}
			}
			var attribute = 1;
			if(document.new_product.attribute_status[0].checked==false){
				attribute = 0;
			}else if(document.new_product.attribute_status[1].checked==false){
				attribute = 1;
			}
			attrb_text=attrb_text.substring(0,(attrb_text.length)-1)+','+document.new_product.quantity.value+' SKU:' +document.new_product.attrb_sku.value+' Status:' +attribute;
			attrb_value=attrb_value.substring(0,(attrb_value.length)-1)+'#'+document.new_product.quantity.value+' SKU:' +document.new_product.attrb_sku.value+' Status:' +attribute;
			attrbAdd[0]=attrb_text;
			attrbAdd[1]=attrb_value;
			return attrbAdd;
		}		
		/*function ValidateForm(){				
		var id=0;
		if(document.new_product && document.new_product.event_id) id=document.new_product.event_id.value;
		if(document.new_product.cPath) category_id=document.new_product.cPath.value;				 
		var span_details=document.getElementById("span_details");
		var span_edit=document.getElementById("span_edit");				
		var span_delete=document.getElementById("span_delete");	
		var span_copy=document.getElementById("span_copy");	
		var span_move=document.getElementById("span_move");
		var loadings=document.getElementById("loading");				
		if(span_details && span_details.style.display=="") return false;
		else if(span_details && span_details.style.display!="" && span_edit.style.display==''){
			var frm=document.new_product;
			var address="";
			var icnt;
			var quantity=0;
			var error_result='';		
			
			if (document.new_product.elements["events_name["+lang[0]+"]"]){
			  for (icnt=0;icnt<lang.length;icnt++){ 
				if (document.new_product.elements["events_name["+lang[icnt]+"]"].value==""){
				  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_EVENT_NAME); ?>\n";break;
				}
			  } 
			} else {
			  if (document.new_product.events_name.value=="")  error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_EVENT_NAME); ?>\n";
			}
			 
			  if (document.new_product.events_categories_ids.selectedIndex<0){
						error_result+="<?php echo tep_db_input(TEXT_ERR_SELECT_CATEGORY); ?>\n";
			  } else if (document.new_product.events_wait_list.checked==true){
				   if (document.new_product.waitsize_vip.value=="" || document.new_product.waitsize_firstcome.value=="" || document.new_product.waitsize_custom.value==""){
							error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_WAITSIZE); ?>\n";
					  } else if(isNaN(parseInt(document.new_product.waitsize_vip.value))==true || isNaN(parseInt(document.new_product.waitsize_firstcome.value))==true || isNaN(parseInt(document.new_product.waitsize_custom.value))==true){
						 error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_WAITSIZE); ?>\n";
					  } else if(document.new_product.waitfee_vip.value==""){
						error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_WAITFEE); ?>\n";
					  } else if (isNaN(parseInt(document.new_product.waitfee_vip.value))==true){
						 error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_WAITFEE); ?>\n";
					  }
			  }
			
			 if (document.new_product.events_forward_period.checked==true){
			  if (document.new_product.events_forward_length.value==""){
				 error_result+="<?php echo tep_db_input(TEXT_ERR_EMPTY_FORWARD_PERIOD); ?>\n";
			   } else if(isNaN(parseInt(document.new_product.events_forward_length.value))==true){
				 error_result+="<?php echo tep_db_input(TEXT_ERR_INVALID_FORWARD_PERIOD); ?>\n";
			   }
			 }  
			    var j=0;
				var vals="";
				var obj=frm.elements['events_categories_ids[]'];
				var obj_assign=frm.events_categories_ids_assign;
				if(obj){					
					for(i=0;i<obj.length;i++){													
					  if(obj[i].selected && obj_assign) {
					  	vals+=obj[i].value+",";
					  	j++;					  	
					  }												
					}
				 obj_assign.value=vals.substr(0,vals.length-1);					 
			  }
			   var vals="";
			   var j=0; 	
			   var obj=frm.elements['subscription_categories_ids[]'];
			   var obj_assign=frm.subscription_categories_ids_assign;
				if(obj){					
					for(i=0;i<obj.length;i++){													
					  if(obj[i].selected && obj_assign) {
					  	vals+=obj[i].value+",";
					  	j++;					  	
					  }												
					}
				 obj_assign.value=vals.substr(0,vals.length-1);					 
			  }				  			  			 
			  for(i=0;i<document.new_product.link_service.length;i++){
				  if(document.new_product.link_service[i].checked){
					if(document.new_product.link_service[i].value=='L'){
						  if (parseInt(document.new_product.events_max_reserve.value)>getLocationSeats()){ 
							 error_result+="<?php echo tep_db_input(TEXT_ERR_MAX_RESERVATIONS_GREATER); ?>\n";
						  }
					 } else if(document.new_product.link_service[i].value=='S'){
							if(document.new_product.sel_customers.options[document.new_product.sel_customers.selectedIndex].value=='nil'){
								error_result+="<?php echo tep_db_input(TEXT_ERR_NO_BOOKINGS_EXIST);?>\n";
							} else { 
								if(document.new_product.sel_services.selectedIndex<=0){
									error_result+="<?php echo tep_db_input(TEXT_ERR_SELECT_SERVICE);?>\n";
								} else{
									var selectedindex=document.new_product.sel_services.selectedIndex;
									  if (parseInt(document.new_product.events_max_reserve.value)>getServiceLocationSeats()){ 
										// error_result+="<?php //echo tep_db_input(TEXT_ERR_MAX_SERVICE_RESERVATIONS_GREATER); ?>\n";
										error_result+="Only "+ getServiceLocationSeats() + " seats are available in selected service. \n";
										} 
								}	
							}
						}
						break;
					}	
			  }	
			   if (document.new_product.events_group_bookings.checked) {
					if (!isNumeric(parseInt(document.new_product.events_group_min.value),1) ||document.new_product.events_group_min.value<=0){
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MIN_VALUE); ?>\n";
					} else if (!isNumeric(parseInt(document.new_product.events_group_max.value),1)){
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MAX_VALUE); ?>\n";
					} else if (parseInt(document.new_product.events_group_min.value)>parseInt(document.new_product.events_group_max.value)){
						error_result+="<?php echo tep_db_input(TEXT_ERR_GROUP_MIN_VALUE_GREATER); ?>\n";
					} 
					if(parseInt(document.new_product.events_group_max.value) >= parseInt(document.new_product.events_max_reserve.value))
						error_result+="<?php echo tep_db_input(TEXT_ERR_MAX_RESERVE_GREATER);?>\n" ;
				 }
			if (error_result!=""){
			   alert(error_result);
			   return false;
			 }else {																	
					span_details.innerHTML="";
					command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=update_event');?>&eID="+id;														
					do_post_command('new_event',command);	
					if(loadings) loadings.style.display=""; 					
					if(span_edit) span_edit.style.display="none";
					return false;
			}
		}else if(span_delete.style.display==""){					
			span_edit.innerHTML="";
			command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=delete_confirm');?>&eID="+id;			
			do_post_command('new_event',command);
			if(loadings) loadings.style.display=""; 					
			if(span_delete) span_delete.style.display="none";
			return false;
		}else if(span_copy.style.display==""){			
			span_edit.innerHTML="";
			command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=copy_confirm');?>&eID="+id;			
			do_post_command('new_event',command);
			if(loadings) loadings.style.display=""; 					
			if(span_copy) span_copy.style.display="none";
			return false;		
		}else if(span_move.style.display==""){			
			span_edit.innerHTML="";
			command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=move_confirm');?>&eID="+id;			
			do_post_command('new_event',command);
			if(loadings) loadings.style.display=""; 					
			if(span_move) span_move.style.display="none";
			return false;
		}
	}*/
		
		function subvalidateForm(){
			var frm=document.new_product;
			var error_result="";
			var pro_sku=frm.attrb_sku.value.replace(" ");
			if("<?php echo SKU_LENGTH;?>"=='true'){
				if(frm.quantity.value=="" || frm.quantity.value==0 || isNaN(frm.quantity.value) || frm.quantity.value<0){
					error_result='* <?php echo TEXT_QUANTITY_ERROR;?>\n';
				}
				if(str_trim(pro_sku.value)==""){
					error_result+='* <?php echo TEXT_ERROR_eventS_SKU;?>\n';
				}else if(pro_sku.length!=<?PHP echo SKU_COUNT;?>){
					if(frm.default_sku_value.value>1){
						error_result+='* <?php echo TEXT_ERROR_eventS_SKU;?>\n';
					}else if(frm.default_sku_value.value==""){
						error_result+='Set Configuration value';
					}
				}
			}
			if(error_result!=""){
				alert(error_result);
				return false;
			}			
			return true;	
		}			
				
		function get_position(dateAdd){
			frm=document.new_product;
			for (icnt=0;icnt<frm.attribute_list.length;icnt++){
				if(dateAdd<=frm.attribute_list.options[icnt].value){
					return icnt;
				}
			}
			return icnt;
		 }
		 
		function init_page(){
		if (document.new_product.attribute_list.options.length>0){
			document.new_product.attribute_list.selectedIndex=0;
			do_action("select");
		} 
		} 
		function do_skew_action(val){
			if(val){
				document.new_product.events_sku.disabled=true;
				if(document.getElementById("panel_"+is_attrb)) document.getElementById("panel_"+is_attrb).style.display="";
				/*if(document.getElementById("attrib_list"))document.getElementById("attrib_list").style.display="";
				if(document.getElementById("option_list")) document.getElementById("option_list").style.display="";*/
			}else{
				document.new_product.events_sku.disabled=false;
				if(document.getElementById("panel_"+is_attrb)) document.getElementById("panel_"+is_attrb).style.display="none";
				/*if(document.getElementById("attrib_list"))document.getElementById("attrib_list").style.display="none";
				if(document.getElementById("option_list")) document.getElementById("option_list").style.display="none";*/
			}	
		}
    var is_attrb= '<?php echo str_replace(" ","_",TEXT_IS_ATTRIBUTES);?>';
   	function doaction(){
			if(document.getElementById("panel_"+is_attrb).style.display=="")
				document.new_product.events_sku.disabled=true;
			else if(document.getElementById("panel_"+is_attrb).style.display=="none")
				document.new_product.events_sku.disabled=false;	
		}
	/* function expand_category(id,category,category_id){	  	 	 	 	 	 	 	 	  	 
 	 	var res_display=document.getElementById("res_display");
 	 	if(res_display) res_display.style.display="none";	 	 	
 	 	if(document.new_product && document.new_product.event_id)	{
			var old_ids=document.new_product.event_id.value;
			var old_categories_id=document.new_product.cPath.value;
			var pre_data_id=document.getElementById("data_"+old_ids+"_"+old_categories_id);
			var pre_head=document.getElementById("head_"+old_ids+"_"+old_categories_id);
			var loadings=document.getElementById("loading");
			if(loadings) loadings.style.display="none";
			if(category_id>0 && category==1 && pre_head && pre_head.innerHTML!='') pre_head.innerHTML="";
		}
		if(document.new_product && document.new_product.event_id && document.new_product.event_id.value=="") document.new_product.event_id.value=id; 	 	 
			if(document.new_product.event_id.value>0 && document.new_product.event_id.value!=id){
			   var head=document.getElementById("head_"+old_ids+"_"+old_categories_id);
			   if(head && head.style.display=="") head.style.display="none";
			   if(pre_data_id && pre_data_id.style.display=="none") pre_data_id.style.display="";
			   document.new_product.event_id.value=id;			   
			}													
 	 	if(category_id>0 && document.new_product.cPath) document.new_product.cPath.value=category_id; 	 		 
 	 	if(id && category){
 	 		if(!category_id && category==1) var category_id=document.new_product.cPath.value;
 	 		var span_details=document.getElementById("span_details");
 	 		var span_edit=document.getElementById("span_edit");			
			var span_delete=document.getElementById("span_delete");
			var span_copy=document.getElementById("span_copy");			
			var span_move=document.getElementById("span_move");						
			var data_id=document.getElementById("data_"+id+"_"+category_id);						
			var head=document.getElementById("head_"+id+"_"+category_id);
			var img_save=document.getElementById("img_save");
			var command="";																		 
 	 		switch(category){ 	 			
 	 			case 1: 	 			   	 			   	 			 	  	 			
 	 			 if(head && span_details){ 	 			 	 	 			    	 			    	 			    	 			   
 	 			   if(head.style.display==""){ 	 			   	   	 			   	   	 			   	   	 			   	   	 			   	  
 	 			   	  if(span_details.style.display==""){
 	 			   	    head.style.display="none"; 	 			   	    
 	 			   	  	data_id.style.display=""; 	 			   	  	
 	 			   	  }else { 
 	 			   	  	if(span_edit.style.display=="") span_edit.style.display="none";
 	 			   	  	if(span_delete.style.display=="") span_delete.style.display="none";
 	 			   	  	if(span_copy.style.display=="") span_copy.style.display="none";
 	 			   	  	if(span_move.style.display=="") span_move.style.display="none"; 	 			   	  	 	 			   	  
 	 			   	  	span_details.style.display=""; 	 			   	  	 
						if(img_save) img_save.style.display="none";
						if(document.getElementById("img_ids")){
 	 			   	  		var tr_obj=document.getElementById("img_ids");
 	 			   	  		if(tr_obj.childNodes[1].childNodes[0].src==img_src+'template/img_edit_hover.gif')	
 	 			   	  			tr_obj.childNodes[1].childNodes[0].src=img_src+'template/img_edit.gif';
 	 			   	  		else if(tr_obj.childNodes[2].childNodes[0].src==img_src+'template/img_trash_hover.gif')	
 	 			   	  			tr_obj.childNodes[2].childNodes[0].src=img_src+'template/img_trash.gif';	
 	 			   	  		else if(tr_obj.childNodes[3].childNodes[0].src==img_src+'template/img_copy_hover.gif')	
 	 			   	  			tr_obj.childNodes[3].childNodes[0].src=img_src+'template/img_copy.gif';	 	 			   	  			  	 			   	  		
  	 			   	  		else if(tr_obj.childNodes[4].childNodes[0].src==img_src+'template/img_move_hover.gif')	
		 			   	  		tr_obj.childNodes[4].childNodes[0].src=img_src+'template/img_move.gif';		
		 			   	    else if(tr_obj.childNodes[5].childNodes[0].src==img_src+'template/img_attrib_hover.gif')	
		 			   	  		tr_obj.childNodes[5].childNodes[0].src=img_src+'template/img_attrib.gif';		
 	 			   	  	} 	 			   	  	
 	 			   	  }	 			   	  	
 	 			   }else {	 	 			 		 	 			 			 	 			 	
	 	 			 	if(head) head.style.display=="";
	 	 			 	if(pre_data_id && pre_data_id.style.display=="none") pre_data_id.style.display="none";	 	 			 			 	 	 			  	 		 	 		 	 			 	
	 	 			 	command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=get_details');?>&eID="+id;	 	 			 			 	 			 	
 	 			   }
 	 			 }else {
 	 			 	if(data_id && data_id.style.display=="") data_id.style.display="none";
 	 			 	if(pre_head && pre_head.style.display=="") pre_head.style.display="none"; 	 			 	
 	 			 	if(head) {
 	 			 	 	head.style.display=""; 	 			 	 	 	 			 	  	 			
 	 			 		head.innerHTML="<img src='images/24-1.gif' alt='Loading...' title='Loading...'>";	 			 		
 	 			 	}
 	 			 	command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=get_details');?>&eID="+id; 	 			 
 	 			 } 	 			  	 			 
 	 			break;
 	 			case 2: 	 				 	 				 	 			 	 				
 	 					span_edit.style.display=""; 	 					
 	 					span_details.style.display=span_delete.style.display=span_copy.style.display=span_move.style.display="none";
 	 					span_edit.innerHTML="<img src='images/24-1.gif' alt='Loading...' title='Loading...'>";
 	 					command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=edit');?>&eID="+id; 	 					 	 					 	 				 	 		
 	 			break;
 	 			case 3:	 	 				 	 				 	 		 	 				
 	 					span_delete.style.display="";
 	 					span_edit.style.display=span_details.style.display=span_move.style.display=span_copy.style.display="none";
 	 					span_delete.innerHTML="<img src='images/24-1.gif' alt='Loading...' title='Loading...'>";
 	 					command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=delete');?>&eID="+id; 	 	 	 			 	 					 	 			
 	 			break; 	
				case 4:										
						span_copy.style.display="";
						span_edit.style.display=span_delete.style.display=span_details.style.display=span_move.style.display="none";
						span_copy.innerHTML="<img src='images/24-1.gif' alt='Loading...' title='Loading...'>";
						command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=copy');?>&eID="+id;																									 	
				break;				
				case 6:				 	
						span_move.style.display="";
						span_edit.style.display=span_delete.style.display=span_details.style.display=span_edit.style.display=span_copy.style.display="none";
						span_move.innerHTML="<img src='images/24-1.gif' alt='Loading...' title='Loading...'>";
						command="<?php echo tep_href_link(FILENAME_EVENTS_MAINPAGE,'action=move');?>&eID="+id;																					 
				break;					
				case 7: //sessions
					location.href="<?php echo tep_href_link(FILENAME_SESSIONS,'');?>?eID=" + id;
					break;
				case 8: //waitlists
					location.href="<?php echo tep_href_link(FILENAME_WAITLISTS,'');?>?events_id=" + id;
					break;
				case 9: //messages
					location.href="<?php echo tep_href_link(FILENAME_EVENTS_MESSAGES,'');?>?events_id=" + id;
					break;
				case 10: //sms
					location.href="<?php echo tep_href_link(FILENAME_EVENTS_SMS_MESSAGES,'');?>?events_id=" + id;
					break;			    
 	 		}
 	 		if(command!="") do_get_command(command);
 	 	}
	  } 		
	  function print_details(category,result){	  	 	 	 	 	 	 	 	 	 	 	
 	 	var no_result=""; 	 	
 	 	if(result.substr(0,15)=='No Record Found'){
 	 		no_result="No Record Found";
 	 	}else if(result!='' && result.length>0 && category!='edit' && result.substr(0,15)!='No Record Found'){
 	 		splt_str=result.split("^"); 	 		 	 		 	 		 	 	 	 	
 	 		var  event_id="";
			var  event_name="";
			var  event_description="";
			var  event_where="";
			var  event_location="";
			var  event_instructor="";
			var  event_cost="";			
			var  event_image="";
			var sort_order="";
 	 		event_id=splt_str[0]; 	 		
 	 		event_name=splt_str[1];
			event_image=splt_str[2];
 	 		event_description=splt_str[3]; 	 		 	 	
			event_where=splt_str[4];			
			event_location=splt_str[5];
			event_instructor=splt_str[6];
 	 		event_cost=splt_str[7];
			event_status=splt_str[8];
 	 	}	 	 	 	 	 	  	 		 	  	 	
 		if(document.new_product && document.new_product.event_id) var id=document.new_product.event_id.value;
 		if(document.new_product && document.new_product.cPath) var category_id=document.new_product.cPath.value;
 		var span_details=document.getElementById("span_details");	
 		var span_edit=document.getElementById("span_edit"); 	 		 	 		
 		var span_delete=document.getElementById("span_delete");
		var span_copy=document.getElementById("span_copy");
		var span_move=document.getElementById("span_move"); 		
 		var head=document.getElementById("head_"+id+"_"+category_id); 		 		 		  
 		var data_id=document.getElementById("data_"+id+"_"+category_id);
 		var res_display=document.getElementById("res_display");
 		var img_save=document.getElementById("img_save");
 		if(img_save && category!='get_details') img_save.style.display=""; 		 	
 	 	switch(category){ 	 		 	 		 	 		
 	 		case 'get_details': 	  	 				 	 		 	 		 	 		 	 		
 	 		if(head  && no_result!="")
				head.innerHTML=no_result; 	 			 	 		
 	 		else if(head && no_result==""){  	 	 		
	 	 		if(data_id) data_id.innerHTML='<img src="images/template/'+((event_status==0)?'icon_inactive.gif':'icon_active.gif')+'" alt="" border="0"><img src="images/pixel_trans.gif" alt="" border="0" height="10" width="5">'+event_name;
				//if(data_id.childNodes[0] && event_image!="") data_id.childNodes[0].src=img_src+"template/"+((event_status==0)?'icon_inactive.gif':'icon_active.gif');
				//if(data_id.childNodes[1] && event_name!="") data_id.childNodes[1].src=;
	 	 		//alert(data_id.childNodes[0].src);
	 	 		head.innerHTML="<table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
				"<tr height='40' class='openContent_top'>"+
				  "<td width='10'></td>"+
				  "<td width='30' valign='middle' align='center'><img src='images/template/"+((event_status==0)?"icon_inactive.gif":"icon_active.gif")+"'></td>"+
				  "<td width='350' align='left' valign='middle' class='main'>"+event_name+"</td>"+
				  "<td width='470' align='left' class='main' valign='top'>"+
				  	"<table border='0' cellspacing='0' cellpadding='0' style='height:30px;display:inline;position:relative;'>"+
				  	  "<tr class='img_move' id='img_ids'>"+
				  	  	"<td class='cell_bg_popm_left' width='10'>&nbsp;</td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",2);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img id='img_edit' alt='Edit' title='Edit' src='images/template/img_edit.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",3);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Delete' title='Delete' id='img_delete' src='images/template/img_trash.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",4);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Copy' title='Copy' id='img_copy' src='images/template/img_copy.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",6);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Move' title='Move' id='img_move' src='images/template/img_move.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",7);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Sessions' title='Sessions' id='img_session' src='images/template/img_attrib.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",8);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Waitlists' title='Waitlists' id='img_waitlist' src='images/template/img_sms.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",9);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='Messages' title='Messages' id='img_message' src='images/template/img_message.gif'></td>"+
				  	    "<td width='10%' onclick='javascript:change_class(this,1);expand_category("+event_id+",10);' onmouseover='javascript:change_class(this,2);' onmouseout='javascript:change_class(this,3);'><img alt='SMS' title='SMS' id='img_sms' src='images/template/img_sms.gif'></td>"+
				  	    "<td class='cell_bg_popm_right' width='10'>&nbsp;</td>"+
				  	  "</tr>"+
				  	"</table>"+
				  "</td>"+
				 "<td width='300' align='right' id='img_save' style='display:none'><input type='image' src='images/template/img_savel.gif' alt='save' title='save' border='0'>&nbsp;&nbsp;<a href='javascript:expand_category("+event_id+",1)'><img src='images/template/img_closel.gif' alt='close' title='close' border='0'></a>&nbsp;&nbsp;</td>"+
				"</tr>"+
				"<tr style='height:10'><td id='loading' style='display:none' colspan='10'><img src='images/24-1.gif' alt='Loading...' title='Loading...'></td></tr>"+				
				"<tr>"+
				  "<td colspan='13' class='main'><span style='display:none' id='span_edit'></span><span style='display:none' id='span_delete'></span><span style='display:none' id='span_copy'></span><span style='display:none' id='span_move'></span><span id='span_details'>"+
				  	"<table width='100%' border='0' cellspacing='0' cellpadding='0'>"+
				  		"<tr>"+
				  			"<td width='30'>&nbsp;</td>"+
				  			"<td width='10'><img alt='"+event_name+"' title='"+event_name+"' src='../images/"+event_image+"' border='0' width='100'></td>"+				  			
							"<td width='550' align='left' valign='top' class='main'><div style='width:100%;height:130;overflow:auto;'>"+
				  			  	event_description +			  			  
				  			"</div></td></tr>"+
				  			"<tr><td width='30'></td><td width='560' valign='top' colspan=2>"+
				  				"<table width='100%' border='0' cellspacing='5' cellpadding='0' class='main'>"+
				  					"<tr>"+
				  						"<td align='left' width='10%' valign='top'><b><?php echo TEXT_WHEN;?><b></td>"+
				  						"<td align='left' width='50%' valign='top'>"+event_where+"</td>"+
				  					"</tr>"+			  					
				  					"<tr>"+
				  						"<td align='left' width='10%'><b><?php echo TEXT_LOCATION;?><b></td>"+
				  						"<td align='left' width='50%'>"+event_location+"</td>"+
				  					"</tr>"+
				  					"<tr>"+
				  						"<td align='left' width='10%'><b><?php echo TEXT_INSTRUCTOR;?><b></td>"+
				  						"<td align='left' width='50%'>"+event_instructor+"</td>"+
				  					"</tr>"+
				  					"<tr>"+
				  						"<td align='left' width='10%'><b><?php echo TEXT_COST;?><b></td>"+
				  						"<td align='left' width='50%'>"+event_cost+"</td>"+
				  					"</tr><tr><td>&nbsp;</td></tr>"+				  								  								  			
				  				"</table>"+			  				
				  			"</td>"+
				  		"</tr>"+
				  	"</table></span>"+			  			  		
				  "</td>"+
				"</tr>"+																		
			"</table>";
 	 		} 	 	
 	 	break;
 	 	case 'edit': 	 		 	 		 	 		 	 		
			if(span_edit) span_edit.style.display="";			
 	 		if(span_edit && span_details){ 	 			 	 			
 	 			span_edit.innerHTML=result; 	 			
 	 			span_details.style.display='none';
 	 		}									
       <?php 	$languages = tep_get_languages();
		   if (HTML_AREA_WYSIWYG_DISABLE=='Enable') { 
			 for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>
		 		initEditor('events_description[<?php echo $languages[$i]['id']; ?>]');
  	   <?php } 
		  }?>
		  enableGroup();
		  doCheck(document.new_product.events_wait_list.checked);
		  updateGross();
			for(i=0;i< document.new_product.link_service.length;i++){
				if(document.new_product.link_service[i].checked){
					if(document.new_product.link_service[i].value=='S'){
						init();
					}
					break;
				}
			}										
		toggle_panel('Costs','false','','0');
		toggle_panel('Instructor','false','','0');
		toggle_panel('WaitingList','false','','0');		
		toggle_panel('Conditions','false','','0');
		toggle_panel('Subscription','false','','0');
		change();						
 	 	break;
 	 	case 'delete': 	 				 	 	
 	 		if(span_delete) span_delete.style.display="";
 	 		if(span_delete){ 	 			
 	 			span_delete.innerHTML=result; 	 			
 	 			span_details.style.display=span_edit.style.display=span_copy.style.display='none';
 	 		} 	 								   			   
 	 	break; 	 	
 	 	case 'delete_success':			 
 	    	 if(head && data_id) {
 	    	 	var tbl_obj=head.parentNode.parentNode.parentNode.parentNode;			 				 				 	
			 	if(tbl_obj) tbl_obj.deleteRow(head.parentNode.parentNode.rowIndex);
			 	data_id.innerHTML=head.innerHTML="";
			 	data_id.style.display=head.style.display="none";
			 }
 	    	 if(res_display){
 	    	 	res_display.innerHTML="<?php echo TEXT_EVENT_DELETE_SUCCESS;?>";
 	    	 	res_display.style.display=""; 	    	 	
 	    	 } 	    	 
			 			 				
 	 	break; 	 	 	  	 	
		case 'copy':			 	 	
 	 		if(span_copy) span_copy.style.display="";
 	 		if(span_copy){ 	 			
 	 			span_copy.innerHTML=result; 	 			
 	 			span_details.style.display=span_edit.style.display=span_delete.style.display=span_move.style.display='none';
 	 		} 	 										       
 	 	break; 
 	 	case 'copy_error':
 	 	case 'copy_success': 	 		 
 	    	  if(res_display){ 	    	 	 	    	 	
 	    	 	if(category=='copy_error') {
 	    	 		res_display.style.display=""; 	    	 		
 	    	 		res_display.innerHTML="<?php echo ERROR_CANNOT_LINK_TO_SAME_EVENT_CATEGORY;?>";
 	    	 	}else if(category=='copy_success') { 	    	 		 	    	 		 	    	 		  	    	 		
 	    	 		//if(result>0) toggle_category_panel(result,1); 	    	 		
 	    	 		res_display.innerHTML="<?php echo TEXT_EVENT_COPY_SUCCESS;?>";
 	    	 		res_display.style.display="";
 	    	 		if(result==category_id){
	  	 		    	toggle_category_panel(result,0,true);	  	 		    	  	 		    	  	 		    	  	 		    
	  	 		    	toggle_category_panel(result,1,true);
	  	 		    }else toggle_category_panel(result,0);	
 	    	 	}  	    	 	
 	    	 	if(head && data_id) {
 	    	 		head.style.display="none";
 	    	 		data_id.style.display="";
 	    	 	} 	    	 	 
 	    	 }		
 	 	break;	 	
 	 	case 'move': 	 		 	 	
 	 		if(span_move) span_move.style.display="";
 	 		if(span_move){ 	 			
 	 			span_move.innerHTML=result; 	 			
 	 			span_details.style.display=span_edit.style.display=span_delete.style.display=span_copy.style.display='none';
 	 		} 	 											       
 	 	break;
 	    case 'move_success': 	    	 	    	  	    	  	    	 
 	    	 if(res_display){ 	    	 	
 	    	 	if(result==category_id){
	  	 		    	toggle_category_panel(result,0,true);	  	 		    	  	 		    	  	 		    	  	 		    
	  	 		    	toggle_category_panel(result,1,true);
	  	 		}else toggle_category_panel(result,0);	
 	    	 	//if(result>0) toggle_category_panel(result,2);
 	    	 	res_display.innerHTML="<?php echo TEXT_EVENT_MOVED_SUCCESS;?>";
 	    	 	res_display.style.display=""; 	    	 	
 	    	 }
 	    	 if(head && data_id) {			 	
			 	var tbl_obj=head.parentNode.parentNode.parentNode.parentNode;			 				 				 	
			 	if(tbl_obj) tbl_obj.deleteRow(head.parentNode.parentNode.rowIndex);
			 	data_id.innerHTML=head.innerHTML="";
			 	data_id.style.display=head.style.display="none";			 				 				 
			 }			  	    	
 	    break; 	 
 	    case 'diff_category':
			if(result) toggle_category_panel(result,0);																
		break;   			
 	 	} 	 	 	 	
 	 	if(res_display.style.display=="") setTimeout("res_display.style.display='none'",2000); 	 	 	 	
 	 	clearTimeout(); 	 	
	  }*/ 	 	     	 	  	 	  	 
	 function show_duplicate(type){
	 	if(type=='dup')
			document.getElementById('dub_prd').style.display='';
		else
		   document.getElementById('dub_prd').style.display='none';
	 }
		function do_change(obj){
		var command='';
		document.new_product.link_service_val.value=obj.value;
		if(obj.value=='L'){
			document.getElementById('locations').style.display="";
			document.getElementById('customers').style.display="none";
			document.getElementById('services').style.display="none";
		} else if(obj.value=='S'){
			var service_count=customers_count="";
			document.getElementById('locations').style.display="none";
			document.getElementById('customers').style.display="";
			for(i=document.new_product.sel_services.options.length;i>=0;i--) {
					document.new_product.sel_services.options[i]=null;
				}
			var Option_value=new Option('<?php echo TEXT_SELECT;?>','-1');
			document.new_product.sel_services.options[0] = Option_value;
			command="<?php echo tep_href_link(FILENAME_EVENTS_CATEGORIES, 'ecPath=' . $ecPath . '&eID=' . $HTTP_GET_VARS['eID'] . '&action='. $form_action.'&command=fetch_customer_details');?>";
			do_get_command(command);
		}
		
	}
	function set_session_style(obj)
	{
		document.new_product.session_style_val.value=obj.value;
	}
	function set_copy_as_val(obj)
	{
		document.new_product.copy_as_val.value=obj.value;
	}
function doCheck(bolEnable){
	document.new_product.priority_vip.disabled=!bolEnable;
	document.new_product.session_style[0].disabled=!bolEnable;
	document.new_product.session_style[1].disabled=!bolEnable;
	document.new_product.priority_firstcome.disabled=!bolEnable;
	document.new_product.priority_custom.disabled=!bolEnable;
	document.new_product.priority_question.disabled=!bolEnable;
	document.new_product.waitsize_vip.disabled=!bolEnable;
	document.new_product.waitsize_firstcome.disabled=!bolEnable;
	document.new_product.waitsize_custom.disabled=!bolEnable;
	document.new_product.waitfee_vip.disabled=!bolEnable;
	document.new_product.waitfee_firstcome.disabled=!bolEnable;
	document.new_product.waitfee_custom.disabled=!bolEnable;
	document.new_product.events_forward_period.disabled=!bolEnable;    
	document.new_product.events_forward_length.disabled=!bolEnable;
	document.new_product.events_pending_period.disabled=!bolEnable;
}
function hide_instruct(bolEnable) {
	document.new_product.instructors_rate_type.disabled=!bolEnable;
	document.new_product.instructors_rate.disabled=!bolEnable;
	document.new_product.instructors_base_rate.disabled=!bolEnable;
	document.new_product.events_instructor.disabled=!bolEnable;
	document.new_product.events_backup_instructor.disabled=!bolEnable;
}
function enableGroup(){
	var frm=document.new_product;
	frm.events_group_max.disabled=!frm.events_group_bookings.checked;
	frm.events_group_min.disabled=!frm.events_group_bookings.checked;
}
 function change_waitfee(txtBox){
   if (txtBox.name!="waitfee_vip")
      document.new_product.waitfee_vip.value=txtBox.value;
   if (txtBox.name!="waitfee_firstcome")
      document.new_product.waitfee_firstcome.value=txtBox.value;
   if (txtBox.name!="waitfee_custom")
      document.new_product.waitfee_custom.value=txtBox.value;
 }
	function isNumeric(value,minimumValue,maximumValue){
		value=parseFloat(value);
		if (isNaN(value)) return false;
		if (value<minimumValue) return false;
	
		if (maximumValue>0 && value>maximumValue) return false;
			return true;
		}
		function init(){
			document.getElementById('locations').style.display="none";
			document.getElementById('customers').style.display="";
			document.getElementById('services').style.display="";
			command="<?php echo tep_href_link(FILENAME_EVENTS_CATEGORIES, 'ecPath=' . $ecPath . '&eID=' . $HTTP_GET_VARS['eID'] . '&action='. $form_action.'&command=fetch_customer_details');?>";
			do_get_command(command);
	    }
/*function change_class(obj,eve){ 		 		 	 	
		 var span_details=document.getElementById("span_details"); 
		 var span_edit=document.getElementById("span_edit");
		 var span_delete=document.getElementById("span_delete");
		 var span_copy=document.getElementById("span_copy");
		 var span_move=document.getElementById("span_move");
		 var span_attrib=document.getElementById("span_attrib");		 		 		 		
		 if(obj){		   		    		    
		    var img_get_src=obj.childNodes[0];		    
			if(img_get_src){
		    if(img_get_src.src==img_src+'template/img_edit.gif') {
				if(span_edit && span_edit.style.display=="" && eve==1 || eve==2){
				 	img_get_src.src=img_src+'template/img_edit_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_edit_hover.gif' && span_edit && span_edit.style.display=="none") img_get_src.src=img_src+'template/img_edit.gif';
		    if(img_get_src.src==img_src+'template/img_trash.gif') {
				if(span_delete && span_delete.style.display=="" && eve==1 || eve==2){
				 	img_get_src.src=img_src+'template/img_trash_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_trash_hover.gif' && span_delete && span_delete.style.display=="none") img_get_src.src=img_src+'template/img_trash.gif';
		    if(img_get_src.src==img_src+'template/img_copy.gif') {
				if(span_copy && span_copy.style.display=="" && eve==1 || eve==2){
				 	img_get_src.src=img_src+'template/img_copy_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_copy_hover.gif' && span_copy && span_copy.style.display=="none") img_get_src.src=img_src+'template/img_copy.gif';
		    if(img_get_src.src==img_src+'template/img_attrib.gif') {
				if(eve==2){
				 	img_get_src.src=img_src+'template/img_attrib_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_attrib_hover.gif') img_get_src.src=img_src+'template/img_attrib.gif';
		    if(img_get_src.src==img_src+'template/img_move.gif') {
				if(span_move && span_move.style.display=="" && eve==1 || eve==2){
				 	img_get_src.src=img_src+'template/img_move_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_move_hover.gif' && span_move && span_move.style.display=="none") img_get_src.src=img_src+'template/img_move.gif';		    
		    if(img_get_src.src==img_src+'template/img_sms.gif') {
				if(eve==2){
				 	img_get_src.src=img_src+'template/img_sms_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_sms_hover.gif') img_get_src.src=img_src+'template/img_sms.gif';		    		     		   	
		    if(img_get_src.src==img_src+'template/img_message.gif') {
				if(eve==2){
				 	img_get_src.src=img_src+'template/img_message_hover.gif';
				}  		   		 	 			 	 			
		    }else if(eve==3 && img_get_src.src==img_src+'template/img_message_hover.gif') img_get_src.src=img_src+'template/img_message.gif';
		  }
		 }		 
	  }	*/	  
	</script>
