function submitJubileum()
{
	$.post("../forms/jubileum.php", $('form').serialize(),
			function(data){
				$('.jubleum_form').html(data);
	   });
	return false;
}

function submitToernooi()
{
	$.post("../forms/toernooi.php", $('form').serialize(),
			function(data){
				$('.voetbal_toernooi').html(data);
	   });
	return false;
}

function getTeamContent(mode,id)
{
	$('.stand').removeClass('stand_active');
	$('.uitslagen').removeClass('uitslagen_active');
	$('.alle_uitslagen').removeClass('alle_uitslagen_active');
	$('.programma').removeClass('programma_active');

	
	$('.'+mode).addClass(mode+'_active');
	
	$('#team_gegevens_laden').show();
	$.ajax({
		  url: 'standen_rip/team.php?teamID='+id,
		  success: function(data) {
				var $response=$(data);
				var content = $response.find('#'+mode).html();
				$('.teamGegevens').html(content);
				$('#team_gegevens_laden').hide();              
		  }
		});
}

function getClubProgramma(mode)
{
	$('.deze_week_knop').removeClass('deze_week_knop_active');
	$('.volgende_week_knop').removeClass('volgende_week_knop_active');
	$('.'+mode+'_knop').addClass(mode+'_knop_active');
	
	if (mode == "deze_week")
	{
		$('.volgende_week').hide();
		$('.deze_week').show();
	}
	else
	{
		$('.volgende_week').show();
		$('.deze_week').hide();
	}
}


popupStatus = 0;
//loading popup with jQuery magic!
function loadPopup(){
	//loads popup only if it is disabled
	if(popupStatus==0){
		$("#backgroundPopup").css({
		"opacity": "0.7"
	});
	$("#backgroundPopup").fadeIn("slow");
	$("#popupContact").fadeIn("slow");
	popupStatus = 1;
	}
}

//disabling popup with jQuery magic!
function disablePopup(){
	//disables popup only if it is enabled
	if(popupStatus==1){
		$("#backgroundPopup").fadeOut("slow");
		$("#popupContact").fadeOut("slow");
		popupStatus = 0;
	}
}

//centering popup
function centerPopup(){
	//request data for centering
	var windowWidth = document.documentElement.clientWidth + 80;
	var windowHeight = document.documentElement.clientHeight + 40;
	
	var popupHeight = $("#popupContact").height();
	var popupWidth = $("#popupContact").width();
	//centering
	$("#popupContact").css({
		"position": "absolute",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	
	var inhoudHeight = $('.pagina').height();
	
	if (inhoudHeight > windowHeight)
	{
		windowHeight = inhoudHeight + 40
	}
	
	//only need force for IE6
	$("#backgroundPopup").css({
		"height": windowHeight
	});
	$("#backgroundPopup").css({
		"width": windowWidth
	});
}
	
function activatePopup()
{
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		 if (ieversion < 7)
		 {	 
			//LOADING POPUP
			//centering with css
			centerPopup();
			//load popup
			loadPopup();
		 }
	}
	//CLOSING POPUP
	//Click the x event!
	$("#popupContactClose").click(function(){
		disablePopup();
	});
	//Click out event!
	$("#backgroundPopup").click(function(){
		disablePopup();
	});
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 || popupStatus==1){
			disablePopup();
		}
	});
}

   
$(function() {
	var nrItems = $('.carousel ul').children("li").length;
	if (nrItems > 4)
	{
		nrItems = 5;
		$(".carousel").jCarouselLite({
			auto: 2,
		    speed: 2000,
		    visible: Number(nrItems),
		    vertical: true
		    });
	}
	
});


function doIframe(){
	o = document.getElementsByTagName('iframe');
	for(i=0;i<o.length;i++){
		if (/\bautoHeight\b/.test(o[i].className)){
			setHeight(o[i]);
			addEvent(o[i],'load', doIframe);
		}
	}
}

function setHeight(e){
	if(e.contentDocument){
		e.height = e.contentDocument.body.offsetHeight + 35;
	} else {
		e.height = e.contentWindow.document.body.scrollHeight;
	}
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener)
	{
	obj.addEventListener(evType, fn,false);
	return true;
	} else if (obj.attachEvent){
	var r = obj.attachEvent("on"+evType, fn);
	return r;
	} else {
	return false;
	}
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);	
}



$(document).ready(function(){					
	$('#multi-ddm').dropDownMenu({timer: 1000, parentMO: 'parent-hover', childMO: 'child-hover1'});
});

 

