$(document).ready(function() {
	$('input[title]').each(function() {
		if($(this).val() === '') {
			$(this).val($(this).attr('title'));	
		}
		
		$(this).focus(function() {
			if($(this).val() == $(this).attr('title')) {
				$(this).val('').addClass('focused');	
			}
		});
		$(this).blur(function() {
			if($(this).val() === '') {
				$(this).val($(this).attr('title')).removeClass('focused');	
			}
		});
	});

    $(".choose-button").hide();

    $("#ChooseBarrister select").change(function() {
        window.location = $("#ChooseBarrister select option:selected").val();
    })
	
    $("#ChooseArea select").change(function() {
        window.location = $("#ChooseArea select option:selected").val();
    })	
	

function wraphours(hrs) {
	if (hrs > 24) { hrs = hrs - 24}
	else if (hrs < 0) { hrs = hrs + 24 };	
	return hrs
}

setInterval( function() {
	// Create a newDate() object and extract the seconds of the current time on the visitor's
	var seconds = ThisSecond;
	// Add a leading zero to seconds value
	$(".sec").html(( seconds < 10 ? "0" : "" ) + seconds);
	},1000);
	
setInterval( function() {
	// Create a newDate() object and extract the minutes of the current time on the visitor's
	var minutes = ThisMinute;
	// Add a leading zero to the minutes value
	$(".min").html(( minutes < 10 ? "0" : "" ) + minutes);
    },1000);
	
setInterval( function() {
	// Create a newDate() object and extract the hours of the current time on the visitor's
	var hours = ThisHour;
	// Add a leading zero to the hours value
	$("#london .hours").html(( hours < 10 ? "0" : "" ) + hours);
	hours = wraphours(hours - 5);
	$("#newyork .hours").html(( hours < 10 ? "0" : "" ) + hours);
	hours = wraphours(hours + 13);
	$("#singapore .hours").html(( hours < 10 ? "0" : "" ) + hours);
	hours = wraphours(hours + 3);
	$("#sydney .hours").html(( hours < 10 ? "0" : "" ) + hours);	
    }, 1000);		
});
