function checklogin()
{
	if (document.login.email.value.length == 0)
	{
		alert("Please enter your username in the space provided.");
		document.login.email.focus();
		return false;
	}
	
	if (document.login.password.value.length == 0)
	{
		alert("Please enter your password in the space provided.");
		document.login.password.focus();
		return false;
	}
	
	return true;
}
function checkregister()
{
    if (document.register.memberas.value.length == 0)
	{
		alert("Please select the membership you wish to be considered for.");
		document.register.memberas.focus();
		return false;
	}
    
    if (document.register.surname.value.length == 0)
	{
		alert("Please enter your lastname in the space provided.");
		document.register.surname.focus();
		return false;
	}
	
	if (document.register.firstname.value.length == 0)
	{
		alert("Please enter your firstname in the space provided.");
		document.register.firstname.focus();
		return false;
	}
	
	if (document.register.region.value.length == 0)
	{
		alert("Please select a region.");
		document.register.region.focus();
		return false;
	}
	if (document.register.gender.value.length == 0)
	{
		alert("Please select your gender.");
		document.register.gender.focus();
		return false;
	}
    
    if (document.register.email.value.length == 0)
	{
		alert("Please enter your email address in the space provided.");
		document.register.email.focus();
		return false;
	}
	
	if ((document.register.email.value).indexOf("@") == -1)
	{
		alert("The email address entered was not valid.  Please re-enter your email address.");
		document.register.email.focus();
		return false;
	}
	
	if (document.register.agreeCodeofConduct.checked == false)
	{
		alert("Please read the IBASA Code of Conduct and check the agreement checkbox.");
		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';
    }
}

function checkfields1()
{
	if (document.contact1.name.value.length == 0)
	{
		alert("Please enter your name in the space provided.");
		document.contact1.name.focus();
		return false;
	}
	
	if (document.contact1.tele.value.length == 0)
	{
		alert("Please enter your contact tel number in the space provided.");
		document.contact1.tele.focus();
		return false;
	}
	
	if (document.contact1.email.value.length == 0)
	{
		alert("Please enter your email address in the space provided.");
		document.contact1.email.focus();
		return false;
	}
	
	if ((document.contact1.email.value).indexOf("@") == -1)
	{
		alert("The email address entered was not valid.  Please re-enter your email address.");
		document.contact1.email.focus();
		return false;
	}
	
	return true;
}

function checkfieldsopp()
{
	if (document.opp.emailopp.value.length == 0)
	{
		alert("Please enter your username in the space provided.");
		document.opp.emailopp.focus();
		return false;
	}
	
	if (document.opp.passwordopp.value.length == 0)
	{
		alert("Please enter your password in the space provided.");
		document.opp.passwordopp.focus();
		return false;
	}
	
	return true;
}

function codeofconductopen()
{
    window.open('codeofconduct.asp','mywindow','status=0,toolbar=0,resizable=0,scrollbars=0,location=0,width=990px,height=873px');
}

// 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;
}

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) { //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];}
}

// -----------------------------------------------------------------------------
// 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;
// -----------------------------------------------------------------------------

var xmlhttp
// AJAX GetXmlHttpObject *START*
function GetXmlHttpObject(){/*code for IE7+, Firefox, Chrome, Opera, Safari*/if (window.XMLHttpRequest){return new XMLHttpRequest();}/*code for IE6, IE5*/if (window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}return null;}
// AJAX GetXmlHttpObject *END*

// AJAX 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.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    xmlhttp.send(url);
}
function stateChanged_chktru()
{if (xmlhttp.readyState==4){document.getElementById("txtChkTru").value=xmlhttp.responseText;}}
// AJAX ChkTru *END*
