function mybtns() {
  $$('div.divbtn').each(function(item){
	item.addEvent('mouseover', function(e) {
	  item.setStyle('background-color','#D0DCE0');
	});
	item.addEvent('mouseout', function(e) {
	  item.setStyle('background-color','#FFFFFF');
	});
  });
}

function myserialize(element, options){
  var str = [];
  var key = encodeURIComponent(options.key || element.id);
  var elements = $A(element.getElements(options.tag || ''));
  elements.each(function(el, i) {
    str.push(key+'['+i+']='+el.id);
  });
  return str.join('&');
}

function blendimage(divid, imageid, imagefile, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    
    //set the current image as background
    $(divid).style.backgroundImage = "url(" + $(imageid).src + ")";
    
    //make image transparent
    changeOpac(0, imageid);
    
    //make new image
    $(imageid).src = imagefile;

    //fade in image
    for(i = 0; i <= 100; i++) {
        setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
        timer++;
    }
}

function opacity(id, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
    var object = $(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}

function dologin() {
  if ($('user').value == "") {
    alert("Please enter your username");
    $('user').focus();
    return false;
  }
  else if ($('pass').value == "") {
    alert("Please enter your password");
    $('pass').focus();
    return false;
  }
  else {
    window.location = $('loginurl').value + "?action=login&user=" + $('user').value + "&pass=" + $('pass').value;
    return true;
  }
}

function toggleRef() {
  if ($('free_account').style.display == "none") {
    $('free_account').style.display = "";
    var exampleFx = new Fx.Styles('free_account');
    exampleFx.start({
	  'width':[0,377],
	  'height':[0,262]
    });
    var exampleFx = new Fx.Styles('free_account_link');
    exampleFx.start({
	  'height':[15,0]
    });
    setTimeout("$('free_account_link').style.display='none'",500);
  }
  else {
    $('free_account_link').style.display = "";
    var exampleFx = new Fx.Styles('free_account');
    exampleFx.start({
	  'width':[377,0],
	  'height':[262,0]
    });
    var exampleFx = new Fx.Styles('free_account_link');
    exampleFx.start({
	  'height':[0,15]
    });
    setTimeout("$('free_account').style.display='none'",500);
  }
}

function chkRegForm() {
  if (document.regform.fname.value == "") {
    alert("Please enter your first name");
    document.regform.fname.focus();
    return false;
  }
  else if (document.regform.lname.value == "") {
    alert("Please enter your last name");
    document.regform.lname.focus();
    return false;
  }
  else if (document.regform.address.value == "") {
    alert("Please enter your address");
    document.regform.address.focus();
    return false;
  }
  else if (document.regform.city.value == "") {
    alert("Please enter your city");
    document.regform.city.focus();
    return false;
  }
  else if (document.regform.state.value == "") {
    alert("Please select your state");
    document.regform.state.focus();
    return false;
  }
  else if (document.regform.zip.value == "") {
    alert("Please enter your zip code");
    document.regform.zip.focus();
    return false;
  }
  else if (document.regform.phone.value == "") {
    alert("Please enter your phone number");
    document.regform.phone.focus();
    return false;
  }
  else if (document.regform.email.value.indexOf('@') <= 0) {
    alert("Please enter a valid email address");
    document.regform.email.focus();
    document.regform.email.select();
    return false;
  }
  else if (document.regform.username.value == "") {
    alert("Please enter a username");
    document.regform.username.focus();
    return false;
  }
  else if (document.regform.password.value == "") {
    alert("Please enter a password");
    document.regform.password.focus();
    return false;
  }
  else if (document.regform.password.value != document.regform.password_check.value) {
    alert("Your passwords did not match, please re-enter.");
    document.regform.password_check.value = "";
    document.regform.password.focus();
    document.regform.password.select();
    return false;
  }
  else if ((document.regform.agree) && (document.regform.agree.checked == false)) {
    alert("Please you must check that you agree to the terms of this registration.");
    return false;  
  }
  /*
  else if ((document.regform.paytype[0].checked) && (document.regform.ct.value == "")) {
    alert("Please select a card type");
    document.regform.ct.focus();
    return false;
  }
  else if ((document.regform.paytype[0].checked) && (document.regform.cn.value == "")) {
    alert("Please enter a card number");
    document.regform.cn.focus();
    return false;
  }
  else if ((document.regform.paytype[0].checked) && (document.regform.em.value == "")) {
    alert("Please select an expiration month");
    document.regform.em.focus();
    return false;
  }
  else if ((document.regform.paytype[0].checked) && (document.regform.ey.value == "")) {
    alert("Please select an expiration year");
    document.regform.ey.focus();
    return false;
  }
  else if ((document.regform.paytype[0].checked) && (document.regform.cvv.value == "")) {
    alert("Please enter the card's CVV 3-digit number");
    document.regform.cvv.focus();
    return false;
  }
  else {
    if (document.regform.paytype[0].checked) { // paying with card
      document.regform.subtn.value = "please wait...";
      document.regform.subtn.disabled = true;
    }
    return true;
  }
  */
  else if (document.regform.ct.value == "") {
    alert("Please select a card type");
    document.regform.ct.focus();
    return false;
  }
  else if (document.regform.cn.value == "") {
    alert("Please enter a card number");
    document.regform.cn.focus();
    return false;
  }
  else if (document.regform.em.value == "") {
    alert("Please select an expiration month");
    document.regform.em.focus();
    return false;
  }
  else if (document.regform.ey.value == "") {
    alert("Please select an expiration year");
    document.regform.ey.focus();
    return false;
  }
  else if (document.regform.cvv.value == "") {
    alert("Please enter the card's CVV 3-digit number");
    document.regform.cvv.focus();
    return false;
  }
  else {
    document.regform.subtn.value = "please wait...";
    document.regform.subtn.disabled = true;
    return true;
  }
}

function pLogin() {
  if (document.plogin.user.value == "") {
    alert("Please enter your username");
    document.plogin.user.focus();
    return false;
  }
  else if (document.plogin.pass.value == "") {
    alert("Please enter your password");
    document.plogin.pass.focus();
    return false;
  }
  else {
    document.plogin.submit.value = "Logging in...";
    document.plogin.submit.disabled = true;
    return true;
  }
}

function ikey(evt,doit) {
  evt = evt || window.event;
  var key = evt.keyCode;
  if (key == 13) {
    eval(doit);
  }
}

menuout = 0;
function show_zoom_menu() {
//  if (menuout == 0) {
//    menuout = 1;
//    $('zoom_menu').effect('left',{
//  	  duration: 1000,
//  	  transition: Fx.Transitions.bounceOut
//    }).start(-725,0);
//  }
}
function hide_zoom_menu() {
//  if (menuout == 1) {
//    menuout = 0;
//    new Fx.Style('zoom_menu','left').start(0,-725);
//  }
}

function splReferral() {
  var result_array = $('referral_name').value.split("%%");
  
  clean_id = result_array[0];
  clean_id = clean_id.replace(/<span class="noshow">/,'');
  clean_id = clean_id.replace(/<SPAN class="noshow">/,'');
  clean_id = clean_id.replace(/<span class=noshow>/,'');
  clean_id = clean_id.replace(/<SPAN class=noshow>/,'');
  $('referral_id').value = clean_id;
  
  clean_name = result_array[1];
  clean_name = clean_name.replace(/<\/span>/,'');
  clean_name = clean_name.replace(/<\/SPAN>/,'');
  clean_name = clean_name.replace(/&amp;/,'&');
  $('referral_name').value = clean_name;
}

function getData(dataSource,divID) {
  var XMLHttpRequestObject = false;
  try {
    XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");
  }
  catch (exception1) {
    try {
      XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (exception2) {
      XMLHTTPRequestObject = false; 
    }
  }

  if (!XMLHttpRequestObject && window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  }

  if (XMLHttpRequestObject) {
    var obj = $(divID);
    obj.innerHTML = "<center><br><img src=\"images/indicator_medium.gif\" border=0 title=\"LOADING...\"><br><span style=\"font:7pt Tahoma; color:#c0c0c0\">Loading...</span></center>";

    XMLHttpRequestObject.open("GET",dataSource);
    XMLHttpRequestObject.onreadystatechange = function() {
      if ((XMLHttpRequestObject.readyState == 4) && (XMLHttpRequestObject.status == 200)) {
        obj.innerHTML = XMLHttpRequestObject.responseText;	
      }
    }
    XMLHttpRequestObject.send(null);
  }
}

function getData_comp(dataSource,divID,js) {
  var XMLHttpRequestObject = false;
  try {
    XMLHttpRequestObject = new ActiveXObject("MSXML2.XMLHTTP");
  }
  catch (exception1) {
    try {
      XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    catch (exception2) {
      XMLHTTPRequestObject = false; 
    }
  }

  if (!XMLHttpRequestObject && window.XMLHttpRequest) {
    XMLHttpRequestObject = new XMLHttpRequest();
  }

  if (XMLHttpRequestObject) {
    var obj = $(divID);
    obj.innerHTML = "<center><br><img src=\"images/indicator_medium.gif\" border=0 title=\"LOADING...\"><br><span style=\"font:7pt Tahoma; color:#c0c0c0\">Loading...</span></center>";

    XMLHttpRequestObject.open("GET",dataSource);
    XMLHttpRequestObject.onreadystatechange = function() {
      if ((XMLHttpRequestObject.readyState == 4) && (XMLHttpRequestObject.status == 200)) {
        obj.innerHTML = XMLHttpRequestObject.responseText;
        
        if (js) {
          eval(js);
        }
        
      }
    }
    XMLHttpRequestObject.send(null);
  }
}

function launch_cms_login(goret) {
  MOOdalBox.open(
    "cms_login.php?return="+goret,
    "LOGIN TO ENTER THE CONTENT MANAGEMENT SYSTEM",
    "350 250"
  );
}

function toggle_module_history(mid,hh) {
  nn = $('MH'+mid);
  if (nn.style.display == "none") {
    nn.style.display = "";
    new Fx.Style('MH'+mid,'height').start(0,hh);
    new Fx.Style('MH'+mid,'borderWidth').start(0,2);
  }
  else {
    new Fx.Style('MH'+mid,'height').start(hh,0);
    new Fx.Style('MH'+mid,'borderWidth').start(2,0);
    setTimeout("$('MH"+mid+"').style.display='none'",500);
  }
}

function store_removeItem(cid) {
  var cc = confirm("Are you sure you want to remove this product from your cart?");
  if (cc == true) {
    window.location = "?action=cart&mode=remove&cartid="+cid;
  }
}

function store_chkCheckOut() {
  if (document.chkout.shipping_fname.value == "") {
    alert("Please enter your first name for your shipping address");
    document.chkout.shipping_fname.focus();
    return false;
  }
  else if (document.chkout.shipping_lname.value == "") {
    alert("Please enter your last name for your shipping address");
    document.chkout.shipping_lname.focus();
    return false;
  }
  else if (document.chkout.shipping_address1.value == "") {
    alert("Please enter your address for your shipping address");
    document.chkout.shipping_address1.focus();
    return false;
  }
  else if (document.chkout.shipping_city.value == "") {
    alert("Please enter your city for your shipping address");
    document.chkout.shipping_city.focus();
    return false;
  }
  else if (document.chkout.shipping_state.value == "") {
    alert("Please select a state for your shipping address");
    document.chkout.shipping_state.focus();
    return false;
  }
  else if (document.chkout.shipping_zip.value == "") {
    alert("Please enter a zip code for your shipping address");
    document.chkout.shipping_zip.focus();
    return false;
  }
  else if (document.chkout.billing_fname.value == "") {
    alert("Please enter your first name for your billing address");
    document.chkout.billing_fname.focus();
    return false;
  }
  else if (document.chkout.billing_lname.value == "") {
    alert("Please enter your last name for your billing address");
    document.chkout.billing_lname.focus();
    return false;
  }
  else if (document.chkout.billing_address1.value == "") {
    alert("Please enter your address for your billing address");
    document.chkout.billing_address1.focus();
    return false;
  }
  else if (document.chkout.billing_city.value == "") {
    alert("Please enter your city for your billing address");
    document.chkout.billing_city.focus();
    return false;
  }
  else if (document.chkout.billing_state.value == "") {
    alert("Please select a state for your billing address");
    document.chkout.billing_state.focus();
    return false;
  }
  else if (document.chkout.billing_zip.value == "") {
    alert("Please enter a zip code for your billing address");
    document.chkout.billing_zip.focus();
    return false;
  }
  else if (document.chkout.ct.value == "") {
    alert("Please select a card type");
    document.chkout.ct.focus();
    return false;
  }
  else if (document.chkout.cn.value == "") {
    alert("Please enter your card number");
    document.chkout.cn.focus();
    return false;
  }
  else if (document.chkout.em.value == "") {
    alert("Please select en expiration date month");
    document.chkout.em.focus();
    return false;
  }
  else if (document.chkout.ey.value == "") {
    alert("Please select en expiration date year");
    document.chkout.ey.focus();
    return false;
  }
  else if (document.chkout.cvv.value == "") {
    alert("Please enver the 3-digit CVV code");
    document.chkout.cvv.focus();
    return false;
  }
  else if (document.chkout.phone.value == "") {
    alert("Please enter your phone number");
    document.chkout.phone.focus();
    return false;
  }
  else if (document.chkout.email.value.indexOf('@') <= 0) {
    alert("Please enter a valid email address");
    document.chkout.email.focus();
    document.chkout.email.select();
    return false;
  }
  else if (($('add_info')) && ($('add_info').value == "")) {
    alert("Please enter the Name, Vemma ID, Current Rank and City/State for EACH ticket-holder:");
    $('add_info').focus();
    return false;
  }
  else {
    document.chkout.submit.value = "processing...please wait";
    document.chkout.submit.disabled = true;
    return true;
  }
}

function URLEncode(str) {
  var SAFECHARS = "0123456789" +					// Numeric
				  "ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
				  "abcdefghijklmnopqrstuvwxyz" +    // lower case
				  "-_.!~*'()";					    // RFC2396 Mark characters
  var HEX = "0123456789ABCDEF";
  var plaintext = str;
  var encoded = "";
  for (var i = 0; i < plaintext.length; i++ ) {
	var ch = plaintext.charAt(i);
	if (ch == " ") {
	  encoded += "+";	// x-www-urlencoded, rather than %20
	}
	else if (SAFECHARS.indexOf(ch) != -1) {
	  encoded += ch;
	}
	else {
	  var charCode = ch.charCodeAt(0);
	  if (charCode > 255) {
	    alert("Unicode Character '" +
          ch +
          "' cannot be encoded using standard URL encoding.\n" +
	      "(URL encoding only supports 8-bit characters.)\n" +
	      "A space (+) will be substituted.");
	    encoded += "+";
	  }
	  else {
		encoded += "%";
		encoded += HEX.charAt((charCode >> 4) & 0xF);
	    encoded += HEX.charAt(charCode & 0xF);
	  }
	}
  }
  return encoded;
}





/*  MVT FUNCTIONS  */

sel_mvt_btn = "1";
sel_inbox_id = "";
sel_inbox_id_bg = "";
sel_vpass_id = "";
sel_vpass_id_bg = "";

function genrn() {
  return randomnumber=Math.floor(Math.random()*9999999);
}

function mvt_select_inbox(id,bg) {
  if (sel_inbox_id && sel_inbox_id_bg) {
    $('inbox'+sel_inbox_id).className = 'mvt_index_rec'+sel_inbox_id_bg;
  }
  sel_inbox_id = id;
  sel_inbox_id_bg = bg;
  $('inbox'+id).className = 'mvt_index_rec_select';
  if ($('inbox'+id+'A').style.fontWeight == 'bold') {
    if ($('tnewct').innerHTML > 0) {
      $('tnewct').innerHTML = (parseInt($('tnewct').innerHTML) - 1);
    }
  }
  $('inbox'+id+'A').style.fontWeight = 'normal';
  $('inbox'+id+'B').style.fontWeight = 'normal';
  $('inbox'+id+'C').style.fontWeight = 'normal';
  $('inbox'+id+'A').style.color = '';
  $('inbox'+id+'B').style.color = '';
  $('inbox'+id+'C').style.color = '';
  rn = genrn();
  getData('/ajax/mvt_show_message.php?id='+id+'&rn='+rn,'mvt_display');
}

function mvt_rec_over(id) {
  if (id != sel_inbox_id) {
    $('inbox'+id).className = 'mvt_index_rec_over';
  }
}

function mvt_rec_out(id,bg) {
  if (id != sel_inbox_id) {
    $('inbox'+id).className = 'mvt_index_rec'+bg;
  }
}

function mvt_btn_over(id) {
  if (id != sel_mvt_btn) {
    $('mvt_btn'+id).className = 'mvt_btn_over';
  }
}

function mvt_btn_out(id) {
  if (id != sel_mvt_btn) {
    $('mvt_btn'+id).className = 'mvt_btn';
  }
}

function mvt_btn_select(id,df) {
  if (sel_mvt_btn) {
    $('mvt_btn'+sel_mvt_btn).className = 'mvt_btn';
  }
  $('mvt_btn'+id).className = 'mvt_btn_select';
  sel_mvt_btn = id;
  if (df) {
    eval(df);
  }
}

function mvt_mark_unread(id) {
  $('inbox'+id+'A').style.fontWeight = 'bold';
  $('inbox'+id+'B').style.fontWeight = 'bold';
  $('inbox'+id+'C').style.fontWeight = 'bold';
  $('inbox'+id+'A').style.color = '#0000FF';
  $('inbox'+id+'B').style.color = '#0000FF';
  $('inbox'+id+'C').style.color = '#0000FF';
  rn = genrn();
  getData('/ajax/mvt_show_message.php?id='+id+'&action=mark_unread&rn='+rn,'mvt_display');
  $('tnewct').innerHTML = (parseInt($('tnewct').innerHTML) + 1);
}

function mvt_gt_inbox() {
  rn = genrn();
  getData('/ajax/mvt_list_inbox.php?rn='+rn,'mvt_list');
  getData('/ajax/mvt_show_message.php?rn='+rn,'mvt_display');
}

function mvt_gt_trash() {
  rn = genrn();
  getData('/ajax/mvt_list_trash.php?rn='+rn,'mvt_list');
  getData('/ajax/mvt_show_trash.php?rn='+rn,'mvt_display');
}

function mvt_gt_vpass() {
//  rn = genrn();
//  getData('/ajax/mvt_list_vpass.php?rn='+rn,'mvt_list');
//  getData('/ajax/mvt_show_vpass.php?rn='+rn,'mvt_display');
alert("The V-PASS SYSTEM IS CURRENTLY BEING UPDATED!");
}

function mvt_gt_vpass_old() {
  rn = genrn();
  getData('/ajax/mvt_list_vpass_old.php?rn='+rn,'mvt_list');
}

function mvt_gt_vpass_new() {
  rn = genrn();
  getData('/ajax/mvt_list_vpass.php?rn='+rn,'mvt_list');
  getData('/ajax/mvt_show_vpass_new.php?rn='+rn,'mvt_display');
}

function mvt_gt_compose(id) {
  rn = genrn();
  if (id == 0) {
    postload = "var auto = new AjaxAutoCompleter('mvt_rec_name', 'mvt_rec_auto_complete', 'ajax/mvt_public_users.php?&str=', {indicator: 'indicator2', post_load_func: 'mvt_select_user()' });";
    getData('/ajax/mvt_list_inbox.php?rn='+rn,'mvt_list');
    getData_comp('/ajax/mvt_compose_message.php?rn='+rn,'mvt_display',postload);
  }
  else { // REPLY
    getData('/ajax/mvt_compose_message.php?action=reply&reply_id='+id+'&rn='+rn,'mvt_display');
  }
}

function mvt_gt_templates() {
  rn = genrn();
  getData('/ajax/mvt_show_templates.php?rn='+rn,'mvt_display');
}

function mvt_gt_bus_card() {
  rn = genrn();
  getData('/ajax/mvt_bus_card.php?rn='+rn,'mvt_display');
}

function mvt_inbox_sort(ss) {
  rn = genrn();
  getData('/ajax/mvt_list_inbox.php?sort='+ss+'&rn='+rn,'mvt_list');
}

function mvt_vpass_sort(ss) {
  rn = genrn();
  getData('/ajax/mvt_list_vpass.php?sort='+ss+'&rn='+rn,'mvt_list');
}

function mvt_vpass_sort_old(ss) {
  rn = genrn();
  getData('/ajax/mvt_list_vpass_old.php?sort='+ss+'&rn='+rn,'mvt_list');
}

function mvt_chk_vpass_form() {
  if ($('mvt_vpass_fname').value == "") {
    alert("Please enter the recipient's first name.");
    $('mvt_vpass_fname').focus();
    return false;
  }
  else if ($('mvt_vpass_lname').value == "") {
    alert("Please enter the recipient's last name.");
    $('mvt_vpass_lname').focus();
    return false;
  }
  else if ($('mvt_vpass_email').value.indexOf('@') <= 0) {
    alert("Please enter a valid email address for the recipient.");
    $('mvt_vpass_email').focus();
    $('mvt_vpass_email').select();
    return false;
  }
  else {
    pdata  = "action=gennew";
    pdata += "&fname="+URLEncode($('mvt_vpass_fname').value);
    pdata += "&lname="+URLEncode($('mvt_vpass_lname').value);
    pdata += "&email="+URLEncode($('mvt_vpass_email').value);
    rn = genrn();
    
//    var vv = confirm("This will generate a unique V-Pass code for you to send to your prospects.  By doing so, you acknowledge that you are responsible for delivering this code to your prospect.\n\nThis system does not email for you.");
    
//    if (vv == true) {
      getData('/ajax/mvt_show_vpass.php?'+pdata+'&msg=new&rn='+rn,'mvt_display');
      setTimeout("getData('/ajax/mvt_list_vpass.php?rn="+rn+"','mvt_list');",1500);
//    }
    
  }
}

function mvt_select_vpass(id,bg,sysflag) {
  if (sel_vpass_id && sel_vpass_id_bg) {
    if ($('vpass'+sel_vpass_id)) {
      $('vpass'+sel_vpass_id).className = 'mvt_index_rec'+sel_vpass_id_bg;
    }
    else {
      sel_vpass_id = "";
    }
  }
  sel_vpass_id = id;
  sel_vpass_id_bg = bg;
  $('vpass'+id).className = 'mvt_index_rec_select';
  rn = genrn();
  getData('/ajax/mvt_show_vpass_view.php?action=show&id='+id+'&sysflag='+sysflag+'&rn='+rn,'mvt_display');
}

function mvt_vpass_over(id) {
  if (id != sel_vpass_id) {
    $('vpass'+id).className = 'mvt_index_rec_over';
  }
}

function mvt_vpass_out(id,bg) {
  if (id != sel_vpass_id) {
    $('vpass'+id).className = 'mvt_index_rec'+bg;
  }
}

function mvt_update_ct() {
  mvt_rn_update();
  setTimeout("mvt_update_ct()",10000); // refresh count every 10 seconds
}

function mvt_rn_update() {
  if ($('mvt_total_inbox_new')) {
    $('tnewct').innerHTML = parseInt($('mvt_total_inbox_new').value);
  }
  if ($('mvt_total_trash')) {
    $('ttrashct').innerHTML = parseInt($('mvt_total_trash').value);
  }
}

function mvt_delete_vpass(id) {
  var dm = confirm("Are you sure you want to delete this v-pass record?");
  if (dm == true) {
    rn = genrn();
    getData('/ajax/mvt_list_vpass.php?action=killvpass&id='+id+'&rn='+rn,'mvt_list');
    getData('/ajax/mvt_show_vpass_new.php?rn='+rn,'mvt_display');
  }
}

function mvt_delete_old_vpass(id) {
  var dm = confirm("Are you sure you want to delete this v-pass code?");
  if (dm == true) {
    rn = genrn();
    getData('/ajax/mvt_list_vpass_old.php?action=delete&id='+id+'&rn='+rn,'mvt_list');
    getData('/ajax/mvt_show_vpass_new.php?rn='+rn,'mvt_display');
  }
}


function mvt_delete_msg(id) {
//  var dm = confirm("Are you sure you want to delete this message?");
//  if (dm == true) {
    sel_inbox_id = "";
    sel_inbox_id_bg = "";
    rn = genrn();
    getData('/ajax/mvt_list_inbox.php?action=delete&id='+id+'&rn='+rn,'mvt_list');
    getData('/ajax/mvt_show_message.php?rn='+rn,'mvt_display');
    setTimeout("mvt_rn_update()",500);
//  }
}

function mvt_delete_next_msg(id,nid) {
//  var dm = confirm("Are you sure you want to delete this message?");
//  if (dm == true) {
    sel_inbox_id = "";
    sel_inbox_id_bg = "";
    rn = genrn();
    getData('/ajax/mvt_list_inbox.php?action=delete&id='+id+'&rn='+rn,'mvt_list');
    getData('/ajax/mvt_show_message.php?id='+nid+'&rn='+rn,'mvt_display');
    setTimeout("mvt_rn_update()",500);
//  }
}

function mvt_next_prev(id) {
  getData('/ajax/mvt_list_inbox.php?rn='+rn,'mvt_list');
  getData('/ajax/mvt_show_message.php?id='+id+'&rn='+rn,'mvt_display');
}

function mvt_select_user() {
  var result_array = $('mvt_rec_name').value.split("%%");
  clean_id = result_array[0];
  clean_id = clean_id.replace(/<span class="noshow">/,'');
  clean_id = clean_id.replace(/<SPAN class="noshow">/,'');
  clean_id = clean_id.replace(/<span class=noshow>/,'');
  clean_id = clean_id.replace(/<SPAN class=noshow>/,'');
  $('mvt_rec_id').value = clean_id;
  
  clean_name = result_array[1];
  clean_name = clean_name.replace(/<\/span>/,'');
  clean_name = clean_name.replace(/<\/SPAN>/,'');
  clean_name = clean_name.replace(/&amp;/,'&');
  $('mvt_rec_name').value = clean_name;
}

function mvt_sbmt_msg() {
  if ($('mvt_rec_name').value == "") {
    alert("Please select a recipient.  Start typing the name of the MyVtraining user you want to send a message to and select from the list that is provided.");
    $('mvt_rec_name').focus();
    return false;
  }
  else if ($('mvt_compose_subject').value == "") {
    alert("Please enter a subject for your message.");
    $('mvt_compose_subject').focus();
    return false;
  }
  else if ($('mvt_compose_message').value == "") {
    alert("Please enter a message.");
    $('mvt_compose_message').focus();
    return false;
  }
  else {
    postload  = "var auto = new AjaxAutoCompleter('mvt_rec_name', 'mvt_rec_auto_complete', 'ajax/mvt_public_users.php?&str=', {indicator: 'indicator2', post_load_func: 'mvt_select_user()' }); ";
    postload += "getData('/ajax/mvt_list_inbox.php?rn="+rn+"','mvt_list'); ";
    pdata  = "&action=newmsg";
    pdata += "&mvt_rec_id="+$('mvt_rec_id').value;
    pdata += "&mvt_rec_name="+URLEncode($('mvt_rec_name').value);
    pdata += "&mvt_compose_subject="+URLEncode($('mvt_compose_subject').value);
    pdata += "&mvt_compose_message="+URLEncode($('mvt_compose_message').value);
    rn = genrn();
    getData_comp('/ajax/mvt_compose_message.php?'+pdata+'&rn='+rn,'mvt_display',postload);
  }
}

function mvt_select_vpass_template() {
  if ($('mvt_vpass_id') && ($('mvt_vpass_id').value != "")) {
    vpid = $('mvt_vpass_id').value;
    rn = genrn();
    getData('/ajax/mvt_show_templates.php?mvt_vpass_id='+vpid+'&rn='+rn,'mvt_display'); 
  }
}

function mvt_sbmt_template() {
  if ($('mvt_subject').value == "") {
    alert("Please enter a subject");
    $('mvt_subject').focus();
    return false;
  }
  else if ($('mvt_email').value.indexOf('@') <= 0) {
    alert("Please enter a valid email address");
    $('mvt_email').focus();
    $('mvt_email').select();
    return false;
  }
  else if ($('mvt_message').value == "") {
    alert("Please enter a message");
    $('mvt_message').focus();
    return false;
  }
  else {
    pdata  = "&action=create";
    pdata += "&mode=gen";
    pdata += "&mvt_format="+$('mvt_format').value;
    pdata += "&mvt_email="+URLEncode($('mvt_email').value);
    pdata += "&mvt_subject="+URLEncode($('mvt_subject').value);
    pdata += "&mvt_message="+URLEncode($('mvt_message').value);
    rn = genrn();
    setTimeout("getData('/ajax/mvt_show_templates.php?action=create&rn="+rn+"','mvt_display');",1000);
    window.location = '/ajax/mvt_create_template.php?'+pdata+'&rn='+rn;
    return true;
  }
}

function mvt_save_vpass() {
  if ($('mvt_current_vpass').value == "") {
    alert('Please enter a V-Pass code.');
    $('mvt_current_vpass').focus();
    return false;
  }
  else {
    pdata  = "&action=save";
    pdata += "&mvt_new_vpass="+URLEncode($('mvt_current_vpass').value);
    rn = genrn();
    getData_comp('/ajax/mvt_show_vpass_new.php?'+pdata+'&rn='+rn,'mvt_display');
  }
}

function mvt_create_template(id) {
  window.open('/ajax/mvt_create_template_id.php?id='+id+'&rn='+rn);
//  setTimeout("alert('An HTML file was just delivered to you.  You can open this file with your default internet browser to see the generated message.  You can COPY/PASTE this message into your email program to send to your prospect. \\n\\n NOTE: This system does not email for you.')",2000);
}

function mvt_arrow(evt) {
  // mvt_arrow(event)
  evt = evt || window.event;
  var key = evt.keyCode;
  if (key==37) alert("Left arrow");
  if (key==38) alert("Up arrow");
  if (key==39) alert("Right arrow");
  if (key==40) alert("Down arrow");
  if (key==32) alert("Space Bar");
}

function mvt_empty_trash() {
  var dd = confirm("Are you sure you want to delete all messages in your trash?");
  if (dd == true) {
    getData('/ajax/mvt_list_trash.php?action=empty&rn='+rn,'mvt_list');
    $('ttrashct').innerHTML = "0";
  }
}

function dim_screen() {
  $('screendim').setStyle('display','');
  $('screendim').effect('opacity', { duration: 150, transition: Fx.Transitions.sineIn }).start(0,.8);
}

function undim_screen() {
  $('screendim').setStyle('display','');
  $('screendim').effect('opacity', { duration: 500, transition: Fx.Transitions.sineIn }).start(.8,0);
}

/* END MVT FUNCTIONS */

/* MVT3K */
function mvt3k_over_cat(id) {
  $('mvt3k_cats').setProperty('src','/images/MVT3K_CATS_'+id+'.png');
}
function mvt3k_sel_cat(id) {
  new Ajax('ajax/mvt3k_listing_loader.php?rn='+Math.floor(Math.random()*999999)+'&catid='+id, { update: 'mvt3k_listing_loader', onComplete: init_mvt3k_listing_over } ).request();
}
function mvt3k_play(id) {
  dim_screen();
  $('mvt3k_player').setStyles({'display':''});
  new Ajax('ajax/mvt3k_play.php?rn='+Math.floor(Math.random()*999999)+'&vid='+id, { update: 'mvt3k_player' } ).request();
}
function mvt3k_stop() {
  undim_screen();
  new Ajax('ajax/mvt3k_play.php?rn='+Math.floor(Math.random()*999999), { update: 'mvt3k_player', onComplete: function(){ $('mvt3k_player').setStyles({'display':'none'}); } } ).request();
}
function mvt3k_ticket() {
  if (document.mvt3k_login.ticket.value == "") {
    alert("Your MVT Theatre Ticket pass should consists of numbers and dashes only.");
    document.mvt3k_login.ticket.focus();
    document.mvt3k_login.ticket.select();
    return false;
  }
  else {
    document.mvt3k_login.subtn.disabled = true;
    return true;
  }
}
function mvt3k_register() {
  if ($('reg_fname').value == "") {
    alert("Please enter your first name.");
    $('reg_fname').focus();
    return false;
  }
  else if ($('reg_lname').value == "") {
    alert("Please enter your last name.");
    $('reg_lname').focus();
    return false;
  }
  else if (($('req_email').value == '1') && ($('reg_email').value.indexOf('@') <= 0)) {
    alert("Please enter a valid email address.");
    $('reg_email').focus();
    $('reg_email').select();
    return false;
  }
  else {
    $('reg_subtn').value = "saving...";
    $('reg_subtn').disabled = true;
    pdata  = "action=register&rn="+genrn();
    pdata += "&vid="+$('reg_vid').value;
    pdata += "&reg_fname="+URLEncode($('reg_fname').value);
    pdata += "&reg_lname="+URLEncode($('reg_lname').value);
    pdata += "&reg_email="+URLEncode($('reg_email').value);
    new Ajax('/ajax/mvt3k_play.php', { postBody: pdata, update: 'mvt3k_player' } ).request();
  }
}
function mvt3k_msg_form() {
  dim_screen();
  $('mvt3k_player').setStyles({'display':''});
  new Ajax('ajax/mvt3k_send_msg.php?rn='+Math.floor(Math.random()*999999), { update: 'mvt3k_player' } ).request();
}
function mvt3k_send_msg() {
  if ($('reg_fname').value == "") {
    alert("Please enter your first name.");
    $('reg_fname').focus();
    return false;
  }
  else if ($('reg_lname').value == "") {
    alert("Please enter your last name.");
    $('reg_lname').focus();
    return false;
  }
  else if ($('reg_email').value.indexOf('@') <= 0) {
    alert("Please enter a valid email address.");
    $('reg_email').focus();
    $('reg_select').focus();
    return false;
  }
  else if ($('msg_subject').value == "") {
    alert("Please enter a subject.");
    $('msg_subject').focus();
    return false;
  }
  else if ($('msg_message').value == "") {
    alert("Please enter a message.");
    $('msg_message').focus();
    return false;
  }
  else {
    $('reg_subtn').value = "saving...";
    $('reg_subtn').disabled = true;
    pdata  = "action=send&rn="+genrn();
    pdata += "&reg_fname="+URLEncode($('reg_fname').value);
    pdata += "&reg_lname="+URLEncode($('reg_lname').value);
    pdata += "&reg_email="+URLEncode($('reg_email').value);
    pdata += "&reg_phone="+URLEncode($('reg_phone').value);
    pdata += "&msg_subject="+URLEncode($('msg_subject').value);
    pdata += "&msg_message="+URLEncode($('msg_message').value);
    new Ajax('/ajax/mvt3k_send_msg.php', { postBody: pdata, update: 'mvt3k_player' } ).request();
  }
}

function mvt3k_gt_new() {
  rn = genrn();
  getData('/ajax/mvt3k_list.php?rn='+rn,'mvt_list');
//  getData('/ajax/mvt3k_show_new.php?rn='+rn,'mvt_display');
  new Ajax('/ajax/mvt3k_show_new.php?rn='+rn, { onComplete: mvt3k_def_regpreg, update: 'mvt_display' }).request();
}

function mvt3k_filters_chk() {
  rn = genrn();
  su = '';
  if ($('show_unregistered').checked) {
    su = '&show_unregistered=1';
  }
  sa = '';
  if ($('show_archived').checked) {
    sa = '&show_archived=1';
  }
  getData('/ajax/mvt3k_list.php?rn='+rn+su+sa,'mvt_list');
}

function mvt3k_mail_sort(ss) {
  rn = genrn();
  getData('/ajax/mvt3k_list.php?sort='+ss+'&rn='+rn,'mvt_list');
}

function mvt3k_mail_over(id) {
  if (id != sel_vpass_id) {
    $('vpass'+id).className = 'mvt_index_rec_over';
  }
}

function mvt3k_mail_out(id,bg) {
  if (id != sel_vpass_id) {
    $('vpass'+id).className = 'mvt_index_rec'+bg;
  }
}

function mvt3k_select_mail(id,bg,sysflag) {
  if (sel_vpass_id && sel_vpass_id_bg) {
    if ($('vpass'+sel_vpass_id)) {
      $('vpass'+sel_vpass_id).className = 'mvt_index_rec'+sel_vpass_id_bg;
    }
    else {
      sel_vpass_id = "";
    }
  }
  sel_vpass_id = id;
  sel_vpass_id_bg = bg;
  $('vpass'+id).className = 'mvt_index_rec_select';
  rn = genrn();
  getData('/ajax/mvt3k_show_mail_view.php?action=show&id='+id+'&sysflag='+sysflag+'&rn='+rn,'mvt_display');
}

function mvt3k_delete_mail(id) {
  var dm = confirm("Are you sure you want to archive this record?");
  if (dm == true) {
    rn = genrn();
    su = '';
    if ($('show_unregistered').checked) {
      su = '&show_unregistered=1';
    }
    sa = '';
    if ($('show_archived').checked) {
      sa = '&show_archived=1';
    }
    getData('/ajax/mvt3k_list.php?action=delete'+su+sa+'&id='+id+'&rn='+rn,'mvt_list');
    getData('/ajax/mvt3k_show_new.php?rn='+rn,'mvt_display');
  }
}

function mvt3k_regpref() {
  chk = 0;
  chkB = 0;
  if ($('mvt3k_reg_chk').checked) {
    chk = 1;
  }
  if ($('mvt3k_reg_email_chk').checked) {
    chkB = 1;
  }
  window.location = "?action=reqreg&vvA="+chk+"&vvB="+chkB;
}

function mvt3k_def_regpreg() {
  if ($('mvt3k_reg_chk').checked) {
    $('mvt3k_email_reg_opt').setStyle('display','none');
  }
  else {
    $('mvt3k_email_reg_opt').setStyle('display','');
  }
}

function formatCurrency(num) {
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num))
	num = "0";
	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	cents = num%100;
	num = Math.floor(num/100).toString();
	if(cents<10)
	cents = "0" + cents;
	for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
	num = num.substring(0,num.length-(4*i+3))+','+
	num.substring(num.length-(4*i+3));
	return (((sign)?'':'-') + '$' + num + '.' + cents);
}
function chkSeatSelect() {
  if ($('total_seats').value != '') {
    tSeats = $('total_seats').value.toInt();
    $('total_price').setHTML(formatCurrency((parseFloat($('ticket_price').value) * tSeats)));
	$('seat_form').setHTML('');
	
	i = 1;
	while (i <= tSeats) {
	
	  if (i == 1) {
	    ms = "m"; // master (first resv)
	  }
	  else {
	    ms = "s"; // slave (secondary resv)
	  }
	
  	  ifs  = new Element('fieldset').setProperty('class','fs');
  	  new Element('legend').setHTML('Reservation '+i).inject(ifs);
	  itbl = new Element('table').setProperty('class','ft');

	  itr  = new Element('tr');
	  new Element('th').setHTML('First Name:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('first_name'+i)) { vv = $('first_name'+i).value; }
	  new Element('input').setProperties({'name':'first_name['+i+']', 'type':'text', 'class':'sff req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);
	  
	  itr  = new Element('tr');
	  new Element('th').setHTML('Last Name:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('last_name'+i)) { vv = $('last_name'+i).value; }
	  new Element('input').setProperties({'name':'last_name['+i+']', 'type':'text', 'class':'sff req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('Rank:').inject(itr);
	  itd = new Element('td');
	  isel = new Element('select').setProperties({'name':'rank['+i+']', 'class':'sff req', 'autocomplete':'off'});
	  new Element('option').setProperties({'value':''}).setHTML('-please select-').inject(isel);
	  ranks = new Array('Member','Bronze','Silver','Gold','Diamond','Platinum','Star Platinum','Executive','Star Executive','Presidential','Star Presidential','Ambassador','Star Ambassador','Royal Ambassador');
	  for (ii=0; ii<(ranks.length-1); ii++) {
	    newOpt = new Element('option').setProperties({'value':ranks[ii]}).setHTML(ranks[ii]).inject(isel);
	    if ($('rank'+i)) {
	      if (ranks[ii] == $('rank'+i).value) {
	        newOpt.setProperty('selected','selected');
	      }
	    }
	  }
	  isel.inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('Address 1:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('address1'+i)) { vv = $('address1'+i).value; }
	  new Element('input').setProperties({'name':'address1['+i+']', 'type':'text', 'class':'sff '+ms+'1 req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('<span class="optional">*<\/span> Address 2:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('address2'+i)) { vv = $('address2'+i).value; }
	  new Element('input').setProperties({'name':'address2['+i+']', 'type':'text', 'class':'sff '+ms+'2', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('City:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('city'+i)) { vv = $('city'+i).value; }
	  new Element('input').setProperties({'name':'city['+i+']', 'type':'text', 'class':'sff '+ms+'3 req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);
	  
	  itr  = new Element('tr');
	  new Element('th').setHTML('State:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('state'+i)) { vv = $('state'+i).value; }
	  isel = new Element('select').setProperties({'name':'state['+i+']', 'class':'sff '+ms+'4 req', 'autocomplete':'off'});
	  new Element('option').setProperties({'value':''}).setHTML('-please select-').inject(isel);
	  states = new Array(
	  'AL@Alabama',
	  'AK@Alaska',
	  'AR@Arkansas',
	  'AZ@Arizona',
	  'CA@California',
	  'CO@Colorado',
	  'CT@Connecticut',
	  'DE@Delaware',
	  'DC@District of Columbia',
	  'FL@Florida',
	  'GA@Georgia',
	  'HI@Hawaii',
	  'ID@Idaho',
	  'IL@Illinois',
	  'IN@Indiana',
	  'IA@Iowa',
	  'KS@Kansas',
	  'KY@Kentucky',
	  'LA@Louisiana',
	  'ME@Maine',
	  'MD@Maryland',
	  'MA@Massachusetts',
	  'MI@Michigan',
	  'MN@Minnesota',
	  'MS@Mississippi',
	  'MO@Missouri',
	  'MT@Montana',
	  'NC@North Carolina',
	  'ND@North Dakota',
	  'NE@Nebraska',
	  'NH@New Hampshire',
	  'NJ@New Jersey',
	  'NM@New Mexico',
	  'NV@Nevada',
	  'NY@New York',
	  'OH@Ohio',
	  'OK@Oklahoma',
	  'OR@Oregon',
	  'PA@Pennsylvania',
	  'RI@Rhode Island',
	  'SC@South Carolina',
	  'SD@South Dakota',
	  'TN@Tennessee',
	  'TX@Texas',
	  'UT@Utah',
	  'VT@Vermont',
	  'VA@Virginia',
	  'WA@Washington',
	  'WV@West Virginia',
	  'WI@Wisconsin',
	  'WY@Wyoming'
	  );
	  for (ii=0; ii<(states.length-1); ii++) {
	    istate = states[ii].split("@");
	    vstate = new Element('option').setProperties({'value':istate[0]}).setHTML(istate[1]).inject(isel);
	    if ($('state'+i)) {
	      if (istate[0] == $('state'+i).value) {
	        vstate.setProperty('selected','selected');
	      }
	    }
	  }
	  isel.inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('Zip:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('zip'+i)) { vv = $('zip'+i).value; }
	  new Element('input').setProperties({'name':'zip['+i+']', 'type':'text', 'class':'sff '+ms+'5 req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  itr  = new Element('tr');
	  new Element('th').setHTML('Phone:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('phone'+i)) { vv = $('phone'+i).value; }
	  new Element('input').setProperties({'name':'phone['+i+']', 'type':'text', 'class':'sff req', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);
	  
	  itr  = new Element('tr');
	  new Element('th').setHTML('Email:').inject(itr);
	  itd = new Element('td');
	  vv = ""; if ($('email'+i)) { vv = $('email'+i).value; }
	  new Element('input').setProperties({'name':'email['+i+']', 'type':'text', 'class':'sff req emaila', 'autocomplete':'off', 'value':vv}).inject(itd);
	  itd.inject(itr);
	  itr.inject(itbl);

	  if ((i == 1) && (tSeats > 1) && (!window.ie7)) {
	    itr  = new Element('tr');
	    new Element('th').setHTML('&nbsp;').inject(itr);
	    itd = new Element('td');
	    new Element('input').setProperties({'type':'button', 'value':'Apply address to all seats and billing'}).addEvent('click',function(){ applyAddAll(); }).inject(itd);
	    itd.inject(itr);
	    itr.inject(itbl);
	  }
	  
	  itbl.inject(ifs);
	  if (window.ie7) { // IE 7 can't handle table injection into DOM
	    $('seat_form').setHTML($('seat_form').innerHTML+'<fieldset class="fs">'+ifs.innerHTML+'</fieldset>');
	  }
	  else {
	    ifs.inject($('seat_form'));
	  }
	  i++;
	}
	
    $('seat_form').setStyle('display','block');
    $('bill_form').setStyle('display','block');
    $('terms_form').setStyle('display','block');
  }
  else {
    $('seat_form').setStyle('display','none');
    $('bill_form').setStyle('display','none');
    $('terms_form').setStyle('display','none');
  }
}

function applyAddAll() {
  $$('input.m1').each(function(itemA){
    $$('input.s1').each(function(itemB){
      itemB.value = itemA.value;
    });
  });
  $$('input.m2').each(function(itemA){
    $$('input.s2').each(function(itemB){
      itemB.value = itemA.value;
    });
  });
  $$('input.m3').each(function(itemA){
    $$('input.s3').each(function(itemB){
      itemB.value = itemA.value;
    });
  });
  $$('select.m4').each(function(itemA){
    $$('select.s4').each(function(itemB){
      itemB.value = itemA.value;
    });
  });
  $$('input.m5').each(function(itemA){
    $$('input.s5').each(function(itemB){
      itemB.value = itemA.value;
    });
  });
}

function chkSform() {
  error = false;
  $$('.req').each(function(item){
    if ((!error) && (item.value == "")) {
      error = true;
      alert("Please enter all required information before completing registration.");
      item.focus();
      return false;
    }
  });
  
  if (!error) {
    $$('input.emaila').each(function(item){
      if ((!error) && (item.value.indexOf('@') <= 0)) {
        error = true;
        alert("Please enter a valid email address for all reservations/seats.");
        item.focus();
        item.select();
        return false;
      }
    });
  }

  if (!error) {
    if (!$('terms').checked) {
      alert("Please check that you agree to the Terms/Agreement.");
      $('terms').focus();
      return false;
    }
    else {
      $('subtn').value = "Processing...";
      $('subtn').disabled = true;
      return true;
    }
  }
  else {
    return false;
  }
}

function approveSeats(confId,ilink) {
  var cc = confirm("This will add the necessary seats to this registration's Team Leader, confirm the reservations with the registraint(s) and send the postcard tickets.\n\nDo you wish to proceed?");
  if (cc) {
    window.location = ilink+"&action=confirmSeats&confId="+confId;
  }
}

function chkSeats() {
  ff = eval("document.sForm");
  if (ff.total_seats.value == "") {
    alert("Please select the number of seats you wish to reserve.");
    ff.total_seats.focus();
    return false;
  }
  else {
    ff.subtn.disabled = true;
    return true;
  }
}
