jQuery(document).ready(function(){
	// top menu item hover
	jQuery("#topMenu li").hover(
      function () {
		if(jQuery(this).hasClass('active')){
			return false;
		}
		else {
        	jQuery(this).addClass("hovered");
		}
      }, 
      function () {
        jQuery(this).removeClass("hovered");
      }
    );
	
	// input hint
	if(jQuery('input')[0]){
		jQuery('input').hint();
	}
	
	// content first paragraph
	// jQuery('#content p:first').css({"font-weight":"bold"});
	
	// course table
	jQuery('.courseTable tr:even').addClass('evened');
	
	// popups
	if(jQuery('#infoAanbieder')[0]){
		jQuery('#infoAanbieder').qtip({
			content: 	{ url: 'fileadmin/popups/aanbieders.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoNiveau')[0]){
		jQuery('#infoNiveau').qtip({
			content: 	{ url: 'fileadmin/popups/niveau.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoPrijs')[0]){
		jQuery('#infoPrijs').qtip({
			content: 	{ url: 'fileadmin/popups/prijs.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoLesduur')[0]){
		jQuery('#infoLesduur').qtip({
			content: 	{ url: 'fileadmin/popups/lesduur.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoLessen')[0]){
		jQuery('#infoLessen').qtip({
			content: 	{ url: 'fileadmin/popups/lessen.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoLocatie')[0]){
		jQuery('#infoLocatie').qtip({
			content: 	{ url: 'fileadmin/popups/locatie.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoDeelnemers')[0]){
		jQuery('#infoDeelnemers').qtip({
			content: 	{ url: 'fileadmin/popups/deelnemers.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoIncompany')[0]){
		jQuery('#infoIncompany').qtip({
			content: 	{ url: 'fileadmin/popups/incompany.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	if(jQuery('#infoData')[0]){
		jQuery('#infoData').qtip({
			content: 	{ url: 'fileadmin/popups/data.html', title: { text: ' &nbsp; ',  button: 'Close' } },
			position: 	{ corner: { target: 'rightBottom',tooltip: 'bottomLeft' } },
			style: 		{ name: 'blue', tip: 'bottomLeft', border: { width: 5, radius: 10 } },
			show: 		{ when: 'click' },
			hide: 		false
		})
	}
	var nrOfCheckBoxesChecked = jQuery('input:checked').length;
	if((nrOfCheckBoxesChecked > 1)&&(nrOfCheckBoxesChecked < 4)) {
		document.filtercompare.comparebtna.disabled = false;
		document.getElementById('comparebtna').className = 'inpCompare';
		document.leftform.comparebtnb.disabled = false;
		document.getElementById('comparebtnb').className = 'inpCompare';
	}
});

function addCheckButtons(str) {

	if(str!=0){ 
	 	var taginput = document.getElementById("tagsearch").value;
	 	var myarr = taginput.split(",");
	
	 	if(myarr.inArray(str)){
	 		document.getElementById('tagsearch').value = document.getElementById('tagsearch').value.replace (str+",", "");
	 	}else{
	  		document.getElementById('tagsearch').value += str+",";
	 	}
	}

	var tagIDSTemp = document.getElementById('tagsearch').value;
	tagIDSTemp = tagIDSTemp.substring(0, tagIDSTemp.length-1);
	var tagIDS = tagIDSTemp;
	
	var finalarr = tagIDS.split(",");
	var noArray = finalarr.length;
	
	if((noArray > 1) && (noArray < 4)) {
		document.filtercompare.comparebtna.disabled = false;
		document.getElementById('comparebtna').className = 'inpCompare';
		document.leftform.comparebtnb.disabled = false;
		document.getElementById('comparebtnb').className = 'inpCompare';
	} else {
		document.filtercompare.comparebtna.disabled = true;
		document.getElementById('comparebtna').className = 'inpCompareInactive';
		document.leftform.comparebtnb.disabled=true;
		document.getElementById('comparebtnb').className = 'inpCompareInactive';
	}
}
Array.prototype.inArray = function (value){
// Returns true if the passed value is found in the
// array. Returns false if it is not.
var i;
for (i=0; i < this.length; i++){
	if (this[i] == value) 
	{
	return true;
	}
}
return false;
};
