	var catering = '';
	var filterparam ='';
	var	order_by = '';
	var	asc_by = '';
	var	key;
	var	tot_ph = 0;
	var	temp = 0;
	var	temp_pdfarray = 0;
	
	

	function disableEnterKey(e)
	{
			 var key;      
			 if(window.event){  
			 key = window.event.keyCode; //IE
			 }
			 else { 
			 key = e.which; //firefox 
			 }     
		
			 return (key != 13);
	}
		
		
		function capWords(fo,p) {
		
			 
		var f 	= document.getElementById(fo);

		var p = f[p]; // The input text field
		var inputString = p; // The input text field
		

		var tmpStr, tmpChar, preString, postString, strlen;
		tmpStr = inputString.value.toLowerCase();
		stringLen = tmpStr.length;
		if (stringLen > 0)
		{
		  for (i = 0; i < stringLen; i++)
		  {
			if (i == 0)
			{
			  tmpChar = tmpStr.substring(0,1).toUpperCase();
			  postString = tmpStr.substring(1,stringLen);
			  tmpStr = tmpChar + postString;
			}
			else
			{
			  tmpChar = tmpStr.substring(i,i+1);
			  if (tmpChar == " " && i < (stringLen-1))
			  {
			  tmpChar = tmpStr.substring(i+1,i+2).toUpperCase();
			  preString = tmpStr.substring(0,i+1);
			  postString = tmpStr.substring(i+2,stringLen);
			  tmpStr = preString + tmpChar + postString;
			  }
			}
		  }
		}
		inputString.value = tmpStr;
		
 		}
		


	function EditPost(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
				
				 // alert(myajax.responseText);
				 
				 if (myajax.responseText !== 0){
 					 
					 // $("#btn_save").effect('highlight');
					 $(".msg_saved").animate({opacity: 1.0}, 400);
					 $(".msg_saved").fadeIn("fast");
					 $(".msg_saved").animate({opacity: 1.0}, 800);
					 $(".msg_saved").fadeOut("fast");
					 
					 $("#btn_save").fadeOut("fast");					
					 $("#btn_save").animate({opacity: 1.0}, 1600);
					 $("#btn_save").fadeIn("fast");					
					 
					 // $("#btn_save").fadeIn("fast");
				 	 // document.getElementById("msg_saved").style.display="block";
				 	 // document.getElementById("btn_save").style.display="none";
				} 
			}
		}
	}
	
	 
 

	function processSend(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
				var valo = Number(myajax.responseText);
 				if (valo == 0){  

					} else{ 
					
						$("#theform").fadeOut("fast");
						$("#thefeedback").animate({opacity: 1.0}, 1300);
						$("#thefeedback").fadeIn("fast");

					}
			}
		}
	}
	 


	function updatePost(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ 
		//alert(myajax.responseText);
 		    refreshit();
			}
		}
	}




	function processGetPost(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
		
				var valo = Number(myajax.responseText);
 				if (valo == 0){  
					 document.getElementById("container_temp").innerHTML = "No results."; 
					 document.getElementById("container").innerHTML = "";
					 
					} else{ 
					 document.getElementById("container").innerHTML = myajax.responseText;
					 document.getElementById("container_temp").innerHTML = ""; 
				}

			}
		}
	}
	 

 
	function processAddPost(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ 
			// alert(myajax.responseText);			
							eval("window.location='"+paramAddPost2+".php?"+paramAddPost3+"="+ paramAddPost1 +"&"+paramAddPost4+"="+paramAddPost5+"'");
		
			}
		}
	}
	
	
	function changePress(p){
		
		document.getElementById("p"+1).className = "btn_press";
		document.getElementById("p"+2).className = "btn_press";
		document.getElementById("p"+3).className = "btn_press";
		
		document.getElementById("p"+p).className = "btn_press_select";
		ajaxpack.postAjaxRequest("process_press.php", "press_category="+p, processPress, "txt");
	}
	
	function processPress(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
		
				var valo = Number(myajax.responseText);
 				if (valo == 0){  
					 document.getElementById("press_cont").innerHTML = "";
					 
					} else{ 
					 document.getElementById("press_cont").innerHTML = myajax.responseText;
				}

			}
		}
	}
	 


	function refreshit(){
		ajaxpack.postAjaxRequest(proccessurl, key+"", processGetPost, "txt");
	}
	
	function change_input_stye(param,hasFocus){
			//if(hasFocus == true ) {alert(param)}
			document.getElementById(param).style.border='1px solid #999999';
			document.getElementById(param).style.backgroundColor='#ffffff';
	}
	
		
	function empty_Search(){
			document.getElementById('txtSearch').value = '';
	}
	
		
	function change_hover_style(param){
			document.getElementById(param).style.border='1px solid #aaaaaa';
	}
	
	
	function change_input_rtn(param,hasFocus){
			document.getElementById(param).style.border='1px solid #D9D9D9';
			document.getElementById(param).style.backgroundColor='#E8E8E8';
	}
	
	
	function change_out_style(param){
		//if(param.Focused == false){
			
			//alert(param.hasFocus)
			
			document.getElementById(param).style.border='1px solid #D9D9D9';
			document.getElementById(param).style.backgroundColor='#E8E8E8';
		//}
	}
	

	function change_input_back(param){
		
			//document.getElementById("msg_saved").style.visibility="hidden";
			document.getElementById(param).style.border='1px solid #D9D9D9';
			document.getElementById(param).style.backgroundColor='#E8E8E8';
	}
	
	function refreshordit(p1,p2){
		order_by = p1;
		asc_by = p2;
		ajaxpack.postAjaxRequest(proccessurl, "order_by="+order_by+"&asc_by="+asc_by+"&filterTxt="+filterparam+"&catering="+catering, processGetPost, "txt");
	}
	
 	function filterCancel(){
		filterparam = '';
		document.getElementById("filtercancel").style.display = "none";
		document.getElementById("filterbox").value="Type here";
		ajaxpack.postAjaxRequest(proccessurl, key+"&order_by="+order_by+"&asc_by="+asc_by+"&filterTxt=&", processGetPost, "txt");
	}
	
	
	
	function filterList(param){
		document.getElementById("filtercancel").style.display="block";
		filterparam = param;
		ajaxpack.postAjaxRequest(proccessurl, key+"&order_by="+order_by+"&asc_by="+asc_by+"&filterTxt="+filterparam+"&catering="+catering, processGetPost, "txt");
		
	}

	
	function filterList(param){
		document.getElementById("filtercancel").style.display="block";
		filterparam = param;
		ajaxpack.postAjaxRequest(proccessurl, key+"&order_by="+order_by+"&asc_by="+asc_by+"&filterTxt="+filterparam+"&catering="+catering, processGetPost, "txt");
		
	}

	 
	function closeNav(e){
		
		$(".col_header").slideUp();
		
		
		
	}
	
	function openNav(e){
		
		$(".col_header").slideDown();
		
		
		
	}
	
	
	
	function filterit(p,e){
		
	
  	
		$(".col_header_works_m a").removeClass("xelected");
		$(".col_header a").removeClass("xelected");
	 
 	
		if(p){
			$("#"+e).addClass("xelected");
		
			$(".clientsmask").fadeIn();
			$(".clientsmask"+"."+p).fadeOut();
		
			$(".clients").animate({"opacity": 0.2}, { duration: "fast" ,queue: false });
			$("."+p).animate({"opacity": 1}, { duration: "slow" });
	
		}
		else {
		
			$("#all").addClass("xelected");
			$(".clients").animate({"opacity": 1}, { duration: "fast" ,queue: false });
			$(".clientsmask").fadeOut();
			
		}
	
		
	$.ajax({
	   type: "POST",
	   url: "process_m.php",
	   data: "bym="+p
	  
	 });	 
	
	
	//ajaxpack.postAjaxRequest("process_m.php",  "&bym="+p+"", processmPost, "txt");
	
	
	}
	
	
	
	function saveToPDF(e){
		
 		
		$.ajax({
		   type: "POST",
		   url: "process_pdf.php",
		   data: "id="+e,
		   success: function(msg){
     		     		
						 
     		     		$("#saveToPDF").addClass("saveToPDFok");
     		     		$("#saveToPDF").html("Added");

  				 }
		 });	 
 	}
	
	
		function verifyEmail(){
		var status = false;     
		var emailRegEx = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i;
			 if (document.getElementById('sendToPDFfrm').email.value.search(emailRegEx) == -1) {
				  alert("Please enter a valid email address.");
			 }
			 else {
				  status = true;
			 }
			 return status;
		}	
	
	
	function sendToPDF(){
		
		var yourname  = document.getElementById('sendToPDFfrm').yourname.value;
		var email  = document.getElementById('sendToPDFfrm').email.value;
		var ss  = document.getElementById('sendToPDFfrm').email.value;
		var arr = document.getElementById('sendToPDFfrm').arr.value;
		
		var ss =  verifyEmail(ss); 
		
		if(ss==false){
 				
 		
  		} 
		else {
				
				
			$.ajax({
			   type: "POST",
			   url: "process_sendpdf.php",
			   data: "&arr="+arr+"&email="+email+"&yourname="+yourname,
			   success: function(msg){
				alert( "Sent "+ msg);
				//$("#simpleModal").addClass("show");
			   }
			 });	 
			
		}
 		
		
	}
	
	
	
	
	function delToPDF(e){
		
		$(".a"+e).fadeOut();

		
		$.ajax({
		   type: "POST",
		   url: "process_pdf.php",
		   data: "del="+e,
		   success: function(msg){
					alert( "Sent "+ msg);
					
						document.getElementById("arr").value = msg;
			 
  				 }
		 });	
		
		
		 
		
	}
	
	

	function processmPost(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
		
			
				alert(myajax.responseText);
				

			}
		}
	}


	 
	function filterThis(p){
		
		var m = document.getElementById("wed_frm"+p);
		var p1 = m.filterEvent.value;
		var n  = m.filterState;
		var p2 = n.options[n.selectedIndex].value;
		filterWedddings(p1, p2, p);
	
	}
	

	
	 function gallery_movenext() { //alert(tot_ph);
			 
		 if(temp < tot_ph-1){
	   		 temp = temp + 1; 
			 gallery_move_reset();			 
	   		 var _ml = document.getElementById("wg_box").style.marginLeft; 
			 var _ml = Number(_ml.replace("px","")); 
	   		 var _xx = _ml - 680; 
			 $("#wg_box").animate({marginLeft: _xx+"px"}, 1000, "swing", function(){ gallery_moveprev_reset(); gallery_movenext_reset(); } );
		}
			 
	 }; 
	 
	 
	 function  gallery_moveprev() { 
	 	  
		 if(temp > 0){
			 
			 gallery_move_reset();	
			 temp = temp - 1; 
	   		 var _ml = document.getElementById("wg_box").style.marginLeft; 
			 var _ml = Number(_ml.replace("px","")); 
	   		 var _xx = _ml + 680; 
			 $("#wg_box").animate({marginLeft:  _xx+"px"}, 1000, "swing", function(){ gallery_moveprev_reset(); gallery_movenext_reset(); } );
		 
		 }
	 
	 }; 
	 
	 
	 
	 function  gallery_move_reset() { 
			 document.getElementById("btn_prev").style.display = "none";
			 document.getElementById("btn_next").style.display = "none";
			 document.getElementById("btn_prev_temp").style.display = "block";
			 document.getElementById("btn_next_temp").style.display = "block";
	 };
	 
	 function  gallery_movenext_reset() { 
			 	document.getElementById("btn_next").style.display = "block";
			 	document.getElementById("btn_next_temp").style.display = "none";
	 };
	 
	 function  gallery_moveprev_reset() { 
	 		 	document.getElementById("btn_prev").style.display = "block";
	 		 	document.getElementById("btn_prev_temp").style.display = "none";
	 };
	 

	
	function showWg(weddings_id, wg_title, tot){
			 temp = 0;
			 tot_ph = tot;
			 document.getElementById("wg_title").innerHTML = wg_title;
			 $("#wg_container").slideDown("slow");
			 $("#wg_navbar").slideDown("slow");
			 ajaxpack.postAjaxRequest("process_wedgallery.php", "weddings_id="+weddings_id, processWedGallery, "txt");
	}
	
	
	
	function processWedGallery(){
		
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
				
					 document.getElementById("wg_container").style.display = 'block';
					 document.getElementById("wg_container").innerHTML = myajax.responseText;
			 
			}
		}
	}
	 
	function processGallery(){
		
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){  
				
					 document.getElementById("wg_container").style.display = 'block';
					 document.getElementById("wg_container").innerHTML = myajax.responseText;
			 
			}
		}
	}
	 

	
	

	function searchBox_clear(){
		
		var ss = document.getElementById('search_Box');
		
		if(ss.value=="Search"){
			
			ss.value="";
			
		}
	}
	
	
	
	function changeMyValue(par){
			if(document.getElementById(par).checked){
				document.getElementById(par).value = "1";
			}else{
				document.getElementById(par).value = "0";
			}
	}
	
	
	
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	
	
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	
	
	function MM_findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	
	
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}
		
		
 	
	function publishit(param1, param2, param3){ 
		ajaxpack.postAjaxRequest("process_submitit.php", "order_by="+order_by+"&asc_by="+asc_by+"&pre_table="+param1+"&id="+param2+"&filterTxt="+filterparam+"&catering="+catering+"&val="+param3, processpublishit, "txt");
	}
	
	
	
	function checked_it(param1, param2, param3, param4){ 
	//alert(param1 +" "+ param2 +" "+ param3+" "+ param4);
		ajaxpack.postAjaxRequest("process_submititslide.php", "order_by="+order_by+"&asc_by="+asc_by+"&pre_table="+param1+"&pre_row="+param2+"&id="+param3+"&val="+param4, processpublishit, "txt");
	}
	
	 



 	function processpublishit(){
		var myajax=ajaxpack.ajaxobj
		var myfiletype=ajaxpack.filetype
		if (myajax.readyState == 4){ //if request of file completed
		if (myajax.status==200 || window.location.href.indexOf("http")==-1){ 
		//alert(myajax.responseText);
				ajaxpack.postAjaxRequest(proccessurl, "order_by="+order_by+"&asc_by="+asc_by+"&filterTxt="+filterparam+"&catering="+catering+"&"+key, processGetPost, "txt");
			
			}
		}
	}

	 


	
	function deleteit(param){
		if(param!=false){
		ajaxpack.postAjaxRequest(proccessurl, key+"action=delete&id="+param, processGetPost, "txt");
		}
	}
	
	function movedw(param){
		ajaxpack.postAjaxRequest(proccessurl, key+"action=movedw&id="+param, processGetPost, "txt");
	}
	
	
	function moveup(param){
		ajaxpack.postAjaxRequest(proccessurl, key+"action=moveup&id="+param, processGetPost, "txt");
	}




