﻿


$(document).ready(function() {
   $(" #menu ul ").css({display: "none"}); // Opera Fix
$(" #menu >.menu-item,.menu-item-first").hover(function(){

		$(" #menu .menu-item,.menu-item-first").css('background-image','url(/images/bkg-tab.png)');

		$(this).css('background-image','url(/images/bkg-tab-dark.png)');

		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);

		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		$(this).mouseout(function(){$(this).css('background-image','url(/images/bkg-tab.png)');});
		});




	
    $('.item-cine').click(function() {

        //var SRC = this.parentElement.parentElement.firstChild.nextSibling.src
       
        var lastHtmlVideo = "";
        var myID = this.id;
        var myPlayerID = '#player_' + myID;
		var myCloseID='#close_player_'+myID;
		$(myCloseID).css('display', 'block');
        $('html').css('overflow', 'hidden');
        $('.boxBKG').css('display', 'block');
        $(myPlayerID).css('display', 'block');
        $(myPlayerID).css('left', (document.body.offsetWidth / 2) - 350);
		 $('.boxBKG').css('width', document.body.offsetWidth );
		$('.closeVideo').css('left',(document.body.offsetWidth / 2) + 350);
		

		if( navigator.appVersion.indexOf("MSIE 6.0")!=-1)
		{
		 $('.boxBKG').css('height', document.body.offsetHeight);
		}


		 
        lastHtmlVideo = $(myPlayerID).html();
        $(myCloseID).click(function() {
            $('.boxBKG').css('display', 'none'); $('html').css('overflow', 'scroll'); $('.boxBKG').html('');
            $(myPlayerID).css('display', 'none');
            $(myPlayerID).html(lastHtmlVideo);
			$(myCloseID).css('display', 'none');

        });


    });



});



//TELEVISION

$('#imagesTelevision').cycle({
    fx: 'scrollLeft',
    speed: 'slow',
    timeout: 0,
    next: '#next',
    prev: '#back'
});



//cargar videos e imagenes
 function Loadimages(id,numimg) {
    
   
    	$.ajax({
    	 
  			type: "POST",
  			url: "/ajax/LoadImages.aspx", 
  			data:"id=" +  id +"&numimg=" + numimg,
  			success: function(html)
  			{
  		
  			 
  			   $("#image").html(html);
  			   $("#image").slideDown("80");
  			 
  			  
  			
  			  
  			
  			}
  		});
  		
}



function Loadvideos(id,numimg) {
    
   
    	$.ajax({
    	 
  			type: "POST",
  			url: "/ajax/LoadVideos.aspx", 
  			data:"id=" +  id +"&numimg=" + numimg,
  			success: function(html)
  			{
  		
  			 
  			   $("#video").html(html);
  			   $("#video").slideDown("80");
  			 
  			  
  			
  			  
  			
  			}
  		});
  		
}

function cambiavideo(id,videoanterior,rutaimg,docid) {
   
  
   $("#imgvid").replaceWith("<div id='imgvid'><div id='"+id+"' ><img onclick=\"mostrarvideo("+id+");\"  src='/pic.aspx?w=277&img="+rutaimg+"' /></div></div>");
  

  html="<div id='capavideo'><div><div id=\"player_"+id+"\" class=\"noDisplay\"></div>"
  html += "<div id=\"close_player_" + id + "\" class=\"closeVideo\"></div></div>";
   
       $("#capavideo").replaceWith(html);
       $("#video").append("<script src='/ajax/Loadvideos.aspx?tokenid="+id+"&docid="+docid+"'></script></div>");  
         
          
  		
}

function mostrarvideo(id)
{
        var lastHtmlVideo = "";
        var myID = id;
        var myPlayerID = '#player_' + myID;
		var myCloseID='#close_player_'+myID;
		$(myCloseID).css('display', 'block');
        $('html').css('overflow', 'hidden');
       
        scrollTo(10,10); 
        $('.boxBKG').css('display', 'block');
        $(myPlayerID).css('display', 'block');
      
       
        $(myPlayerID).css('left', (document.body.offsetWidth / 2) - 350);
		 $('.boxBKG').css('width', document.body.offsetWidth );
		$('.closeVideo').css('left',(document.body.offsetWidth / 2) + 350);
		  $('boxBKG').css('height', document.body.offsetHeight);
		


		if( navigator.appVersion.indexOf("MSIE 6.0")!=-1)
		{
		 $('.boxBKG').css('height', document.body.offsetHeight);
		}


		 
        lastHtmlVideo = $(myPlayerID).html();
        $(myCloseID).click(function() {
            $('.boxBKG').css('display', 'none'); $('html').css('overflow', 'scroll'); $('.boxBKG').html('');
            $(myPlayerID).css('display', 'none');
            $(myPlayerID).html(lastHtmlVideo);
			$(myCloseID).css('display', 'none');

        });
}







