// JavaScript Document
$(document).ready(function() {

	$('.jQHd').css('display', 'none');

	$('#imageHeader').innerfade({ speed: 'slow', timeout: 4000, type: 'sequence', containerheight: '297px' }); 

	$('.xText').focus(function(){
		$(this).css('border-color', '#FBAD46');
		$(this).parents('tr').find('span').css('visibility', 'visible');
	});
	
	$('.xText').blur(function(){
		$(this).css('border-color', '#CFCFCF');	
		$(this).parents('tr').find('span').css('visibility', 'hidden');
	});

	$('#kwick_1').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/the-blade/'; });
	$('#kwick_2').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/sean-skinner/'; });
	$('#kwick_3').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/freedom-climber/'; });
	$('#kwick_4').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/rapid-hands/'; });
	$('#kwick_5').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/tapis-5-points/'; });
	$('#kwick_6').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/jacobs-ladder/'; });
	$('#kwick_7').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/slideboard/'; });
	$('#kwick_8').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/powerskater/'; });
	$('#kwick_9').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/sweet-hands/'; });
	$('#kwick_10').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/boites-pliometriques/'; });
	$('#kwick_11').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/boites-russes/'; });
	$('#kwick_12').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/v-angle/'; });
	$('#kwick_13').click(function(){ window.location.href='http://www.patinagehauteperformance.com/services/rapidshot/'; });
	
	$('.boxlink').each(function(){
		$(this).data('boxid',$(this).attr('title')).removeAttr('title');	
	});
	
    $('.boxlink').click(function() {
    	var boxid = $(this).data('boxid');
        $.blockUI({
        	message: $('#' + boxid),
			css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#fff', 
            '-webkit-border-radius': '10px', 
            '-moz-border-radius': '10px', 
            color: '#000',
            cursor: 'default'
        },
		overlayCSS: { cursor: 'default' }
		 });
        $('.blockOverlay').attr('title','Click to unblock').click($.unblockUI); 
    }); 
   	$('.closeblock').click(function(){ $.unblockUI(); });
   	
	$('#ath').change(function(){ newCalc(); });
	$('#ses').change(function(){ newCalc(); });
	function newCalc() {
		var a1 = $('#ath').val();
		var a2 = $('#ses').val();
		var a3;
		var a4;
		if(a2 == 3) { a3 = 30; }
		if(a2 == 5) { a3 = 25; }
		if(a2 == 10) { a3 = 20; }
		a4 = round_float(((a2 * a3) * a1),2);
		$('#cost').html(a4);	
	}
	function round_float(x,n){
	  if(arguments.length < 2 || !parseInt(n))
	        var n=0;
	  if(!parseFloat(x))
	        return false;  return Math.round(x*Math.pow(10,n))/Math.pow(10,n);
	}
});
