
jQuery(document).ready(function(){ 

    $.getJSON("jsonProgramas.php",
       function(data){
        $.each(data.items, function(i,item){
         $('.programas').prepend('<p>Test</p>');
		 /*$("<p>").attr("src", item.media.m).appendTo("#images");*/
        if ( i == 3 ) return false;
      });
    });
	
	//FAQ
	jQuery('.listaFAQ').children('dd').css({display: "none"});
	var strHref = window.location.href;
	var strHrefparam=(strHref.split("="));
	var strHrefparamValor = "#" + strHrefparam[1];
	jQuery(strHrefparamValor).slideDown();
	jQuery('.listaFAQ').children('dt').hover(function (){
		$(this).find('span').css({backgroundColor: "#413F3C"})},
		function (){$(this).find('span').css({backgroundColor: "#0096C4"});});
	jQuery('.listaFAQ').find('dt').click(function() {
		var answer = $(this).next();
		if (answer.is(':visible')) {
			answer.slideUp();
			//answer.toggle("slow");
		} else {
			answer.slideDown();
		}
	});
	
	
	
	//HOME Rollover y click
	 jQuery(".listaCapitulos").css({display: "none"});

	 jQuery(".programas").children("li").children("img").mouseover(function() {
		 jQuery(this).animate({   // <img>
      width: "205px",
			height: "101px",
      marginLeft: "7px"
    }, 200 );
		 jQuery(this).prev().animate({ // <h2>
		  width: "286px"
		}, 200 );
	 jQuery(this).next().animate({ // <p>
	  	width: "264px"
		}, 200 );
		 jQuery(this).next().next().animate({ // <h3>
	  	marginLeft: "12px"
		}, 200 );
		var src_imagen =  jQuery(this).attr("src");
		var src_sin_ext=(src_imagen.split("."));
		var src_over = src_sin_ext[0] + "_ov.jpg";
		 jQuery(this).attr("src", src_over);
	});

	 jQuery(".programas").children("li").children("img").mouseout(function() {
		 jQuery(this).animate({   // <img>
     width: "196px",
			height: "92px",
      marginLeft: "0"
    }, 200 );
		 jQuery(this).prev().animate({ // <h2>
	  width: "308px"
		}, 200 );
 jQuery(this).next().animate({ // <p>
	  	width: "286px"
		}, 200 );
		 jQuery(this).next().next().animate({ // <h3>
	  	marginLeft: "0"
		}, 200 );
		var src_imagen =  jQuery(this).attr("src");
		var src_sin_ext=(src_imagen.split("_ov"));
		var src_over = src_sin_ext[0] + ".jpg";
		 jQuery(this).attr("src", src_over);
	});


	// Home IMG CLICK + capitulos
	 jQuery('.programas').find('img').click(function() {
		var answer =  jQuery(this).next().next().next();
		if (answer.is(':visible')) {
			answer.slideUp();
			//answer.toggle("slow");
			 jQuery(this).next().next().children('span').text("+");
			 jQuery(this).next().next().children('span').css({paddingLeft: "0"});
			 jQuery(this).next().next().children('span').css({paddingRight: "7px"})
		} else {
			answer.slideDown();
			 jQuery(this).next().next().children('span').text("-");
			 jQuery(this).next().next().children('span').css({paddingLeft: "2px"});
			 jQuery(this).next().next().children('span').css({paddingRight: "9px"});
		}
	});


	// Home H3 + capitulos
	 jQuery('.programas').find('h3').click(function() {
		var answer =  jQuery(this).next();
		if (answer.is(':visible')) {
			answer.slideUp();
			//answer.toggle("slow");
			 jQuery(this).children('span').text("+");
			 jQuery(this).children('span').css({paddingLeft: "0"});
			 jQuery(this).children('span').css({paddingRight: "7px"})
		} else {
			answer.slideDown();
			 jQuery(this).children('span').text("-");
			 jQuery(this).children('span').css({paddingLeft: "2px"});
			 jQuery(this).children('span').css({paddingRight: "9px"});
		}
	});
	
	
	/****** POP UP VideoTutorial *********/
	
   jQuery('#videoTutorial').children('a').click(function() {
     jQuery('#videoTutorial').children('a').attr("href");
		window.open('http://descargas.encuentro.gov.ar/pop/tutorial_video.html', 'newWin', "status,scrollbars,resizable,location,height=512,width=560");
		 return false; 
	});

	
});

