		function seton(img)
			{ img.src = img.src.replace(/\.gif/, "_over.gif"); }
		
		function setoff(img)
			{ img.src = img.src.replace(/\_over.gif/, ".gif"); }
			
		
		function closetab_01()
		{			
			$('mysubmenuarea2').hide();
		}
		
		function showtab_01()
		{			
			$('mysubmenuarea2').show();
		}
		
		function closetab_02()
		{			
			$('mysubmenuarea').hide();
		}
		
		function showtab_02()
		{			
			$('mysubmenuarea').show();
		}
		
		function showarchive_01()
		{			
			$('archive_01').show();
		}
		
		function showdownloads_01()
		{			
			$('downloads_01').show();
		}	
		
		function showscreensaver(pic)
		{
			$('scID').value = pic;
			$('scType').value = "ss";
			html = "<img src='"+ pic +"' border='0'>";
			$('screensaver').update(html);
			$('screensaver').show();
			
			$('mask').show();
			$('popup_screensaver').show();

			hide_drops();
		}
		
		function showwallpaper(pic)
		{

			hide_drops();
			
			$('wcID').value = pic;
			$('wcType').value = "wp";
			html = "<img src='"+ pic +"' width='200' border='0'>";
			$('wallpaper').update(html);
			$('wallpaper').show();
			$('mask').show();
			$('popup_wallpaper').show();
			document.getElementById('mask').style.visibility = 'visible';
			document.getElementById('popup_wallpaper').style.visibility = 'visible';
		}
		
		function showregister()
		{			
			show_drops();
			$('mask').show();
			$('popup_register').show();
			document.getElementById('mask').style.visibility = 'visible';
			document.getElementById('popup_register').style.visibility = 'visible';
		}
		
		function showpic(pic)
		{			

			$('pcID').value = pic;
			$('pcType').value = "eventpic";

			html = "<img src='"+ pic +"' border='0' height=\"280\">";
			$('pics').update(html);
			$('pics').show();
			
			$('mask').show();
			$('popup_pics').show();
		}	
		
		
		function showvids(vidType, vidID)
		{
		
			if(vidType == "youtube"){
				html = "<object width=\"425\" height=\"344\">";
				html += "<param name=\"movie\" value=\"http://www.youtube.com/v/"+vidID+"&hl=en&fs=1\"></param>";
				html += "<param name=\"allowFullScreen\" value=\"true\"></param>";
				html += "<embed src=\"http://www.youtube.com/v/"+vidID+"&hl=en&fs=1\" type=\"application/x-shockwave-flash\" allowfullscreen=\"true\" width=\"425\" height=\"344\"></embed>";
				html += "</object>";
				$('youtubetext').show();
			}
			
			if(vidType == "teaser"){

				html = "";
				//html += "<s cript language=\"javascript\">";
				//html += "if (AC_FL_RunContent == 0) {";
				//html += "alert(\"This page requires AC_RunActiveContent.js.\");";
				//html += "} else {";
				//html += "AC_FL_RunContent('codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0','width', '320','height', '240','src', 'flash_source/fest_movie','quality', 'high','pluginspage', 'http://www.macromedia.com/go/getflashplayer','align', 'middle','play', 'true','loop', 'true','scale', 'showall','wmode', 'window','devicefont', 'false','id', 'fest_movie','bgcolor', '#ffffff','name', 'fest_movie','menu', 'true','allowFullScreen', 'false','allowScriptAccess','sameDomain','movie', 'flash_source/fest_movie','salign', ''); //end AC code";
				//html += "}";
				//html += "< /script>";
				html += "<div style='z-index:20'>";
				html += "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0\" width=\"320\" height=\"240\" id=\"fest_movie\" align=\"middle\">";
				html += "<param name=\"allowScriptAccess\" value=\"sameDomain\" />";
				html += "<param name=\"allowFullScreen\" value=\"false\" />";
				html += "<param name=\"movie\" value=\"flash_source/"+vidID+".swf\" />";
				html += "<param name=\"quality\" value=\"high\" />";
				html += "<param name=\"bgcolor\" value=\"#ffffff\" />";
				html += "<param name=\"wmode\" value=\"transparent\" />";
				html += "<embed src=\"flash_source/"+vidID+".swf\" wmode=\"transparent\" quality=\"high\" bgcolor=\"#000000\" width=\"320\" height=\"240\" name=\"fest_movie\" align=\"middle\" allowScriptAccess=\"sameDomain\" allowFullScreen=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />";
				html += "</object>";
				html += "</div>";

			}
			
			if(vidType == "mpg"){
			
			
			html = "<object id=\"MediaPlayer1\" width=\"310\" height=\"278\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" ";
			html += " codebase=\"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902\" ";
			html += " standby=\"Loading Microsoft Windows Media Player components...\" type=\"application/x-oleobject\"> ";
			html += " <param name=\"FileName\" value=\"flash_source/"+vidID+".wmv\"> ";
			html += "<param name=\"animationatStart\" value=\"false\">";
			html += "<param name=\"transparentatStart\" value=\"true\">";
			html += "<param name=\"autoStart\" value=\"true\">";
			html += "<param name=\"showControls\" value=\"true\">";
			html += "<embed type=\"application/x-mplayer2\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" Name=\"MediaPlayer\" src=\"flash_source/"+vidID+".wmv\" AutoStart=\"true\" ShowStatusBar=\"0\" volume=\"-1\" HEIGHT=\"278\"  WIDTH=\"310\"></embed></object>";
			
			/**/
			html = "<embed src=\"flash_source/"+vidID+".wmv\" width=\"430\" height=\"350\" autostart=\"false\" type=\"movie/mpg\"></ embed >";
			
			}
			
			$('vcID').value = vidID;
			$('vcType').value = vidType;
			$('vids').update(html);
			$('vids').show();
			
			$('mask').show();
			$('popup_vids').show();
		}
		
		
		function showtvads(vidType, vidID)
		{
			$('vcID').value = vidID;
			$('vcType').value = vidType;
			//vidID = vidID.replace(/wmv/gi, "jpg");
			vidID = vidID.replace(/mpg/gi, "jpg");
			vidID = vidID.replace(/\/vids\//gi,"/vids/thumbs/"); 
			var html = "<img src='"+ vidID +"' width='200' border='0'>";
			
			$('vids').update(html);
			$('vids').show();
			
			$('mask').show();
			$('popup_vids').show();
			document.getElementById('mask').style.visibility = 'visible';
			document.getElementById('popup_vids').style.visibility = 'visible';
		}
		
		
	function send2friend(prepend)
	{
			
			if(prepend == "v"){
				var tName = $F('vtName');
				var tEmail = $F('vtEmail');
				var fName = $F('vfName');
				var fEmail = $F('vfEmail');
				var cType = $F('vcType');
				var cID = $F('vcID');
			}else if(prepend == "w"){
				var tName = $F('wtName');
				var tEmail = $F('wtEmail');
				var fName = $F('wfName');
				var fEmail = $F('wfEmail');
				var cType = $F('wcType');
				var cID = $F('wcID');
			}else if(prepend == "r"){
				var tName = $F('rtName');
				var tEmail = $F('rtEmail');
				var fName = $F('rfName');
				var fEmail = $F('rfEmail');
				var cType = $F('rcType');
				var cID = $F('rcID');
			}else if(prepend == "s"){
				var tName = $F('stName');
				var tEmail = $F('stEmail');
				var fName = $F('sfName');
				var fEmail = $F('sfEmail');
				var cType = $F('scType');
				var cID = $F('scID');
			}else if(prepend == "ra"){
				var tName = $F('ratName');
				var tEmail = $F('ratEmail');
				var fName = $F('rafName');
				var fEmail = $F('rafEmail');
				var cType = $F('raType');
				var cID = $F('raID');
			}else if(prepend == "p"){
				var tName = $F('ptName');
				var tEmail = $F('ptEmail');
				var fName = $F('pfName');
				var fEmail = $F('pfEmail');
				var cType = $F('pcType');
				var cID = $F('pcID');
			}
			
		if (checkSend2Friend(fName, fEmail, tName, tEmail))
		{
		var url = '/avatar/inc/send2friend.asp';
		var pars = 'cType=' + cType + '&cID=' + cID + '&tName=' + tName + '&tEmail=' + tEmail + '&fName=' + fName + '&fEmail=' + fEmail;
		
		//location.href = url + '?' + pars;
		
		var myAjax = new Ajax.Request(
			url, 
			{
				method: 'post', 
				parameters: pars, 
				onLoading: $('loader').show(),
				onComplete: function(transport)
					{
					var response = transport.responseText;
					$('loader').hide();
					alerterr(response);
					},
				onFailure: function(){ alerterr('Something went wrong...') }
			} 
		);
		}
	}
		
		function complete_send2friend()
		{
			alerterr('Thank you, your message has been sent.');
		}
		
		
		function download(prepend){
			if(prepend == "v"){
				var cType = $F('vcType');
				var cID = $F('vcID');
			}else if(prepend == "w"){
				var cType = $F('wcType');
				var cID = $F('wcID');
				
				if($('wcSize1').checked){
					var cSize = "1024";	
				}else{
					var cSize = "1280";	
				}
				
			}else if(prepend == "r"){
				var cType = $F('rcType');
				var cID = $F('rcID');
			}else if(prepend == "s"){
				var cType = $F('scType');
				var cID = $F('scID');
			}else if(prepend == "p"){
				var cType = $F('pcType');
				var cID = $F('pcID');
			}else if(prepend == "ra"){
				var cType = $F('raType');
				var cID = $F('raID');
			}
			
			var url = '/avatar/inc/download.asp';
			var pars = 'cType=' + cType + '&cID=' + cID + '&cSize=' + cSize;
			top.location.href = url + '?' + pars;
			//alert(this.href);
			
		}
		
		function download_cell(prepend){
		
			if(prepend == "v"){
				var cType = $F('vcType');
				var cID = $F('vcID');
				var tCell = $F('vtCell');
			}else if(prepend == "w"){
				var cType = $F('wcType');
				var cID = $F('wcID');
				var tCell = $F('wtCell');
			}else if(prepend == "rprim"){
				var cType = $F('rcType');
				var cID = $F('rcID');
				var tName = $F('rfName');
				var tCell = $F('rfCell');
			}else if(prepend == "rref"){
				var cType = $F('rcType');
				var cID = $F('rcID');
				var tName = $F('rtName');
				var tCell = $F('rtCell');
				var fName = $F('rfName');
				var fCell = $F('rfCell');
			}else if(prepend == "smsprim"){
				var cType = $F('smscType');
				var cID = $F('smscID');
				var tName = $F('smsfName');
				var tCell = $F('smsfCell');
			}else if(prepend == "smsref"){
				var cType = $F('smscType');
				var cID = $F('smscID');
				var tName = $F('smstName');
				var tCell = $F('smstCell');
				var fName = $F('smsfName');
				var fCell = $F('smsfCell');
			}
			
			var url = '/avatar/inc/download_sms.asp';
			var pars = 'cType=' + cType + '&cID=' + cID + '&tName=' + tName + '&tCell=' + tCell + '&fName=' + fName + '&fCell=' + fCell;
			
			//location.href = url + '?' + pars;
			
				var myAjax = new Ajax.Request(
					url, 
					{
						method: 'post', 
						parameters: pars, 
						onLoading: $('loader').show(),
						onComplete: function(transport)
							{
							var response = transport.responseText;
							$('loader').hide();
							alerterr(response);
							},
						onFailure: function(){ alerterr('Something went wrong...') }
	
					});
			
		}
		
function Validemail(val) 
{
	var RE1 = /^[A-Za-z0-9_-]+[.A-Za-z0-9_-]*@{1,1}[A-Za-z0-9_-]+[.]{1,1}\w{2,4}/;
	return RE1.test(val);
}	
	
function TestNumerics(val) 
{
	var RE1 = /[\d]+/;
	return RE1.test(val);
}
	
function TestAlphaNumerics(val)
{
	var RE1 = /[A-Za-z ]/;
	return RE1.test(val);
}
		
function checkSend2Friend(yn, ye, fn, fe)
	{
	var errmsg = "";
	if (yn == '' || yn.length == 0 || yn == 'Your Name')
		{ errmsg += 'You need to complete your name.<br>'; }
	else if(TestNumerics(yn.value))
		{ errmsg += 'Make sure your first name does not contain any numerics.<br>'; }
		
	if (ye == '' || ye.length == 0)
		{ errmsg += 'You need to complete your email address.<br>'; }
	else if(!Validemail(ye))
		{ errmsg += 'Make sure you have entered your email address in the correct format xxx@xxx.xx.<br>'; }
	
	if (fn == '' || fn.length == 0 || fn == "Friend's Name")
		{ errmsg += 'You need to complete your friend\'s name.<br>'; }
	else if(TestNumerics(fn))
		{ errmsg += 'Make sure your friend\'s name does not contain any numerics.<br>'; }
	
	if (fe == '' || fe.length == 0)
		{ errmsg += 'You need to complete your friend\'s email address.<br>'; }
	else if(!Validemail(fe))
		{ errmsg += 'Make sure you have entered your friend\'s email address in the correct format xxx@xxx.xx.<br>'; }
	
	
	if(errmsg.length >= 1)
		{
		//alert(errmsg);
		alerterr(errmsg);
		return false;
		} 
	else { return true; }
	}
		
function checkReg(f)
	{
	var errmsg = "";
		
	if (f.firstname.value == '' || f.firstname.value.length == 0)
		{ errmsg += 'You need to complete your first name.<br>'; }
	else if(TestNumerics(f.firstname.value))
		{ errmsg += 'Make sure your first name does not contain any numerics.<br>'; }
		
	if (f.surname.value == '' || f.surname.value.length == 0)
		{ errmsg += 'You need to complete your surname.<br>'; }
	else if(TestNumerics(f.surname.value))
		{ errmsg += 'Make sure your surname does not contain any numerics.<br>'; }
	
	if (f.email.value == '' || f.email.value.length == 0)
		{ errmsg += 'You need to complete your email address.<br>'; }
	else if(!Validemail(f.email.value))
		{ errmsg += 'Make sure you have entered your email address in the correct format xxx@xxx.xx.<br>'; }
	
	if (f.cell.value == '' || f.cell.value.length == 0)
		{ errmsg += 'You need to complete your cell number.<br>'; }
	else if(TestAlphaNumerics(f.cell.value) || f.cell.value.length <= 9 || (f.cell.value.charAt(0) != "0"))
		{ errmsg += 'Make sure you have entered a valid cell number with no spaces.<br>'; }
	
	if (f.dob.value == '' || f.dob.length == 0 || f.dob.value.indexOf("DATE")==0)
		{ errmsg += 'You need to indicate your date of birth.<br>'; }
	
	gender = document.getElementsByName('gender');
	if (!valbutton(gender))
		{ errmsg += 'You need to indicate your gender.<br>'; }
		
	if (f.likeness.selectedIndex == 0)
		{ errmsg += 'Please indicate why you like Coke Zero<br>'; }
	
	if (!f.terms_agree.checked)
		{ errmsg += 'You need to agree to the terms and conditions in order to register.<br>'; }
	
	if(errmsg.length >= 1)
		{
		//alert(errmsg);
		alerterr(errmsg);
		return false;
		} 
	else { return true; }
	}
	
function valbutton(button) 
{
	// place any other field validations that you require here
	// validate myradiobuttons
	myOption = -1;
	for (i=button.length-1; i > -1; i--) 
		{
		if (button[i].checked) 
			{ myOption = i; i = -1; }
		}
	if (myOption == -1) 
		{ return false; } else { return true;}
}

	
function alerterr(msg)
	{
		hide_drops();
		$('errorLyr').hide();
		html  = '<table bgcolor="#e9e9e9" cellpadding="0" cellspacing="0" border="0" width="320" height="320">\n';
		html += '<tr>\n';
		html += '<td width="15" height="25"></td>\n';
		html += '<td width="290" height="25" valign="bottom"><img src="/fest/images/pleasenote.gif" width="100" height="18" alt=""></td>\n';
		html += '<td width="15" height="25"></td>\n';
		html += '</tr>\n';
		html += '<tr>\n';
		html += '<td width="320" height="10" colspan="3"></td>\n';
		html += '</tr>\n';
		html += '<tr>\n';
		html += '<td width="15" height="100"></td>\n';
		html += '<td width="290" height="110" valign="top" style="color:#4f4f4f;font-family:Arial;font-size:11px;">'+msg+'</td>\n';
		html += '<td width="15" height="100"></td>\n';
		html += '</tr>\n';
		html += '<tr>\n';
		html += '<td width="15" height="30"></td>\n';
		html += '<td width="290" height="30" align="right" valign="top"><a href="javascript://" onclick="$(\'errorLyr\').hide();show_drops()"><img src="/fest/images/error_close.gif" width="50" height="18" alt="" border="0"></a></td>\n';
		html += '<td width="15" height="30"></td>\n';
		html += '</tr>\n';
		html += '</table>\n';		
			$('errorLyr').update(html);
		$('errorLyr').show();
		
	}


/* Ajax functions for registration */

	function doRegister(f)
	{
		if (checkReg(f))
		{
			var firstname = $F('firstname');
			var surname = $F('surname');
			var cell = $F('cell');
			var email = $F('email');
			var dob = $F('dob');
	
			if ($('gender_M').checked)
			{
				var gender = 'M';
			} else {
				var gender = 'F'
			}	
	
			var like = $('likeness').options[$('likeness').selectedIndex].value;
			like = like.replace(/\s/gi, '_');
			dob = dob.replace(/\//gi, '-');
			if ($('consent_cc').checked)
			{
				var consent_cc = "Y";
			}
			else
			{
				var consent_cc = "N";
			}
			
			if ($('terms_agree').checked)
			{
				var terms_agree = "Y";
			}
			else
			{
				var terms_agree = "N";
			}
			
			var url = '/generic/register.asp';
			var pars = 'firstname=' + firstname + '&surname=' + surname + '&cell=' + cell + '&email='+email+'&dob='+dob+'&gender='+ gender+'&like='+ like+"&consent_cc="+consent_cc+"&terms_agree="+terms_agree;	
	
		//location.href = url + '?' + pars;
			var myAjax = new Ajax.Request(
				url, 
				{
					method: 'post', 
					parameters: pars, 
					onLoading: $('loader').show(),
					onComplete: function(transport)
						{
						var response = transport.responseText;
						$('loader').hide();
						alerterr(response);
						},
					onFailure: function(){ alerterr('Something went wrong...') }
				}
			);
		}
	}

	function completeReg(response)
	{
		alerterr(response.responseText);
		$('popup_register').hide();
		$('mask').hide();
	}
	
	
	function hide_drops()
	{
		
		var f = $$('select');
		var s = '';
		for(var i=0; i<f.length; i++){
			f[i].style.display='';
		}
		
	}	
	
	function show_drops()
	{
		
		var f = $$('select');
		var s = '';
		for(var i=0; i<f.length; i++){
			f[i].style.display='inline';
		}
		
	}
	
	function navon(img)
		{ 
		if(img.longdesc != "on")
			{img.src = img.src.replace(/\.gif/, "_over.gif");}
		}
	
	function navoff(img)
		{ 
		if(img.longdesc != "on")
			{img.src = img.src.replace(/\_over.gif/, ".gif"); }
		}
	

