function openFile(url){
	positionx=screen.width/2-(screen.width/2 - 100);
	positiony=screen.height/2-(screen.height/2 - 100);
	
	window.open(url,"boe", "width="+(screen.width - 300)+",height="+(screen.height - 400)+",resizable=yes,menubar=yes,toolbar=yes,status=no,location=no, left=" + positionx + ",top=" + positiony + ",scrollbars").focus()
}

/**
 * File with several functions for ajax usage
 *
 */

function calculate()
{
  var visualPrestatie = 
    (($('#prestatieU').val().length != 0) ? $('#prestatieU').val() + "." : "" ) +
    (($('#prestatieM').val().length != 0) ? $('#prestatieM').val() + "." : "" ) +
    (($('#prestatieS').val().length != 0) ? $('#prestatieS').val() : "0" );

  var hours = parseInt($('#prestatieU').val().replace(",", ".")) * 3600;
  var minutes = parseInt($('#prestatieM').val().replace(",", ".")) * 60;
  var seconds = parseFloat($('#prestatieS').val().replace(",", "."));

  var handtijd = 'off';
  if($("#handtijd").length > 0)
  {
    if($("#handtijd").is(":checked"))
      handtijd = 'on';
  }

  var prestatie = (isNaN(hours) ? 0: hours) + (isNaN(minutes) ? 0: minutes) + (isNaN(seconds) ? 0: seconds);
  if(prestatie == "NaN" || prestatie == 0) prestatie = "empty";
  
  visualPrestatie = visualPrestatie.replace(",", ".");

  $.post("/ranglijst/bereken/punten/scoretype/" + $('#scoreType').val() + 
    "/category/" + $('#category').val() + 
    "/type/" + $('#type').val() + 
    "/onderdeel/" + $('#onderdeel').val() +
    "/prestatie/" + prestatie +
    "/vprestatie/" + visualPrestatie +
    "/ht/" + handtijd,
    {}, 
    function(xml) {
	    processPointsFormResponse(xml);
	  }
  );
	return false;
}

function processPointsFormResponse(text){
  $('#fullcolumn').replaceWith(text);
}

$(document).ready(function(){ 
  $('a[rel*=spamemail]').spemail('[AT],[DOT]','linkbase');
});









