var loadingimage = '<img src="/includes/images/app/wait.gif">';
var current = "";

function locationReplace(url) {
        if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
                var referLink = document.createElement('a');
                referLink.href = url;
                document.body.appendChild(referLink);
                referLink.click();
        } else {
                location.href = url;
        }
}


function showSubNav(navId, link){
  var reveal = $(navId);
  
  $('#menuTabs li').removeClass('selected');
  $(link).addClass('selected');
  
  reveal.animate({
    opacity: "show"
  });
  
  if (current != navId) {
    var hide = $(current);
    hide.css({
      display: "none"
    });
    current = navId;
  }
}

function Isie6(){
  var agent = navigator.userAgent;
  str = "MSIE";
  if ((i = agent.indexOf(str)) >= 0) {
    this.isIE = true;
    if (parseFloat(agent.substr(i + str.length)) == 6) {
      return true;
    }
    else {
      return false;
    }
  }
	return false;
	
}

function msg(msgClass, message){
  var msgTxt = '';
  msgTxt += '<div class="' + msgClass + '">';
  msgTxt += '<p style="float:right;"><a href="javascript:void(0);" onclick="hideMsgBox();"><img src="/includes/images/app/bullet_toggle_plus.png" height="16" width="16" /></a></p>';
  msgTxt += '<p class="cbox_messagebox">' + message + '</p>';
  msgTxt += '</div>';
  
  $('.cbox_messagebox_info, .cbox_messagebox_warning, .cbox_messagebox_error').remove();
  $('#content2').prepend(msgTxt);
}

function hideMsgBox(){
  $(".cbox_messagebox_info, .cbox_messagebox_warning, .cbox_messagebox_error").hide("slow");
}

function createCals(){
  // df is set above the first createCals call 
  // in Layout.Main.cfm and Layout.CMSPage.cfm
  $('input.imadate').datepicker({

    buttonImageOnly: true
  });
}

$.fn.check = function(){
  return this.each(function(){
    this.checked = true;
  });
};

function getCaptcha(){
  var url = "/index.cfm?event=ehCaptcha.getCaptcha" + '&r=' + Math.floor(Math.random()*10000000000000000);
  $('#cap').load(url);
}
