var IFrameObj; // our IFrame object
function callToServer(FRM,URL) {
  if (!document.createElement) {return true};
  var IFrameDoc;
  //var URL = 'server.html';
  //if (!IFrameObj && document.createElement) {
    // create the IFrame and assign a reference to the
    // object to our global variable IFrameObj.
    // this will only happen the first time
    // callToServer() is called
    var tempIFrame=document.createElement('iframe');
    //tempIFrame.setAttribute('id','RSIFrame');
    tempIFrame.setAttribute('id',FRM);
    tempIFrame.style.border='0px';
    tempIFrame.style.width='0px';
    tempIFrame.style.height='0px';
    IFrameObj = document.body.appendChild(tempIFrame);
    if (document.frames) {
      // this is for IE5 Mac, because it will only
      // allow access to the document object
      // of the IFrame if we access it through
      // the document.frames array
      IFrameObj = document.frames[FRM];
    }
 // }

  if (navigator.userAgent.indexOf('Gecko') !=-1 && !IFrameObj.contentDocument) {
    // we have to give NS6 a fraction of a second
    // to recognize the new IFrame
    setTimeout('callToServer()',10);
    return false;
  }

  if (IFrameObj.contentDocument) {
    // For NS6
    IFrameDoc = IFrameObj.contentDocument;
  } else if (IFrameObj.contentWindow) {
    // For IE5.5 and IE6
    IFrameDoc = IFrameObj.contentWindow.document;
  } else if (IFrameObj.document) {
    // For IE5
    IFrameDoc = IFrameObj.document;
  } else {
    return true;
  }


  IFrameDoc.location.replace(URL);
          //document.getElementById('tmpTest').innerHTML=FRM + ' >>>>>>> ' + URL;
  return false;
}



function buildQueryString(theFormName) {
  theForm = document.forms[theFormName];
  var qs = ''
  for (e=0;e<theForm.elements.length;e++) {
    if (theForm.elements[e].name!='') {
      qs+=(qs=='')?'?':'&'
      qs+=theForm.elements[e].name+'='+escape(theForm.elements[e].value)
      }
    }
  return qs
}

function do_submit()
{
    document.getElementById('divMSG').innerHTML='<strong><font color=\"#006633\">Sending Your Comment ..........Please Wait</font></strong>';
    var URL= '../feedback/process.php' +  buildQueryString('frmCon');
    callToServer('con',URL)
}

function remote_response(MSG)
{
  if(MSG=='DONE'){
           document.getElementById('divMSG').innerHTML='<strong><font color=\"#006633\">Your Message Successfully Sent</font></strong>';
  }else if(MSG=='BLANK')
  {
           document.getElementById('divMSG').innerHTML='<strong><font color=\"#FF0000\">Please fill out all required fields marked *</font></strong>';
  }else if(MSG){
           document.getElementById('divMSG').innerHTML='<strong><font color=\"#FF0000\">' + MSG + '</font></strong>';

  }

}
