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 PreLoadImg()
{
    MM_preloadImages("images/but_home2.gif","images/but_player2.gif","images/but_tournaments2.gif","images/but_golfie2.gif","images/but_scrapbook2.gif","images/but_contact2.gif","images/but_feed2.gif");
}

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) { //v3.0
  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); 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];}
}

// empty arrays for preloading images
var arrPreloadImages = new Array();

// image preload example: fill in this array and the contents will be preloaded during body onload event
arrPreloadImages[arrPreloadImages.length] = "images/spacer.gif";

function doSomething(e)
{
    var posx = 0;
    var posy = 0;
    if (!e) var e = window.event;
    if (e.pageX || e.pageY)
    {
        posx = e.pageX;
        posy = e.pageY;
    } else if (e.clientX || e.clientY)
    {
        posx = e.clientX;
        posy = e.clientY;
    }

    if(typeof window.document.nav != 'undefined'
    && window.document.nav
    &&	typeof window.document.nav.SetVariable != 'undefined'
    ) {


    window.document.nav.SetVariable("_level0.y_position", posy);


    }
}

if (document.layers) {
    window.captureEvents(Event.MOUSEMOVE);
    window.onmousemove=doSomething;
}
else {
   document.onmousemove=doSomething;
}
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 6;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------

function checkContact(form)
{
    var name = form.name;
    var tele = form.tele;
    var email = form.email;
    var email1 = form.email1;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
    
    if(name.value == "") {
        alert('You must enter your name.');
        name.focus();
        return false;
    }
    
    if(tele.value == "") {
        alert('You must enter your contact number.');
        tele.focus();
        return false;
    }
    if(email.value == "") {
        alert('You must enter your email.');
        email.focus();
        return false;
    }
    if(!email.value.match(emailRegex)) {
        alert('You have entered an invalid email.');
        email.focus();
        return false;
    }
    
    if (email1.value != email.value){
        alert("Your email confirmation doesn't match your email.");
        email1.focus();
        return false;
    }
    
    if (document.getElementById('cd').value.length == 0)
    {
        document.getElementById('place').style.display = 'none';
        document.getElementById('empty').style.display = 'block';
        document.getElementById('incorrect').style.display = 'none';
        return false;
    }else{
        document.getElementById('place').style.display = 'block';
        document.getElementById('empty').style.display = 'none';
        document.getElementById('incorrect').style.display = 'none';
    }

    if (document.getElementById('cd').value != document.getElementById('txtChkTru').value)
    {
        document.getElementById('place').style.display = 'none';
        document.getElementById('empty').style.display = 'none';
        document.getElementById('incorrect').style.display = 'block';
        return false;
    }else{
        document.getElementById('place').style.display = 'block';
        document.getElementById('empty').style.display = 'none';
        document.getElementById('incorrect').style.display = 'none';
    }
    return true;
}

function checkLog(form)
{
    var email = form.email;
    var pw = form.pw;
	if (email.value.length == 0)
	{
		alert("Please enter your email address.");
		email.focus();
		return false;
	}
	if (pw.value.length == 0)
	{
		alert("Please enter your password.");
		pw.focus();
		return false;
	}
	return true;
}

function checkReg(form)
{
    var parentName = form.parentName;
    var childName = form.childName;
    var kdi = form.kdi;
    var email = form.email;
    var pw = form.pw;
    var pw1 = form.pw1;
    var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;
	
	if (parentName.value.length == 0)
	{
		alert("Please enter your name.");
		parentName.focus();
		return false;
	}
	if (childName.value.length == 0)
	{
		alert("Please enter the golfer's name.");
		childName.focus();
		return false;
	}
	if (kdi.value.length == 0)
	{
		alert("Please enter the golfer's membership number.");
		kdi.focus();
		return false;
	}
	if (memreg != "true")
	{
		alert("You have entered invalid golfer details.");
		childName.select();
		return false;
	}
	if (email.value.length == 0)
    {
	    alert("Please enter your email address.");
	    email.focus();
	    return false;
    }
    if(!email.value.match(emailRegex))
    {
	    alert("The email address entered was not valid.  Please re-enter your email address.");
	    email.focus();
	    return false;
    }
    if (pw.value.length == 0)
    {
	    alert("Please enter a password.");
	    pw.focus();
	    return false;
    }
    if (pw1.value.length == 0)
    {
	    alert("Please enter a password confirmation.");
	    pw1.focus();
	    return false;
    }
    if (pw.value != pw1.value)
    {
        alert("Your password confirmation doesn't match your password.");
	    pw1.focus();
	    return false;
    }
	return true;
}

var xmlhttp
//GetXmlHttpObject *START*
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
//GetXmlHttpObject *END*

//ChkTru *Start*
function ChkTru(str,strid)
{
if (str.length==0)
  {
  document.getElementById("txtChkTru").value="";
  return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url="LITVI_chktru.asp";
url=url+"?ref="+str;
url=url+"&id="+strid;
xmlhttp.onreadystatechange=stateChanged_chktru;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged_chktru()
{
if (xmlhttp.readyState==4)
  {
  document.getElementById("txtChkTru").value=xmlhttp.responseText;
  }
}
//ChkTru *End*

//checkMem *START*
var memreg;
function checkMem(nm,memnum)
{
    if (nm.length == 0 || memnum.length == 0)
    {
      document.getElementById("MemChk").innerHTML = '<img src="images/invalid.png" alt="Invalid" title="Invalid" border="0" />';
      document.getElementById("memID").value = "";
      memreg = "false";
      return;
    }
    
    xmlhttp=GetXmlHttpObject();
    
    if (xmlhttp==null)
    {
        alert ("Your browser does not support XMLHTTP!");
        return;
    }
    
    var url="checkMem.asp?nm=" + nm + "&memnum=" + memnum;
    xmlhttp.onreadystatechange = function(){
		if (xmlhttp.readyState==4)
		{
			var myresponse = xmlhttp.responseText;
			var values = myresponse.split("|");
			myresult = values[0];
			theID = values[1];
			if (myresult == "TRUE"){
				document.getElementById("MemChk").innerHTML = '<img src="images/valid.png" alt="Valid" title="Valid" border="0" />';
				document.getElementById("memID").value = theID;
				memreg = "true";
			} else {
				document.getElementById("MemChk").innerHTML = '<img src="images/invalid.png" alt="Invalid" title="Invalid" border="0" />';
				document.getElementById("memID").value = "";
				memreg = "false";
			}
			//alert(memreg);
		}
	};
    xmlhttp.open("POST",url,true);
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(url);
}
//checkMemName *END*
