var imgGal;var imgGalTimer;$('table#imageGallery div.main img').ready(function(){if($('table#imageGallery div.main').size()==0){return true};imgGalSetCont();});function imgGalSetCont(){if($('table#imageGallery div.main img').width()<1){setTimeout('imgGalSetCont()',500);return true};$('table#imageGallery div.main').width($('table#imageGallery div.main img').width()).height($('table#imageGallery div.main img').height()).css({'padding':0,'margin':0});$('table#imageGallery div.main img').css({'padding':0,'margin':0});}
$(document).ready(function(){imgGalSetup();});function imgGalSetup(){if(document.getElementById("imageGallery")==undefined){return true};if($('table#imageGallery .thumbs img').size()==0){return true};var mainDiv=$('table#imageGallery div.main');$(mainDiv).css({overflow:'hidden','z-index':100,'background-repeat':'no-repeat','background-position':'center center'});imgGal={width:$(mainDiv).width(),height:$(mainDiv).height(),bottom:$(mainDiv).position().top+$(mainDiv).height(),'z-index':1,delay:3000,epO:0.3,epH:30};if($('table#imageGallery').attr('epH')!=undefined){imgGal.epH=parseInt($('table#imageGallery').attr('epH').valueOf())};if($('table#imageGallery').attr('epO')!=undefined){imgGal.epO=parseFloat($('table#imageGallery').attr('epO'))};if($('table#imageGallery').attr('delay')!=undefined){imgGal.delay=$('table#imageGallery').attr('delay').valueOf();imgGal.delay=imgGal.delay*1000};var mImage=new Array();var i=new Number();var maxW=new Number();var maxH=new Number();$('table#imageGallery .thumbs img').each(function(){i++;mImage[i]=new Image();mImage[i].src=$(this).attr('longdesc');}).click(function(){imgGalStop();imgGalShow($(this))});if(document.getElementById("scroller")!=undefined){var scOff=$("#scroller img:eq(0)").position().left+($('#scroller').width()/2);$("#scroller img").load(function(){$(this).attr("left",function(arr){if($(this).position().left-scOff<1){return 0}else{return $(this).position().left-scOff;};})});$('#imageGallery .thLeft').click(function(){imgGalStop();if($('#scroller').scrollLeft()>0){$('#scroller').animate({scrollLeft:$('#scroller').scrollLeft()-$('#scroller').width()},1000)}});$('#imageGallery .thRight').click(function(){imgGalStop();if($('#scroller').scrollLeft()<$("#scroller img:last").attr('left')){$('#scroller').animate({scrollLeft:$('#scroller').scrollLeft()+$('#scroller').width()},1000)}});};$(mImage[i]).load(function(){$('table#imageGallery div.main').css(imgGal+{'background-image':'url('+mImage[1].src+')','background-repeat':'no-repeat'});if($('table#imageGallery').attr('autorun')!=undefined){imgGalRun()}})};function imgGalShow(oImage){$('table#imageGallery div.ep').fadeOut().remove();$('table#imageGallery table.thumbs img').removeClass('sel');$(oImage).addClass('sel');$('table#imageGallery div.main').css({'background-image':'url('+$('table#imageGallery div.main img').attr('src')+')'});$('table#imageGallery div.main img').hide(1,function(){$('table#imageGallery div.main img').attr('src',$(oImage).attr('longdesc'))}).fadeIn(500,function(){if($(oImage).attr('alt')!=''){imgGalEpigraph(oImage)};$('table#imageGallery div.main').css({'background-image':'none'});})};function imgGalEpigraph(oImage){var epPadding=5;$('table#imageGallery div.main').append('<div class="ep"></div>');$('table#imageGallery div.ep').css({'width':imgGal.width-(epPadding*2),'height':parseInt(imgGal.epH)-(epPadding*2),'padding':epPadding,'background-color':'#000000','display':'none','opacity':imgGal.epO,'position':'absolute','left':'inherit','top':imgGal.bottom-parseInt(imgGal.epH),'z-index':10})
$('table#imageGallery div.ep').fadeIn();};function imgGalRun(){if($('table#imageGallery').attr('autorun')=='-1'){return true};nxtImg=$('table#imageGallery').attr('autorun').valueOf();if($('table#imageGallery .thumbs img.sel').size()==0){nxtImg=0};nxtImg++;if(nxtImg>($('table#imageGallery .thumbs img').length-1)){nxtImg=0}
$('table#imageGallery').attr('autorun',nxtImg);imgGalShow($('table#imageGallery .thumbs img:eq('+nxtImg+')'));igTimer=setTimeout('imgGalRun()',imgGal.delay);};function imgGalStop(){if($('table#imageGallery').attr('autorun')!=undefined){$('table#imageGallery').attr('autorun','-1')};clearTimeout(imgGalTimer);};var cmSStimer;$(document).ready(function(){if($('#slideshow img').size()<2){return true};$('#slideshow img:first').addClass('on');$('#slideshow img:not(.on)').hide();$('#slideshow').css({overflow:'hidden'}).append('<div><img src="/cms/ss.prev.gif" alt="Anterior" class="ssn Prev" style="position: absolute; cursor: pointer"/><img src="/cms/ss.next.gif" alt="Siguiente" class="ssn Next" style="position: absolute; cursor: pointer"/></div>');$('img.ssn').hide();slideShowSetup();});function slideShowSetup(){var fi=$('#slideshow img:first');if($(fi).width()==0){setTimeout('slideShowSetup()',500);return true};var fc={height:$(fi).height(),width:$(fi).width(),top:$(fi).offset().top,left:$(fi).offset().left};$('#slideshow').css({width:fc.width,height:fc.height}).hover(function(){slideShowPlaceNav()},function(){slideShowHideNav()});$('#slideshow img').css({position:'absolute'});$('img.ssn.Prev').click(function(){clearTimeout(cmSStimer);slideShowPrev()});$('img.ssn.Next').click(function(){clearTimeout(cmSStimer);slideShowNext()});cmSStimer=setTimeout('slideShowNext(true)',5000);};function slideShowPlaceNav(){var fc={height:$('#slideshow').height(),width:$('#slideshow').width(),top:$('#slideshow').offset().top,left:$('#slideshow').offset().left};var snTop=fc.top+(fc.height/2);$('img.ssn.Prev').css({top:snTop,left:fc.left}).fadeIn('slow');$('img.ssn.Next').css({top:snTop,left:(fc.left+fc.width)-($('img.ssn.Next').width())}).fadeIn('slow');};function slideShowHideNav(){$('img.ssn').fadeOut();};function slideShowNext(bAuto){var ni=$('#slideshow img.ss.on').next('img');if($(ni).size()==0){var ni=$('#slideshow img.ss:first')};$('#slideshow img.ss.on').removeClass('on').fadeOut('slow');$(ni).addClass('on').fadeIn('slow');if(bAuto){cmSStimer=setTimeout('slideShowNext(true)',5000);};};function slideShowPrev(){var ni=$('#slideshow img.ss.on').prev('img');if($(ni).size()==0){var ni=$('#slideshow img.ss:last')};$('#slideshow img.ss.on').removeClass('on').fadeOut('slow');$(ni).addClass('on').fadeIn('slow');}
