var SITE_HOME_PATH = "http://www.betacoder.com/";

function gotolink(url)
{
	window.location = url;
}

//--------------------////--------------------////--------------------////--------------------////--------------------//
// user register //
function registeruser()
{
	
	$('#userregisterform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: showregisterRequest,
		success: showregisterrResponse,
		url: SITE_HOME_PATH+'request_process.php?calling=1'
	};

	// bind to the form's submit event
	$('#userregisterform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function showregisterRequest(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function showregisterrResponse(responseText, statusText)
{
	var myarray = new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//--------------------////--------------------////--------------------////--------------------////--------------------//
function saveUserProfileInfo()
{
	$('#changeuserinfoform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_saveUserProfileInfo_Request,
		success: show_saveUserProfileInfo_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=2'
	};

	// bind to the form's submit event
	$('#changeuserinfoform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_saveUserProfileInfo_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_saveUserProfileInfo_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//--------------------////--------------------////--------------------////--------------------////--------------------//

function deleteuserdata(user_id, id, page)
{
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=4',
	   data: 'user_id='+user_id+'&id='+id+'&page='+page,
	   
	   success: function(msg)
	   {
		   var myarray=new Array();
		   myarray=msg.split("-separator-");
		   if(myarray[0] == 'done')
		   {
			   document.getElementById('outputdeldata').innerHTML = '<span style="color:#6BAC01; font-size:14px;">Record Deleted Successfully!</span>';
			   jQuery('#outputdeldata').fadeIn(500);
			   //setTimeout("$(document).trigger(\'close.facebox\')", 2000);
			   
			   var url = 'viewmydata.php?'+myarray[1];
			   setTimeout('gotolink(\''+url+'\')', 2002);
		   }
		},
		error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
		}
	 });
}

//---------------------------------------------------------------------------------------------------------------//

// user register //
function loginuser()
{
	$('#loginform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_loginform_Request,
		success: show_loginform_Response,
		url: 'request_process.php?calling=3'
	};

	// bind to the form's submit event
	$('#loginform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_loginform_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_loginform_Response(responseText, statusText)
{
	var myarray=new Array();
    myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//--------------------////--------------------////--------------------////--------------------////--------------------//

function saveNewProject()
{
	$('#saveNewProjectForm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_saveNewProjectForm_Request,
		success: show_saveNewProjectForm_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=4'
	};

	// bind to the form's submit event
	$('#saveNewProjectForm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_saveNewProjectForm_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_saveNewProjectForm_Response(responseText, statusText)
{
   //alert(responseText);
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//--------------------////--------------------////--------------------////--------------------////--------------------//

function placeabid_Project()
{
	$('#changeuserinfoform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_placeabid_Request,
		success: show_placeabid_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=5'
	};

	// bind to the form's submit event
	$('#changeuserinfoform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_placeabid_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_placeabid_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//------------------------------------------------------------------------------------------------------------------------------//
function refreshp_mess_div(str)
{
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=7',
	   data: str,
	   
	   success: function(msg)
	   {
		   $('#pmb_results').html(msg);
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}

function PostPrivateMessage()
{
	$('#postmess_form').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_PostPrivateMessage_Request,
		success: show_PostPrivateMessage_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=6'
	};

	// bind to the form's submit event
	$('#postmess_form').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_PostPrivateMessage_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_PostPrivateMessage_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('refreshp_mess_div(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//-------------------------------------------------------//

function sendInvitation()
{
	$('#sendInvitationForm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_sendInvitation_Request,
		success: show_sendInvitation_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=8'
	};

	// bind to the form's submit event
	$('#sendInvitationForm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_sendInvitation_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_sendInvitation_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//-------------------------------------------------------//

function saveDispute()
{
	$('#saveNewProjectForm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_saveDispute_Request,
		success: show_saveDispute_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=9'
	};

	// bind to the form's submit event
	$('#saveNewProjectForm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_saveDispute_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_saveDispute_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}


//--------------------////--------------------////--------------------////--------------------////--------------------//
// reset password //
function resetpassword()
{
	$('#loadingdiv').show();
	
	$('#userregisterform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_resetpassword_Request,
		success: show_resetpassword_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=11'
	};

	// bind to the form's submit event
	$('#userregisterform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_resetpassword_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_resetpassword_Response(responseText, statusText)
{
   $('#loadingdiv').hide();
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		$('#passresetdiv1').hide();
		$('#passresetdiv2').show();
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//--------------------////--------------------////--------------------////--------------------////--------------------//
// contact us //
function contactus()
{
	$('#userregisterform').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_contactus_Request,
		success: show_contactus_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=12'
	};

	// bind to the form's submit event
	$('#userregisterform').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_contactus_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_contactus_Response(responseText, statusText)
{
	var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//------------------------------------------------------------------------------------------------------------------------------//
function toggledive()
{
	$('#newmilestone_div').slideToggle("slow");
}

function refreshmilestonegrid(project_id, client_id, provider_id)
{
	//newmilestonelisting_div
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=15',
	   data: 'project_id='+project_id+'&client_id='+client_id+'&provider_id='+provider_id,
	   
	   success: function(msg)
	   {
		  $('#newmilestonelisting_div').html(msg);
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}
//------------------------------------------------------------------------------------------------------------------------------//
function savemilestone()
{
	var milestone_title = $('#milestone_title').val();
	var amount = $('#amount').val();
	var notes = $('#notes').val();
	var delivery_date = $('#delivery_date').val();
	var project_id = $('#project_id').val();
	var client_id = $('#client_id').val();
	var provider_id = $('#provider_id').val();
	var medit_id = $('#medit_id').val();
	
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=14',
	   data: 'milestone_title='+milestone_title+'&amount='+amount+'&notes='+notes+'&delivery_date='+delivery_date+'&project_id='+project_id+'&client_id='+client_id+'&provider_id='+provider_id+'&medit_id='+medit_id,
	   
	   success: function(msg)
	   {
		   	if(msg == 'done')
			{
				setTimeout('refreshmilestonegrid(\''+project_id+'\', \''+client_id+'\', \''+provider_id+'\')', 0);
				setTimeout('toggledive()', 1000);
			}
			else
			{
				$('#dialogbox_div').html(msg);
				$('#dialog').dialog('open');
			}
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}

//----------------------------------------------------------------------------------------------------------------------------------//

function createmilestone(project_id, client_id, provider_id, edit_id)
{
	if(document.getElementById('newmilestone_div').style.display != 'none')
	{
		$('#newmilestone_div').slideToggle("slow");
	}
	
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=13',
	   data: 'project_id='+project_id+'&client_id='+client_id+'&provider_id='+provider_id+'&edit_id='+edit_id,
	   
	   success: function(msg)
	   {
		   	$('#newmilestone_div').html(msg);
			$('#newmilestone_div').slideToggle("slow");
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}

//----------------------------------------------------------------------------------------------------------------------------------//

function viewMileStone(project_id, client_id, provider_id, edit_id)
{
	if(document.getElementById('newmilestone_div').style.display != 'none')
	{
		$('#newmilestone_div').slideToggle("slow");
	}
	
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=24',
	   data: 'project_id='+project_id+'&client_id='+client_id+'&provider_id='+provider_id+'&edit_id='+edit_id,
	   
	   success: function(msg)
	   {
		   	$('#newmilestone_div').html(msg);
			$('#newmilestone_div').slideToggle("slow");
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}

//----------------------------------------------------------------------------------------------------------------------------------//

function confirmdelFile(fid, pid)
{
	if(confirm("Are you sure to delete this file?"))
	{
		//window.location = serverpath+'workroom.php';
		$.ajax({
		   type: "POST",
		   url: SITE_HOME_PATH+'request_process.php?calling=16',
		   data: 'fid='+fid+'&pid='+pid,
		   
		   success: function(msg)
		   {
				$('#newmilestonelisting_div').html(msg);
				//$('#newmilestone_div').slideToggle("slow");
		   },
		   error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
		   }
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//

function sendmilestonerequest(from, to, project_id)
{
	if(confirm("Are you sure to send this request?"))
	{
		//window.location = serverpath+'workroom.php';
		$.ajax({
		   type: "POST",
		   url: SITE_HOME_PATH+'request_process.php?calling=17',
		   data: 'from='+from+'&to='+to+'&project_id='+project_id,
		   
		   success: function(msg)
		   {
			   	alert("Message Sent!");
				//$('#newmilestonelisting_div').html(msg);
				//$('#newmilestone_div').slideToggle("slow");
		   },
		   error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
		   }
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//

function acceptchanges(mid, toid, project_id, client_id, provider_id)
{	
	if(confirm("Are you sure to accept terms?"))
	{
		$.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=18',
		    data: 'mid='+mid+'&toid='+toid+'&project_id='+project_id,
		   
		    success: function(msg)
		    {
			   if(msg == 'done')
			   {
			   		setTimeout('refreshmilestonegrid(\''+project_id+'\', \''+client_id+'\', \''+provider_id+'\')', 0);
			   }
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//
function request_escrowfunds(mid, project_id, client_id)
{
	if(confirm("Are you sure to send escrow fund request?"))
	{
		 $.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=19',
		    data: 'mid='+mid+'&project_id='+project_id+'&client_id='+client_id,
		   
		    success: function(msg)
		    {
			   $('#dialogbox_div').html(msg);
			   $('#dialog').dialog('open');
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//
function refreshBillinggrid(project_id, provider_id, client_id)
{
	$.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=21',
		    data: 'project_id='+project_id+'&provider_id='+provider_id+'&client_id='+client_id,
		   
		    success: function(msg)
		    {
			   $('#newmilestonelisting_div').html(msg);
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
}

//----------------------------------------------------------------------------------------------------------------------------------//
function confirm_escrowfunds(mid, project_id, provider_id, client_id)
{
	if(confirm("Are you sure to escrow funds?"))
	{
		 $.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=20',
		    data: 'mid='+mid+'&project_id='+project_id+'&provider_id='+provider_id,
		   
		    success: function(msg)
		    {
			   $('#dialogbox_div').html(msg);
			   $('#dialog').dialog('open');
			   
			   setTimeout('refreshBillinggrid(\''+project_id+'\', \''+provider_id+'\', \''+client_id+'\')', 0);
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//
function request_Releasefunds(mid, project_id, client_id)
{
	if(confirm("Are you sure to send Release funds request?"))
	{
		 $.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=22',
		    data: 'mid='+mid+'&project_id='+project_id+'&client_id='+client_id,
		   
		    success: function(msg)
		    {
			   $('#dialogbox_div').html(msg);
			   $('#dialog').dialog('open');
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//
function confirm_Releasefunds(mid, project_id, provider_id, client_id)
{
	if(confirm("Are you sure to Release funds?"))
	{
		 $.ajax({
		    type: "POST",
		    url: SITE_HOME_PATH+'request_process.php?calling=23',
		    data: 'mid='+mid+'&project_id='+project_id+'&provider_id='+provider_id,
		   
		    success: function(msg)
		    {
			   $('#dialogbox_div').html(msg);
			   $('#dialog').dialog('open');
			   
			   setTimeout('refreshBillinggrid(\''+project_id+'\', \''+provider_id+'\', \''+client_id+'\')', 0);
		    },
		    error: function(){ //so, if data is retrieved, store it in html 
				//alert('error')
				//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
			}
		 });
	}
}

//----------------------------------------------------------------------------------------------------------------------------------//

//--------------------////--------------------////--------------------////--------------------////--------------------//

function PostAReview()
{
	$('#saveNewProjectForm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_PostAReview_Request,
		success: show_PostAReview_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=25'
	};

	// bind to the form's submit event
	$('#saveNewProjectForm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_PostAReview_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_PostAReview_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

//-------------------------------------------------------------------------------------------------------------------//

function refreshp_messPmb_div(str)
{
	$.ajax({
	   type: "POST",
	   url: SITE_HOME_PATH+'request_process.php?calling=26',
	   data: str,
	   
	   success: function(msg)
	   {
		   $('#pmb_results').html(msg);
	   },
	   error: function(){ //so, if data is retrieved, store it in html 
			//alert('error')
			//$("#"+resultDiv).html('Error Loading Script'); //show the html inside .content div 
	   }
	 });
}

//---------------------------------------------------------------------//
function saveAnswer()
{
	$('#ansform').unbind('submit');
		var options = {
		target: '#output', // target element(s) to be updated with server response
		beforeSubmit: show_saveAnswer_Request, // pre-submit callback
		success: show_saveAnswer_Response, // post-submit callback
		url: SITE_HOME_PATH+'request_process.php?calling=27' //override for form's 'action' attribute //type: type // 'get' or 'post', override for form's 'method' attribute
	};

	// bind to the form's submit event
	$('#ansform').submit(function() {
	$(this).ajaxSubmit(options);
	
	return false;
	});
}

// pre-submit callback
function show_saveAnswer_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_saveAnswer_Response(responseText, statusText)
{
	 var myarray=new Array();
	 myarray=responseText.split("-separator-");
		   
	if(myarray[0] == 'done')
	{
		$('#output').hide();
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		$('#output').show();
	}
}

function signup_user()
{
	//alert('Pakistan');
	$('#loginuser').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_signin_Request,
		success: show_signin_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=3'
	};

	// bind to the form's submit event
	$('#loginuser').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

function show_signin_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_signin_Response(responseText, statusText)
{
	var myarray=new Array();
    myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

// Report Violation

function report_violation()
{
	$('#report_violation_frm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_report_violation_Request,
		success: show_report_violation_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=28'
	};

	// bind to the form's submit event
	$('#report_violation_frm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_report_violation_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_report_violation_Response(responseText, statusText)
{
	var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('gotolink(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}

// Invite Freelancers

function invite_freelancer_pmb()
{
	
	$('#invite_freelancer_frm').unbind('submit');
		var options = {
		target: '#dialogbox_div',
		beforeSubmit: show_freelancer_pmb_Request,
		success: show_freelancer_pmb_Response,
		url: SITE_HOME_PATH+'request_process.php?calling=29'
	};

	// bind to the form's submit event
	$('#invite_freelancer_frm').submit(function() {
		$(this).ajaxSubmit(options);
		return false;
	});
}

// pre-submit callback
function show_freelancer_pmb_Request(formData, jqForm, options)
{
	var queryString = $.param(formData);
	return true;
}

function show_freelancer_pmb_Response(responseText, statusText)
{
   var myarray=new Array();
   myarray=responseText.split("-SEPARATOR-");
	if(myarray[0] == 'done')
	{
		$('#dialog').dialog('close');
		setTimeout('refreshp_messPmb_div(\''+myarray[1]+'\')', 1000);
	}
	else
	{
		//jQuery('#outputedituserdata').fadeIn(1500);
		//dialogbox_div
		$('#dialog').dialog('open');
	}
}


