jQuery.fn.extend({
	/*Obtener la posicion top y lef de un objeto*/
	_getXY:function(dir,obj) {
	  	var cur = 0;
		var objN=(obj!=null)? obj:document.getElementById($(this).attr("id"))
		if (objN.offsetParent){
			while (objN.offsetParent){
				if(dir=="x") cur += objN.offsetLeft
				else if(dir=="y")cur += objN.offsetTop
				objN = objN.offsetParent;
			}
		}else if (objN.x || objN.y){
			if(dir=="x")  cur += objN.x;
			if(dir=="y")  cur += objN.y;
		}
		return cur;   
	},
	getX:function() {return $(this)._getXY("x")},
	getY:function() {return $(this)._getXY("y")},
	exists:function(){ return $(this).size()>0},
	del:function(){return $(this).empty().remove()}, 
	urlParams:function(){
		var url=$(this).attr("href")
		return (url.indexOf("?")!=-1)? {dir:url,host:url.split("?")[0], parameters:url.split("?")[1]} : {dir:url,host:url, parameters:""}
	},
	createElem:function(tag,properties,styles,text){
		var el=document.createElement(tag)
        if(properties!=null)for (var i in properties){var v=eval("properties."+i);$(el).attr(i,v)}
		if(styles!=null)for (var x in styles){
			var w=eval("styles."+x);
			$(el).css(x,w)
		}
		if(text!=null){el.appendChild(document.createTextNode(text))}
	
		return el;   
	},
	appendElement:function(tag,properties,styles,text){$(this).append($(this).createElem(tag,properties,styles,text))},
	getCommonStyles:function(){
		//$(this)
	},
	ajaxShowPreloader:function(ids,styles,funct){
		if($("#"+ids).exists()){$("#"+ids).show()}
		else{$("#wrapper").appendElement("div",{id:ids},styles)}
		$("#"+ids).fadeTo(100, 0.25);
		if(funct)funct()
	},
	ajaxHidePreloader:function(ids){
		$("#"+ids).fadeTo(300,0,function(){$(this).del()})
	},
	ajaxGetContent:function(url,theid,styles,funct,rewrite){
		var rewriteLay=(rewrite==null ||rewrite==true )? true:false;
		var ajaxLay=$(this)
		if(styles==null){
			ajaxLay.styles={
				position:"absolute",
				width:$(this).width()+ parseInt($(this).css("paddingRight"))+ parseInt($(this).css("paddingLeft")),
				height:$(this).height()+ parseInt($(this).css("paddingTop"))+ parseInt($(this).css("paddingBottom")),
				left:$(this).getX(),
				top:$(this).getY(),
				border:"1px solid #ccc",
				background:"#fff url(img/ico_loading.gif) no-repeat center center"
			}
		}
		$(this).css("visibility","hidden")
		var aj=$.ajax({
	        url: url,
	        async:true,
	        beforeSend: function(obj){ajaxLay.ajaxShowPreloader("load"+theid,ajaxLay.styles)},
	        complete: function(obj, go){
				
	            if(go=="success"){
					if(rewriteLay){
						ajaxLay.html(obj.responseText);
						ajaxLay.ajaxHidePreloader("load"+theid);
						ajaxLay.show();
						ajaxLay.css("visibility","visible");
					}else {}
					if(funct)funct();
	            }
	        },
	        error: function(objeto, quepaso, otroobj){
	            alert("Error en la peticon ajax: "+quepaso);
	        },			
	        dataType: "html",
	        type: "get"
		});
	}
	
});	

