function FormSubmit(id, value, action){
	if(document.getElementById(id)){
		document.getElementById(id).value=value;
	}
	if(action){
		document.FormName.action=action;
	}
	document.FormName.submit();
}function SearchFunction(){
	var SearchBy=document.getElementById('SearchBy').value;
	var SearchValue=document.getElementById('SearchValue').value;
	if(SearchBy ==''){
		document.getElementById('SearchBy').style.background='red';
		alert("Please Select SearchBy Option");
	}else if(SearchValue ==''){
		document.getElementById('SearchValue').style.background='red';
		document.getElementById('SearchValue').focus();
		alert("Please insert search value");
	}else{ 
		AjaxFunction('module/search_engin/suggest.php', SearchValue, 'suggest', SearchBy);
	}
}function check_uncheck(obj){
	if(obj.checked){
		for (var i = 0; i < document.FormName.elements.length; i++) {
				var e = document.FormName.elements[i];
				if(e.type=="checkbox"){
					e.checked = true;
				}
		}
	}else{
		for (var i = 0; i < document.FormName.elements.length; i++){
			var e = document.FormName.elements[i];
			if(e.type=="checkbox"){
				e.checked = false;
			}
		}
	}
}function check_selected(action,FormAction,DivID,val1,ElementType,val2,val3){
	//alert(action);
	var flag ='no';
	var element_type='checkbox';
	var j=1; var p_id=new Array();
	document.FormName.action = 'index.php?page=delete';	
	if(FormAction){
		document.FormName.action = FormAction;	
	}
	if(ElementType){
		element_type=ElementType;	
	}
	for (var i = 0; i < document.FormName.elements.length; i++){
		var e = document.FormName.elements[i];
		if ((e.type == element_type)){
			if (e.checked && element_type=='checkbox'){
				var flag='yes';
				p_id[j]=e.value;
				j++;
			}else if(element_type=='select-one' && e.value!='' && e.value!=0){
				var flag='yes';
				p_id[j]=e.value;
				j++;
			} 
		}
	}
	if(flag=='no'){
		 alert('Please select atleast one '+element_type);
		 return false;	
	}
	else{
		if(action=='delete'){
			if( confirm('Are you sure to delete selected record?')){
				document.FormName.submit();
			}
		}else if(action=='access_code'){
			if( confirm('Are you sure to Generate & Send Access Code to selected record?')){
				document.FormName.submit();
			}
		}else if(action=='activate'){
			if( confirm('Are you sure to activate to selected record?')){
				document.FormName.action = 'index.php?page=delete&action=activate';
				document.FormName.submit();
			}
		}else if(action=='disactivate'){
			if( confirm('Are you sure to disactivate to selected record?')){
				document.FormName.action = 'index.php?page=delete&action=disactivate';
				document.FormName.submit();
			}
		}else if(action=='AjaxDelete'){
			Ajax(FormAction,DivID,val1,p_id,'delete')
		}else if(action=='ScheduledMeetings'){
			Ajax(FormAction,DivID,val1,val2,p_id,val3);
		}
	}
}function display(val){
	if(val=='Other'){
		document.getElementById('DisplayID').style.display='';
		if(document.getElementById('MessageType')){
			document.getElementById('MessageType').value='';
		}
	}else{
		document.getElementById('DisplayID').style.display='none';
		if(document.getElementById('MessageType')){
			document.getElementById('MessageType').value='Message Type';
		}
	}
}function window_open(page,hight,width,x,y,top){
   window.open( page , 
  'windowname2', 
  'width= ' + width +', \
   height=' + hight +', \
   directories=no, \
   top=' + top + ', \
   screenX=' + x + ', \
   screenY=' + y + ' \
   location=no, \
   menubar=no, \
   resizable=1, \
   scrollbars=1, \
   status=no, \
   toolbar=no');
}function Ajax(url,DivID,val1,val2,val3,val4,val5,val6) {
	//alert(val1);
document.getElementById(DivID).innerHTML="<img class='img_center' src='http://www.one2onescheduler.com/images/Loading.gif'/><br><b><font color=green size=2>If page does not loads in 2 minutes, then please reclick on link and try again !</font></b>";
	$.post(url, {
	val1:val1,
	val2:val2,
	val3:val3,
	val4:val4,
	val5:val5,
	val6:val6,
	ajax_active:'set'
	}, function(data) {
	$("#"+DivID).html(data);
	});
	//alert(url+'--'+DivID+'--'+val1+'--'+val2+'--'+val3+'--'+val4+'--'+val5);
}function ShutUp1(ID){
	$("#AdminDetails").hide();
	$("#EventDetails").hide();
	$("#TimeSlots").hide();
	$("#CompanyImportAdd").hide();
	$("#TableAllocationSettings").hide();
	$("#BoothDetails").hide();
	$("#SponsorsDetail").hide();
	if(ID != 'AdminDetails') $('#IMG_AdminDetails').attr('name', 'down');
	if(ID != 'EventDetails') $('#IMG_EventDetails').attr('name', 'down');
	if(ID != 'TimeSlots') $('#IMG_TimeSlots').attr('name', 'down');
	if(ID != 'CompanyImportAdd') $('#IMG_CompanyImportAdd').attr('name', 'down');
	if(ID != 'TableAllocationSettings') $('#IMG_TableAllocationSettings').attr('name', 'down');
	if(ID != 'BoothDetails') $('#IMG_BoothDetails').attr('name', 'down');
	if(ID != 'SponsorsDetail') $('#IMG_SponsorsDetail').attr('name', 'down');
	var img='IMG_'+ID;
	var obj = document.getElementById(img);
	if(obj.name=='up'){
		obj.src="../../images/close.png"; obj.name='down';
		$("#"+ID).hide();
		//$("#AdminDetails").hide().slideToggle(2000);
	}else{
		obj.src="../../images/open.png"; obj.name='up';
		$("#"+ID).show();
		//$("#AdminDetails").show().slideToggle(2000);
	}
}function HideShow(obj,ID){
	if(obj.checked){
		$("#"+ID).show();
	}else{
		$("#"+ID).hide();
	}
}function Hide_Show(ID,action){
	if(action=='show'){
		$("#"+ID).show();
	}else{
		$("#"+ID).hide();
	}
}function MultipleHideShow(ShowID,HideID,ID1,ID2){
	if(ShowID){
		$("#"+ShowID).show();
		if(document.getElementById(ID1)){
			document.getElementById(ID1).className='required drop_down_212';
		}
	}if(HideID){
		if(document.getElementById(ID2)){
			document.getElementById(ID2).className='';
		}
		$("#"+HideID).hide();
	}
}
