
/* example in textfield */
(function(A){A.fn.example=function(D,C){var B=A.extend({},A.fn.example.defaults,C);var E=A.isFunction(D);if(!A.fn.example.bound_class_names[B.class_name]){A(window).unload(function(){A("."+B.class_name).val("")});A("form").submit(function(){A(this).find("."+B.class_name).val("")});A.fn.example.bound_class_names[B.class_name]=true}return this.each(function(){var G=A(this);if(A.browser.msie&&!G.attr("defaultValue")&&(E?G.val()!="":G.val()==D)){G.val("")}if(G.val()==""){G.addClass(B.class_name);G.val(E?D.call(this):D)}if(B.hide_label){var F=A("label[@for="+G.attr("id")+"]");F.next("br").hide();F.hide()}G.focus(function(){if(A(this).is("."+B.class_name)){A(this).val("");A(this).removeClass(B.class_name)}});G.blur(function(){if(A(this).val()==""){A(this).addClass(B.class_name);A(this).val(E?D.call(this):D)}})})};A.fn.example.defaults={class_name:"example",hide_label:false};A.fn.example.bound_class_names=[]})(jQuery);

$(document).ready(function() {
	$('.example').example(function() {
		return $(this).attr('title'); 
	});
/**
 * @author harm wimmenhove
 * non-obtrusive password example
 */
	$('#tf_example').show();
	$('#tf_pass').hide();
	//show example in pass field
	$('#tf_example').focus(function(){
		$('#tf_example').hide();
		$('#tf_pass').show();
		$('#tf_pass').focus();
	});
});


//function limitChars 
function limitChars(textid, limit, output) {
	var text = $('#'+textid).val(); 
	var textlength = text.length;
	if(textlength > limit) {
		$('#' + output)
		$('#' + output).html('<span class="warning">'+limit+'/'+limit+' karakters gebruikt</span>');
		$('#'+textid).val(text.substr(0,limit));
		return false;
	} else {
		$('#' + output).html(textlength+'/'+limit+' karakters gebruikt');
		return true;
	}
}

function getReports(page, type, path, aantalobjecten) {

	if(type != '') {
		targetDiv = $('#meer-reports');
		targetDiv[0].innerHTML = '<div id="loading"></div>';
		
		switch(type) {
			case 'foto':
				filename = path+"ajx_getfotoreports.php"
				break
			case 'video':
			case 'video2':
				filename = path+"ajx_getecoreports.php"
				break
			case 'dossier':
				filename = path+"ajx_getartisdossiers.php"
				break
		}
	
		$.get(filename,{ 
		      page: page, 
		      type: type,
		      aantal: aantalobjecten
		    }, function(result) { 
		   		targetDiv.hide();
		  		targetDiv[0].innerHTML = result;
		  		targetDiv.fadeIn('fast');
		  		//alert(document.getElementById('aantalresultaten').value);
		});

	}
	
}

function getRelatedReports(page, reportid, type, path, aantalobjecten) {

	if(reportid != '') {
		
		$.get(path+'ajx_getrelatedreports.php',{ 
		      page: page,
		      reportid: reportid,
		      type: type,
		      aantal: aantalobjecten
		    }, function(result) { 

				divId = 'meer-reports'+reportid;
				ecoDiv = document.getElementById(divId);
				ecoDiv.innerHTML = result;
				
		});


	}

	
}

function getReacties(page, parent, path, aantalobjecten) {

	if(parent != '') {
		reactiesDiv = $('#list-reacties');
		reactiesDiv[0].innerHTML = '<div id="loading"></div>';
		
		$.get(path+"ajx_getreacties.php",{ 
		      page: page, 
		      parent: parent,
		      aantal: aantalobjecten
		    }, function(result) { 
		   		reactiesDiv.hide();
		  		reactiesDiv[0].innerHTML = result;
		  		reactiesDiv.fadeIn('fast');
		  		//alert(reactiesDiv[0].innerHTML);
		});

	}
	
}

function getSter(path) {

	sterrenDiv = $('#sterren-van-artis');
	sterrenDiv[0].innerHTML = '<div id="loading"></div>';
	
	$.get(path+"ajx_getster.php",{ 
	    }, function(result) { 
	   		sterrenDiv.hide();
	  		sterrenDiv[0].innerHTML = result;
	  		sterrenDiv.fadeIn('fast');
	  		//alert(reactiesDiv[0].innerHTML);
	});
	
}

function setRating(reportid, cijfer, ipadres, path) {
	/*
	alert('report='+reportid);
	alert('cijfer='+cijfer);
	alert('stemmer='+ipadres);
	*/
	$.get(path+"ajx_setrating.php",{ 
	      report: reportid, 
	      cijfer: cijfer,
	      ip: ipadres
	    }, function(result) { 
			
			$('#rating-txt').hide();
			
	    	$('#rating-txt')[0].innerHTML = 'Bedankt voor je stem!';
			$('#rating-txt').addClass('bedankt');
			$('#rating-txt').fadeIn('fast');

	});
	
}

function getNopinie(path) {

	nopinieDiv = $('#nopinie');
	nopinieDiv[0].innerHTML = '<div id="loading"></div>';
	
	$.get(path+"ajx_getnopinie.php",{ 
	    }, function(result) { 
	   		nopinieDiv.hide();
	  		nopinieDiv[0].innerHTML = result;
	  		nopinieDiv.fadeIn('fast');
	});
	
}

function setNopinie(nopinieid, path) {

	pollValue = $("input[name='poll']:checked").val();

	if(pollValue == null) {
		alert('Je hebt nog geen antwoord gekozen.');
	} else {
		/*
		alert(nopinieid);
		alert(pollValue);
		alert(path);
		*/
		nopinieDiv = $('#nopinie');
		nopinieDiv[0].innerHTML = '<div id="loading"></div>';
		
		$.get(path+"ajx_getnopinie.php",{
		      nopinieid: nopinieid, 
		      antwoord: pollValue	 
		    }, function(result) { 
		   		nopinieDiv.hide();
		  		nopinieDiv[0].innerHTML = result;
		  		nopinieDiv.fadeIn('fast');
		});
	}
	
}


function mainmenu(){
$(" #navigation ul ").css({display: "none"}); // Opera Fix
$(" #navigation li").hover(function(){
		//$(this).find('ul:first:hidden').css({visibility: "visible",display: "none"}).show(400);
		$(this).find('ul:first:hidden').css({visibility: "visible",display: "none"}).slideToggle("fast");
	},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
	});
}

 $(document).ready(function(){
	mainmenu();
});

