
function eUpload(form, action_url, div_id){
// 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","float:left;width: 0px; height: 0px; border: none;visibility:hidden");

// Add to document...
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 !==''){
 var board = parseInt($('#board').val());
 var newvalue = board + 1;
 var newDiv = '<div id="eBoard_'+newvalue+'"></div>';
$('#eForms').fadeOut(500).html('');
$('.wc_input').val('What\'s your Situation?'); 
$('#eBoard_'+board).eDelay(400).html(content).fadeIn('slow');


		$('form#pform').removeAttr( "target");
		$('form#pform').removeAttr( "action");
		$('form#pform').removeAttr( "method");
        $('form#pform').removeAttr( "enctype");
		$('.etihad_publish_button').removeAttr('onClick');
		$('#eBoard_'+board).before(newDiv);
		$('#board').val(newvalue);
		


}

// Del the iframe...
setTimeout('iframeId.parentNode.removeChild(iframeId)', 250);
}

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", action_url);
form.setAttribute("method","post");
form.setAttribute("enctype","multipart/form-data");
form.setAttribute("encoding","multipart/form-data");


form.submit();

}


blocks_opt = function () {
    var target = $('#layout').val();
    $.php(url, {'action':'admin','target':target});
    return false;
}



cities_opt = function () {
    var iso_state = $('#state').val();
    $.php(url, {'action':'account','target':'cities', 'state':iso_state});
    return false;
}


load_dot = function () {
    var DOT = $('#dot').val();
    $.php(url, {'target':'fmcsa', 'dot':DOT});
    return false;
}

b_rank = function () {
   
    $.php(url, {'action':'admin','target':'ranking'});
    return false;
}



formAjax = function (div) {
    $.php(url, $(div).formToArray(true));
    return false;

    // do an ajax post request
    $.ajax({
       // AJAX-specified URL
       url: "ajax.php",
       // JSON
       type: "POST",
       data: $(div).formToArray(true),
       dataType : "json",

       /* Handlers */       
       // Handle the beforeSend event
       beforeSend: function(){
           return php.beforeSend();
       },
       // Handle the success event
       success: function(data, textStatus){   
           return php.success(data, textStatus);
       },
       // Handle the error event
       error: function (xmlEr, typeEr, except) {
           return php.error(xmlEr, typeEr, except);                  
       },
       // Handle the complete event
       complete: function (XMLHttpRequest, textStatus) {              
           return php.complete(XMLHttpRequest, textStatus);
       }
	   
    });
    return false;
    
}