(function($){
	$.createElem2 = function(tag,properties,styles,text){
		
		var el=document.createElement(tag)
        if(properties!=null)for (var i in properties){var v=eval("properties."+i);$(el).attr(i,v)}
		if(styles!=null)for (var x in styles){
			var w=eval("styles."+x);
			$(el).css(x,w)
		}
		if(text!=null){el.appendChild(document.createTextNode(text))}
		return el;   
	}
	
})(jQuery);
(function($){

	// to track if the mouse button is pressed
	var isMouseDown    = false;
	var limits=[];

	// to track the current element being dragged
	var currentElement = null;

	// callback holders
	var dropCallbacks = {};
	var dragCallbacks = {};

	// global position records
	var lastMouseX;
	var lastMouseY;
	var lastElemTop;
	var lastElemLeft;
	
	var limits=[];

	// returns the mouse (cursor) current position
	$.getMousePosition = function(e){
		var posx = 0;
		var posy = 0;

		if (!e) var e = window.event;

		if (e.pageX || e.pageY) {
			posx = e.pageX;
			posy = e.pageY;
		}
		else if (e.clientX || e.clientY) {
			posx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
			posy = e.clientY + document.body.scrollTop  + document.documentElement.scrollTop;
		}

		return { 'x': posx, 'y': posy };
	}

	// updates the position of the current element being dragged
	$.updatePosition = function(e) {
		var pos = $.getMousePosition(e);

		var spanX = (pos.x - lastMouseX);
		var spanY = (pos.y - lastMouseY);
		
		var xxPos=(lastElemLeft + spanX);
		var yyPos=(lastElemLeft + spanX);
		//limits
		
		
		//if(xxPos>80 && xxPos<937){
			$(currentElement).css("left", (lastElemLeft + spanX));
		//}
	}

	// when the mouse is moved while the mouse button is pressed
	$(document).mousemove(function(e){
		if(isMouseDown){
			// update the position and call the registered function
			$.updatePosition(e);
			
			if(dragCallbacks[currentElement.id] != undefined){
				dragCallbacks[currentElement.id](e);
				
			}
			
			return false;
		}
	});

	// when the mouse button is released
	$(document).mouseup(function(e){
		if(isMouseDown){
			isMouseDown = false;
			if(dropCallbacks[currentElement.id] != undefined){
				dropCallbacks[currentElement.id](e);
			}

			return false;
		}
	});

	// register the function to be called while an element is being dragged
	$.fn.ondrag = function(callback){
		return this.each(function(){
			dragCallbacks[this.id] = callback;
		});
	}

	// register the function to be called when an element is dropped
	$.fn.ondrop = function(callback){
		return this.each(function(){
			dropCallbacks[this.id] = callback;
		});
	}

	// set an element as draggable - allowBubbling enables/disables event bubbling
	$.fn.easydrag = function(allowBubbling){ //left,right//,top,bottom

		return this.each(function(){
			// if no id is defined assign a unique one
			if(undefined == this.id) this.id = 'easydrag'+time();
			
	
			// change the mouse pointer
			$(this).css("cursor", "move");

			// when an element receives a mouse press
			$(this).mousedown(function(e){			

				// set it as absolute positioned
				$(this).css("position", "absolute");

				// set z-index
				$(this).css("z-index", "10000");

				// update track variables
				isMouseDown    = true;
				currentElement = this;

				// retrieve positioning properties
				var pos    = $.getMousePosition(e);
				lastMouseX = pos.x;
				lastMouseY = pos.y;

				lastElemTop  = this.offsetTop;
				lastElemLeft = this.offsetLeft;
			
		

				$.updatePosition(e);
		
				
				return allowBubbling ? true : false;
			});
		});
	}

})(jQuery);


