$(document).ready(function() {
 
         // facebox login popup

         
         $('a[rel*=facebox]').click().facebox({
              
          });

				var tabContainers = $('.contentWrap .toggle_c');
				var firstone = $(window.location.hash);
                                

				firstone.show().prev().addClass('active_nav').find('.open').html('close').addClass('close_cnav');
				firstone.show().prev().find('.edit').show();

			
				$('div.SectionNav a.open').click(function() {
					var openbtn = $(this).html();
					
					tabContainers.filter(this.hash).slideToggle();
					$(this).parent().toggleClass('active_nav');
					$(this).toggleClass('close_cnav');
					if (openbtn=='open') {
						$(this).html('close');
					}
					else {
						$(this).html('open');
					}
					return false;
				})
				
				$('div.SectionNav a.open').click(function() {
					$(this).next().fadeToggle();
					$(this).prev('.sort_filter').fadeToggle();
					$(this).parent().find(".sve_can").remove();
					$(this).parent().next().find(".edititin").fadeIn("fast");
					$(this).parent().next().find(".outedit").hide();
					$(this).parent().find(".save_c").hide();
				});

				$(".outedit").hide();
				$(".edit").live("click",function(){
					$(this).parent().next().find(".edititin").hide();
					$(this).parent().next().find(".outedit").fadeIn("fast");
					$(this).before('<div class="sve_can"><span>or</span><a class="cansel_c">cancel</a></div>').hide();
					$(this).parent().find(".save_c").show();
					$(this).parent().next().find("#account_details_error").slideUp();
					
					$("#my_videos").prev().find(".save_c").hide();
					$("#my_photos").prev().find(".save_c").hide();
					$("#my_favorites").prev().find(".save_c").hide();
					$("#my_videos").prev().find(".sve_can span").hide();
					$("#my_photos").prev().find(".sve_can span").hide();
					$("#my_favorites").prev().find(".sve_can span").hide();

                                        //-- php developer has added --//
                                        $("#profile_photo").prev().find(".sve_can span").hide();
                                        //-- --//

					$(".ContentNav").find(".sve_can span").hide();
                                        
					
				});
				$(".cansel_c").live("click",function(){
					$(this).parent().parent().next().find(".edititin").fadeIn("fast");
					$(this).parent().parent().next().find(".outedit").hide();
					$(this).parent().parent().find(".edit").show();
					$(this).parent().parent().find(".save_c").hide();
					$(this).parent().remove();
				});
				$('.PersonalNav li div ul li a').click(function() {
					tabContainers.filter(this.hash).show();
					$(this.hash).prev().addClass('active_nav').find('.sort_filter').show();
					$(this.hash).prev().find('.open').html('close').addClass('close_cnav').next().show();
				});
				
				
				$('.btransaction tbody tr:even').next().addClass('alterrow');
								
 });


			$(function () {
                        var tabContainers = $('div.tabs > div');
                        tabContainers.hide().filter(':first').show();
                        
                        $('div.tabs ul.tabNavigation a').click(function () {
                                tabContainers.hide();
                                tabContainers.filter(this.hash).show();
                                $('div.tabs ul.tabNavigation a').removeClass('selected');
                                $(this).addClass('selected');
                                return false;
                        }).filter(':first').click();


                        // edit my videos

                        $('.edit_video').live("click",function(){                   
                              $(this).parent().parent().find('.name').hide();
                              $(this).parent().parent().find('.dates').hide();
                              $(this).parent().parent().find('.duration').hide();
                              $(this).parent().parent().find('.save_video_data').show();
                              $(this).parent().parent().find('.cancel_video_data').show();
                              $(this).parent().parent().find('.video_title_input').val($(this).parent().parent().find('.name').html());
                              $(this).parent().parent().find('.video_title_input').show();
                              $(this).parent().parent().find('.edit_video').hide();
                              return false;
                        });

                        $('.cancel_video_data').live("click",function(){
                              $(this).parent().parent().find('.name').show();
                              $(this).parent().parent().find('.title').show();
                              $(this).parent().parent().find('.duration').show();
                              $(this).parent().parent().find('.save_video_data').hide();
                              $(this).parent().parent().find('.cancel_video_data').hide();
                              $(this).parent().parent().find('.video_title_input').hide();
                              $(this).parent().parent().find('.edit_video').show();
                              return false;
                        });

                         $('.save_video_data').live("click",function(){
                              $(this).parent().parent().find('.name').show();
                              $(this).parent().parent().find('.title').show();
                              $(this).parent().parent().find('.duration').hide();
                              $(this).parent().parent().find('.save_video_data').hide();
                              $(this).parent().parent().find('.cancel_video_data').hide();
                              $(this).parent().parent().find('.video_title_input').hide();
                              $(this).parent().parent().find('.edit_video').show();
                              return false;
                         });
                         
                       
                         // edit my photos
                         
                         $('.edit_photo').live("click",function(){                   
                              $('.Note_small').remove();
                              $(this).parent().parent().find('.name').hide();
                              $(this).parent().parent().find('.title').hide();
                              $(this).parent().parent().find('.save_photo_data').show();
                              $(this).parent().parent().find('.cancel_photo_data').show();
                              $(this).parent().parent().find('.photo_title_input').val($(this).parent().parent().find('.name').html());
                              $(this).parent().parent().find('.photo_title_input').show();
                              $(this).parent().parent().find('.edit_photo').hide();
                              return false;
                        });

                        $('.cancel_photo_data').live("click",function(){
                              $(this).parent().parent().find('.name').show();
                              $(this).parent().parent().find('.title').show();
                              $(this).parent().parent().find('.save_photo_data').hide();
                              $(this).parent().parent().find('.cancel_photo_data').hide();
                              $(this).parent().parent().find('.photo_title_input').hide();
                              $(this).parent().parent().find('.edit_photo').show();
                              return false;
                        });

                         $('.save_photo_data').live("click",function(){
                              $(this).parent().parent().find('.name').show();
                              $(this).parent().parent().find('.title').show();
                              $(this).parent().parent().find('.save_photo_data').hide();
                              $(this).parent().parent().find('.cancel_photo_data').hide();
                              $(this).parent().parent().find('.photo_title_input').hide();
                              $(this).parent().parent().find('.edit_photo').show();
                              return false;
                         });
                         
});
				

            // add and clear text on input fields

            function clearText(theField)
            {
                    if (theField.defaultValue == theField.value)
                    theField.value = '';
            }

            function addText(theField)
            {
                    if (theField.value == '')
                    theField.value = theField .defaultValue;
            }





