String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}


function getHTTPObject()
{
   if (window.ActiveXObject) 
      return new ActiveXObject("Microsoft.XMLHTTP");
   else if (window.XMLHttpRequest) 
      return new XMLHttpRequest();
   else {
      alert("Your browser does not support AJAX.");
      return null;
   }
  
}

function CreateAccount() {
     var theURL;
     var adjidx = 0;
   
     //I have a div that tells them to wait, something is happening
     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    
     //window.opener.document.getElementById('cma_msg').style.color = 'red';
     //Create the object
     xmlHttp = getHTTPObject();

     //Url to the page to insert records
     theURL = 'ajaxaccount.php';
 
     var poststr = 'cname=' + escape(encodeURI(window.document.getElementById('cname').value)); 
         poststr += '&address=' + escape(encodeURI(window.document.getElementById('address').value)); 
	 poststr += '&city=' + escape(encodeURI(window.document.getElementById('city').value)); 
	 poststr += '&state=' + escape(encodeURI(window.document.getElementById('state').value));
	 poststr += '&zip=' + escape(encodeURI(window.document.getElementById('zip').value));  
	 poststr += '&phonenum=' + escape(encodeURI(window.document.getElementById('phonenum').value));
         poststr += '&faxnum=' + escape(encodeURI(window.document.getElementById('faxnum').value)); 
	 poststr += '&username=' + escape(encodeURI(window.document.getElementById('username').value)); 
	 poststr += '&passwd=' + escape(encodeURI(window.document.getElementById('passwd').value));
         poststr += '&cpasswd=' + escape(encodeURI(window.document.getElementById('cpasswd').value));
	 poststr += '&ct_name=' + escape(encodeURI(window.document.getElementById('ct_name').value)); 
         
	 poststr += '&ct_title=' + escape(encodeURI(window.document.getElementById('ct_title').value));
         poststr += '&ct_email=' + escape(encodeURI(window.document.getElementById('ct_email').value));
         poststr += '&ct_extension=' + escape(encodeURI(window.document.getElementById('ct_extension').value));  
         poststr += '&recaptcha_challenge_field=' + escape(encodeURI(window.document.getElementsByName('recaptcha_challenge_field')[0].value));
         poststr += '&recaptcha_response_field=' + escape(encodeURI(window.document.getElementsByName('recaptcha_response_field')[0].value));
         poststr += '&mode=1'
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  
     //Tell it what js function to call when you get your response from your asp page:
     xmlHttp.onreadystatechange = function() {ajaxCreateAccountComplete();};

     
     //Send request
     //xmlHttp.open("GET", theURL, true);
     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);
     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
     xmlHttp.setRequestHeader("Content-length", poststr.length);
     xmlHttp.setRequestHeader("Connection", "close");
     xmlHttp.send(poststr);

    return 0;
 }



function ajaxCreateAccountComplete(compnum)
{
    var responseText;
    //var theSelect;
    //var cCallRef;
    var responseArray;
	//var txml; 
	//Check readystate and status to make sure your asp page didn't error out
	
    if (xmlHttp.readyState==4) {
      if(xmlHttp.status == 200) {
          alert('HI');
	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)
          {
             alert('responseText = ' + responseText); 
             switch (Number(responseText)) 
             {
                case 100:
                     document.getElementById('rcaptcha_field_error').innerHTML = 'Recaptcha phase don\'t match! Please re-enter.';
                     break;
                case 1:
                     alert('Record was inserted.');
                     break;  
             }
          //  //window.close();
          //  responseArray = responseText.split('|');
          } //Length
      }
      xmlHttp = null;
    }  

    else {
    }
    
    return false;    
}