var Ticker={
	init:null,
	cont:1,
	tot:0,
	load:function(){
	
	
		$("#ticker").css("position","absolute")
		$("#ticker").css("left",0)
		$("#ticker").css("top",$("#ticker").getY()-10)
		$("#ticker").css("zIndex","3330")
		$("#ticker").css("width",760)
		
		$("#cticker").css("position","absolute")
		$("#cticker").css("left",0)
		$("#cticker").css("top",0)

		Ticker.tot=$("#cticker>ul>li").size()
		Ticker.init=setInterval("Ticker.move()",5000) 	
		
	
	},
	move:function(){
		
		$("#cticker").animate({top:-1*Ticker.cont*25},1000)
		Ticker.cont++
		if(Ticker.tot==Ticker.cont){
			Ticker.cont=0
			$("#cticker").animate({top:-1*Ticker.cont*25+25},10)
		}
	}
}	
var popUp={
        xWin_min:15,
        yWin_min:70,
        xWin:0,
        yWin:0,
	load:function(automatic){
		$(".viewvideox").each(function(i){
			$(this).bind("click", function(){
                                /* NOTA de Santi a Santi: Esto se podría sacar en un método redim.*/
                                popUp.xWin = popUp.xWin_min + document.documentElement.scrollTop;
                                popUp.yWin = popUp.yWin_min + document.documentElement.scrollLeft;
				popUp.open($(this).attr("href"));
                                return false;
			})
		})
	},
        
        openArtur:function(url){
         popUp.xWin = popUp.xWin_min + document.documentElement.scrollTop;
                                popUp.yWin = popUp.yWin_min + document.documentElement.scrollLeft;
				popUp.open(url);
                                return false;
        
        },
        
        
	open:function(url){
    		if(!$("#pop1").exists()){
			popUp.create(url)			
                        return false;
		}
	},
	close:function(){
		$("#pop1").del();
		$("#wrappop1").del();
		$("#wrappop2").del();
	}, 
	create:function(_url){
		
                var topWin=popUp.xWin;
		var leftWin=popUp.yWin;
		var widthWin=760;
		var heighWin=605;
		var borderWin=10;
		var borderColWin="#000";
		var opacityWin=0.5;
		
		var wrappop=$.createElem2("div",
			{id:"wrappop1"},
			{width:parseInt(widthWin+borderWin*2)+ "px",height:parseInt(heighWin+borderWin*2) + "px",backgroundColor:borderColWin,position:"absolute",left:leftWin+"px",top:topWin+"px",zIndex:100}
		)
		var wrappop2=$.createElem2("div",
			{id:"wrappop2"},
			{width:parseInt(widthWin+borderWin*2)+ "px",height:"115px",backgroundColor:"#333",position:"absolute",left:leftWin+"px",top:topWin+"px",zIndex:101}
		)
		var pop=$.createElem2("div",
			{id:"pop1"},
			{width:widthWin+ "px",height:heighWin+"px",backgroundColor:"#999",position:"absolute",left:parseInt(leftWin+borderWin)+"px" ,top:parseInt(topWin+borderWin)+"px",zIndex:102}
		)
		var ifrPop=$.createElem2("iframe",
			{id:"ifrPop1",marginwidth:"0",marginheight:"0",frameBorder:"0",scrolling:"no",width:widthWin,height:heighWin},
			{padding:"0",margin:"0"}
		)
                
                
		/*ifrPop.src="iframe.html?id=1"*/
		
		$("body").append(wrappop)
		$("body").append(wrappop2)
		$(pop).append(ifrPop)
		$("body").append(pop)
		
		$("#pop1").fadeTo(1000, 1);
		$("#wrappop1").fadeTo(1000, 0.5);
		$("#wrappop2").fadeTo(1000, 1);
                
		ifrPop.src=_url


	}
	
}
var More={
	txt1:"Ver Más ...",
	txt2:"Ocultar ...",
	viewLoad:function(){
		
		$(".hdtype1").each(function(i){
			var maxHeight=$(this).parent().height()
			var minHeight=100;
			$(this).appendElement("div",{id:"cpView"+i},{height:"50px"})
			$(this).appendElement("a",{id:"btView"+i,className:"btdown1"},{width:"100px",cursor:"hand",marginTop:"100px",color:"#f8981d"},More.txt1)
			$(this).parent().css("height",minHeight)
			$(this).parent().css("overflow","hidden")
			$(this).bind("click",function(){
				if($("#btView"+i).text()==More.txt1){
					$(this).parent().animate({height:maxHeight,opacity:1},1000)
					$("#btView"+i).text(More.txt2)
					$("#btView"+i).attr("class","btup1")
				}else{
					$(this).parent().animate({height:minHeight,opacity:1},1000)
					$("#btView"+i).text(More.txt1)
					$("#btView"+i).attr("class","btdown1")
				}
			})
		})
	}
}

