// jQuery.noConflict(); // this has been commentated by Thomas because of the new menu (megamenu)

jQuery(function($) { 

// DROP DOWN MENU
	// http://users.tpg.com.au/j_birch/plugins/superfish/#getting-started
	// http://users.tpg.com.au/j_birch/plugins/superfish/#options
	$(".sf-menu").supersubs({ 
			minWidth:    10,   // minimum width of sub-menus in em units 
			maxWidth:    27,   // maximum width of sub-menus in em units 
			extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
							   // due to slight rounding differences and font-family 
		}).superfish({
			dropShadows:    false,
			delay:			400
			
							}); // call supersubs first, then superfish, so that subs are 
                         		// not display:none when measuring. Call before initialising 
                         		// containing tabs for same reason. 

	
	// Scroll to top animation
	$('.scroll-top').click(function(){ 
		$('html, body').animate({scrollTop:0}, 600); return false; 
	});
	
	// Scroll to steps animation at registration
	$('.scroll-step2').click(function(){
		$('html, body').animate({scrollTop:$("#step2").offset().top}, 600);
	});
	$('.scroll-step3').click(function(){
		$('html, body').animate({scrollTop:$("#step3").offset().top}, 600);
	});
	$('.scroll-step4').click(function(){
		$('html, body').animate({scrollTop:$("#step4").offset().top}, 600);
	});
	$('.scroll-step5').click(function(){
		$('html, body').animate({scrollTop:$("#step5").offset().top}, 600);
	});
	
	
	// Hide parent on click (error messages, etc...)
	$('a.hideparent').click(function(){ 
		$(this).parent().fadeOut();
		return false;
	});

	// Lightbox setup
	// Ex: open any link <a href="large.jpg" />...
	$('a[href$="jpg"], a[href$="jpeg"], a[href$="png"], a[href$="gif"]').fancybox();
	
	$(".extLinkSmall").fancybox({
		 'width' 			: 400,
		 'height' 			: 225,
		 'autoScale' 		: false,
		 'transitionIn' 	: 'none',
		 'transitionOut' 	: 'none',
		 'title'			: this.title,
		 'type' 			: 'iframe'
	 });
	
	$(".extLinkLarge").fancybox({
		 'width' 			: 660,
		 'height' 			: 380,
		 'autoScale' 		: false,
		 'transitionIn' 	: 'none',
		 'transitionOut'	: 'none',
		 /*title'			: this.title,*/
		 'type' 			: 'iframe'
	 });
 

	// Vimeo Popup - Large
	$(".vimeo-popup-large").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 600,
			'height'		: 340,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});
		return false;
	});
	
	// Vimeo Popup - Regula Size
	$(".vimeo-popup").click(function() {
		$.fancybox({
			'padding'		: 0,
			'autoScale'		: false,
			'transitionIn'	: 'none',
			'transitionOut'	: 'none',
			'title'			: this.title,
			'width'			: 400,
			'height'		: 225,
			'href'			: this.href.replace(new RegExp("([0-9])","i"),'moogaloop.swf?clip_id=$1'),
			'type'			: 'swf'
		});
		return false;
	});

	// Default Modal box
	$(".modal-box").fancybox({
		'modal' : true
	});
		

	// login form validation
		var hasCheckedLoginData = false;
		$(".loginData #submit").click(function () { 
			hasCheckedLoginData = true;
			return checkFormLoginData();
		});
		$(".loginData #email,.loginData #password").live('change click', function(){
			if(hasCheckedLoginData == true)
			{
				return checkFormLoginData();
			}
		});

		function checkFormLoginData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

			if($(".loginData #email").val() == '') {
				$(".loginData #error-email").fadeIn();
				hasError = true;
			}else if(!emailReg.test( $(".loginData #email").val() )) {
				$(".loginData #error-email").fadeIn();
				hasError = true;
			}else{
				$(".loginData #error-email").fadeOut();
			}
			if($(".loginData #password").val() == '') {
				$(".loginData #error-password").fadeIn();
				hasError = true;
			}else{
				$(".loginData #error-password").fadeOut();
			}
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end login form validation

		// contact form validation
		var hasCheckedContactData = false;
		$(".contactData #submit").click(function () { 
			hasCheckedContactData = true;
			return checkFormContactData();
		});
		$(".contactData #name,.contactData #email,.contactData #phone,.contactData #message").live('change click', function(){
			if(hasCheckedContactData == true)
			{
				return checkFormContactData();
			}
		});
		function checkFormContactData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

			if($(".contactData #name").val() == '') {
				$(".contactData #error-name").fadeIn();
				hasError = true;
			}else{
				$(".contactData #error-name").fadeOut();
			}
			if($(".contactData #email").val() == '') {
				$(".contactData #error-email").fadeIn();
				hasError = true;
			}else if(!emailReg.test( $(".contactData #email").val() )) {
				$(".contactData #error-email").fadeIn();
				hasError = true;
			}else{
				$(".contactData #error-email").fadeOut();
			}
			if($(".contactData #phone").val() == '') {
				$(".contactData #error-phone").fadeIn();
				hasError = true;
			}else{
				$(".contactData #error-phone").fadeOut();
			}
			if($(".contactData #message").val() == '') {
				$(".contactData #error-message").fadeIn();
				hasError = true;
			}else{
				$(".contactData #error-message").fadeOut();
			}
			if(hasError == true)
			{
				$(".contactData #error-general").fadeIn();
				return false;
			}else{
				$(".contactData #error-general").fadeOut();
				return true;
			}
		}
		// end contact form validation
		
		// expert question form validation
		var hasCheckedExpertData = false;
		$(".expertData #submit").click(function () { 
			hasCheckedExpertData = true;
			return checkFormExpertData();
		});
		$(".expertData #name,.expertData #email,.expertData #topic,.expertData #page,.expertData #question").live('change click', function(){
			if(hasCheckedExpertData == true)
			{
				return checkFormExpertData();
			}
		});
		function checkFormExpertData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

			if($(".expertData #name").val() == '') {
				$(".expertData #error-name").fadeIn();
				hasError = true;
			}else{
				$(".expertData #error-name").fadeOut();
			}
			if($(".expertData #email").val() == '') {
				$(".expertData #error-email").fadeIn();
				hasError = true;
			}else if(!emailReg.test( $(".expertData #email").val() )) {
				$(".expertData #error-email").fadeIn();
				hasError = true;
			}else{
				$(".expertData #error-email").fadeOut();
			}
			if($(".expertData #topic").attr("selectedIndex") == 0) {
				$(".expertData #error-topic").fadeIn();
				hasError = true;
			}else{
				$(".expertData #error-topic").fadeOut();
			}
			if($(".expertData #page").val() == '') {
				$(".expertData #error-page").fadeIn();
				hasError = true;
			}else{
				$(".expertData #error-page").fadeOut();
			}
			if($(".expertData #question").val() == '') {
				$(".expertData #error-question").fadeIn();
				hasError = true;
			}else{
				$(".expertData #error-question").fadeOut();
			}
			if(hasError == true)
			{
				$(".expertData #error-general").fadeIn();
				return false;
			}else{
				$(".expertData #error-general").fadeOut();
				return true;
			}
		}
		// end contact form validation
		
		
		// registration data form validation
		var hasCheckedRegistrationData = false;
		$(".registrationData #submit").click(function () { 
			hasCheckedRegistrationData = true;
			return checkFormRegistrationData();
		});
		$(".registrationData #email,.registrationData #confirm_email,.registrationData #companyName,.registrationData #taxId,.registrationData #firstName,.registrationData #lastName,.registrationData #address,.registrationData #zip,.registrationData #city,.registrationData #country").live('change click', function(){
			if(hasCheckedRegistrationData == true)
			{
				return checkFormRegistrationData();
			}
		});
		$(".registrationData input[name=isCompany], .registrationData input[name=subscr], .registrationData input[name=payment], .registrationData input[name=terms]").live('change', function(){
			if(hasCheckedRegistrationData == true)
			{
				return checkFormRegistrationData();
			}
		});
		function checkFormRegistrationData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			
			
			if($(".registrationData input[name=subscr]:checked").val() == undefined) {
				$(".registrationData #error-subscr").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-subscr").fadeOut();
			}
			
			if($(".registrationData input[name=payment]:checked").val() == undefined && $(".registrationData input[name=subscr]:checked").val() != "subscr_demo") {
				$(".registrationData #error-payment").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-payment").fadeOut();
			}
			
			if($(".registrationData input[name=isCompany]:checked").val() != undefined) {
				if($(".registrationData #companyName").val() == '') {
					$(".registrationData #error-companyName").fadeIn();
					hasError = true;
				}else{
					$(".registrationData #error-companyName").fadeOut();
				}
				if($(".registrationData #taxId").val() == '') {
					$(".registrationData #error-taxId").fadeIn();
					hasError = true;
				}else{
					$(".registrationData #error-taxId").fadeOut();
				}
			}else {
				$(".registrationData #error-companyName").fadeOut();
				$(".registrationData #error-taxId").fadeOut();
			}
			
			
			var validateEmail = $(".registrationData #validateEmail");
			
			$.ajax({
				url: '/backend/v10/ajax_check_if_email_exists.php',
				data: 'email=' + $(".registrationData #email").val() + '&user_id=-1',
				dataType: 'json',
				async: false, 
				type: 'post',
				success: function (j) {
					// put the 'msg' field from the $resp array from check_username (php code) in to the validation message
					
					if(j.msg != null)
					{
						validateEmail.html(j.msg).fadeIn();
						hasError = true;
					}
					else validateEmail.fadeOut();
				}
			});
			if($(".registrationData #confirm_email").val() != $(".registrationData #email").val()) {
				$(".registrationData #error-confirm_email").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-confirm_email").fadeOut();
			}	
			
			
			if($(".registrationData #firstName").val() == '') {
				$(".registrationData #error-firstName").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-firstName").fadeOut();
			}
			if($(".registrationData #lastName").val() == '') {
				$(".registrationData #error-lastName").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-lastName").fadeOut();
			}
			if($(".registrationData #address").val() == '') {
				$(".registrationData #error-address").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-address").fadeOut();
			}
			if($(".registrationData #zip").val().length < 4) {
				$(".registrationData #error-zip").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-zip").fadeOut();
			}
			if($(".registrationData #city").val() == '') {
				$(".registrationData #error-city").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-city").fadeOut();
			}
			if($(".registrationData #country").attr("selectedIndex") == 0) {
				$(".registrationData #error-country").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-country").fadeOut();
			}
			if($(".registrationData input[name=terms]:checked").val() == undefined) {
				$(".registrationData #error-terms").fadeIn();
				hasError = true;
			}else{
				$(".registrationData #error-terms").fadeOut();
			}
			
			if(hasError == true)
			{
				$(".registrationData #error-general").fadeIn();
				return false;
			}else{
				$(".registrationData #error-general").fadeOut();
				return true;
			}
		}
		// end registration data form validation
		
		
		// workshop registration data form validation
		var hasCheckedWorkshopData = false;
		$(".workshopData #submit").click(function () { 
			hasCheckedWorkshopData = true;
			return checkFormWorkshopData();
		});
		$(".workshopData #email,.workshopData #firstName,.workshopData #lastName,.workshopData #address,.workshopData #zip,.workshopData #city,.workshopData #country").live('change click', function(){
			if(hasCheckedWorkshopData == true)
			{
				return checkFormWorkshopData();
			}
		});
		$(".workshopData input[name=terms]").live('change', function(){
			if(hasCheckedWorkshopData == true)
			{
				return checkFormWorkshopData();
			}
		});
		function checkFormWorkshopData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			
			
			if($(".workshopData #firstName").val() == '') {
				$(".workshopData #error-firstName").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-firstName").fadeOut();
			}
			if($(".workshopData #lastName").val() == '') {
				$(".workshopData #error-lastName").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-lastName").fadeOut();
			}
			if($(".workshopData #address").val() == '') {
				$(".workshopData #error-address").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-address").fadeOut();
			}
			if($(".workshopData #zip").val().length < 4) {
				$(".workshopData #error-zip").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-zip").fadeOut();
			}
			if($(".workshopData #city").val() == '') {
				$(".workshopData #error-city").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-city").fadeOut();
			}
			if($(".workshopData #country").attr("selectedIndex") == 0) {
				$(".workshopData #error-country").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-country").fadeOut();
			}
			if($(".workshopData #email").val() == '') {
				$(".workshopData #error-email").fadeIn();
				hasError = true;
			}else if(!emailReg.test( $(".workshopData #email").val() )) {
				$(".workshopData #error-email").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-email").fadeOut();
			}
			if($(".workshopData input[name=terms]:checked").val() == undefined) {
				$(".workshopData #error-terms").fadeIn();
				hasError = true;
			}else{
				$(".workshopData #error-terms").fadeOut();
			}
			
			if(hasError == true)
			{
				$(".workshopData #error-general").fadeIn();
				return false;
			}else{
				$(".workshopData #error-general").fadeOut();
				return true;
			}
		}
		// end workshop registration data form validation
		
		
		// pwreset form validation
		var hasCheckedPwResetData = false;
		$(".passwordResetData #submit").click(function () { 
			hasCheckedPwResetData = true;
			return checkFormPwResetData();
		});
		$(".passwordResetData #email").live('change click', function(){
			if(hasCheckedPwResetData == true)
			{
				return checkFormPwResetData();
			}
		});
		function checkFormPwResetData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;

			if($(".passwordResetData #email").val() == '') {
				$(".passwordResetData #error-email").fadeIn();
				hasError = true;
			}else if(!emailReg.test( $(".passwordResetData #email").val() )) {
				$(".passwordResetData #error-email").fadeIn();
				hasError = true;
			}else{
				$(".passwordResetData #error-email").fadeOut();
			}
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end pwreset form validation
		
			
		// profile data form validation
		var hasCheckedProfileData = false;
		$(".profileData #submit").click(function () { 
			hasCheckedProfileData = true;
			return checkFormProfileData();
		});
		$(".profileData #companyName,.profileData #taxId,.profileData #firstName,.profileData #lastName,.profileData #address,.profileData #zip,.profileData #city,.profileData #country,.profileData #email").live('change click', function(){
			if(hasCheckedProfileData == true)
			{
				return checkFormProfileData();
			}
		});
		$(".profileData input[name=isCompany]").live('change', function(){
			if(hasCheckedProfileData == true)
			{
				return checkFormProfileData();
			}
		});
		function checkFormProfileData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			
			if($(".profileData input[name=isCompany]:checked").val() != undefined) {
				if($(".profileData #companyName").val() == '') {
					$(".profileData #error-companyName").fadeIn();
					hasError = true;
				}else{
					$(".profileData #error-companyName").fadeOut();
				}
				if($(".profileData #taxId").val() == '') {
					$(".profileData #error-taxId").fadeIn();
					hasError = true;
				}else{
					$(".profileData #error-taxId").fadeOut();
				}
			}else {
				$(".profileData #error-companyName").fadeOut();
				$(".profileData #error-taxId").fadeOut();
			}

			if($(".profileData #firstName").val() == '') {
				$(".profileData #error-firstName").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-firstName").fadeOut();
			}
			if($(".profileData #lastName").val() == '') {
				$(".profileData #error-lastName").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-lastName").fadeOut();
			}
			if($(".profileData #address").val() == '') {
				$(".profileData #error-address").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-address").fadeOut();
			}
			if($(".profileData #zip").val() == '') {
				$(".profileData #error-zip").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-zip").fadeOut();
			}
			if($(".profileData #city").val() == '') {
				$(".profileData #error-city").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-city").fadeOut();
			}
			if($(".profileData #country").attr("selectedIndex") == 0) {
				$(".profileData #error-country").fadeIn();
				hasError = true;
			}else{
				$(".profileData #error-country").fadeOut();
			}
			
			var validateEmail = $(".profileData #validateEmail");
			
			$.ajax({
				url: '/backend/v10/ajax_check_if_email_exists.php',
				data: 'email=' + $(".profileData #email").val() + '&user_id=' + userId,
				dataType: 'json',
				async: false, 
				type: 'post',
				success: function (j) {
					// put the 'msg' field from the $resp array from check_username (php code) in to the validation message
					
					if(j.msg != null)
					{
						validateEmail.html(j.msg).fadeIn();
						hasError = true;
					}
					else validateEmail.fadeOut();
				}
			});
			
			if(hasError == true)
			{
				$(".profileData #error-general").fadeIn();
				return false;
			}else{
				$(".profileData #error-general").fadeOut();
				return true;
			}
		}
		// end profile data form validation
		
		
		// passwordChange form validation
		var hasCheckedPassword = false;
		$(".passwordData #submit").click(function () { 
			hasCheckedPassword = true;
			return checkFormPasssword();
		});
		$(".passwordData #currentPassword,.passwordData #newPassword1,.passwordData #newPassword2").live('change click', function(){
			if(hasCheckedPassword == true)
			{
				return checkFormPasssword();
			}
		});
		function checkFormPasssword()
		{
			var hasError = false;
			if($(".passwordData #currentPassword").val() == '') {
				$(".passwordData #error-currentPassword").fadeIn();
				hasError = true;
			}else{
				$(".passwordData #error-currentPassword").fadeOut();
			}
			if($(".passwordData #newPassword1").val().length < 6) {
				$(".passwordData #error-newPassword1").fadeIn();
				hasError = true;
			}else{
				$(".passwordData #error-newPassword1").fadeOut();
			}
			if($(".passwordData #newPassword2").val() != $(".passwordData #newPassword1").val()) {
				$(".passwordData #error-newPassword2").fadeIn();
				hasError = true;
			}else{
				$(".passwordData #error-newPassword2").fadeOut();
			}
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end passwordChange form validation
		
		// subscriptionForm form validation
		var hasCheckedSubscription = false;
		$(".subscriptionFormData #submit").click(function () { 
			hasCheckedSubscription = true;
			return checkFormSubscriptionData();
		});
		$(".subscriptionFormData input[name=subscr], .subscriptionFormData input[name=terms]").live('change', function(){
			if(hasCheckedSubscription == true)
			{
				return checkFormSubscriptionData();
			}
		});
		function checkFormSubscriptionData()
		{
			var hasError = false;
			
			if($(".subscriptionFormData input[name=subscr]:checked").val() == undefined) {
				$(".subscriptionFormData #error-subscr").fadeIn();
				hasError = true;
			}else{
				$(".subscriptionFormData #error-subscr").fadeOut();
			}
			if($(".subscriptionFormData input[name=terms]:checked").val() == undefined) {
				$(".subscriptionFormData #error-terms").fadeIn();
				hasError = true;
			}else{
				$(".subscriptionFormData #error-terms").fadeOut();
			}
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end subscriptionForm form validation
		
		// userNewAdmin form validation (user_edit and user_new)
		var hasCheckedUserNewAdmin = false;
		$(".userNewAdminData #submit").click(function () { 
			hasCheckedUserNewAdmin = true;
			return checkFormUserNewAdminData();
		});
		$(".userNewAdminData #email").live('change click', function(){
			if(hasCheckedUserNewAdmin == true)
			{
				return checkFormUserNewAdminData();
			}
		});
		function checkFormUserNewAdminData()
		{
			var hasError = false;
			var validateEmail = $(".userNewAdminData #validateEmail");
			
			$.ajax({
				url: '/backend/v10/ajax_check_if_email_exists.php',
				data: 'email=' + $(".userNewAdminData #email").val() + '&user_id=-1',
				dataType: 'json',
				async: false, 
				type: 'post',
				success: function (j) {
					// put the 'msg' field from the $resp array from check_username (php code) in to the validation message
					
					if(j.msg != null)
					{
						validateEmail.html(j.msg).fadeIn();
						hasError = true;
					}
					else validateEmail.fadeOut();
				}
			});
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end userNewAdmin form validation
		
		// userEditAdmin form validation (user_edit and user_new)
		var hasCheckedUserEditAdmin = false;
		$(".userEditAdminData #submit").click(function () { 
			hasCheckedUserEditAdmin = true;
			return checkFormUserEditAdminData();
		});
		$(".userEditAdminData #email").live('change click', function(){
			if(hasCheckedUserEditAdmin == true)
			{
				return checkFormUserEditAdminData();
			}
		});
		function checkFormUserEditAdminData()
		{
			var hasError = false;
			var validateEmail = $(".userEditAdminData #validateEmail");
			
			$.ajax({
				url: '/backend/v10/ajax_check_if_email_exists.php',
				data: 'email=' + $(".userEditAdminData #email").val() + '&user_id=' + userId,
				dataType: 'json',
				async: false, 
				type: 'post',
				success: function (j) {
					// put the 'msg' field from the $resp array from check_username (php code) in to the validation message
					
					if(j.msg != null)
					{
						validateEmail.html(j.msg).fadeIn();
						hasError = true;
					}
					else validateEmail.fadeOut();
				}
			});
			if(hasError == true)
			{
				return false;
			}else{
				return true;
			}
		}
		// end userEditAdmin form validation
		
		// review data form validation
		var hasCheckedReviewData = false;
		$(".reviewData #submit").click(function () { 
			hasCheckedReviewData = true;
			return checkFormReviewData();
		});
		$(".reviewData #title,.reviewData #review,.reviewData #name").live('change click', function(){
			if(hasCheckedReviewData == true)
			{
				return checkFormReviewData();
			}
		});
		$(".reviewData input[name=reviewTopic], .reviewData input[name='coachType[]'], .reviewData input[name='targetGroup[]'], .reviewData input[name=makepublic]").live('change', function(){
			if(hasCheckedReviewData == true)
			{
				return checkFormReviewData();
			}
		});
		function checkFormReviewData()
		{
			var hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			
			
			if($(".reviewData input[name=reviewTopic]:checked").val() == undefined) {
				$(".reviewData #error-reviewTopic").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-reviewTopic").fadeOut();
			}
			if($(".reviewData input[name='coachType[]']:checked").val() == undefined) {
				$(".reviewData #error-coachType").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-coachType").fadeOut();
			}
			if($(".reviewData input[name='targetGroup[]']:checked").val() == undefined) {
				$(".reviewData #error-targetGroup").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-targetGroup").fadeOut();
			}	
			
			
			if($(".reviewData #title").val() == '') {
				$(".reviewData #error-title").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-title").fadeOut();
			}
			if($(".reviewData #review").val() == '') {
				$(".reviewData #error-review").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-review").fadeOut();
			}
			if($(".reviewData #name").val() == '') {
				$(".reviewData #error-name").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-name").fadeOut();
			}
			if($(".reviewData input[name=makepublic]:checked").val() == undefined) {
				$(".reviewData #error-makepublic").fadeIn();
				hasError = true;
			}else{
				$(".reviewData #error-makepublic").fadeOut();
			}

			if(hasError == true)
			{
				$(".reviewData #error-general").fadeIn();
				return false;
			}else{
				$(".reviewData #error-general").fadeOut();
				return true;
			}
		}
		// end review data form validation
	
		// Latest Tweets
		$("#latest-footer-tweets").tweet({
			join_text: "auto",
			username: "cudazi",
			count: 4,
			auto_join_text_default: "we said,", 
			auto_join_text_ed: "we",
			auto_join_text_ing: "we were",
			auto_join_text_reply: "we replied",
			auto_join_text_url: "we were checking out",
			loading_text: "Loading tweets..."
		  });
		
		
		// Toggle Content!
		$(".hidden").hide();
		$("a.toggle").click(function(event){
			if( $(this).text() == 'Mehr Infos' ) {
				$(this).text("Close");
			}else{
				$(this).text("Open");
			}
			$(this).parents(".toggle-container").find(".hidden").slideToggle("normal");
			return false;
		});
		
		
		// This script is for demonstration purposes only, you can remove once you are done experimenting with the css/theme switcher
		$('a.switch-theme').click(function(event){
			$('#theme-colors').attr('href', "css/themes/" + $(this).attr('title') + ".css ");
			$('a.switch-theme').css('font-weight','normal');
			$(this).css('font-weight','bold');
			return false;
		});
		
		
		var loader = "<div align=\"center\"><img src=\"images/loading_new.gif\" align=\"absmiddle\" class=\"load\" alt=\"L&auml;dt&hellip;\" /></div>";
		$('.image').hide();
		$('.image_frame').append(loader);
		$(window).load( function() {
			$('.load').hide();
			$('.image').fadeIn('slow');
		});
		
		
		
		$("#expertQuestion").fancybox({
			'width'				: '85%',
			'height'			: '85%',
	        'autoScale'     	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'scroll'			: false
		});
		
		$("#agbIFrame").fancybox({
			'width'				: '85%',
			'height'			: '85%',
	        'autoScale'     	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'scroll'			: false
		});
		
		$("#contactIFrame").fancybox({
			'width'				: '55%',
			'height'			: '75%',
	        'autoScale'     	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'scroll'			: false
		});
		
		$("#shippingIFrame").fancybox({
			'width'				: '45%',
			'height'			: '30%',
	        'autoScale'     	: false,
	        'transitionIn'		: 'none',
			'transitionOut'		: 'none',
			'type'				: 'iframe',
			'scroll'			: false
		});
		
		$("#menu").megaMenu('hover_fade');
		//$("#sideMenu").sideMegaMenu('hover_fade');


			
}); // end jQuery