function validateFrm()
{
    var invalid = " "; // Invalid character is a space  
    var minLength = 6; // Minimum length
    var pw1 = window.document.getElementById('passwd').value;
    var pw2 = window.document.getElementById('cpasswd').value;
    var cname = window.document.getElementById('cname').value;
    var phonenum = window.document.getElementById('phonenum').value;
    var username = window.document.getElementById('username').value;
    var ctname = window.document.getElementById('ct_name').value;
    var ctemail = window.document.getElementById('ct_email').value;
    var recaptcha_challenge_field = window.document.getElementsByName('recaptcha_response_field')[0].value;
    var rtnval = true;
    var pwderror = false; 

    // alert('challenge field' + window.document.getElementsByName('recaptcha_challenge_field')[0].value);
    // alert('response field' + window.document.getElementsByName('recaptcha_response_field')[0].value);
    //alert('PW1 = ' + pw1);
    //alert('PW2 = ' + pw2);
    // check for a value in both fields.
    
    if (cname.trim() == "") {
      document.getElementById('cname_error').innerHTML = 'Please enter a company name!';
      document.getElementById('cname').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {

      document.getElementById('cname_error').innerHTML = '';
      document.getElementById('cname').setAttribute("class", "");
      //return true;
    }   

    if (phonenum.trim() == "" ) {
      document.getElementById('phonenum_error').innerHTML = 'Please enter a phone number!';
      document.getElementById('phonenum').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
        if (phonenum.length != 10) {
          document.getElementById('phonenum_error').innerHTML = 'Phone number must include the area code!';
          document.getElementById('phonenum').setAttribute("class", "requiredflderror");
        }
        else 
        {
          document.getElementById('phonenum_error').innerHTML = '';
          document.getElementById('phonenum').setAttribute("class", "");
        }
      //return true;
    } 

    if (username.trim() == "") {
      document.getElementById('username_error').innerHTML = 'Please enter a username!';
      document.getElementById('username').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      document.getElementById('username_error').innerHTML = '';
      document.getElementById('username').setAttribute("class", "");
      //return true;
    } 

    if (ctname.trim() == "") {
      document.getElementById('ct_name_error').innerHTML = 'Please enter a contact name!';
      document.getElementById('ct_name').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      document.getElementById('ct_name_error').innerHTML = '';
      document.getElementById('ct_name').setAttribute("class", "");
      //return true;
    } 

    if (ctemail.trim() == "") {
      document.getElementById('ct_email_error').innerHTML = 'Please enter a E-mail Address!';
      document.getElementById('ct_email').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      if (checkEmail(ctemail) != true ) {
       document.getElementById('ct_email_error').innerHTML = 'Invalid E-mail Address! Please re-enter.';
       document.getElementById('ct_email').setAttribute("class", "requiredflderror");
      }
      else { 
        document.getElementById('ct_email_error').innerHTML = '';
        document.getElementById('ct_email').setAttribute("class", "");
      }
      //return true;
    } 
    if (recaptcha_challenge_field.trim() == "") {
      document.getElementById('rcaptcha_field_error').innerHTML = 'Please enter the recaptcha phase!';
      //document.getElementById('rcaptcha_field').setAttribute("class", "requiredflderror");
      //document.getElementsByName('recaptcha_challenge_field')[0].setAttribute("class", "requiredflderror");
    }
    else
    {
      document.getElementById('rcaptcha_field_error').innerHTML = '';
      //document.getElementById('rcaptcha_field').setAttribute("class", ""); 
      //document.getElementsByName('recaptcha_challenge_field')[0].setAttribute("class", "requiredflderror");

    }

    if (pw1 == '' || pw2 == '')
    {
      //alert('Please enter your password twice.');
      document.getElementById('password_error').innerHTML = 'Please enter your password twice!';
      document.getElementById('passwd').setAttribute("class", "requiredflderror");
      document.getElementById('cpasswd').setAttribute("class", "requiredflderror");
      //return false;
      rtnval = false;
      pwderror = true;
    }
   
    // check for minimum length
    if (pw1.length < minLength)
    {
      //alert('Your password must be at least ' + minLength + ' characters long. Try again.');
      if (pwderror != true) {
        window.document.getElementById('password_error').innerHTML = 'Password is too short!';
        document.getElementById('passwd').setAttribute("class", "requiredflderror");
        //return false;
        rtnval = false;
        pwderror = true;
      }
    }
    else 
    {
      window.document.getElementById('password_error').innerHTML = '';
      document.getElementById('passwd').setAttribute("class", ""); 
    }

    // check for spaces
    if (pw1.indexOf(invalid) > -1)
    {
      //alert("Sorry, spaces are not allowed.");
      if (pwderror != true) {
      window.document.getElementById('password_error').innerHTML = 'Sorry, spaces are not allowed!';
      //return false;
      rtnval = false;
      pwderror != true
      }
    }
    else
    {
      if (pw1 != pw2) {
        //alert ("You did not enter the same new password twice. Please re-enter your password.");
        window.document.getElementById('cpassword_error').innerHTML = "The password values don\'t match!";
        document.getElementById('cpasswd').setAttribute("class", "requiredflderror");
        //return false;
        rtnval = false; 
        pwderror != true
      }
      else
      {
        window.document.getElementById('cpassword_error').innerHTML = "";
        document.getElementById('cpasswd').setAttribute("class", ""); 

        //alert('Nice job.');
        //return true;
      }
   }

   return rtnval;
}

function validateConferenceFrm()
{
    var invalid = " "; // Invalid character is a space  
    var minLength = 6; // Minimum length
    var fname = window.document.getElementById('firstname').value;
    var lname = window.document.getElementById('lastname').value;
    var address = window.document.getElementById('address').value;
    var city = window.document.getElementById('city').value;
    var state = window.document.getElementById('state').value;
    var zipcode = window.document.getElementById('zipcode').value;
    var wphone = window.document.getElementById('wphone').value;
    var hphone = window.document.getElementById('hphone').value;
    var email = window.document.getElementById('email').value;
    var dues = window.document.getElementById('dues').value;
    var lunches = window.document.getElementById('lunches').value;
    var rtnval = true;
    var pwderror = false; 

    // alert('challenge field' + window.document.getElementsByName('recaptcha_challenge_field')[0].value);
    // alert('response field' + window.document.getElementsByName('recaptcha_response_field')[0].value);
    //alert('PW1 = ' + pw1);
    //alert('PW2 = ' + pw2);
    // check for a value in both fields.
    
    //alert('validateConferenceFrm');
    
    if (fname.trim() == "") {
      //document.getElementById('fname_error').innerHTML = 'Please enter a company name!';
      document.getElementById('firstname').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {

      //document.getElementById('cname_error').innerHTML = '';
      document.getElementById('firstname').setAttribute("class", "");
      //return true;
    }
 
    if (lname.trim() == "") {
      //document.getElementById('fname_error').innerHTML = 'Please enter a company name!';
      document.getElementById('lastname').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {

      //document.getElementById('cname_error').innerHTML = '';
      document.getElementById('lastname').setAttribute("class", "");
      //return true;
    } 

    //if (address.trim() == "") {
    //  //document.getElementById('fname_error').innerHTML = 'Please enter a company name!';
    //  document.getElementById('address').setAttribute("class", "requiredflderror");
    //  rtnval = false;
    //}
    //else 
    //{

      //document.getElementById('cname_error').innerHTML = '';
    //  document.getElementById('lname').setAttribute("class", "");
    //  //return true;
    //}  


    //if (wphone.trim() == "" ) {
    //  //document.getElementById('lname_error').innerHTML = 'Please enter a phone number!';
    //  document.getElementById('wphone').setAttribute("class", "requiredflderror");
    //  rtnval = false;
    //}
    //else 
    //{
    //    if (wphone.length != 10) {
    //      //document.getElementById('phonenum_error').innerHTML = 'Phone number must include the area code!';
    //      document.getElementById('wphone').setAttribute("class", "requiredflderror");
    //    }
    //    else 
    //    {
    //      //document.getElementById('phonenum_error').innerHTML = '';
    //      document.getElementById('wphone').setAttribute("class", "");
    //    }
    //  //return true;
    //}

    if (hphone.trim() == "" ) {
      //document.getElementById('lname_error').innerHTML = 'Please enter a phone number!';
      document.getElementById('hphone').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
        if (hphone.length != 10) {
          //document.getElementById('phonenum_error').innerHTML = 'Phone number must include the area code!';
          document.getElementById('hphone').setAttribute("class", "requiredflderror");
        }
        else 
        {
          //document.getElementById('phonenum_error').innerHTML = '';
          document.getElementById('hphone').setAttribute("class", "");
        }
      //return true;
    } 

    
    if (email.trim() == "") {
      //document.getElementById('ct_email_error').innerHTML = 'Please enter a E-mail Address!';
      document.getElementById('email').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      if (checkEmail(email) != true ) {
       //document.getElementById('ct_email_error').innerHTML = 'Invalid E-mail Address! Please re-enter.';
       document.getElementById('email').setAttribute("class", "requiredflderror");
      }
      else { 
        //document.getElementById('ct_email_error').innerHTML = '';
        document.getElementById('email').setAttribute("class", "");
      }
      //return true;
    } 
   
   //alert("return value: " + rtnval); 
   return rtnval;
}

//////
function validateProfileUpdate()
{
    var invalid = " "; // Invalid character is a space  
    //var cname = window.document.getElementById('cname').value;
    var phonenum = window.document.getElementById('phonenum').value;
    var ctname = window.document.getElementById('ct_name').value;
    var ctemail = window.document.getElementById('ct_email').value;
    var rtnval = true;
    var errorstr = ''; 

    
    //if (cname.trim() == "") {
    //  //document.getElementById('cname_error').innerHTML = 'Please enter a company name!';
    //  if (errorstr.trim() != "")
    //      errorstr += '<br>';  
    //  errorstr = 'Please enter a company name!';
    //  document.getElementById('cname').setAttribute("class", "requiredflderror");
    //  rtnval = false;
    //}
    //else 
    //{
    //  //document.getElementById('cname_error').innerHTML = '';
    //  document.getElementById('cname').setAttribute("class", "");
    //  //return true;
    //}   

    if (phonenum.trim() == "" ) {
      //document.getElementById('phonenum_error').innerHTML = 'Please enter a phone number!';
      if (errorstr.trim() != "")
         errorstr += '<br>';  
      errorstr += 'Please enter a phone number!';
      document.getElementById('phonenum').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
        if (phonenum.length != 10) {
          //document.getElementById('phonenum_error').innerHTML = 'Phone number must include the area code!';
         if (errorstr.trim() != "")
            errorstr += '<br>';  
          errorstr += 'Phone number must include the area code!';
          document.getElementById('phonenum').setAttribute("class", "requiredflderror");
        }
        else 
        {
          //document.getElementById('phonenum_error').innerHTML = '';
          document.getElementById('phonenum').setAttribute("class", "");
        }
      //return true;
    } 


    if (ctname.trim() == "") {
      //document.getElementById('ct_name_error').innerHTML = 'Please enter a contact name!';
      if (errorstr.trim() != "")
         errorstr += '<br>';  
      errorstr += 'Please enter a contact name!';
      document.getElementById('ct_name').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      //document.getElementById('ct_name_error').innerHTML = '';
      document.getElementById('ct_name').setAttribute("class", "");
      //return true;
    } 

    if (ctemail.trim() == "") {
      //document.getElementById('ct_email_error').innerHTML = 'Please enter a E-mail Address!';
      if (errorstr.trim() != "")
         errorstr += '<br>';  
      errorstr += 'Please enter a E-mail Address!';
      document.getElementById('ct_email').setAttribute("class", "requiredflderror");
      rtnval = false;
    }
    else 
    {
      if (checkEmail(ctemail) != true ) {
       //document.getElementById('ct_email_error').innerHTML = 'Invalid E-mail Address! Please re-enter.';
       if (errorstr.trim() != "")
         errorstr += '<br>';  
       errorstr += 'Invalid E-mail Address! Please re-enter.';
       document.getElementById('ct_email').setAttribute("class", "requiredflderror");
       rtnval = false;
      }
      else { 
        //document.getElementById('ct_email_error').innerHTML = '';
        document.getElementById('ct_email').setAttribute("class", "");
      }
      //return true;
    } 
   
    if (errorstr.trim() != '' ) { 
      document.getElementById('uerror').innerHTML =  '<br>' + errorstr; 
    }
    
    //alert('errorstr ' + errorstr + ' rtnval ' + rtnval);
    
   return rtnval;
}

//////
function isNumberKey(evt)
{
   var charCode = (evt.which) ? evt.which : evt.keyCode
   if (charCode > 31 && (charCode < 48 || charCode > 57))
     return false;

   return true;
}

function checkEmail(emailval) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(emailval) == false)
      return false;
   else
      return true; 
}

/* -NEW 12/21/2009- */

function EditJForm(pid,jid) {

     var theURL;

     var adjidx = 0;

   

     //I have a div that tells them to wait, something is happening

     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    

     //window.opener.document.getElementById('cma_msg').style.color = 'red';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     
     /*var poststr = 'cname=' + escape(encodeURI(window.document.getElementById('cname').value)); 

         poststr += '&address=' + escape(encodeURI(window.document.getElementById('address').value)); 

	 poststr += '&city=' + escape(encodeURI(window.document.getElementById('city').value)); 

	 poststr += '&state=' + escape(encodeURI(window.document.getElementById('state').value));

	 poststr += '&zip=' + escape(encodeURI(window.document.getElementById('zip').value));  

	 poststr += '&phonenum=' + escape(encodeURI(window.document.getElementById('phonenum').value));
         poststr += '&faxnum=' + escape(encodeURI(window.document.getElementById('faxnum').value)); 

	 poststr += '&username=' + escape(encodeURI(window.document.getElementById('username').value)); 

	 poststr += '&passwd=' + escape(encodeURI(window.document.getElementById('passwd').value));
         poststr += '&cpasswd=' + escape(encodeURI(window.document.getElementById('cpasswd').value));

	 poststr += '&ct_name=' + escape(encodeURI(window.document.getElementById('ct_name').value)); 
         

	 poststr += '&ct_title=' + escape(encodeURI(window.document.getElementById('ct_title').value));
         poststr += '&ct_email=' + escape(encodeURI(window.document.getElementById('ct_email').value));

         poststr += '&ct_extension=' + escape(encodeURI(window.document.getElementById('ct_extension').value));  
         poststr += '&recaptcha_challenge_field=' + escape(encodeURI(window.document.getElementsByName('recaptcha_challenge_field')[0].value));
         poststr += '&recaptcha_response_field=' + escape(encodeURI(window.document.getElementsByName('recaptcha_response_field')[0].value));

         poststr += '&mode=2'*/
     
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         poststr += '&jid=' + escape(encodeURI(jid)); 

         poststr += '&mode=3';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxEditJComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}

/////
function EditEduForm(csid) {

     var theURL;

     var adjidx = 0;

   

     //I have a div that tells them to wait, something is happening

     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    

     //window.opener.document.getElementById('cma_msg').style.color = 'red';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';

     var poststr = '&csid=' + escape(encodeURI(csid)); 
         poststr += '&mode=3';

         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  
     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxEditEduComplete();};

     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}

