$(document).ready(function() {
    $('.head-banner').cycle({
		fx: 'fade',
        timeout: '5000'
	});
    $('#locationSelector').change(function(){
        if ($('#locationSelector').val() !='' ) {
            window.location = ''+$('#locationSelector').val();
        }
    });
    $('#registrationForm').validate();
    $('#referFriendForm').validate();
	$('#contactUsForm').validate();
    
    function blink(time, interval, targetId){
        var timer = window.setInterval(function(){
            $("#"+targetId).fadeOut();
            window.setTimeout(function(){
                $("#"+targetId).fadeIn();
            }, 100);
        }, interval);
        window.setTimeout(function(){clearInterval(timer);}, time);
    }
    blink(9999999, 2000, 'blink-image');
    $("input.phone").mask("9999 9999");
    $("input.mobile").mask("9999 999 999");

    $('#preferred_area').change(function() {
        var suburb = escape($(this).val());
        $('#available-day').show();
        $('#day-list').load('getAvailableDay.php?suburb='+suburb);
    })
	// default options
	/*$("#external").jmp3({
		filepath: "http://www.soccertimekids.com.au/jingle/",
		backcolor: "ffd700",
		forecolor: "8B4513",
		width: 150,
		autoplay: "true",		
		showdownload: "false"
	});
*/$("#external").toggle(
  function () {
	$(this).find('#toggleText').html('Play Music');
  },
  function () {
    $(this).find('#toggleText').html('Pause Music');
  }
);
  var tempHtml = '';
$('.fancybox').fancybox({
    onStart: function() {
        tempHtml = $('#external').html();
        $('#external').html('');
    },
    onClosed: function() {
        $('#external').html(tempHtml);
    }
});
});
