function limiet(veld, maximum, telveld){
	if (veld.value.length > maximum){
    	veld.value = veld.value.substring(0, maximum);
		alert('U kunt maximaal 500 karakters invoeren.')
	}
} 
function ooc( schermnaam ){  
	var element, visualiteit;  
	if( document.getElementById ) 
	element = document.getElementById( schermnaam ); 		
	else if( document.all )      
	element = document.all[schermnaam];  else if( document.layers ) 
	element = document.layers[schermnaam];  
	visualiteit = element.style;  
	if(visualiteit.display==''&&element.offsetWidth!=undefined&&element.offsetHeight!=undefined)    
	visualiteit.display = (element.offsetWidth!=0&&element.offsetHeight!=0)?'block':'none';  
	visualiteit.display = (visualiteit.display==''||visualiteit.display=='block')?'none':'block';
}		

function removeQuotes(f){
	val = f.search.value;
	val_a = val.split("'");
	newval = '';
	for(x=0; x<val_a.length; x++){
		newval += val_a[x];
	}
	if(newval!=val){
		f.search.value = newval;
	}
}

function change_form_action(){
	var x=document.getElementById("myForm")
	x.action="index.cfm?/Registreer"
	document.getElementById("hiddenact").value =''
	x.submit()
}
	
function forgotpassword(){
	document.getElementById("loginform2").style.display='none'
	document.getElementById("forgotpasswordform").style.display='block'
}

function forgotpasswordmax(email){
	document.getElementById("loginform").style.display='none'
	document.getElementById("forgotpasswordform").style.display='block'
	document.getElementById("emailforget").value=email;
	document.getElementById("myFormsend").submit();
}

//pager button handler for reviews page
$(document).ready(function(){
	setPager();
});
	
function setPager(){
	$(".morerevbtn").click(function(){
		startpos = $(this).attr('id');
		shopid = $(this).attr('sid');
		theurl = 'samenvoordeel/siteparts/winkelreviews/_x_seqpage.cfm?starter='+startpos+'&wid='+shopid;
		//alert('going to call url '+theurl);
		smsLoadPane(theurl, 'morereviews_'+startpos, 'overwrite');
	})
}
	
function smsLoadPane(theurl, divid, type){
	$.ajax({
		url: theurl,
		success: function(data) {
			if(type=='append'){
				//alert('got html');
				$('#'+divid).append(data);
				setPager();
				//alert('appended html to divid '+divid)
			}
			else{
				$('#'+divid).html(data);
				setPager();
			}
		},
		error: function(jqXHR, textStatus, errorThrown){
			//$('#'+divid).html('error calling '+theurl+'<br><br>textStatus='+textStatus+'<br><br>errorThrown='+errorThrown+'<br><br>jqXHR='+jqXHR);
			//$('#'+divid).show('slow');
			//alert('error calling '+theurl+'\ntextStatus='+textStatus+'\nerrorThrown='+errorThrown+'\njqXHR='+jqXHR);
			//window.open(theurl);
		}
	});
}
