function quickSave(cookiename,cookiehandle)
{
	
		var getString = 'cookiedrop.php?cookie='+cookiename+'&cookiehandle='+cookiehandle+'&';


	var theForm = document.forms[0]

for(i=0; i<theForm.elements.length; i++)
{
	
	  if(theForm.elements[i].type == "text" || theForm.elements[i].type == "textarea" || theForm.elements[i].type == "button"){
  	  getString += theForm.elements[i].name + '='+ theForm.elements[i].value + "&";
      }
      else if(theForm.elements[i].type == "checkbox"){
      getString += theForm.elements[i].name + '='+ theForm.elements[i].checked + "&";
      }
	  else if(theForm.elements[i].type == "radio"){
		  if(theForm.elements[i].checked)
		  {
      	  getString += theForm.elements[i].name + '='+ theForm.elements[i].value + "&";
      	  }
      }
	else if(theForm.elements[i].type == "select-one")
	{
	getString +=  theForm.elements[i].name+'='+theForm.elements[i].options[theForm.elements[i].selectedIndex].text + "&";
    }
      	
}

		getString = encodeURI(getString);
		//alert(getString);

	  document.getElementById("savebutton").innerHTML = "<img src='../new_app/app_images/saving.gif' />";

		var uid = new sack();

		uid.requestFile = getString;	// Specifying which file to get
		uid.onCompletion = function(){ uidComplete(uid,cookiename) };	// Specify function that will be executed after file has been found
		uid.runAJAX();		// Execute AJAX function

}

function uidComplete(uid,cookiename)
{
 var obj = document.getElementById('savebutton');
 eval(uid.response); // Executing the response from Ajax as Javascript code
 if (uid.response != '1'){
   document.getElementById("savebutton").innerHTML = '<input type="button" name="Quick Save" class="rent_text" value="Quick Save"  onClick="javascript:quickSave(\''+cookiename+'\');"/>';
   return true;
 } else
 {
  document.getElementById("savebutton").innerHTML = '&nbsp;&nbsp;There was a problem saving the data.';
   return false;
 }
}





function submitSave(cookiename,step,cookiehandle)
{
	
		var getString = 'cookiedrop.php?cookie='+cookiename+'&cookiehandle='+cookiehandle+'&';

    var thisstep = String(step);
	var theForm = document.forms[0]
	

for(i=0; i<theForm.elements.length; i++)
{
	
	  if(theForm.elements[i].type == "text" || theForm.elements[i].type == "textarea" || theForm.elements[i].type == "button"){
  	  getString += theForm.elements[i].name + '='+ theForm.elements[i].value + "&";
      }
      else if(theForm.elements[i].type == "checkbox"){
      getString += theForm.elements[i].name + '='+ theForm.elements[i].checked + "&";
      }
	  else if(theForm.elements[i].type == "radio"){
		  if(theForm.elements[i].checked)
		  {
      	  getString += theForm.elements[i].name + '='+ theForm.elements[i].value + "&";
      	  }
      }
	else if(theForm.elements[i].type == "select-one")
	{
	getString +=  theForm.elements[i].name+'='+theForm.elements[i].options[theForm.elements[i].selectedIndex].text + "&";
    }
      	
}
		getString = encodeURI(getString);
		//alert(getString);

	  document.getElementById("nextbutton").innerHTML = "<img src='../new_app/app_images/saving.gif' />";

		var uid = new sack();

		uid.requestFile = getString;	// Specifying which file to get
		uid.onCompletion = function(){ checkComplete(uid,thisstep) };	// Specify function that will be executed after file has been found
		uid.runAJAX();		// Execute AJAX function

}

function checkComplete(uid,thisstep)
{
 eval(uid.response); // Executing the response from Ajax as Javascript code
 if (uid.response != '1'){
   
    //alert('yessdf!');
				document.frm.action="rental_application_step"+thisstep+".php";
				document.frm.method='get';
				document.frm.submit();
   
   
   return true;
 } else
 {
  document.getElementById("savebutton").innerHTML = '&nbsp;&nbsp;There was a problem saving the data.';
   return false;
 }
}