////



function formReset(p)
{
	document.getElementById(p).reset();
}




function startUpload(param){
	
      document.getElementById('upload_loader').style.visibility = 'visible';
      document.getElementById('upload_msg').innerHTML = '';
      document.getElementById('upload_msg').style.visibility = 'hidden';      
	
	
   var theForm =  document.getElementById(param);
  var request = {};
  var fileName = '';
  
  for (var i=0; i < theForm.elements.length; i++) { 
    ele = theForm.elements[i];
    if (ele.type == 'file') {
      var fileName = ele.value;
    	if (fileName.indexOf('/') > -1) { 
    	  fileName = fileName.substring(fileName.lastIndexOf('/')+1, fileName.length);
      }	else {
    	  fileName = fileName.substring(fileName.lastIndexOf('\\')+1, fileName.length);
      }
      break;
    }
  }
  if (fileName.replace('/\s/', '').toString() === '') {return;}
  theForm.submit();
  return true;
}



function stopUpload(success){
      var result = '';

	  if (success == "1"){
         result = '<div class="msg">File Uploaded!</div><br />';
      } else if (success == "2"){
		  
         result = '<div class="emsg">Error. <br/>Filename contains invalid characters (ex. %$^&*#@).  <br/>Retry by renaming your file.</div><br />';
	  
	  } else {
		  
         result = '<div class="emsg">Error. File not uploaded. Retry.</div><br />';
      }
       
      document.getElementById('upload_loader').style.visibility = 'hidden';
      document.getElementById('upload_msg').innerHTML = result;
      document.getElementById('upload_msg').style.visibility = 'visible';      
      return true;   
}




function  changeTitle(p,c) {
		 
	  for(i=0;i < c; i++) {
		  
		 	document.getElementById('title'+i).style.marginLeft = '-3600px';
	  }
	
	  document.getElementById('title'+p).style.marginLeft = '0px';
	 
 }
	 
 function  openFlash() { $("#flash_slideshow").animate({height: "280px" }, 1000 );	}; 
 function  closeFlash(){ $("#flash_slideshow").animate({height: "0px" }, 1000 );	}; 





 function  opencaption(e) { 
 
 //alert(e);
 
 $("#cap"+e).animate({marginTop: "0px" }, 500 );	
 
 
 }; 


 function  closecaption(e) { 
 
 $("#cap"+e).animate({marginTop: "150px" }, 500 );	
 
 
 }; 