////


function ajaxEditJComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                      document.getElementById('datagridouter').innerHTML = '';
                      document.getElementById('datagridouter').innerHTML = responseText;
                      InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }
    
    return false;    

}

function ajaxEditEduComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                      document.getElementById('datagridouter').innerHTML = '';
                      document.getElementById('datagridouter').innerHTML = responseText;
                      InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }
    
    return false;    

}

function InitTextArea()
{
        tinyMCE.init({
                    theme : "advanced",
                    mode: "exact",
                    force_br_newlines : true,
                    forced_root_block : '',
                    elements : "jdescription",
                    skin : "o2k7",
                    theme_advanced_toolbar_location : "top",
                    //theme_advanced_buttons1 : "newdocument,|,bold,italic,underline,strikethrough,separator,spellchecker,|,"
                    //+ "justifyleft,justifycenter,justifyright,justifyfull,formatselect,"
                    //+ "bullist,numlist,outdent,indent",
                    //theme_advanced_buttons2 : "formatselect,fontselect,fontsizeselect,|,link,unlink,anchor,image,separator,"
                    //+"undo,redo,cleanup,code,separator,sub,sup,charmap",
                    //theme_advanced_buttons3 : "",
                    theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",
                    theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,preview",
                    theme_advanced_buttons3 : "", //"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
                    theme_advanced_buttons4 : "", //"insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
                    height:"350px",
                    width:"700px",
                    plugins : "spellchecker,paste,preview",
                    paste_auto_cleanup_on_paste : true,
                    //plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",
                    file_browser_callback : 'myFileBrowser'
           });
}

