function timeConverter(UNIX_timestamp){
 var a = new Date(UNIX_timestamp*1000);
 var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
     var year = a.getFullYear();
     var month = a.getMonth()+1;
     var date = a.getDate();
     var hour = a.getHours()+1;
     var min = a.getMinutes();
     var sec = a.getSeconds();
     var time = date+','+month+' '+year+' '+hour+':'+min+':'+sec ;
     return time;
 }



	
function submitAddPhraseForm($form,action){
		var options = { 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse , // post-submit callback 
		url:          action,         // override for form's 'action' attribute 
        type:      'post',        // 'get' or 'post', override for form's 'method' attribute 
		dataType:  'html',
		timeout:   3000000,
		
    };
		$($form).ajaxSubmit(options); 
		
		return false;
	
	
		}
		
// pre-submit callback
function showRequest(formData, jqForm, options) { 
    // formData is an array; here we use $.param to convert it to a string to display it 
    // but the form plugin does this for you automatically when it submits the data 
    var queryString = $.param(formData);
 
    // jqForm is a jQuery object encapsulating the form element.  To access the 
    // DOM element for the form do this: 
    // var formElement = jqForm[0]; 
    
	$(jqForm).parent().find("#loading").show();
	$.colorbox.resize();
    // here we could return false to prevent the form from being submitted; 
    // returning anything other than false will allow the form submit to continue 
    return true; } 

// post-submit callback 
function showResponse(responseText, statusText, xhr, $form)  { 
    
	// for normal html responses, the first argument to the success callback 
    // is the XMLHttpRequest object's responseText property 
 
    // if the ajaxSubmit method was passed an Options Object with the dataType 
    // property set to 'xml' then the first argument to the success callback 
    // is the XMLHttpRequest object's responseXML property 
 
    // if the ajaxSubmit method was passed an Options Object with the dataType 
    // property set to 'json' then the first argument to the success callback 
    // is the json data object returned by the server 
 		
		
		
		 var response=responseText.split(',');
		
		 if(response[0]=='1')
		 {
			$($form).parent().find("#output").html(response[1]);
			$($form).hide();
			
		 }
		 else{
		    	$($form).parent().find("#output").html(response[2]);
				$("#captchaSpan").html(response[1]);
				$("#captcha").val("");
		 	}
		 $($form).parent().find("#loading").hide();	
		 $.colorbox.resize();
		 
}
function checkLength(obj,MaxLen,evt){
  var e = (evt.which) ? evt.which : event.keyCode;
  if(e != 8)
   return (obj.value.length <= MaxLen);
} 
