
$j(document).ready(function(){
		MTV.loadMemberbarHTML();
		Geek.Pagination.init();
	});
	var Geek = new function(){
		this.Pagination = new function(){
		this.init = function(){
			$j('#featuredVideos .paginatefooter a').each(function(){
				var strFunction = $j(this).attr('onmousedown').toString();
				var aryFunction = strFunction.split(",");
				//Handle cross browser handling of apostraphe
				if(aryFunction[0].indexOf("'") != -1){
					var p_hide =  aryFunction[0].substring(aryFunction[0].indexOf("'")+1,aryFunction[0].lastIndexOf("'"));
					var p_show = aryFunction[1].substring(aryFunction[1].indexOf("'")+1,aryFunction[1].lastIndexOf("'"));
					var p_id = aryFunction[2].substring(aryFunction[2].indexOf("'")+1,aryFunction[2].lastIndexOf("'"));
					var p_target = aryFunction[3].substring(aryFunction[3].indexOf("'")+1,aryFunction[3].lastIndexOf("'"));
				} else{
					var p_hide =  aryFunction[0].substring(aryFunction[0].indexOf('"')+1,aryFunction[0].lastIndexOf('"'));
					var p_show = aryFunction[1].substring(aryFunction[1].indexOf('"')+1,aryFunction[1].lastIndexOf('"'));
					var p_id = aryFunction[2].substring(aryFunction[2].indexOf('"')+1,aryFunction[2].lastIndexOf('"'));
					var p_target = aryFunction[3].substring(aryFunction[3].indexOf('"')+1,aryFunction[3].lastIndexOf("'"));
				}
				
				$j(this).removeAttr("onmousedown");
				$j(this).bind("mousedown",{hide: p_hide, show: p_show, id: p_id, target: p_target},Geek.Pagination.pageflip);
			});
		}
		this.pageflip = function(e){
			if (document.getElementById(e.data.id+e.data.hide) != null){
				var curPage = document.getElementById(e.data.id+e.data.hide);
				var flipPage = document.getElementById(e.data.id+e.data.show);
				$j('html, body').animate({scrollTop: $j('#featuredVideos').offset().top}, 400);
				$j(curPage).slideUp(700, function(){
					$j(flipPage).slideDown(700);
				});
			}
			
		}
		
	}
}


