var component;
function SaveForm(_component)
{
    component = _component;
     StopWait();
    document.SendFile.onsubmit();
}

function createIFrame(_component, _container_id) {
  var id = 'f' + Math.floor(Math.random() * 99999);
  var div = document.createElement('div');
  div.innerHTML = '<iframe style="display:none" src="about:blank" id="'+id+'" name="'+id+'" onload=" $(document).ready(function() {sendComplete('+id+', \''+ _component +'\', \''+ _container_id +'\')});"></iframe>';
  document.body.appendChild(div);
  return document.getElementById(id);
}

function uploadComplete(_container_id) {
  //alert(_component);
  //alert(_container_id);
  ServerEventWithFormData(component, 'on_ok_click', _container_id, '');
}

function sendForm(form, url, _component, _container_id) {
     StartWait();
    if (document.getElementById(_component).value !== "")
    {
      //alert(_component);
      if (!document.createElement) return; // not supported
      if (typeof(form)=="string") form=document.getElementById(form);
      var frame=createIFrame(_component, _container_id);
      //frame.onSendComplete = _component;
      form.setAttribute('target', frame.id);
      form.setAttribute('action', url);
      form.submit();
     }
     else
     {
        uploadComplete(_container_id);
     }
}

function sendComplete(id, _component, _container_id) {
  var iframe=document.getElementById(id);
  uploadComplete(_container_id);
}

var cnt=0;

function SubmitForm()
{
    return 
}
