var ContentInfo = "";

var topColor = "#000066"
var subColor = "#ffffff"

var mouse_X;
var mouse_Y;

var tip_active = 0;

function update_tip_pos(){

		document.getElementById('ToolTip').style.left = mouse_X + 15;
		document.getElementById('ToolTip').style.top  = mouse_Y;
}

var ie = document.all?true:false;
if (!ie) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

function getMouseXY(e) {
if (ie) { // grab the x-y pos.s if browser is IE
mouse_X = event.clientX + document.body.scrollLeft;
mouse_Y = event.clientY + document.body.scrollTop;
}
else { // grab the x-y pos.s if browser is NS
mouse_X = e.pageX;
mouse_Y = e.pageY;
}
if (mouse_X < 0){mouse_X = 0;}
if (mouse_Y < 0){mouse_Y = 0;}

if(tip_active){update_tip_pos();}
}

function EnterContent(TTitle, TContent){

ContentInfo = '<table border="0" width="250" cellspacing="0" cellpadding="0">'+
'<tr><td width="100%" bgcolor="#000000">'+

'<table border="0" width="100%" cellspacing="1" cellpadding="0">'+
'<tr><td width="100%" bgcolor='+topColor+'>'+

'<table border="0" width="90%" cellspacing="0" cellpadding="0" align="center">'+
'<tr><td width="100%">'+

'<font class="tooltiptitle">&nbsp;'+TTitle+'</font>'+

'</td></tr>'+
'</table>'+

'</td></tr>'+

'<tr><td width="100%" bgcolor='+subColor+'>'+

'<table border="0" width="90%" cellpadding="0" cellspacing="1" align="center">'+

'<tr><td width="100%">'+

'<font class="tooltipcontent">'+TContent+'</font>'+

'</td></tr>'+
'</table>'+

'</td></tr>'+
'</table>'+

'</td></tr>'+
'</table>';

}


function tip_it(which, TTitle, TContent){

	
	if(which){
	
		update_tip_pos();
	
		tip_active = 1;
		
		document.getElementById('ToolTip').style.visibility = "visible";
		
		EnterContent(TTitle, TContent);
		
		document.getElementById('ToolTip').innerHTML = ContentInfo;
	
	}else{
	
		tip_active = 0;
	
		document.getElementById('ToolTip').style.visibility = "hidden";
	}

}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showPic (whichpic)
{  		document.getElementById("placeholder").src = whichpic.href
		return false
		}		

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


// validation functions
function alertAndFocus(element, alertText) {
	alert(alertText);
	element.focus();	
}
function isEmpty(element, defaultValue, errorAlert) { 
	if ( (element.value == "" ) || (element.value == defaultValue ) ){ 
		alertAndFocus(element,errorAlert); 
		return true;  
	} else {
		return false;  
	}
}
function isNumerical(stringInput, allowedChars) {  
	var decPoints = 0;
	var decCheck = false;    
	
	if (allowedChars.indexOf(".") != -1) {     
		decCheck = true;
	}                 
	for (i = 0;  i < stringInput.length;  i++)  {
		ch = stringInput.charAt(i);            
		if (allowedChars.indexOf(ch) == -1) {    
			return false;
		}             
		if ( (decCheck == true) && (ch == ".") ) {
			decPoints++;
			if (decPoints > 1) {
				return false;
			}
		}         
	}
	return true;
}
function validateEmail(email, defaultText) {	
	if ((email == "") || (email == defaultText)) {
		return false;
	} else {
		eLength = email.length;
		eAt = email.indexOf("@"); 
		eDot = email.lastIndexOf(".");	
		eSpace = email.indexOf(" ");
		
		// if no @ sign, @ is at start or end of email
		if ( (eAt == -1) || (eAt == 0) || (eAt == eLength-1) ) {
			return false;
		} else {
			// if no dot, dot is at start end or next to or less than @
			if ( (eDot == -1) || (eDot == 0) || (eDot == eLength-1) || (eDot <= eAt+1)  )  {
				return false;
			}		
		}
		if (eSpace != -1) {
			return false;	
		}
	}
	return true;
}

function submitForm(formId) {
	if (document.getElementById(formId)) {
		document.getElementById(formId).submit()
	}
}

function openJoinMud() {
	MM_openBrWindow("include_members.asp","","scrollbars=yes,resizable=yes,width=600,height=500");
	return false;
}

function openGuestlistVoucher(url) {
	MM_openBrWindow(url,"","scrollbars=yes,resizable=yes,width=560,height=360");
	return false;
}




