function fnUploadPhoto(){
	var html_data  = '<form name="upload_form" action="" method="post">';
	    html_data += '<table cellpadding="3" cellspacing="3" border="0">';

	    html_data += '<tr>'
	    html_data += '<td align="left" valign="middle">';
	    html_data += '<span id="message_box"></span>';
	    html_data += '</td>';
	    html_data += '</tr>';
	    html_data += '<tr>';
	    html_data += '<td align="left" valign="top">';
	    html_data += '<input type="file" name="upload_photo" id="upload_photo"></input>';
	    html_data += '<br />';
		html_data += '<br />';
	    html_data += '<p style="margin-bottom:0.5em">Instructions:';
		html_data += '<ul style="list-style:disc; margin:0 0 0.5em 1.5em">';
		html_data += '<li>Click on browse to locate your image on your computer.</li>';
		html_data += '<li>You can upload a JPG, GIF or PNG files.</li>';
		html_data += '<li>File size limit is 10 MB.</li>';
		html_data += '<li>Click on the upload button and wait for the uplaod process to complete.</li>';
		html_data += '</ul>';
		html_data += '</p>';
	    html_data += '</td>';
	    html_data += '</tr>';
	    html_data += '<tr>'
	    html_data += '<td align="left" valign="middle">';
	    html_data += '<input type="button" name="upload_button" value="Upload Now" onclick="uploadPhoto(this.form); return false;" />';		    
	    html_data += '<span id="photo_upload_loading_box" style="display:none;">&nbsp;<img src="http://www.barbizonmodeling.com/uploader/js/facebox/loading.gif" align="absmiddle"/>&nbsp;Please wait...</span>';
	    html_data += '</td>';
	    html_data += '</tr>';
	    html_data += '</table>';
	    html_data += '</form>';
	    jQuery.facebox(html_data);
}

function uploadPhoto(form){

	  // create the iframe...
	  var iframe = document.createElement("iframe"); 
	  iframe.setAttribute("id","upload_iframe"); 
	  iframe.setAttribute("name","upload_iframe");
	  iframe.setAttribute("width","0"); 
	  iframe.setAttribute("height","0"); 
	  iframe.setAttribute("border","0"); 
	  iframe.setAttribute("style","width: 0; height: 0; border: none;");

	  // add to document...
	  document.body.appendChild(iframe); // form.parentNode.appendChild(iframe); 
	  window.frames['upload_iframe'].name="upload_iframe";

	  iframeId = document.getElementById("upload_iframe");

	  // add event...
	  var eventHandler = function()  {    
	   
		if (iframeId.detachEvent) 
			iframeId.detachEvent("onload", eventHandler);
		else 
			iframeId.removeEventListener("load", eventHandler, false);

		// message from server...
		if (iframeId.contentDocument) {
			content = iframeId.contentDocument.body.innerHTML; 
		} 
		else if (iframeId.contentWindow) {
			content = iframeId.contentWindow.document.body.innerHTML;
		} 
		else if (iframeId.document) {
			content = iframeId.document.body.innerHTML;
		}

		if(content.search('photo_') == -1) {
			document.getElementById('photo_upload_loading_box').style.display = 'none';
			document.getElementById('message_box').innerHTML = content;
			document.getElementById('image_file_name').value = '';
		}
		else {
			document.getElementById('image_file_name').value = content;
			jQuery.facebox.close();
		}

		document.body.removeChild(iframe); 
	  }

	  if (iframeId.addEventListener)        
	  iframeId.addEventListener("load", eventHandler, true); 
	  if (iframeId.attachEvent)        
	  iframeId.attachEvent("onload", eventHandler);

	  // set properties of form...
	  form.setAttribute("target","upload_iframe");
	  form.setAttribute("action", 'http://www.barbizonmodeling.com/uploader/upload.inc.php'); 
	  form.setAttribute("method","post"); 
	  form.setAttribute("enctype","multipart/form-data"); 
	  form.setAttribute("encoding","multipart/form-data"); 

	  document.getElementById('photo_upload_loading_box').style.display = '';

	  // Submit the form...
	  form.submit();
}