function myFileBrowser (field_name, url, type, win) {
               var fileBrowserWindow = new Array();
               fileBrowserWindow['title'] = 'File Browser';
               fileBrowserWindow['file'] = "my_cms_script.php" + "?type=" + type;
               fileBrowserWindow['width'] = '420';
               fileBrowserWindow['height'] = '400';
               tinyMCE.openWindow(fileBrowserWindow, { window : win, resizable : 'yes', inline : 'yes' });
               return false;
}

function JDataGrid(pid) {

     var theURL;

     var adjidx = 0;

   

     //I have a div that tells them to wait, something is happening

     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    

     //window.opener.document.getElementById('cma_msg').style.color = 'red';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     
     
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         //poststr += '&jid=' + escape(encodeURI(jid)); 

         poststr += '&mode=4';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxJDataGridComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxJDataGridComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                     document.getElementById('datagridouter').innerHTML = responseText;
             //        InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }
    
    return false;    

}

function EditProfileGrid(pid) {

     var theURL;

     var adjidx = 0;

   

     //I have a div that tells them to wait, something is happening

     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    

     //window.opener.document.getElementById('cma_msg').style.color = 'red';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     
     
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         //poststr += '&jid=' + escape(encodeURI(jid)); 

         poststr += '&mode=5';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxProfileGridComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxProfileGridComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                     document.getElementById('userdatapage').innerHTML = responseText;
             //        InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }
    
    return false;    

}

