// Beveiliging tegen frames

if (parent.frames.length) {
	top.location.href = document.location;
	}

// Als bladwijzer of favoriet instellen

function bookmarksite(title,url) {

	if (window.sidebar) {
		window.sidebar.addPanel(title, url, "");
		}
	else if (document.all) {
		window.external.AddFavorite(url, title);
		}
	else {
		alert ('Uw browser ondersteunt deze functie niet.');
		}
 
}

//Capitalize

String.prototype.capitalize = function() {
    return this.charAt(0).toUpperCase() + this.slice(1);
}

//function to check username availability   

function check_username(){   
  
        //get the username   
        var username = $('#gebruikersnaam').val();   
        
        if(username.length <= 3){
                $('#username_availability_result').html('');
        }else{
        //use ajax to run the check   
        $.post("php/JQ_registercheck.php", { username: username },   
            function(result){   
                //if the result is 1   
                if(result == 1){   
                    //show that the username is available   
                    $('#username_availability_result').html('');//<span style="color:#00ff00;">' + username + ' is nog beschikbaar.</span><br>   
                }else{   
                    //show that the username is NOT available   
                    $('#username_availability_result').html('<span style="color:#ff0000;">' + username.capitalize() + ' is niet meer beschikbaar.</span><br>');   
                }   
        });   
        }//if else <=3
  
} 

function check_email(){   
  
        //get the email   
        var email = $('#emailadres').val();   
        
        //use ajax to run the check   
        $.post("php/JQ_registercheck.php", { email: email },   
            function(result){   
                //if the result is 1   
                if(result == 1){   
                    //show that the email is available   
                    $('#email_availability_result').html('');   
                }else{   
                    //show that the email is NOT available   
                    $('#email_availability_result').html('<span style="color:#ff0000;">Dit e-mailadres is reeds in gebruik.</span><br>');   
                }   
        });   
  
}

// Resolutie
function select_my_resolution() {
   var res_menu = document.getElementsByName("size");
   var mywidth  = screen.width;
   var myheight = screen.height;
   if (mywidth == '768' && myheight == '1024') {
      mywidth = '1024';
   }
   for (var i=0; i<res_menu.length; i++) {
      for (var j=0; j<res_menu[i].options.length; j++) { 
	  
         if (res_menu[i].options[j].value == mywidth+'x'+myheight) {
			res_menu[i].options[j].text = res_menu[i].options[j].value + ' (uw resolutie)';
         } 
		 
      } 
   }
}
