var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
// Handle all the the FSCommand messages in a Flash movie
function header_DoFSCommand(command, args) {
  var headerObj = InternetExplorer ? header : document.header;
}
// Hook for Internet Explorer 
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && 
	  navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<SCRIPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('Sub header_FSCommand(ByVal command, ByVal args)\n');
	document.write('  call header_DoFSCommand(command, args)\n');
	document.write('end sub\n');
	document.write('</SCRIPT\> \n');
};
 
function header (headtext) {
window.document.header.SetVariable("header", headtext); 
};

if (top.location != self.location) {
   top.location = self.location};

   function messageOpen(theURL,winName,features) { //Opens new windows for calendar details
  detail=window.open(theURL,winName,features);
   detail.focus();
    
}

function closeMe() {
	opener.location.reload();
	self.close();
}


extArray = new Array(".jpg", ".png", ".gif"); 

function LimitAttach(form, file) { 
if (!file) 
{
alert("Please select a file to upload!"); 
return false; 
}
while (file.indexOf("\\") != -1) 
file = file.slice(file.indexOf("\\") + 1); 
ext = file.slice(file.indexOf(".")).toLowerCase(); 
for (var i = 0; i < extArray.length; i++) { 
if (extArray[i] == ext) { return true; } 
} 
alert("Please only upload files that end in types: " 
+ (extArray.join(" ")) + "\n\nPlease select a new " 
+ "file to upload and submit again."); 
return false;
} 

function register() {
	opener.document.location="register.jsp";
	self.close();
}

function login() {
	opener.document.location="login.jsp";
	self.close();
}

function openURLAndCloseSelf(url) {
	opener.document.location=url;
	self.close();
}

function checkEventFees(form)
{
var fees = form.fees.value;
if(fees > 0)
{
form.regReq.checked=true;
}
return true;
}

function changeURL(url) {
	this.document.location=url;
}

function resizePopup() {
Ey=screen.height;
Ex=screen.width;
//alert("screen.width"+screen.width);
//alert("window.width"+ window.width);


//tx=(window.width)+40;
//ty=(window.height)+120;
//alert("tx"+ tx);
//if (navigator.appName=='Microsoft Internet Explorer')
//{
//var tx=tx+16;
//var ty=ty+32
//};
//if (tx>(Ex-40)) tx=(Ex-40);
//if (ty>(Ey-40)) ty=(Ey-40);
//window.resizeTo(tx,ty);
px=((Ex-500)/2);
py=((Ey-500)/2);
window.moveTo(px,py);
}

function firstFocus()
{
   if (document.forms.length > 0)
   {
      var TForm = document.forms[0];
      for (i=0;i<TForm.length;i++)
      {
         if ((TForm.elements[i].type=="text")||
           (TForm.elements[i].type=="textarea")||
			  (TForm.elements[i].type=="password"))
         {
            document.forms[0].elements[i].focus();
            break;
         }
      }
   }
}


var _editor_url = "/htmlarea/";                     // URL to htmlarea files
//alert( navigator.appVersion);
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }


if (win_ie_ver >= 5.5) {
//alert( win_ie_ver);
var functionDeclaration='<script type="text/JavaScript" src="' +_editor_url+ 'editor.js"></script>';
//alert( functionDeclaration);
document.write(functionDeclaration);
} else { document.write('<script>function editor_generate() { return false; }</script>'); }


function textLimit(field, maxlen) {
	if (field.value.length > maxlen) {
		field.value = field.value.substring(0, maxlen);
		alert('your input has been truncated!');
	}
}  