function CancelProfileChanges(pid) {

     var theURL;

     var adjidx = 0;

   

     
     document.getElementById('uerror').innerHTML =  '';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     
     
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         //poststr += '&jid=' + escape(encodeURI(jid)); 

         poststr += '&mode=6';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxCancelProfileChangeComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxCancelProfileChangeComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                     document.getElementById('userdatapage').innerHTML = responseText;
             //        InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }
    
    return false;    

}


function SaveProfileChanges(pid) {

     var theURL;

     var adjidx = 0;

   

     //I have a div that tells them to wait, something is happening

     //window.opener.document.getElementById('cma_msg').innerHTML = 'Updating CMA...';    

     //window.opener.document.getElementById('cma_msg').style.color = 'red';

     //Create the object

     xmlHttp = getHTTPObject();



     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     
     //alert("ADDRESS" + window.document.getElementById('address').value);
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         //poststr += '&jid=' + escape(encodeURI(jid)); 
         poststr += '&address=' + escape(encodeURI(window.document.getElementById('address').value)); 

	 poststr += '&city=' + escape(encodeURI(window.document.getElementById('city').value)); 

	 poststr += '&state=' + escape(encodeURI(window.document.getElementById('state').value));

	 poststr += '&zip=' + escape(encodeURI(window.document.getElementById('zip').value));  

	 poststr += '&phonenum=' + escape(encodeURI(window.document.getElementById('phonenum').value));
         poststr += '&faxnum=' + escape(encodeURI(window.document.getElementById('faxnum').value)); 

	 poststr += '&ct_name=' + escape(encodeURI(window.document.getElementById('ct_name').value)); 
         poststr += '&ct_title=' + escape(encodeURI(window.document.getElementById('ct_title').value));
         poststr += '&ct_email=' + escape(encodeURI(window.document.getElementById('ct_email').value));

         poststr += '&ct_extension=' + escape(encodeURI(window.document.getElementById('ct_extension').value));  
         poststr += '&mode=7';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxSaveProfileChangeComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxSaveProfileChangeComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             //alert('responseText = ' + responseText); 
             //switch (Number(responseText)) 
             //{
             //   case 100:
                     document.getElementById('userdatapage').innerHTML = responseText;
             //        InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }

    return false;

}

