// ===================================================================
// Company: Attendee Interactive
// Author: Jason Daiger
// Website: http://www.attendeeinteractive.com/
// Description: This file contains generic global javascript functions
//	used by the ai-evolution system.
// 	
// NOTIC: You may *NOT* re-distribute this code in any way.
// That means, you cannot include it in your product, or your web
// site, or any other form where the code is actually being used. You
// may not put the plain javascript up on your site for download or
// include it in your javascript libraries for download. 
// ===================================================================
var submitting = 0;
function submitForm( formName ) {
    if( submitting == 0 ) {
        submitting = 1;
        document.getElementById(formName).submit();
    }
}

function openAIEditWindow(url, windowID) {
	var aWindow;
   aWindow = window.open(url, windowID, "top=10,left=10,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500");
   aWindow.focus();
}
function openAIPreviewWindow(url, windowID) {
	var aWindow;
   aWindow = window.open(url, windowID, "top=15,left=15,toolbar=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=500");
   aWindow.focus();
}
function redirectAIPage(url) {
	document.location.href = url;
}
function checkLength(formElement,maxLength) {
   //Find the desired element.
   if (document.getElementById(formElement).value.length > maxLength) {
      document.getElementById(formElement).value = document.getElementById(formElement).value.substring(0,maxLength - 1);
      alert("The entered text exceeds the allowable limit.  Only " + maxLength + " characters are allowed.  You must shorten this text before it can be saved.");
      return false;
   }
   else
      return true;
}

function openAINewWindow(url, windowID) {
	var aWindow;
   aWindow = window.open(url, windowID, "status=1,location=1,menubar=1,directories=1,resizable=1,scrollbars=1,top=15,left=15,width=800,height=600");
   aWindow.focus();
}