var ListGen={
	
	viewProgramsLoad:function(){
		var withSelect=$("#selProgram").attr("class").indexOf("nolist")==-1

		$(".viewAll").each(function(i){
			$(this).bind("click",function(){ListGen.viewAll();return false})
		})
		
		if(withSelect){
			var sel=document.createElement("select")
			sel.id="selOpts1"
			sel.options[0]=new Option("seleccione opcion",-1);
			$("#selProgram").before(sel)
			$("#selOpts1").css({fontSize:"11px",color:"#666",position:"relative",left:"10px",top:"-5px"})
		
			$("#selOpts1").bind("change",function(){
							
				if($(this).val()!=-1){
					//ListGen.closeAll()
					var o=$("#selProgram >li").eq($(this).val()-1)
					o.find("h3").attr("class","linkLess")
                                        o.attr("class","programOn")
					o.find("h3").attr("id","anchor" + $(this).val())
					o.find("div").show()
					var y=$("#anchor"+$(this).val())
					window.scrollTo(null ,y.getY())
						
				}
			})
		}
		$("#selProgram >li").each(function(i){
			
			var lnk=$(this).find("h3")
			
			if(withSelect)sel.options[i+1] = new Option($(this).find("h3").text(),i+1);
			
			$(this).find("h3").bind("click",ListGen.viewProgram)
			if($(this).attr("class")=="programOn") var a;
			else $(this).find("div").hide()
			
		})
	}, 
	viewProgram:function(viewAll){
		if($(this).attr("class")=="linkMore" ){
                        $(this).attr("class","linkLess")
			$(this).parent().find("div").show("fast")
                        $(this).parent().attr("class","programOn")
		}else {
			$(this).attr("class","linkMore")
			$(this).parent().find("div").hide("slow")
                        $(this).parent().attr("class","")
		}			
		return false;
	},
	viewAll:function(){
		$("#selProgram >li").each(function(i){
			$(this).find("h3").attr("class","linkLess")
			$(this).parent().find("div").show()
                        var temporal = $(this).find("h3").attr("class","linkLess")
                        temporal.parent().attr("class","programOn")
		})
	}, 
	closeAll:function(){
		$("#selProgram >li").each(function(i){
			$(this).find("h3").attr("class","linkMore")
			$(this).parent().find("div").hide()
		})
	}
}

