// JavaScript Document

$(function(){
	
	$('#homeAccordian div.acc').click(function(){
		window.location.href = $('a',$(this)).attr('href');										  		
	});
		   
	$('div.date_select_container select').each(function(){
		$(this).change(function(){
			var objCont = $(this).parent();
			
			var date = $('select.date_select_year',objCont).val()+'-'+$('select.date_select_month',objCont).val()+'-'+$('select.date_select_day',objCont).val();
			$('input.date_select_hidden',objCont).val(date);
		});
	});
	
	$('input.chkDoB').click(function(){
		if($(this).attr('checked') == true){
			$('select',$(this).parent().parent()).attr('disabled','');
		}else{
			$('select',$(this).parent().parent()).attr('disabled','disabled').val('00');
			$('input.date_select_hidden',$(this).parent().parent()).val('0000-00-00');
		}
	});
	
	$('#calendar2select').livequery('change',function(){
		$('#calendar_wrap').load('p/calendar2.php'+$(this).val());
	});
	
	$('#calendar_wrap3_select').livequery('change',function(){
		var divWrap = $(this).attr('id').replace('_select','');
		$('#'+divWrap).load('p/calendar3.php'+$(this).val());
	});
	
	$('#selPaymentMethod').change(function(){
		
		if($(this).val()=='card'){
			$('#card_wrap').show();
			$('#bacs_wrap').hide();
			$('#cheque_wrap').hide();
		}
		if($(this).val()=='bacs'){
			$('#card_wrap').hide();
			$('#bacs_wrap').show();
			$('#cheque_wrap').hide();
		}
		if($(this).val()=='cheque'){
			$('#card_wrap').hide();
			$('#bacs_wrap').hide();
			$('#cheque_wrap').show();
		}
		
	});
	
	$('.image_cycle').cycle({ 
	    fx:     'fade', 
	    speed:   300, 
	    timeout: 3000, 
	    next:   '#s3', 
	    pause:   1 
	});
	
	$('#galleryWrap a').lightBox();
	
	$('label.required').each(function(){
		$(this).prepend('<span>*</span>');
	});
	
	
});
