$(document).ready(function () {
	$('.hidden').hide();
	$('.accordian').find('span > a:first').toggleClass('forceInline');
	var originalEmailAddress = $('#email_address').val();
	var originalMobileNumber = $('#mobile_number').val();
	$('.accordian > span , .accordian > a').css('cursor', 'pointer').click(function () { 
		$(this).parent().find('.hidden').toggle();
		$(this).parent().find('a').toggleClass('forceInline');
	}).bind("click",function(){
		$('#email_address:hidden').val( originalEmailAddress );
		$('#mobile_number:hidden').val( originalMobileNumber );
	});
	$('#questionNotFound').click(function(){
		$('#wizardBanner').slideUp();
		return false;
	});
	$('.newWindowLink').click(function(){
		$(this).attr('href', $(this).attr('href')+'%26wizard%3D1');
		var target = decodeURI($(this).attr('href'));
		target = target.split('target_page%3D');
		target = target[1].split('%26');
		target = target[0];
		window.location = '/wizard/?p=wizard&page='+$('#pageID').val()+'&target_page='+target+'&wizard_id=38';
	}).hover( function () {
            var title = $(this).attr('title');
            $(this).removeAttr('title');
            $('#tooltip').show().html(title);
            $(this).mousemove(function(e){ 
                $('#tooltip').css({'top':e.pageY-120+'px','left':e.pageX-190+'px', 'display':'block','bottom':''});
            });
        },
        function () {
            $(this).attr('title',$('#tooltip').html());
            $('#tooltip').empty().hide().css({'bottom':0, 'left':0});	
        }
    );

	$('#searchOptions').change(function(){
		if($(this).val() == 'custom'){
			$('.calendar').show();
		} else {
			$('.calendar').hide();
		}
	}).trigger('change');
    Date.format = 'dd/mm/yy';
    $('#dateFrom, #dateTo').datePicker({startDate:'01/01/08'});

});