function SaveJobChanges(pid,jid) {
     var theURL;
     var adjidx = 0;

     //Create the object

     xmlHttp = getHTTPObject();
     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     //alert("ADDRESS" + window.document.getElementById('address').value);
     var poststr = 'pid=' + escape(encodeURI(pid)); 

         poststr += '&jid=' + escape(encodeURI(jid)); 
         poststr += '&jtitle=' + escape(encodeURI(window.document.getElementById('jtitle').value)); 

         //poststr += '&jdescription=' + escape(encodeURI(window.document.getElementById('jdescription').value)); 
         poststr += '&jdescription=' + escape(encodeURI(tinyMCE.activeEditor.getContent())); 
         poststr += '&jwebsitelink=' + escape(encodeURI(window.document.getElementById('jwebsitelink').value));

         poststr += '&jdisplay=' + escape(encodeURI(window.document.getElementById('jdisplay').value));  

         //poststr += '&phonenum=' + escape(encodeURI(window.document.getElementById('phonenum').value));
         //poststr += '&faxnum=' + escape(encodeURI(window.document.getElementById('faxnum').value)); 

         //poststr += '&ct_name=' + escape(encodeURI(window.document.getElementById('ct_name').value)); 
         //poststr += '&ct_title=' + escape(encodeURI(window.document.getElementById('ct_title').value));
         //poststr += '&ct_email=' + escape(encodeURI(window.document.getElementById('ct_email').value));

         //poststr += '&ct_extension=' + escape(encodeURI(window.document.getElementById('ct_extension').value));  
         poststr += '&mode=8';
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxSaveJobChangeComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxSaveJobChangeComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 

	//Check readystate and status to make sure your asp page didn't error out

	

    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');

	  responseText = xmlHttp.responseText ;
          if(responseText.length > 0)

          {
             document.getElementById('datagridouter').innerHTML = responseText;
             //        InitTextArea();
             //        break;
             //   case 1:
             //        alert('Record was inserted.');
             //        break;  
             //}

          //  //window.close();

          //  responseArray = responseText.split('|');

          } //Length

      }

      xmlHttp = null;

    }  



    else {

    }

    return false;

}

