
function getLipsum()
	{
	var myLipsum = createRequest();
	myLipsum.onreadystatechange=function() { if(myLipsum.readyState==4) { document.myForm.time.value=myLipsum.responseText; } }
	myLipsum.open("GET","mytime.php",true);
	myLipsum.send(null);
	}


function useForm(f)
	{
	
	//animatedcollapse.hide('resultsDiv');
	
	var myLipsum = createRequest();
	myLipsum.onreadystatechange=function() 
		{ 
		
		if(myLipsum.readyState==4) 
			{			
			//$("#resultsDiv").fadeOut(500);
			
			// fade out; replace lorem ipsum with new random text;
			$("#resultsDiv").fadeOut( 750,  function() { $(    document.getElementById("resultsDiv").innerHTML= myLipsum.responseText     ) });
			
			//$("#resultsDiv").fadeOut( 750);
			//document.getElementById("resultsDiv").innerHTML= myLipsum.responseText;
			
			// then fade back in; then put the ZeroClipboard button on the page
			$("#resultsDiv").fadeIn(750,  function() { $(    initClipboardButton()     ) });
			
			// put the ZeroClipboard button on the page
			//initClipboardButton();
			}
		}
	
	myURL = "code/php/lipsum.php?" + getFormData(f);
	//alert(myURL);
	myLipsum.open("POST",myURL,true);
	myLipsum.send(null);

	}


function getFormData(form)
	{
	myFormData = "";
	for (x=0;x<form.length;x++)
		{
		ampersand = (x>0) ?   "&"   :  ""    ;
		if (   
				( (form[x].type=="radio"  || form[x].type=="checkbox"  )  && form[x].checked==true )   ||
				( form[x].type!="radio" && form[x].type!="checkbox" ) &&
				( form[x].name !="submit" )
			 )
			{ myFormData += ampersand + form[x].name + "=" + form[x].value }
		}
	return myFormData;
	}

// radio buttons
function radioButtons(form)
	{
	madeChoice=false;
	for (s = 0; s < form.length; s++)
		{ if (form[s].checked == 1) return form[s].value; }
	}



