function loadArray(item, firstlevel)
{
	var a = new Array('Test', 'Bye', 'Yes');	
}
function mouseOver(controlID)
{
	document.getElementById(controlID).style.backgroundColor = '#f1efe2';
	document.getElementById(controlID).style.color = 'DarkBlue';
}
function mouseLeave(controlID)
{
	document.getElementById(controlID).style.backgroundColor = '#033599';
	document.getElementById(controlID).style.color = 'White';						
}
function framePrint( whichFr )
{
	parent.window.frames[whichFr].focus();	
	parent.window.frames[whichFr].print();
	
	
}
function showArchive( year )
{
	
		if (document.getElementById(year).style.display=='block')
		{
			document.getElementById(year).style.display='none';			
		}
		else 
		{			
			document.getElementById(year).style.display='block';						
		}
		
	
}

function printVer( pageid, type, url )
{
	var path;
	if(type == 0) path="getpage.aspx?print=1&id="+pageid;
	if(type == 1) path=url+"?print=1&id="+pageid;
	window.open(path);
		
}

function printPage( whichPage )
{
	window.print();	
	
}

function goTo(controlID)
{
	
	if(document.all)
	{
		switch(controlID)
	{
		case 1:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(1,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 2:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(2,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 3:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(3,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 4:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(4,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 5:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(5,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 6:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(6,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		case 7:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(7,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		case 8:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(8,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		case 9:
		document.getElementById('heading').innerHTML="<img src='fora/images/btnHome.gif' height=22 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnPrint.gif' height=22 border=0 style='CURSOR: hand' onclick=javascript:printVer(9,0,'');>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnRegister.gif' height=22 onclick='openCFP()' border=0 style='CURSOR: hand'>&nbsp;";
		document.getElementById('heading').innerHTML+="<img src='fora/images/btnForum.gif' height=22 onclick='openWindow(0)' border=0 style='CURSOR: hand'>&nbsp;";
		break;
		
	}
		
		//document.getElementById('heading').style.visibility = 'visible';	
		//document.getElementById('heading').innerHTML="<img src='images/homeCage.gif' height=20 border=0 style='CURSOR: hand' onclick=parent.window.frames[0].location='sitemap.aspx';>";
		//document.getElementById('heading').innerHTML+="<img src='images/printCage.gif' border=0 style='CURSOR: hand' alt='Print this page' onclick=alert();>";
		//document.getElementById('heading').innerHTML+="<img src='images/regCage.gif' onclick='openCFP()' alt='Register as NEW Forum Member' border=0 style='CURSOR: hand'>";
			
		parent.window.frames[0].location = "getpage.aspx?id="+controlID;
	}
						
}
function writeHeading(pageName)
{
	document.Form1.heading.innerHTML=pageName;
}
function openCFP()
{
	var fn = 'register.aspx?radio=0';
	window.open(fn, '', 'width=1020,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,left=10,top=10');
}
function openReg( option )
{
	var opt = option;
	var fn = 'register.aspx?radio='+opt;
	window.open(fn, '', 'width=1000,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,left=10,top=10');
}

function setFocus( control )
{
	document.getElementById(control).focus();
}
function showBtn()
{
	if(document.Form1.btnClient.style.width = '0')
	{
		document.Form1.btnClient.style.width = '100';	
	}					
}
function showEBtn()
{
	if(document.Form1.btnClient.style.width = '100')
	{
		document.Form1.btnClient.style.width = '0';
		document.Form1.btnEmail.style.width = '100';
	}
}
function showProposals( index )
{
	switch(index)
	{
		case 2:
			var code = document.Form1.txtAssoCode.value;
			var url = 'proposals.aspx?assocode='+code;
				
			if(code == '' || code.match("<!--") || code.match("<!-") || code.match("<!") || code.match("<"))
			{
				alert('You must enter a valid Association Code that the CAGE System assigned you when you registered the first time. If you did NOT register with CAGE, please register to proceed. If you need any assistance please phone our Call Centre at +27(0)12 664 9419 or email us at info@cage.org.za.');
				document.Form1.txtAssoCode.value = '';
				document.Form1.txtAssoCode.focus();
				
			}
			else
			{
				window.location.href=url;
			}	
		break;
		case 3:
			var email = document.Form1.txtEmailReturn.value;
			var url = 'proposals.aspx?email='+email;
				
			if(email == '' || email.match("<!--") || email.match("<!-") || email.match("<!") || email.match("<"))
			{
				alert('You must enter a valid Email Address.');
				document.Form1.txtEmailReturn.value = '';
				document.Form1.txtEmailReturn.focus();
				
			}
			else
			{
				window.location.href=url;
			}	
		break;
		case 4:
			var email = document.Form1.txtEmailLogin.value;
			var assoc = document.Form1.txtAssoC.value;
			var url = 'users_update.aspx?email='+email+'&assocode='+assoc;
			var valid = 2;
			if(email == '' || email.match("<!--") || email.match("<!-") || email.match("<!") || email.match("<"))
			{
				alert('You must enter a valid Email Address to log in.');
				document.Form1.txtEmailLogin.value = '';
				document.Form1.txtEmailLogin.focus();
				valid--;
			}			
			if(assoc == '' || assoc.match("<!--") || assoc.match("<!-") || assoc.match("<!") || assoc.match("<"))
			{
				alert('You must enter a valid Association Code to log in.');
				document.Form1.txtAssoC.value = '';
				document.Form1.txtAssoC.focus();
				valid--;
			}
			if(valid == 2)
			{
				window.location.href=url;
			}
		break;
		case 5:
			var email = document.Form1.txtEmailLogin.value;
			var assoc = document.Form1.txtAssoC.value;
			var url = 'login.aspx?email='+email+'&assocode='+assoc;
			var valid = 2;
			if(email == '' || email.match("<!--") || email.match("<!-") || email.match("<!") || email.match("<"))
			{
				alert('You must enter a valid Email Address to log in.');
				document.Form1.txtEmailLogin.value = '';
				document.Form1.txtEmailLogin.focus();
				valid--;
			}			
			if(assoc == '' || assoc.match("<!--") || assoc.match("<!-") || assoc.match("<!") || assoc.match("<"))
			{
				alert('You must enter a valid Association Code to log in.');
				document.Form1.txtAssoC.value = '';
				document.Form1.txtAssoC.focus();
				valid--;
			}
			if(valid == 2)
			{
				window.location.href=url;
			}
		break;
		case 6:
			var email = document.Form1.txtEmailReturn.value;			
			var url = 'login.aspx?email='+email+'&emailReq=true';
			var valid = 2;
			if(email == '' || email.match("<!--") || email.match("<!-") || email.match("<!") || email.match("<"))
			{
				alert('You must enter a valid Email Address.');
				document.Form1.txtEmailReturn.value = '';
				document.Form1.txtEmailReturn.focus();
				
			}
			else
			{
				window.location.href=url;
			}	
		break;
	}
	
	
}
function txtCounter(field, max)
{
	if(field.value.length > max)
	{
		alert('You have exceeded the maximum of 160 characters allowed for this field.');
		field.value = field.value.substring(0, max);
	}					
}

function max( control )
{
	var max = 160;	
	if(document.getElementById(control).value.length > max)
	{
		alert('You have exceeded the maximum of 160 characters allowed for this field.');
		document.getElementById(control).value = document.getElementById(control).value.substring(0, max);
	}				
	
}

function ReturnHistory()
{
	if(document.all)
	{
		if(history.length == 0)
		{
			window.close();
		}
		else if(history.length != 0)
		{
			history.back();
										
		}
	}
}	

function openDelete( entryId, page )
{
	var leftPos = 0;
	var topPos = 0;
	var url = "/fora/forum/Delete.aspx?entryId="+entryId+"&page="+page;
	if (screen)
	{
		leftPos = (screen.width / 2) - 251;
		topPos = (screen.height / 2) - 162;
	}
	window.open(url,'','width=502,height=325,left='+leftPos+',top='+topPos);	

}

function openWindow( winID )
{
	switch(winID)
	{
		case 0:
		window.open('/fora/ForumTopics.aspx?auth=0', '', 'width=1020,height=600,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,left=width/2,top=height/2');
		break;
		
		
	}
	
}
var img = new Image;
var clicked = 0;
function SwapImage( n, id )
{
	if(clicked == 0)
	{
		if(n == 0) img.src='/images/tabBlue1.gif';
		if(n == 1) img.src='/images/tabBlueLight1.gif';										
		document.getElementById(id).style.backgroundImage="url("+img.src+")";
		document.getElementById(id).style.cursor='hand';
	}					
	
}
function ClickChange( id )
{
	clicked = 1;
	img.src='/images/tabBlueLight1.gif';
	window.location.href='focusareas.aspx?tab='+id;
}
function ResetClick()
{
	clicked = 0;
}