////
function changeitem(pid,jid,mode,display) {
     var theURL;
     var adjidx = 0;

     //Create the object

     xmlHttp = getHTTPObject();
     //Url to the page to insert records

     theURL = 'ajaxaccount.php';
     //alert("ADDRESS" + window.document.getElementById('address').value);
     var poststr = 'pid=' + escape(encodeURI(pid));

         poststr += '&jid=' + escape(encodeURI(jid));
         //poststr += '&jtitle=' + escape(encodeURI(window.document.getElementById('jtitle').value)); 

         //poststr += '&jdescription=' + escape(encodeURI(window.document.getElementById('jdescription').value)); 
         //poststr += '&jdescription=' + escape(encodeURI(tinyMCE.activeEditor.getContent())); 
         //poststr += '&jwebsitelink=' + escape(encodeURI(window.document.getElementById('jwebsitelink').value));

         poststr += '&jdisplay=' + display;

         //poststr += '&phonenum=' + escape(encodeURI(window.document.getElementById('phonenum').value));
         //poststr += '&faxnum=' + escape(encodeURI(window.document.getElementById('faxnum').value)); 

         //poststr += '&ct_name=' + escape(encodeURI(window.document.getElementById('ct_name').value)); 
         //poststr += '&ct_title=' + escape(encodeURI(window.document.getElementById('ct_title').value));
         //poststr += '&ct_email=' + escape(encodeURI(window.document.getElementById('ct_email').value));

         //poststr += '&ct_extension=' + escape(encodeURI(window.document.getElementById('ct_extension').value));  
         poststr += '&mode=' + mode;
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:

     xmlHttp.onreadystatechange = function() {ajaxchangeitemComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxchangeitemComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 
	//Check readystate and status to make sure your asp page didn't error out


    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');
          responseText = xmlHttp.responseText ;
          if(responseText.length > 0)
          {
             document.getElementById('datagridouter').innerHTML = responseText;
          } //Length

      }

      xmlHttp = null;

    }
    else {

    }
    return false;
}


function conferenceReg() {
     var theURL;
     var adjidx = 0;

     //Create the object

     xmlHttp = getHTTPObject();
     //Url to the page to insert records
     var radioObj = document.getElementsByName("dues");
     for (var i = 0; i < radioObj.length; i++)
     {
         if (radioObj[i].checked)
         {
           var duesValue = radioObj[i].value;
           break;
         }
     }
    var radioObj = document.getElementsByName("lunches");
     for (var i = 0; i < radioObj.length; i++)
     {
         if (radioObj[i].checked)
         {
           var lunchValue = radioObj[i].value;
           break;
         }
     }

     theURL = 'ajaxaccount.php';
     //alert("ADDRESS" + window.document.getElementById('address').value);
     var poststr = 'mode=100';
         poststr += '&firstname=' + escape(encodeURI(window.document.getElementById('firstname').value));
         poststr += '&lastname=' + escape(encodeURI(window.document.getElementById('lastname').value));
         poststr += '&address=' + escape(encodeURI(window.document.getElementById('address').value));
         poststr += '&city=' + escape(encodeURI(window.document.getElementById('city').value));
         poststr += '&state=' + escape(encodeURI(window.document.getElementById('state').value));
         poststr += '&zipcode=' + escape(encodeURI(window.document.getElementById('zipcode').value));
         poststr += '&wphone=' + escape(encodeURI(window.document.getElementById('wphone').value));
         poststr += '&hphone=' + escape(encodeURI(window.document.getElementById('hphone').value));
         poststr += '&email=' + escape(encodeURI(window.document.getElementById('email').value));
         poststr += '&dues=' + escape(encodeURI(duesValue));
         poststr += '&lunches=' + escape(encodeURI(lunchValue)); 
         poststr += '&hosted_button_id=' + escape(encodeURI(window.document.getElementById('hosted_button_id').value));
         //poststr += '&t=' + escape(encodeURI(stamp.getTime()));  

     //Tell it what js function to call when you get your response from your asp page:
     //alert('poststr: ' + poststr );
     xmlHttp.onreadystatechange = function() {ajaxconferenceRegComplete();};



     
     //Send request

     //xmlHttp.open("GET", theURL, true);

     //xmlHttp.send(null);
     
     //alert('POSTSTR ' + poststr);
     //Post to page
     xmlHttp.open('POST', theURL, true);

     xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

     xmlHttp.setRequestHeader("Content-length", poststr.length);

     xmlHttp.setRequestHeader("Connection", "close");

     xmlHttp.send(poststr);


    return 0;

}


function ajaxconferenceRegComplete()

