//This fn. vl remove the value during onclick 
function removeDefault()
	{
		 $('.removeDefault').each(function() {
		   
		    $(this).focus(function() {
		        if(this.value == this.defaultValue) {
		            this.value = '';
		        }
		    });
		    $(this).blur(function() {
		        if(this.value == '') {
		            this.value = this.defaultValue;
		        }
		    });
		});
	}
function autoTabs(classOfli,contentClass) 
  { 
	 $(classOfli).mouseover(function(event){
		 $(classOfli).removeClass("tabSelected");
		 $(classOfli).addClass("tabdeSelected");
		 		 
		 $(this).addClass("tabSelected");
		 
		 $(contentClass).hide();
  		 $('#tabContent-'+this.id).show();		 
	   });
	 }
function ratingHover()
{
	$(".bigstar").mouseover(function(event){
		
		$("#ratingstatus").html("<a rel='internal nofollow' href='http://poochandi.com/login.php'>Sign in</a> to rate.")
	})
}



//Update delete

$('.update-Delete').click(function(event){
    $.get("/Misc/DeleteUserUpdate.php", { id: this.id },removeActivityItem(this.id));
		});
function removeActivityItem(id)
{
  //alert('#single-'+id);
	$('#single-'+id).html('');
}

//friend comments
function friendComments(url,itemId)
{
$('#friend-comments').click(function(event){
	   if($('#tabContent-friend-comments').hasClass('inactive') )
	   {   
			    $.get(url, { id: itemId }, function(data){
	    	$('#tabContent-friend-comments')
	    	.html(data)		    	
	    	.removeClass("inactive");		    	 
		});
	   }
	   $('#tabContent-all-comments').hide();
	   $('#tabContent-friend-comments').show();
	   $('.commentTabs')
 	.removeClass("tabSelected")
 	.addClass("tabdeSelected");				 		 
				 $('#friend-comments').addClass("tabSelected");
				 });

$('#all-comments').click(function(event){		    
	 $('.commentTabs')
	 .removeClass("tabSelected")
	 .addClass("tabdeSelected");		 		 
	 $('#all-comments').addClass("tabSelected");
	 $('#tabContent-friend-comments').hide();
	 $('#tabContent-all-comments').show();			
		});
}
function commentInit(url,itemId)
{
	$('#showFriendComments').click(function(event){
	   if($('#friendCommentBlock').hasClass('inactive') )
	   {   
			$.get(url, { id: itemId }, function(data){
	    	$('#friendCommentBlock')
	    	.html(data)		    	
	    	.removeClass("inactive");		    	 
		});
	   }
	   $('#allCommentBlock').hide();
	   $('#friendCommentBlock').show();
	   
				 });

$('#showAllComments').click(function(event){		    
	 $('#friendCommentBlock').hide();
	 $('#allCommentBlock').show();			
		});
}
//search form
$('#google-search').submit(function(){
	var keyword=$("#google-search-q").val();
	if(keyword=='Type to search')
	{
		alert('Enter keyword to search');
		return false;
	}
	
});

//redirect user after login
function loginRedirect()
{
	$("a[href*='http://poochandi.com/login.php']").click(function(event){
		var url =window.location;		
		var urlencode=escape(url);
		window.location="http://poochandi.com/login.php?continue="+urlencode;
	});
}
removeDefault();
loginRedirect();
//FBCONNECT

            window.fbAsyncInit = function() {
                FB.init({appId: '122232297800436', status: true, cookie: true, xfbml: true});

                /* All the events registered */
                FB.Event.subscribe('auth.login', function(response) {
                    var url =window.location;		
		var urlencode=escape(url);
		window.location="http://poochandi.com/facebook/fBRegister.php?continue="+urlencode;
                    
                });
                FB.Event.subscribe('auth.logout', function(response) {
                    window.location.reload();
                    
                });
            };
            (function() {
                var e = document.createElement('script');
                e.type = 'text/javascript';
                e.src = document.location.protocol +
                    '//connect.facebook.net/en_US/all.js';
                e.async = true;
                document.getElementById('fb-root').appendChild(e);
            }());

