<!--function transitionToggle(id,p,d,h,to){		var el = document.getElementById(id);		var from = parseFloat(el.offsetHeight);		if(isNaN(from)) from = 0;				var delta = to - from;		if(delta == 0){				return false; // nothing to animate		}				function easeit(x){			return 1 + Math.pow(x - 1, 3);		}		var op = p == 'opacity';		function fn(ease){				var to = from + ease * delta;				if (op) {					var o = to;					var s = el.style;					if(window.ActiveXObject){							s.zoom = 1; // trigger hasLayout							s.filter = (s.filter || '').replace(/\s*alpha\([^\)]*\)/gi, '') +	(o == 1 ? '' : ' alpha(opacity=' + (o * 100) + ')');					}else{							s.opacity = o;					}				} else {					el.style[p] = to + 'px'; // default unit is px				}		}		d *= 1000; // convert to milliseconds	var begin = new Date().getTime(),			end = begin + d,			time,			timer = setInterval(function(){					time = new Date().getTime();					if(time >= end){ // end of animation							clearInterval(timer);							fn(1);							if (h) hide(id);					}else							fn(easeit((time - begin) / d));			}, 10); // 10 ms interval is minimum on webkit}function startAjax() {	var ajaxRequest;  // The variable that makes Ajax possible!	try{		// Opera 8.0+, Firefox, Safari		ajaxRequest = new XMLHttpRequest();	} catch (e){		// Internet Explorer Browsers		try{			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");		} catch (e) {			try{				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");			} catch (e){				// Something went wrong				alert("Please upgrade your browser");				return false;			}		}	}	return ajaxRequest;}function toggleLogin(opt) {	if (opt == "show") {		hide('login');		document.getElementById('login_message').innerHTML='';		hide('login_message');		show('login_selected');				var email = document.getElementById('user');		var pass = document.getElementById('pass');		if (email.value != "") {			pass.focus();		} else {			email.focus();		}	} else {		hide('login_selected');		show('login');	}}//Browser Support Codefunction login(){		var login = startAjax();		var buttons = document.getElementById('mini_login_buttons');	var buttonHTML = document.getElementById('mini_login_buttons').innerHTML;	function toggleLoading() {		if (buttons.innerHTML == buttonHTML) {			buttons.innerHTML = "<img src='img/login_loading.gif' border='0' alt=''>";		} else {			buttons.innerHTML = buttonHTML;		}	}	toggleLoading();	// Create a function that will receive data sent from the server	login.onreadystatechange = function(){		if(login.readyState == 4){		  if (login.responseText == 'fail'){		    toggleLoading();			  document.getElementById("user").value = document.getElementById("user").value;			  document.getElementById("pass").value = "";			  document.getElementById("user").focus();			  show('login_message');			  document.getElementById('login_message').innerHTML = "Your login is invalid, please try again. If you continue to get this message please email <a href='mailto:leadership@cypclub.com'>leadership@cypclub.com</a>.<br>If you lost your password, please use our <a href='members/lost-password'>lost password system</a>.";			} else if (login.responseText.split("|")[0] == "confirm")  {			  var hash = login.responseText.split("|")[1];			  window.location = "/members/confirmation/"+hash;			} else {				transitionToggle('login_selected','opacity',1.5,true,0);				timed = window.setTimeout(function(){					document.getElementById('login').innerHTML = login.responseText;					show('login');					transitionToggle('login','opacity',1,false,1);				},10);			}		}	}	//create the cookie for the email	var cookie_value = document.getElementById("user").value;	var cookie_date = new Date ( );  // current date & time	cookie_date.setTime ( cookie_date.getTime() + 31536000000 );	document.cookie = "email="+cookie_value+";expires="+cookie_date.toGMTString();		var random = Math.floor(Math.random()*11);	var email = encodeURIComponent(document.getElementById("user").value);	var pass = encodeURIComponent(document.getElementById("pass").value);	var action = encodeURIComponent("Login");	var params = "Email="+email+"&Password="+pass+"&Action="+action+"&seed="+random;	login.open("POST", "includes/login.inc.php", true);	login.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	login.send(params); }function Logout(){		var login = startAjax();		// Create a function that will receive data sent from the server	document.getElementById('login').innerHTML = "Logging out...";	login.onreadystatechange = function(){		if(login.readyState == 4){			show('login');			document.getElementById('login_message').innerHTML = "";			show('mini_login_buttons');			hide('mini_login_loading');			document.getElementById("pass").value = "";			document.getElementById('login').innerHTML = login.responseText;		}	}	var random = Math.floor(Math.random()*11);	var action = encodeURIComponent("Logout");	var params = "Action="+action+"&seed="+random;	login.open("POST", "includes/login.inc.php", true);	login.setRequestHeader("Content-type", "application/x-www-form-urlencoded");	login.send(params); }function sendConfirmation(code) {	var http = startAjax();		var confirmation = document.getElementById('confirmation-area');	var oldHTML = confirmation.innerHTML;		confirmation.innerHTML = "Sending...";		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			var responseValues = http.responseText.split("|");			if (responseValues[0] == "sent") {				timed = window.setTimeout(function(){					transitionToggle('conf','height',2,false,0);					transitionToggle('conf','opacity',1.3,false,0);					confirmation.innerHTML = "A confirmation email has been sent to "+responseValues[1];				},1000);			} else {				confirmation.innerHTML = oldHTML;			}		}	}	code = encodeURIComponent(code);	var random = Math.floor(Math.random()*11);	http.open("GET", "confirmation.php?Action=SendConfirmation&Code="+code+"&rand="+random, true);	http.send(null); }function toggleAddGuestButton(el) {	var TotalGuests = document.getElementById('TotalGuests').value;	if (el == 'member_guest_area') {		if (TotalGuests > 0) {			show('guest_buttons');		} else {			hide('guest_buttons');		}	}}function newGuest(el) {	var guest_area = document.getElementById(el);	var TotalGuests = document.getElementById('TotalGuests');	var AvailableRegistrations = document.getElementById('AvailableRegistrations');	if (TotalGuests.value < (AvailableRegistrations.value-1)) {		var NewTotal = (TotalGuests.value -1) + 2;		TotalGuests.value = NewTotal;		var divIdName = "Guest"+NewTotal;		var newdiv = document.createElement('div');		newdiv.setAttribute("id",divIdName);		newdiv.className="GuestRegistration";		newdiv.innerHTML = "<table cellpadding=\"0\" cellspacing=\"0\"><tr><td class=\"label\">First Name:<\/td><td><input type=\"text\" name=\"FirstName[]\" value=\"\"><\/td><\/tr><tr><td class=\"label\">Last Name:<\/td><td><input type=\"text\" name=\"LastName[]\" value=\"\"><\/td><\/tr><tr><td class=\"label\">Email:<\/td><td><input type=\"text\" name=\"Email[]\" value=\"\"><\/td><\/tr><\/table>";		newdiv.innerHTML += "<a href=\"javascript:removeGuest(\'"+divIdName+"\',\'"+el+"\')\" onClick=\"confirm(\'Are you sure you want to remove this guest from your registration?\')\"><img src=\'img/delete_guest.png\' width=\'16\' height=\'16\' border=\'0\' alt=\'[delete]\' class=\'deleteicon\'><\/a>";		guest_area.appendChild(newdiv);				toggleAddGuestButton(el);	}}function removeGuest(divNum,el) {	var d = document.getElementById(el);	var olddiv = document.getElementById(divNum);	d.removeChild(olddiv);	var TotalGuests = document.getElementById('TotalGuests');	var NewTotal = (TotalGuests.value -1);	TotalGuests.value = NewTotal;	toggleAddGuestButton(el);}function displayGuestList(id){	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			Shadowbox.open({					player:     'html',					content:    http.responseText,					height:     450,					width:      400			});		}	}	id = encodeURIComponent(id);	var random = Math.floor(Math.random()*11);	http.open("GET", "events.php?Action=GuestList&EventGroupID="+id+"&rand="+random, true);	http.send(null); }function click(id) {	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			return true;		} else {			return false;		}	}	var random = Math.floor(Math.random()*11);	http.open("GET", "includes/sponsors.php?Action=AddClick&BannerID="+id, true);	http.send(null); }function loadOptions(id,p,ppg) {	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			document.getElementById('options-bottom').innerHTML = http.responseText;			document.getElementById('options-top').innerHTML = http.responseText;		}	}	var albumID = encodeURIComponent(id);	var page = encodeURIComponent(p);	var photos = encodeURIComponent(ppg);	var random = Math.floor(Math.random()*11);	http.open("GET", "photos.php?Action=LoadOptions&AlbumID="+id+"&PhotosPerPage="+photos+"&Page="+page+"&rand="+random, true);	http.send(null); }function loadAlbum(id,p,ppg,loader) {	var http = startAjax();	var height = "";	var Elem = "album-container";	if(document.getElementById) {		var elem = document.getElementById(Elem);	} else if (document.all){		var elem = document.all[Elem];	}	height = elem.offsetHeight;	document.getElementById("album-container").style.height = height+"px";	if (loader) {		document.getElementById('album-container').innerHTML = "<img src='img/loading.gif' id='gallery-loading'>";	}	loadOptions(id,p,ppg);		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4 && http.status == 200){			document.getElementById('album-container').innerHTML = http.responseText;			Shadowbox.init(); Shadowbox.setup(); 			document.getElementById("album-container").style.height = "";		}	}	var albumID = encodeURIComponent(id);	var page = encodeURIComponent(p);	var photos = encodeURIComponent(ppg);	var random = Math.floor(Math.random()*20);	http.open("GET", "photos.php?Action=LoadAlbum&AlbumID="+id+"&PhotosPerPage="+photos+"&Page="+page+"&rand="+random, true);	http.send(null); }function sendMessage(){	var name = document.getElementById("Name");	var email = document.getElementById("Email");	var subject = document.getElementById("Subject");	var message = document.getElementById("Message");		function toggleControls() {		var send_button = document.getElementById("send_button");		if (send_button.disabled) {			send_button.disabled = false;		} else {			send_button.disabled = true;		}		toggleDisplay("send_button_cont");		toggleDisplay("send_loading");	}	toggleControls();		if (name.value == "") {		//show the error div		show('error');		//place error message within this div		document.getElementById("error").innerHTML = "You must provide your full name.";		toggleControls();	} else if (email.value == "") {		//show the error div		show('error');		//place error message within this div		document.getElementById("error").innerHTML = "You must provide a valid email address.";		toggleControls();	} else if (message.value == "") {		//show the error div		show('error');		//place error message within this div		document.getElementById("error").innerHTML = "You left the message blank, please provide a message and try sending again.";		toggleControls();	} else {		var send = startAjax();				// Create a function that will receive data sent from the server		send.onreadystatechange = function(){			if(send.readyState == 4){				if (send.responseText == "invalid email") {					show('error');					//place error message within this div					document.getElementById("error").innerHTML = "You must provide a valid email address.";					toggleControls();				} else if (send.responseText == "sent") {					document.getElementById("columnMiddle").innerHTML = "<div class='headlineback'><h1>Thank you</h1></div>";					document.getElementById("columnMiddle").innerHTML += "<p>Your message has been successfully sent! We will respond to the email address that you provided (<a href='mailto:"+email.value+"'>"+email.value+"</a>) within 24-48 hours.</p>";					document.getElementById("columnMiddle").innerHTML += "<p>If you haven't already done so, please check our <a href='contact/frequently-asked-questions.html'>F.A.Q's</a> to see if your question has already been answered.</p>";				} else {					show('error');					//place error message within this div					document.getElementById("error").innerHTML = "We were unable to send your message at this time, please try again.";					toggleControls();				}			}		}				var random = Math.floor(Math.random()*11);		var action = encodeURIComponent("SendMessage");		var params = "Name="+encodeURIComponent(name.value)+"&Email="+encodeURIComponent(email.value)+"&Subject="+encodeURIComponent(subject.value)+"&Message="+encodeURIComponent(message.value)+"&Action="+action+"&seed="+random;		send.open("POST", "contact-us.php", true);		send.setRequestHeader("Content-type", "application/x-www-form-urlencoded");		send.send(params); 	}}function removeRegistration(id,member,refresh) {	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			if (refresh) {				window.location.reload();			} else {				return true;			}		}	}	var id = encodeURIComponent(id);	var member = encodeURIComponent(member);	var random = Math.floor(Math.random()*11);	http.open("GET", "members.php?Action=CancelRegistration&EventGroupID="+id+"&MemberID="+member+"&rand="+random, true);	http.send(null); }function removeAthleticRegistration(id,member,refresh) {	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			if (refresh) {				window.location.reload();			} else {				return true;			}		}	}	var id = encodeURIComponent(id);	var member = encodeURIComponent(member);	var random = Math.floor(Math.random()*11);	http.open("GET", "members.php?Action=CancelAthleticRegistration&LeagueID="+id+"&MemberID="+member+"&rand="+random, true);	http.send(null); }function cancelRegistration(id,member,type,empty,refresh) {	var confirmMessage = "Are you sure you want to cancel your registration for this "+type+"?\n\nNOTE: Keep in mind that the CYP CLUB enforces a no refund policy on all events and athletics.";		if (type == "event") {		var memberEvents = document.getElementById('member_events');		var element = type+""+id;		if (confirm(confirmMessage)) {			//actually cancel the registration			removeRegistration(id,member,refresh);			//now lets get rid of it in the list unless we are called to refresh//it will not show up on refresh or anything cause it is out of the system			if (!refresh) {				transitionToggle(element,'opacity',2,true,0);				timed = window.setTimeout(function(){					var elem = document.getElementById(element);					document.getElementById('members_area').removeChild(elem);					if (memberEvents.innerHTML == "") {						var newElem = document.createElement('div');						newElem.setAttribute('class','empty_set_error');						newElem.innerHTML = empty;						memberEvents.appendChild(newElem);					}				},2100);			}		}	} else {		var memberAthletics = document.getElementById('member_athletics');		var element = type+""+id;		if (confirm(confirmMessage)) {			//actually cancel the registration			removeAthleticRegistration(id,member,refresh);			//now lets get rid of it in the list unless we are called to refresh//it will not show up on refresh or anything cause it is out of the system			if (!refresh) {				transitionToggle(element,'opacity',2,true,0);				timed = window.setTimeout(function(){					var elem = document.getElementById(element);					document.getElementById('members_area').removeChild(elem);					if (memberAthletics.innerHTML == "") {						var newElem = document.createElement('div');						newElem.setAttribute('class','empty_set_error');						newElem.innerHTML = empty;						memberAthletics.appendChild(newElem);					}				},2100);			}		}	}}function deleteGuestFromRegistration(id) {	var http = startAjax();		// Create a function that will receive data sent from the server	http.onreadystatechange = function(){		if(http.readyState == 4){			return true;		}	}	var id = encodeURIComponent(id);	var random = Math.floor(Math.random()*11);	http.open("GET", "members.php?Action=RemoveGuest&GuestID="+id+"&rand="+random, true);	http.send(null); }function trim(string) {	string = string.replace(/^\s+/,"");	return string.replace(/\s+$/,"");}function deleteGuest(id,name) {	var confirmMessage = "Are you sure you want to remove "+name+" from your registration?\n\nNOTE: Keep in mind that the CYP CLUB enforces a no refund policy on all events and athletics.";		var container = document.getElementById('yourGuestsContainer');	var memberGuests = document.getElementById('memberGuests');	var element = "guest"+id;	if (confirm(confirmMessage)) {		//actually cancel the registration		deleteGuestFromRegistration(id);		//now lets get rid of it in the list //it will not show up on refresh or anything cause it is out of the system		transitionToggle(element,'opacity',2,true,0);		timed = window.setTimeout(function(){			var elem = document.getElementById(element);			document.getElementById('memberGuests').removeChild(elem);			if (trim(memberGuests.innerHTML) == "") {				container.innerHTML = "";			}		},2100);	}}function checkKey(event) {	if (event.keyCode == 27) {		toggleLogin('hide');	}	if (event.keyCode == 13) {		login();	}}//-->