$(document).ready(function(){
$(".toggle_container").hide();

	$(".trigger").click(function(){
			$(this).next().slideToggle(300).siblings(".toggle_container").slideUp("slow");
	});

	//$('#thankyou').hide();
			$("#subcontact").click(function(event) { //if the value of these elements change, do this
				event.preventDefault();
				var name = $("#f_name").val();
				var email = $("#f_email").val();
				var message = $("#f_message").val();
				var phone = $("#f_phone").val();

				//send message through get
				$.get('contactus.php',  { name: name, email: email, message : message, phone:phone }, function(data) {//Use GET to run external script, passing on vars as appropriate.
					$('#form').fadeOut('fast');
					$('form.contact').fadeOut('fast');
					$(".toggle_container").delay(2000).slideUp(400);
				});
				return false;
			});
			
			$("#contactform").submit(function() {
				
				var name = $("#f_name").val();
				var email = $("#f_email").val();
				var message = $("#f_message").val();
				var phone = $("#f_phone").val();
		
				//send message through get
				$.get('contactus.php',  { name: name, email: email, message : message, phone:phone }, function(data) {//Use GET to run external script, passing on vars as appropriate.
					$('#form').fadeOut('fast');
					$('form.contact').fadeOut('fast');
					
						$(".toggle_container").delay(2000).slideUp(400);
				});
				return false;
			});
			$("#contactform2").submit(function() {
				
				
				var email = $("#newsletter").val();
				
				
				//send message through get
				$.get('newsletter.php',  { email: email }, function(data) {//Use GET to run external script, passing on vars as appropriate.
					$('#form2').fadeOut('fast');
					$('#contactform2').fadeOut('fast');
						$(".toggle_container").delay(2000).slideUp(400);
			
				});
				return false;
			});
// Ligth Box 
	$(".list_pics li a").each(function(i){
		i=i+1;
		$(this).click(function(){
			var $url = $(this).attr("rel");
			$(".big_show").children().attr("src" , $url);
			$(".big_photos").show(function(){
				$(".close_bt").click(function(){
					$(".big_photos").hide();
				});							   
			});					   
		});
	});
// End Light Box 

// Customise Select Box 
	
	var $items = $('#listBox ul li');
	var $listBox = $('#listBox');
	$('#btn').click(function() {
		var minWidth = $('#ddText').outerWidth() + $('#btn').outerWidth();
		$listBox.css("left",$('#ddText').eq(0).offset().left).css("min-width",minWidth);
		if($listBox.css("display")=="none") {
		$listBox.show("fast", function() {
		$listBox.scrollTop(0).eq(0).focus();
		});
	 }
	else {
		 $listBox.hide("fast");
	      }
	    });
	 $items.click(function(e) {
	       $('#ddText').val($(this).text());
	       $('#ddValue').val($(this).attr("value"));
	       $listBox.hide("fast");
	   });
	   $('#ddText').click(function() {
	   $('#btn').click();
	});
	$items.hover(function() {
	$(this).addClass("highLight");
	}, function() {
	 $(this).removeClass("highLight");
	}
	);
	$listBox.blur(function(e) {
	$listBox.hide("fast");
   });
// End Customise Select Box 

/* Text Box Style */
$("input:text").focus(function(){							   
	$(this).addClass("globalTxt").val("");									   
});
/* End Text Box Style */

/* Check box Event */
$(".end_date:checkbox").click(function(){
	var $chk_box = $(this);
	if($chk_box.is(":checked")){
		$(".check_display").show();	
	}
	else{
		$(".check_display").hide();	
	}
});
/* End Check Box Event */

/* Datepicker */
		$(".dateTxt").datepicker({
			showOn: 'button',
			buttonImage: '/wp-content/themes/5655/images/calender.png',
			buttonImageOnly: true
		});
/* End Datepicker*/



});
