/* This javascript file is build for www.teamperformanceexchange.nl
 * @version 27-06-2011
 * @author Jeroen de Jong / deJong-IT
 * http://www.dejong-it.nl
 */

	// Add Google Analytics
	var _gaq = _gaq || [];
	_gaq.push(['_setAccount', 'UA-11212836-4']);
	_gaq.push(['_trackPageview']);

	(function() {
		var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
		ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
		var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
	})();
	

jQuery(function($) {

	// Is there a logonbox?
	if ($('#loginform').length > 0) {
		checklogonbox();
	}

	fixhover();

});

function fixhover() {
	$('.hvr').hover(
		function () {
			$(this).addClass('ui-widget-content');
			$(this).find('.name').addClass('ui-state-hover');
		},
		function () {
			$(this).removeClass('ui-widget-content');
			$(this).find('.name').removeClass('ui-state-hover');
		}
	);

	$('ul.sidemenu li,.ui-button,.eventcontent').hover(
		function () {
			$(this).addClass('ui-state-hover');
		},
		function () {
			$(this).removeClass('ui-state-hover');
		}
	);

	$('.sponsorphoto').hover(
		function () {
			$(this).addClass('ui-widget-content');
		},
		function () {
			$(this).removeClass('ui-widget-content');
		}
	);

	$('.QReport td').hover(
		function () {
			$(this).addClass('ui-state-hover');
		},
		function () {
			$(this).removeClass('ui-state-hover');
		}
	);

}

function lostpasswordx(msg) {
	if (confirm(msg)) {
		$('#lostpassword').val(1);
		SubmitForm('#loginform','#sidebar','logon.php');
	}

	return false;
}

function checklogonbox() {
	// Can't remember password if you don't remember email
	$('input[name=rememberpassword]').attr('disabled', !$('input[name=rememberemail]').is(':checked'));
	if ($('input[name=rememberpassword]').is(':disabled')) {
		$('input[name=rememberpassword]').attr('checked', false);
	}

	// Can't autologon if you don't remember password
	$('input[name=rememberlogin]').attr('disabled', !$('input[name=rememberpassword]').is(':checked'));
	if ($('input[name=rememberlogin]').is(':disabled')) {
		$('input[name=rememberlogin]').attr('checked', false);
	}
}

function SubmitForm(form,resultid,page) {
	$.post(page, $(form).serialize(), function(data) {
		$(resultid).html(data);
	});

	return false;
}

