

$(document).ready(
	function(){
		$("#playlist").ajaxStart(
			function(){
				$("#playlist").prepend("<div style=\"position:fixed; background-color:#808080; filter:alpha(opacity=80); opacity:0.8; width:898px; height:305px;\"><img src=\"http://arahij.net/wp-content/themes/arahij21/img/loading.gif\" style=\"width:208px; height:13px; margin:140px auto; display:block;\"/></div>")
				//$("#playlist").prepend("<img src=\"http://arahij.net/wp-content/themes/arahij21/img/loading.gif\" style=\"width:12px; height:12px;\"")
				//alert(myGlobalVar);
				//(this).disabled=true;
			}
		);
		$("#playlist").ajaxComplete(
			function(){
				//alert("Borrar progreso");
				$("#playlist #charge_image").remove();
				//(this).disabled=false;
			}
		);
		$("#playlist").ajaxError(
			function(){
				alert("Error de Ajax");
			}
		);
		$("#playlist").load("http://arahij.net/wp-content/themes/arahij21/navigator_ajax.php");
		$("#navegador a.next").click(
			function(event){
				event.preventDefault();
				if ( parseInt( $(this).attr("href").replace("#", "") ) < myGlobalVar + 1 ) {
					$("#playlist").load( "http://arahij.net/wp-content/themes/arahij21/navigator_ajax.php?page=" + $(this).attr("href").replace("#", "") );
					$("#nav_page").text($(this).attr("href").replace("#", ""))
					var new_value =  parseInt( $(this).attr("href").replace("#", "") );
					//if ( new_value > myGlobalVar - 1 ) { $(this).hide(); }
					//$("#navegador a.previous").show();
					$(this).attr("href", "#" + ( new_value + 1 ) );
					var new_value = "#" + ( parseInt( $("#navegador a.previous").attr("href").replace("#", "") ) + 1 );
					$("#navegador a.previous").attr("href", new_value);
				}
			}
		);
		$("#navegador a.previous").click(
			function(event){
				event.preventDefault();
				if ( parseInt( $(this).attr("href").replace("#", "") ) > 0 ) {
					$("#playlist").load( "http://arahij.net/wp-content/themes/arahij21/navigator_ajax.php?page=" + $(this).attr("href").replace("#", "") );
					$("#nav_page").text($(this).attr("href").replace("#", ""))
					var new_value = parseInt( $(this).attr("href").replace("#", "") );
					$(this).attr( "href", "#" + ( new_value - 1 ) );
					//if ( new_value < 2 ) { $(this).hide(); }
					//$("#navegador a.next").show();
					new_value = "#" + ( parseInt( $("#navegador a.next").attr("href").replace("#", "") ) - 1 );
					$("#navegador a.next").attr("href", new_value);
				}
			}
		);
		
		$('div.post-comment-show').hide();
		
		$("p.post-comment-b a").click(
		
			function(event){
			
			
			if ($("div.post-comment-show").is(":hidden")) {
        $("div.post-comment-show").slideDown("slow");
		//$("div.post-comment-show #comment").focus();
      } else {
        $("div.post-comment-show").slideUp("slow");
      }
				return true;


			}
		
		);
		
	}
);