$(document).ready(function(){
  $("#registration_form").validate();
  $("#login_form").validate();
  $("#update-profile").validate();
  $("#change-password").validate();
  $("#post-form").validate();
  $("#edit-post-form").validate();
 });

$(document).ready(function(){

	$("#edit-profile").click(function () {
		$("#user-profile-form").show("fast");
		$("#user-profile").hide("fast");
		});

});

$(document).ready(function(){
   
   $("#cancel-update").click(function(){
		$("#user-profile-form").hide("fast");
		$("#user-profile").show("fast");
	});

});

$(document).ready(function(){
   $("#change-pw").click(function(){
								  
	$("#password-form").show("fast");
	
	});
 });

$(document).ready(function(){
   $("#cancel-pw").click(function(){
								  
	$("#password-form").hide("fast");
	
	});
 });

$(document).ready(function(){
   
   $("#change-password").submit(function(){
	
	var pw1=$("#pw1").val();
	var pw2=$("#pw2").val();
	if(pw1 != pw2)
		{
		alert("The passwords entered do not match, please re enter ensuring that both passwords are the same");
		$("#pw1").val("");
		$("#pw2").val("");
		return false;
		}
		else
		{
		return true;
		}
	
	})
   
 });

$(document).ready(function(){
   
   $("#post-form").submit(function(){
	
		if($("#job-description").val() && $("#job-title").val())
		{
	
			var d=$("#duration").val();
			var msg="Publish?\nYour story will be published imediately\nClick ok to continue";
			
			if(confirm(msg))
				{
				return true;
				}
				else
				{
				return false;
				}
		}
			
			})
		
   
 });

$(document).ready(function(){
   
   $("#edit-post-form").submit(function(){
	
		if($("#job-description").val() && $("#job-title").val())
		{
	
			
			var msg="Save Changes\nClick ok to continue";
			
			if(confirm(msg))
				{
				return true;
				}
				else
				{
				return false;
				}
		}
			
			})
 });

//Latest jobs scroller
/*
$(document).ready(function(){
	
	var first = 0;
	var speed = 700;
	var pause = 3000;
	
		function removeFirst(){
			first = $('ul#listticker li:first').html();
			$('ul#listticker li:first')
			.animate({opacity: 0}, speed)
			.fadeOut('slow', function() {$(this).remove();});
			addLast(first);
		}
		
		function addLast(first){
			last = '<li style="display:none">'+first+'</li>';
			$('ul#listticker').append(last)
			$('ul#listticker li:last')
			.animate({opacity: 1}, speed)
			.fadeIn('slow')
		}
	
	interval = setInterval(removeFirst, pause);
});

*/

// Product and members page forms

$(document).ready(function(){

	$('#browse-members').change(function() {
	  $('#search-members').submit();
	  //alert("hello");
		});
	$('#browse-products').change(function() {
	  $('#search-products').submit();
	});
	
	$('#browse-brands').change(function() {
	  $('#search-brands').submit();
	});

});

//Load the products page

$(document).ready(function(){

	if($('#product-group').val())
	{
		//alert($('#product-group').val());
	id=$('#product-group').val();
	
	var ajax_url="http://www.bheta.co.uk/wp-content/themes/bheta/members-browse-products.php?browse-products="+id;
	
	$.ajax({
  	url: ajax_url,
  	success: function(data) {$('#members-result').html(data)}
		
		
		})//end $.ajax

	
	
	}//end if


});

//Displays r/h column with member link

function show_info(id,e)
{
	var ajax_url="http://www.bheta.co.uk/wp-content/themes/bheta/members-ajax-details.php?id="+id;
	//$('.members-list-right').css('display','none');
	
	img="<img src='http://www.bheta.co.uk/wp-content/themes/bheta/images/ajax-loader.gif' alt='loading' />";
	$('.members-list-right').css('text-align','center');
	$('.members-list-right').html(img);
	
	
	$.ajax({
  	url: ajax_url,
  	success: function(data) {
	$('.members-list-right').css('text-align','left');
	$('.members-list-right').html(data);
	$('.members-list-right').css("display","block");
    $('.members-list-right').css('margin-top',(e-1)*12+'px');

	//$('.locator-members-'+id).css("position","absolute");
	//$('.locator-members-'+id).css("margin-left","371px");
	$('.member-link').css("border","none");
  	$('#l'+id).css("border-bottom","solid 1px #333333");
	$('#l'+id).css("display","block");
	$('#l'+id).css("width","100%");
	
	}// end sucess
	
	});//end ajax



}//End function


/* Members secure area */


$(document).ready(function(){
						
$('.members-item').hide();
$('.members-item:first').show();
$('.show-info:first').addClass('selected');
//$('.show-info').css('border-bottom','solid 1px #ffffff');	
//$('.show-info:first').css('border-bottom','solid 1px #000000');
	$('.show-info').hover(function(){
	//$('.show-info').css('border-bottom','solid 1px #ffffff');
	$('.show-info').removeClass('selected');
	$(this).addClass('selected');
	var pos=this.rel;
	$('#members-item-'+this.id).css('margin-top',(pos-1)*20+'px');
	$('.members-item').hide();
	$('#members-item-'+this.id).show();
 
	});/*end show info*/
						   
});/*End doc ready*/

//Homepage..

$(document).ready(function(){
						   
	$('#slideshow').fadeSlideShow();
						   
});/*End doc ready*/
						   
						   