var photoScroll=_Ps={
	num_elem:5,
	num_max:0,
	cont:2,
	urlNx:"",
	urlPv:"",
	load:function(){
	
		class_max=$("#flashMovieProgram1").attr('className');
		_Ps.num_max=class_max.substr(class_max.indexOf('maxnum_')+7);	
		_Ps.urlNx=$("#sig").attr("href")
		_Ps.urlPv=$("#ant").attr("href")		
		
		$("#sig").bind("click",function(){_Ps.next();return false})
		$("#ant").bind("click",function(){_Ps.prev();return false})
		
		$("#sig").attr("href","#");
		$("#ant").attr("href","#");
			
		var wPrin=$("#imgroll img:eq(0)").width();
		var hPrin=$("#imgroll img:eq(0)").height();
	
		var initX=parseInt($("#imgroll").getX()+ ($("#flashMovieProgram1").width()/2 -wPrin/2)) ;
		$("#imgroll div").css({"position":"relative","top":"200px" })

		$("#imgroll li img").each(function(i){
			
			var w;var h;var l;var t;
			var w2;var h2;var l2;var t2;	
			
			var imgRoll=$("#flashMovieProgram1 li img")
                         
			$(this).css("position","absolute")
          
			$(this).css("zIndex",$(this).size()-i)
		
			if(i==0){
                            
				$(this).css("left",initX)
                                


			}else if(i==1 || i==2){
				w=($(this).width()*.66)
				h=($(this).height()*.66)
				l=(i==1)? initX-w/2+20:(parseInt(wPrin+initX)-w/2)-20	
				t=parseInt(imgRoll.eq(0).getY()+(hPrin/2 - h/2))
				_Ps.redim($(this),w,h,l,t)
				
			}else if(i==3 || i==4){
				w2=($(this).width()*.50)
				h2=($(this).height()*.50)
				
				l2=(i==3)?
					parseInt(imgRoll.eq(1).css("left"))-w2/2+20:
					parseInt(imgRoll.eq(2).css("left"))+parseInt(imgRoll.eq(2).width())- w2/2-20
					
				t2=parseInt(5	+imgRoll.eq(1).getY()+(imgRoll.eq(1).height()/2 - h2/2))
				_Ps.redim($(this),w2,h2,l2,t2)
			}
		})
	
     
	
		_Ps.w1=$("#f1").width()
		_Ps.h1=$("#f1").height()
		_Ps.w2=$("#f3").width()
		_Ps.h2=$("#f3").height()
		_Ps.w3=$("#f5").width()
		_Ps.h3=$("#f5").height()
		

		
		_Ps.x1=$("#f1").getX()
		_Ps.y1=$("#f1").getY()
		_Ps.x2=$("#f2").getX()
		_Ps.y2=$("#f2").getY()	
		_Ps.x3=$("#f3").getX()
		_Ps.y3=$("#f3").getY()
		_Ps.x4=$("#f4").getX()
		_Ps.y4=$("#f4").getY()
		_Ps.x5=$("#f5").getX()
		_Ps.y5=$("#f5").getY()	
                
                
		$("#toolsRoll").css({position:"absolute",top:parseInt(_Ps.h1 + _Ps.y1+15)})	
		$("#toolsRoll").css("left",parseInt(_Ps.x1 +_Ps.w1/2)-$("#toolsRoll").width()/2)

		$("#conttxtPhoto").css({position:"absolute",top:-100})	
		$("#conttxtPhoto").html($("#flashMovieProgram1 li div").html())
		$("#conttxtPhoto").animate({top:0},500)
	
		
		$("#f1").css({position:"absolute",left:_Ps.x1,top:_Ps.y1})	
		$("#f2").css({position:"absolute",left:_Ps.x2,top:_Ps.y2})	
		$("#f3").css({position:"absolute",left:_Ps.x3,top:_Ps.y3})	
		$("#f4").css({position:"absolute",left:_Ps.x4,top:_Ps.y4})	
		$("#f5").css({position:"absolute",left:_Ps.x5,top:_Ps.y5})
                
                

//		alert(_Ps.urlNx+"&cont="+_Ps.cont)
		$("#flashMovieProgram1").css('visibility','visible')
		_Ps.next(_Ps.urlNx+"&cont="+_Ps.cont)
		
			
	}, 
	redim:function(obj,w,h,l,t){

		$(obj).css("width",w)
		$(obj).css("height",h)
		$(obj).css("left",l)
		$(obj).css("top",t)	
	},
	next:function(){
		$("#sig").unbind("click")
                $("#ant").unbind("click")
		if(((_Ps.cont < (_Ps.num_max))&&(_Ps.cont > _Ps.num_elem)) || (_Ps.cont == 1))
			_Ps.cont++ 
		else if((_Ps.cont < _Ps.num_elem )&& (_Ps.cont%2==0))
			_Ps.cont+=2
		else if((_Ps.cont <= _Ps.num_elem )&& (_Ps.cont%2!=0))
			_Ps.cont-=2;
		else if((_Ps.cont == (_Ps.num_max))&& (_Ps.cont != 5))
			_Ps.cont=_Ps.num_elem
		
		if(_Ps.cont > _Ps.num_max) _Ps.cont = _Ps.num_max
					
	
		var objColl=$("#flashMovieProgram1 li img")

		var newImg=$.ajax({
	        url: _Ps.urlNx+"&cont="+_Ps.cont,
	        async:true,
	        beforeSend: function(obj){},
	        complete: function(obj, go){
		
	            if(go=="success"){
					$("#f1").css({zIndex:4})	
					$("#f2").css({zIndex:5})	
					$("#f3").css({zIndex:3})	
					$("#f4").css({zIndex:3})	
					$("#f5").css({zIndex:3})	
		
					$("#f1").animate({width:_Ps.w2,height:_Ps.h2,left:_Ps.x3,top:_Ps.y3},500,function(){$(this).attr("id","f3")})
					$("#f2").animate({width:_Ps.w1,height:_Ps.h1,left:_Ps.x1,top:_Ps.y1},800,function(){
						$(this).attr("id","f1")
						$("#sig").bind("click",function(){_Ps.next();return false})
                                                $("#ant").bind("click",function(){_Ps.prev();return false})
					})
					$("#f3").animate({width:_Ps.w3,height:_Ps.h3,left:_Ps.x5,top:_Ps.y5},500,function(){
						$(this).attr("id","f5")
					})
					$("#f4").animate({width:_Ps.w2,height:_Ps.h2,left:_Ps.x2,top:_Ps.y2},500,function(){
						$(this).attr("id","f2")
						
						$("#imgroll").appendElement("li",{id:"liNext"+_Ps.cont},null)
						$("#liNext"+_Ps.cont).html(obj.responseText)
						
						$("#f4").css({zIndex:1,position:"absolute",width:_Ps.w3,height:_Ps.w3,left:_Ps.x4,top:_Ps.y4})	
						$("#f4").animate({width:_Ps.w3,height:_Ps.h3,left:_Ps.x4,top:_Ps.y4},500)
						
					})
					$("#f5").hide(function(){
						$(this).parent().del()
						
					})	
					
					
					$("#conttxtPhoto").css({position:"absolute",top:-100})	
					$("#conttxtPhoto").html($("#f2").parent().next().html())
					$("#conttxtPhoto").animate({top:0},500)		
					
	            }
	        },
	        error: function(objeto, quepaso, otroobj){
	            alert("Error en la peticon ajax: "+quepaso);
	        },			
	        dataType: "html",
	        type: "post"
		});
		
		//$("#sig").bind("click",function(){_Ps.next();return false})
		
	},
	prev:function(){
		$("#ant").unbind("click")
                $("#sig").unbind("click")

		if((_Ps.cont > (_Ps.num_elem+1) )||(_Ps.cont == 2))
			_Ps.cont-- 
		else if((_Ps.cont < (_Ps.num_elem+2) )&& (_Ps.cont%2==0))
			_Ps.cont-=2
		else if((_Ps.cont < (_Ps.num_elem) )&& (_Ps.cont%2!=0))
			_Ps.cont+=2		
		else if (_Ps.num_max>_Ps.num_elem)
			_Ps.cont =_Ps.num_max
		else if (_Ps.num_max==_Ps.num_elem)
			_Ps.cont--;

		
		var objColl=$("#flashMovieProgram1 li img")               
                
		var newImg=$.ajax({
                     url: _Ps.urlPv+"&cont="+_Ps.cont,
                     async:true,
                    beforeSend: function(obj){},
                     complete: function(obj, go){
		
	            if(go=="success"){
					
					$("#f1").css({zIndex:4})	
					$("#f2").css({zIndex:3})	
					$("#f3").css({zIndex:5})	
					$("#f4").css({zIndex:3})	
					$("#f5").css({zIndex:3})	
		
					$("#f1").animate({width:_Ps.w2,height:_Ps.h2,left:_Ps.x2,top:_Ps.y2},300,function(){$(this).attr("id","f2")})
					$("#f2").animate({width:_Ps.w3,height:_Ps.h3,left:_Ps.x4,top:_Ps.y4},800,function(){
						$(this).attr("id","f4")
						$("#ant").bind("click",function(){_Ps.prev();return false})
                                                $("#sig").bind("click",function(){_Ps.next();return false})
					})
					$("#f3").animate({width:_Ps.w1,height:_Ps.h1,left:_Ps.x1,top:_Ps.y1},300,function(){
						$(this).attr("id","f1")
					})

					$("#f4").hide(function(){
						$(this).parent().del()
						
					})	
					$("#f5").animate({width:_Ps.w2,height:_Ps.h2,left:_Ps.x3,top:_Ps.y3},300,function(){
		
						$(this).attr("id","f3")
						$("#imgroll").appendElement("li",{id:"liPrev"+_Ps.cont},null)
						$("#liPrev"+_Ps.cont).html(obj.responseText)
						$("#f5").css({zIndex:1,position:"absolute",width:_Ps.w3,height:_Ps.w3,left:_Ps.x5,top:_Ps.y5})	
						$("#f5").animate({width:_Ps.w3,height:_Ps.h3,left:_Ps.x5,top:_Ps.y5},300)
						
					})	
					
					$("#conttxtPhoto").css({position:"absolute",top:100})	
					$("#conttxtPhoto").html($("#f3").parent().next().html())
					$("#conttxtPhoto").animate({top:0},500)														
	            }
	        },
	        error: function(objeto, quepaso, otroobj){
	            alert("Error en la peticon ajax: "+quepaso);
	        },			
	        dataType: "html",
	        type: "post"
		});
	//	$("#ant").bind("click",function(){_Ps.prev();return false})
	}
}