{

    var responseText;

    //var theSelect;

    //var cCallRef;

    var responseArray;

	//var txml; 
	//Check readystate and status to make sure your asp page didn't error out


    if (xmlHttp.readyState==4) {

      if(xmlHttp.status == 200) {
          //alert('HI');
          responseText = xmlHttp.responseText ;
          if(responseText.length > 0)
          {
             //document.getElementById('datagridouter').innerHTML = responseText;
             //alert('page response: ' + responseText);
             //document.location.href  = 'https://www.paypal.com/cgi-bin/webscr?hosted_button_id=5487919&cmd=_s-xclick&on0=Membership&item_number=5656565656'
             responseArray = responseText.split('|');
             ////var tagStr = "<form id=\"dynForm\" action=\"https://www.paypal.com/cgi-bin/webscr\" method=\"post\">";
             //var tagStr = "<form id=\"dynForm\" action=\"https://www.sandbox.paypal.com/cgi-bin/webscr\" method=\"post\">";
             //    //tagStr += "<input type='hidden' name='hosted_button_id' value='5487919'/>";
             //    //tagStr += "<input type='hidden' name='on0' value='Membership'/>";
             //    //tagStr += "<input type='hidden' name='item_number' value='13022'/>";
             //   //tagStr += "<input type='hidden' name='os0' value='Active'/>";
             //   tagStr += "<input type=\"hidden\" name=\"cmd\" value=\"_cart\">";
             //   tagStr += "<input type=\"hidden\" name=\"add\" value=\"1\">";
             //   tagStr += "<input type=\"hidden\" name=\"business\" value=\"edilla_1266329572_biz@triad.rr.com\">";
             //   //tagStr += "<input type=\"hidden\" name=\"business\" value=\"\">";
             //    //tagStr += "<input type=\"hidden\" name=\"item_name\" value=\"Baseball Hat\">";
             //   tagStr += "<input type=\"hidden\" name=\"item_name\" value=\"" + responseArray[0] + "\">";
             //    //tagStr += "<input type=\"hidden\" name=\"item_number\" value=\"124\">";
             //   tagStr += "<input type=\"hidden\" name=\"amount\" value=\"" + responseArray[1] + "\">";
             //    //tagStr += "<input type=\"hidden\" name=\"shipping\" value=\"1.00\">";
             //    //tagStr += "<input type=\"hidden\" name=\"shipping2\" value=\"0.50\">";
             //    //tagStr += "<input type=\"hidden\" name=\"handling\" value=\"2.00\">";
             //   tagStr += "<input type=\"hidden\" name=\"currency_code\" value=\"USD\">";
             //   tagStr += "<input type=\"hidden\" name=\"return\" value=\"http://www.ncavt.com/regcomplete.php\">";
             //    //tagStr += "<input type=\"hidden\" name=\"redirect_url\" value=\"http://www.ncavt.com/regcomplete.php?conf_id=" + responseArray[2] + "\">"; 
             //   tagStr += "<input type=\"hidden\" name=\"notify_url\" value=\"http://www.ncavt.com/regcomplete.php?conf_id=" + responseArray[2] + "\">";
             //   //tagStr += "<input type=\"hidden\" name=\"custom\" value=\"conf_id="+ responseArray[2] + "\">";
             //   tagStr += "<input type=\"hidden\" name=\"undefined_quantity\" value=\"1\">";
             //   tagStr += "</form>";

            //document.body.innerHTML += tagStr;
            //document.getElementById("dynForm").submit();

            document.paypalForm.cmd.value = "_cart";
            document.paypalForm.add.value = "1";
            //document.paypalForm.hosted_button_id.value="5487919";
            //document.paypalForm.business.value = "edilla_1266329572_biz@triad.rr.com";
            document.paypalForm.business.value = "payments@ncavt.com";
            document.paypalForm.item_name.value = responseArray[0];
            document.paypalForm.amount.value = responseArray[1];
            document.paypalForm.currency_code.value = "USD";
            document.getElementById("paypalreturn").value = "http://www.ncavt.com/regcomplete.php";
            //document.paypalForm.xreturn.value = "http://www.ncavt.com/regcomplete.php";
            document.paypalForm.notify_url.value = "http://www.ncavt.com/regcomplete.php?conf_id=" + responseArray[2];
            document.paypalForm.undefined_quantity.value = "1";

            document.getElementById("paypalForm").submit();
            //document.getElementsByName("dynForm").submit();

             //aresponseText
          } //Length

      }

      xmlHttp = null;

    }
    else {

    }
    return false;
}


