function handleErrFullPage(strIn) {

        var errorWin;

        // Create new window and display error
        try {
                errorWin = window.open('', 'errorWin');
                errorWin.document.write(strIn);
        }
        // If pop-up gets blocked, inform user
        catch(e) {
                alert('An error occurred, but the error message cannot be' +
                        ' displayed because of your browser\'s pop-up blocker.\n' +
                        'Please allow pop-ups from this Web site.');
        }
}
function ajaxFunction(whatid,whatfont){
	var ajaxRequest;  // The variable that makes Ajax possible!
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Your browser broke!");
				return false;
			}
		}
	}
// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if (ajaxRequest.readyState == 4)
		{
           strResponse = ajaxRequest.responseText;
           switch (ajaxRequest.status)
		   {
                   // Page-not-found error
                   case 404:
                           alert('Error: Not Found. The requested URL ' + 
                                   strURL + ' could not be found.');
                           break;
                   // Display results in a full window for server-side errors
                   case 500:
                           //handleErrFullPage(strResponse);
                           break;
                   default:
                           // Call JS alert for custom error or debug messages
                           if (strResponse.indexOf('Error:') > -1 || 
                                   strResponse.indexOf('Debug:') > -1) {
                                   alert(strResponse);
                           }
                           // Call the desired result function
                           else {
								document.getElementById('previewhold').style.display = 'block';
								document.getElementById(whatid).setAttribute('src',strResponse);
                           }
                           break;
          	}
   		}
	}
	var mytext = document.getElementById('text').value;
	var myfont = whatfont;
	var selected = document.getElementById('hiddenfont').value = whatfont;
	/*for(i=0;i<document.forms[0].fontchoice.length;i++)
	{
	if (document.forms[0].fontchoice[i].checked == true)
	myfont = document.forms[0].fontchoice[i].value;
	}*/
	var mycolor = document.getElementById('color').value.replace('#','');
	ajaxRequest.open("GET", "/js/process.php?fontchoice="+myfont+"&text="+mytext+"&color="+mycolor, true);
	ajaxRequest.send(null); 
}