var carrusel={
        so:"",
	load:function(tran,time){
		var genericDt=$("#carruselFlash>ul").attr("id").split("_")
		carrusel.so = new SWFObject(genericDt[2] + "carrusel.swf", "movie", "605", "289", "9", "#FFFFFF");
		carrusel.so.addParam("wmode","transparent")
		carrusel.so.addVariable("tipo" , genericDt[0]);
		carrusel.so.addVariable("orden" , genericDt[1]);
		var ruta="";
		var auxStr = "";
		$("#carruselFlash>ul>li").each(function(i){
			
			var titF=$(this).find("h3").text()
			var txtF=$(this).find("span")
			var txt1F= replace(txtF.eq(0).text(),"\"","&quot;")
			var lnkF=$(this).find("a")
			var lnkFHref=lnkF.attr("href")
			var lnkFTarget=lnkF.attr("target")
			//var lnkFHref= encodeURIComponent(lnkF.attr("href")) 
			var lnkFRel=lnkF.attr("rel")
			var imgArray = lnkFRel.split("/");
			var img= imgArray[imgArray.length-1]
			if(i==0){
				for(i=0;i<imgArray.length-1;i++){
					ruta += imgArray[i] +"/";
				}
			}
			auxStr += img + "|"+ titF +"| |"+  lnkFHref + "|" + lnkFTarget + "|"+ txt1F + "||";
			//carrusel.so.addVariable("movie_"+parseInt(i+1) , "swf/plantilla"+idF+".swf|"+lnkFHref+"|"+lnkFRel+"|"+txt1F+"|"+titF+"|"+txt2F+"");
		})
		$("#carruselFlash").show();
                $("#carruselFlash").css("visibility","visible");
		auxStr = auxStr.substring(0,auxStr.length-2)
		carrusel.so.addVariable("ruta",ruta);
		carrusel.so.addVariable("images",auxStr);
		carrusel.so.write("carruselFlash");
	}	
}
function replace(texto,s1,s2){
	return texto.split(s1).join(s2);
}

