$(function(){	
	$('#members').tabs();
	});
    

$(document).ready(function(){
			$('#contact_form').ajaxForm(function(data) {
				if (data==1){
					$('#success_c').fadeIn("slow");
					$('#contact_form').resetForm();
					setTimeout(function()
					{
 						 $('#success_c').fadeOut();

					}, 3000); 
										
				}
				else if (data==2){
					$('#fail_c').fadeIn("slow");
					setTimeout(function()
					{
 						 $('#fail_c').fadeOut();

					}, 3000); 
				}
                 else if (data==3){
					$('#fail2_c').fadeIn("slow");
					setTimeout(function()
					{
 						 $('#fail2_c').fadeOut();

					}, 3000); 
				}
			});
		});
        
$(document).ready(function(){
			$('#review_form').ajaxForm(function(data) {
				if (data==1){
				    $('#review_form').resetForm();
                    $('#success').fadeIn("slow");					
					setTimeout(function()
					{
 						 $('#success').fadeOut();
                         window.location.reload();                         

					}, 3000); 
										
				}
				else if (data==2){
					$('#fail').fadeIn("slow");
					setTimeout(function()
					{
 						 $('#fail').fadeOut();

					}, 3000); 
				}
                else if (data==3){
					$('#fail2').fadeIn("slow");
					setTimeout(function()
					{
 						 $('#fail2').fadeOut();

					}, 3000); 
				}
			});
		});
        

    
//Facebook Connect
function auth_using_fb() {
  //get the users data from FB
  var viewer  = FB.Facebook.apiClient.fql_query(

      'SELECT name, pic_square_with_logo,profile_url,proxied_email  FROM user WHERE uid='+FB.Facebook.apiClient.get_session().uid,

      function(results) {
        update_userbox( results[0].name,
                        results[0].pic_square_with_logo,
                        results[0].profile_url,
                        'FB.Connect.logoutAndRedirect("./reviews.php");return false;',results[0].proxied_email)
      }
  );
}

function update_userbox(name, image, url, logout,proxied_email) {

  //populate the data in #userbox and show it
  $('#userbox').html( "<a href='"+url+"'>"
                    + "<img alt='"+name+"' src='"+image+"' />"
                    + "Logged in as " + name + "</a> "
                    + "(<a href='./reviews.php' onclick='" + logout + "'>logout</a>)" ).show();
  
    //populate the values of the inputs
  //using data from serivce
  $('#name').val(name);
  $('#email').val(proxied_email);
  $('#url').val(url);
  $('#image').val(image);
  
  //hide name input and service
  //login buttons
  $('#userinfo').hide();

}

$(document).ready(function(){
$(function(){ $("#review_large").pagination(); });
});


$(function() {
    $('#sport_pics .show').lightBox();
});