var VisorInPage={
    load:function(){
        $("#prevMultiZone").bind("click",VisorInPage.prevPage)
        $("#nextMultiZone").bind("click",VisorInPage.nextPage)
        if($("#tabMultiZone").exists()){$("#tabMultiZone").bind("click",VisorInPage.changeTab)}
        $("#wrapMultiZone").css("visibility","visible")
        
    },
    nextPage:function(url){
        
        $("#wrapMultiZone").ajaxGetContent($("#nextMultiZone").attr("href"),1,null, function(){ 
            VisorInPage._reBind()
        })
        return false;
    },
    prevPage:function(url){
        $("#wrapMultiZone").ajaxGetContent($("#prevMultiZone").attr("href"),1,null, function(){
            VisorInPage._reBind()
        })
        return false;
    },
    changeTab:function(){
        $("#wrapMultiZone").ajaxGetContent($("#tabMultiZone").attr("href"),1,null, function(){
            VisorInPage._reBind()
        })
        return false;
    }, 
    _reBind:function(){
        VisorInPage.load();
        if($(".viewvideox").exists()){popUp.load()}
    }
}

var GeneralPagination={
    load:function(){
           $("#page1").bind("change",function(){GeneralPagination.send(1)})
           $("#page2").bind("change",function(){GeneralPagination.send(2)})
    },
    send:function(id){
        document.getElementById("pag"+id).submit()
    }
}

var GenericPopUp={
    load:function(){
        $(".popUp").each(function(i){
            $(this).bind("click", GenericPopUp.open)
        })
    },
    open:function(){
        var v=window.open($(this).attr("href"),"", "width=800,height=630,scrollbars=yes")
        return false;
    }
}
