

(function($) {
$.fn.jcarousel = function(o) {
return this.each(function() {
new $jc(this, o);
});
};
var defaults = {
vertical: false,
start: 1,
size: null,
scroll: 3,
visible: null,
animation: 'fast',
easing: null,
auto: 0,
wrap: null,
initCallback: null,
reloadCallback: null,
itemLoadCallback: null,
itemFirstInCallback: null,
itemFirstOutCallback: null,
itemLastInCallback: null,
itemLastOutCallback: null,
itemVisibleInCallback: null,
itemVisibleOutCallback: null,
buttonNextHTML: '<div></div>',
buttonPrevHTML: '<div></div>',
buttonNextEvent: 'click',
buttonPrevEvent: 'click',
buttonNextCallback: null,
buttonPrevCallback: null
};
$.jcarousel = function(e, o) {
this.options    = $.extend({}, defaults, o || {});
this.container  = null;
this.clip       = null;
this.list       = null;
this.buttonNext = null;
this.buttonPrev = null;
this.wh = !this.options.vertical ? 'width' : 'height';
this.lt = !this.options.vertical ? 'left' : 'top';
if (e.nodeName == 'UL' || e.nodeName == 'OL') {
this.list = $(e);
this.container = this.list.parent();
if ($.className.has(this.container[0].className, 'jcarousel-clip')) {
if (!$.className.has(this.container[0].parentNode.className, 'jcarousel-container'))
this.container = this.container.wrap('<div></div>');
this.container = this.container.parent();
} else if (!$.className.has(this.container[0].className, 'jcarousel-container'))
this.container = this.list.wrap('<div></div>').parent();
var split = e.className.split(' ');
for (var i = 0; i < split.length; i++) {
if (split[i].indexOf('jcarousel-skin') != -1) {
this.list.removeClass(split[i]);
this.container.addClass(split[i]);
break;
}
}
} else {
this.container = $(e);
this.list = $('ul,ol', e);
}
this.clip = this.list.parent();
if (!this.clip.length || !$.className.has(this.clip[0].className, 'jcarousel-clip'))
this.clip = this.list.wrap('<div></div>').parent();
this.buttonPrev = $('.jcarousel-prev', this.container);
if (this.buttonPrev.size() == 0 && this.options.buttonPrevHTML != null)
this.buttonPrev = this.clip.before(this.options.buttonPrevHTML).prev();
this.buttonPrev.addClass(this.className('jcarousel-prev'));
this.buttonNext = $('.jcarousel-next', this.container);
if (this.buttonNext.size() == 0 && this.options.buttonNextHTML != null)
this.buttonNext = this.clip.before(this.options.buttonNextHTML).prev();
this.buttonNext.addClass(this.className('jcarousel-next'));
this.clip.addClass(this.className('jcarousel-clip'));
this.list.addClass(this.className('jcarousel-list'));
this.container.addClass(this.className('jcarousel-container'));
var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
var li = $('li', this.list);
var self = this;
if (li.size() > 0) {
var wh = 0, i = this.options.start;
li.each(function() {
self.format(this, i++);
wh += self.dimension(this, di);
});
this.list.css(this.wh, wh + 'px');
if (!o || o.size == undefined)
this.options.size = li.size();
}
this.container.css('display', 'block');
this.buttonNext.css('display', 'block');
this.buttonPrev.css('display', 'block');
this.funcNext   = function() { self.next(); };
this.funcPrev   = function() { self.prev(); };
this.funcStop   = function() { self.stop(); };
this.funcResize = function() { self.reload(); };
this.init();
};
var $jc = $.jcarousel;
$jc.fn = $jc.prototype = {
jcarousel: '2.0.0'
};
$jc.fn.extend = $jc.extend = $.extend;
$jc.fn.extend({
setup: function() {
this.first     = null;
this.last      = null;
this.prevFirst = null;
this.prevLast  = null;
this.animating = false;
this.timer     = null;
this.tail      = null;
this.inTail    = false;
this.locked    = false;

this.scroll(this.options.start, false);
},
init: function() {
if (this.options.initCallback != null)
this.options.initCallback(this, 'init');
this.setup();
$(window).bind('resize', this.funcResize);
},
reset: function() {
this.list.empty();
this.list.css(this.lt, '0px');
this.list.css(this.wh, '0px');
if (this.options.initCallback != null)
this.options.initCallback(this, 'reset');
this.setup();
},
reload: function() {
if (this.tail != null && this.inTail)
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + this.tail);
this.tail   = null;
this.inTail = false;
if (this.options.reloadCallback != null)
this.options.reloadCallback(this);
if (this.options.visible != null) {
var self = this;
var di = Math.ceil(this.clipping() / this.options.visible), wh = 0, lt = 0;
$('li', this.list).each(function(i) {
wh += self.dimension(this, di);
if (i + 1 < self.first)
lt = wh;
});
this.list.css(this.wh, wh + 'px');
this.list.css(this.lt, -lt + 'px');
}
this.scroll(this.first, false);
},
lock: function() {
this.locked = true;
this.buttons();
},
unlock: function() {
this.locked = false;
this.buttons();
},
size: function(s) {
if (s != undefined) {
this.options.size = s;
if (!this.locked)
this.buttons();
}
return this.options.size;
},
has: function(i, i2) {
if (i2 == undefined || !i2)
i2 = i;
for (var j = i; j <= i2; j++) {
var e = this.get(j).get(0);
if (!e || $.className.has(e, 'jcarousel-item-placeholder'))
return false;
}
return true;
},
get: function(i) {
return $('.jcarousel-item-' + i, this.list);
},
add: function(i, s) {
var e = this.get(i), old = 0;
if (e.length == 0) {
var c, e = this.create(i), j = $jc.intval(i);
while (c = this.get(--j)) {
if (j <= 0 || c.length) {
j <= 0 ? this.list.prepend(e) : c.after(e);
break;
}
}
} else
old = this.dimension(e);
e.removeClass(this.className('jcarousel-item-placeholder'));
typeof s == 'string' ? e.html(s) : e.empty().append(s);
var di = this.options.visible != null ? Math.ceil(this.clipping() / this.options.visible) : null;
var wh = this.dimension(e, di) - old;
if (i > 0 && i < this.first)
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + wh + 'px');
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) + wh + 'px');
return e;
},
remove: function(i) {
var e = this.get(i);
if (!e.length || (i >= this.first && i <= this.last))
return;
var d = this.dimension(e);
if (i < this.first)
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) + d + 'px');
e.remove();
this.list.css(this.wh, $jc.intval(this.list.css(this.wh)) - d + 'px');
},
next: function() {
this.stopAuto();
if (this.tail != null && !this.intail)
this.scrollTail(false);
else
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
},
prev: function() {
this.stopAuto();
if (this.tail != null && this.inTail)
this.scrollTail(true);
else
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'first') && this.options.size != null && this.first == 1) ? this.options.size : this.first - this.options.scroll);
},
scrollTail: function(b) {
if (this.locked || this.animating || !this.tail)
return;
var pos  = $jc.intval(this.list.css(this.lt));
!b ? pos -= this.tail : pos += this.tail;
this.inTail = !b;
this.prevFirst = this.first;
this.prevLast  = this.last;
this.animate(pos);
},
scroll: function(i, a) {
if (this.locked || this.animating)
return;
this.animate(this.pos(i), a);
},
pos: function(i) {
if (this.locked || this.animating)
return;
if (this.options.wrap != 'circular')
i = i < 1 ? 1 : (this.options.size && i > this.options.size ? this.options.size : i);
var back = this.first > i;
var pos  = $jc.intval(this.list.css(this.lt));
var f = this.options.wrap != 'circular' && this.first <= 1 ? 1 : this.first;
var c = back ? this.get(f) : this.get(this.last);
var j = back ? f : f - 1;
var e = null, l = 0, p = false, d = 0;
while (back ? --j >= i : ++j < i) {
e = this.get(j);
p = !e.length;
if (e.length == 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
c[back ? 'before' : 'after' ](e);
}
c = e;
d = this.dimension(e);
if (p)
l += d;
if (this.first != null && (this.options.wrap == 'circular' || (j >= 1 && (this.options.size == null || j <= this.options.size))))
pos = back ? pos + d : pos - d;
}
var clipping = this.clipping();
var cache = [];
var visible = 0, j = i, v = 0;
var c = this.get(i - 1);
while (++visible) {
e = this.get(j);
p = !e.length;
if (e.length == 0) {
e = this.create(j).addClass(this.className('jcarousel-item-placeholder'));
c.length == 0 ? this.list.prepend(e) : c[back ? 'before' : 'after' ](e);
}
c = e;
d = this.dimension(e);
if (d == 0) {
alert('jCarousel: No width/height set for items. This will cause an infinite loop. Aborting...');
return 0;
}
if (this.options.wrap != 'circular' && this.options.size !== null && j > this.options.size)
cache.push(e);
else if (p)
l += d;
v += d;
if (v >= clipping)
break;
j++;
}
for (var x = 0; x < cache.length; x++)
cache[x].remove();
if (l > 0) {
this.list.css(this.wh, this.dimension(this.list) + l + 'px');
if (back) {
pos -= l;
this.list.css(this.lt, $jc.intval(this.list.css(this.lt)) - l + 'px');
}
}
var last = i + visible - 1;
if (this.options.wrap != 'circular' && this.options.size && last > this.options.size)
last = this.options.size;
var first = last - visible + 1;
if (this.options.wrap != 'circular' && first < 1)
first = 1;
if (this.inTail && back) {
pos += this.tail;
this.inTail = false;
}
this.tail = null;
if (this.options.wrap != 'circular' && last == this.options.size && (last - visible + 1) >= 1) {
var m = $jc.margin(this.get(last), !this.options.vertical ? 'marginRight' : 'marginBottom');
if ((v - m) > clipping)
this.tail = v - clipping - m;
}
while (i-- > first)
pos += this.dimension(this.get(i));
this.prevFirst = this.first;
this.prevLast  = this.last;
this.first     = first;
this.last      = last;
return pos;
},
animate: function(p, a) {
if (this.locked || this.animating)
return;
this.animating = true;
var self = this, pos = p;
var scrolled = function() {
self.animating = false;
if (pos == 0)
self.list.css(self.lt,  0);
if (self.options.wrap == 'both' || self.options.wrap == 'last' || self.options.size == null || self.last < self.options.size)
self.startAuto();
self.buttons();
self.notify('onAfterAnimation');
};
this.notify('onBeforeAnimation');
if (!this.options.animation || a == false) {
this.list.css(this.lt, p + 'px');
scrolled();
} else {
var o = !this.options.vertical ? {'left': p} : {'top': p};
this.list.animate(o, this.options.animation, this.options.easing, scrolled);
}
},
startAuto: function(s) {
if (s != undefined)
this.options.auto = s;
if (this.options.auto == 0)
return this.stopAuto();
if (this.timer != null)
return;
var self = this;
this.timer = setTimeout(function() { self.next(); }, this.options.auto * 1000);
},
stopAuto: function() {
if (this.timer == null)
return;
clearTimeout(this.timer);
this.timer = null;
},
buttons: function(n, p) {
if (n == undefined || n == null) {
var n = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'first') || this.options.size == null || this.last < this.options.size);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'first') && this.options.size != null && this.last >= this.options.size)
n = this.tail != null && !this.inTail;
}
if (p == undefined || p == null) {
var p = !this.locked && this.options.size !== 0 && ((this.options.wrap && this.options.wrap != 'last') || this.first > 1);
if (!this.locked && (!this.options.wrap || this.options.wrap == 'last') && this.options.size != null && this.first == 1)
p = this.tail != null && this.inTail;
}
var self = this;
this.buttonNext[n ? 'bind' : 'unbind'](this.options.buttonNextEvent, this.funcNext)[n ? 'removeClass' : 'addClass'](this.className('jcarousel-next-disabled')).attr('disabled', n ? false : true);
this.buttonPrev[p ? 'bind' : 'unbind'](this.options.buttonPrevEvent, this.funcPrev)[p ? 'removeClass' : 'addClass'](this.className('jcarousel-prev-disabled')).attr('disabled', p ? false : true);
if (this.buttonNext.length > 0 && (this.buttonNext[0].jcarouselstate == undefined || this.buttonNext[0].jcarouselstate != n) && this.options.buttonNextCallback != null) {
this.buttonNext.each(function() { self.options.buttonNextCallback(self, this, n); });
this.buttonNext[0].jcarouselstate = n;
}
if (this.buttonPrev.length > 0 && (this.buttonPrev[0].jcarouselstate == undefined || this.buttonPrev[0].jcarouselstate != p) && this.options.buttonPrevCallback != null) {
this.buttonPrev.each(function() { self.options.buttonPrevCallback(self, this, p); });
this.buttonPrev[0].jcarouselstate = p;
}
},
notify: function(evt) {
var state = this.prevFirst == null ? 'init' : (this.prevFirst < this.first ? 'next' : 'prev');
this.callback('itemLoadCallback', evt, state);
if (this.prevFirst != this.first) {
this.callback('itemFirstInCallback', evt, state, this.first);
this.callback('itemFirstOutCallback', evt, state, this.prevFirst);
}
if (this.prevLast != this.last) {
this.callback('itemLastInCallback', evt, state, this.last);
this.callback('itemLastOutCallback', evt, state, this.prevLast);
}
this.callback('itemVisibleInCallback', evt, state, this.first, this.last, this.prevFirst, this.prevLast);
this.callback('itemVisibleOutCallback', evt, state, this.prevFirst, this.prevLast, this.first, this.last);
},
callback: function(cb, evt, state, i1, i2, i3, i4) {
if (this.options[cb] == undefined || (typeof this.options[cb] != 'object' && evt != 'onAfterAnimation'))
return;
var callback = typeof this.options[cb] == 'object' ? this.options[cb][evt] : this.options[cb];
if (!$.isFunction(callback))
return;
var self = this;
if (i1 === undefined)
callback(self, state, evt);
else if (i2 === undefined)
this.get(i1).each(function() { callback(self, this, i1, state, evt); });
else {
for (var i = i1; i <= i2; i++)
if (!(i >= i3 && i <= i4))
this.get(i).each(function() { callback(self, this, i, state, evt); });
}
},
create: function(i) {
return this.format('<li></li>', i);
},
format: function(e, i) {
var $e = $(e).addClass(this.className('jcarousel-item')).addClass(this.className('jcarousel-item-' + i));
$e.attr('jcarouselindex', i);
return $e;
},
className: function(c) {
return c + ' ' + c + (!this.options.vertical ? '-horizontal' : '-vertical');
},
dimension: function(e, d) {
var el = e.jquery != undefined ? e[0] : e;
var old = !this.options.vertical ?
el.offsetWidth + $jc.margin(el, 'marginLeft') + $jc.margin(el, 'marginRight') :
el.offsetHeight + $jc.margin(el, 'marginTop') + $jc.margin(el, 'marginBottom');
if (d == undefined || old == d)
return old;
var w = !this.options.vertical ?
d - $jc.margin(el, 'marginLeft') - $jc.margin(el, 'marginRight') :
d - $jc.margin(el, 'marginTop') - $jc.margin(el, 'marginBottom');
$(el).css(this.wh, w + 'px');
return this.dimension(el);
},
clipping: function() {
return !this.options.vertical ?
this.clip[0].offsetWidth - $jc.intval(this.clip.css('borderLeftWidth')) - $jc.intval(this.clip.css('borderRightWidth')) :
this.clip[0].offsetHeight - $jc.intval(this.clip.css('borderTopWidth')) - $jc.intval(this.clip.css('borderBottomWidth'));
},
index: function(i, s) {
if (s == undefined)
s = this.options.size;
return Math.round((((i-1) / s) - Math.floor((i-1) / s)) * s) + 1;
}
});
$jc.extend({
defaults: function(d) {
$.extend(defaults, d);
},
margin: function(e, p) {
if (!e)
return 0;
var el = e.jquery != undefined ? e[0] : e;
if (p == 'marginRight' && $.browser.safari) {
var old = {'display': 'block', 'float': 'none', 'width': 'auto'}, oWidth, oWidth2;
$.swap(el, old, function() { oWidth = el.offsetWidth; });
old['marginRight'] = 0;
$.swap(el, old, function() { oWidth2 = el.offsetWidth; });
return oWidth2 - oWidth;
}
return $jc.intval($.css(el, p));
},
intval: function(v) {
v = parseInt(v);
return isNaN(v) ? 0 : v;
}
});
})(jQuery);
$.fn.hoverClass = function(c) {
return this.each(function(){
$(this).hover( 
function() { $(this).addClass(c);  },
function() { $(this).removeClass(c); }
);
});
};  
$.tabs = function(containerId, start) {
var ON_CLASS = 'on';
var id = '#' + containerId;
var i = (typeof start == "number") ? start - 1 : 0;
$(id + '>div:lt(' + i + ')').add(id + '>div:gt(' + i + ')').hide();
$(id + '>ul>li:nth-child(' + (i+1) + ')').addClass(ON_CLASS);
$(id + '>ul>li>a').click(function() {
$(this).load( function() { alert("Hello"); } );
if (!$(this.parentNode).is('.' + ON_CLASS)) {
var re = /([_\-\w]+$)/i;
var target = $('#' + re.exec(this.href)[1]);
if (target.size() > 0) {
$(id + '>div:visible').hide();
target.show();
$(id + '>ul>li').removeClass(ON_CLASS);
$(this.parentNode).addClass(ON_CLASS);
} else {
alert('There is no such container.');
}
}
return false;
});
};
$.tabsh = function(containerId, start) {
var ON_CLASS = 'on';
var id = '#' + containerId;
var i = (typeof start == "number") ? start - 1 : 0;
$(id + '>div:lt(' + i + ')').add(id + '>div:gt(' + i + ')').hide();
$(id + '>ul>li:nth-child(' + (i+1) + ')').addClass(ON_CLASS);
$(id + '>ul>li>a').mousemove(function() {
$(this).load( function() { alert("Hello"); } );
if (!$(this.parentNode).is('.' + ON_CLASS)) {
var re = /([_\-\w]+$)/i;
var target = $('#' + re.exec(this.href)[1]);
if (target.size() > 0) {
$(id + '>div:visible').hide();
target.show();
$(id + '>ul>li').removeClass(ON_CLASS);
$(this.parentNode).addClass(ON_CLASS);
} else {
alert('There is no such container.');
}
}
return false;
});
};
var tb_pathToImage = "../images/icons/ajax-loader.gif";
function tb_init(domChunk){
$(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
if($.browser.msie) $("select, object").hide();
return false;
});
}
function tb_show(caption, url, imageGroup) {
try {
if (typeof document.body.style.maxHeight === "undefined") {
$("body","html").css({height: "100%", width: "100%"});
$("html").css("overflow","hidden");
if (document.getElementById("TB_HideSelect") === null) {
$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
$("#TB_overlay").click(tb_remove);
}
}else{
if(document.getElementById("TB_overlay") === null){
$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
$("#TB_overlay").click(tb_remove);
}
}		
if(tb_detectMacXFF()){
$("#TB_overlay").addClass("TB_overlayMacFFBGHack");
}else{
$("#TB_overlay").addClass("TB_overlayBG");
}
if(caption===null){caption="";}
$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");
$('#TB_load').show();
var baseURL;
if(url.indexOf("?")!==-1){
baseURL = url.substr(0, url.indexOf("?"));
}else{ 
baseURL = url;
}	   
var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$/;
var urlType = baseURL.toLowerCase().match(urlString);
if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){			
TB_PrevCaption = "";
TB_PrevURL = "";
TB_PrevHTML = "";
TB_NextCaption = "";
TB_NextURL = "";
TB_NextHTML = "";
TB_imageCount = "";
TB_FoundURL = false;
if(imageGroup){
TB_TempArray = $("a[@rel="+imageGroup+"]").get();
for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
if (!(TB_TempArray[TB_Counter].href == url)) {						
if (TB_FoundURL) {
TB_NextCaption = TB_TempArray[TB_Counter].title;
TB_NextURL = TB_TempArray[TB_Counter].href;
TB_NextHTML = "<span id='TB_next' class='fLeft mLeft10 mTop5'>&nbsp;&nbsp;<a href='#'><img src='../images/varios/tbNext.gif' /></a></span>";
} else {
TB_PrevCaption = TB_TempArray[TB_Counter].title;
TB_PrevURL = TB_TempArray[TB_Counter].href;
TB_PrevHTML = "<span id='TB_prev' class='fLeft mTop5'>&nbsp;&nbsp;<a href='#'><img src='../images/varios/tbPrev.gif' /></a></span>";
}
} else {
TB_FoundURL = true;
TB_imageCount = "<span class='fLeft mTop8'>"+"Imagen " + (TB_Counter + 1) +" de "+ (TB_TempArray.length)+"</span>";											
}
}
}
imgPreloader = new Image();
imgPreloader.onload = function(){		
imgPreloader.onload = null;
var pagesize = tb_getPageSize();
var x = pagesize[0] - 150;
var y = pagesize[1] - 150;
var imageWidth = imgPreloader.width;
var imageHeight = imgPreloader.height;
if (imageWidth > x) {
imageHeight = imageHeight * (x / imageWidth); 
imageWidth = x; 
if (imageHeight > y) { 
imageWidth = imageWidth * (y / imageHeight); 
imageHeight = y; 
}
} else if (imageHeight > y) { 
imageWidth = imageWidth * (y / imageHeight); 
imageHeight = y; 
if (imageWidth > x) { 
imageHeight = imageHeight * (x / imageWidth); 
imageWidth = x;
}
}
TB_WIDTH = imageWidth + 30;
TB_HEIGHT = imageHeight + 60;
$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption' class='mBot15'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>[cerrar]</a></div>"); 					
$("#TB_closeWindowButton").click(tb_remove);	
if (!(TB_PrevHTML === "")) {
function goPrev(){
if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
$("#TB_window").remove();
$("body").append("<div id='TB_window'></div>");
tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
return false;	
}
$("#TB_prev").click(goPrev);
}
if (!(TB_NextHTML === "")) {		
function goNext(){
$("#TB_window").remove();
$("body").append("<div id='TB_window'></div>");
tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
return false;	
}
$("#TB_next").click(goNext);		
}
document.onkeydown = function(e){ 	
if (e == null) {
keycode = event.keyCode;
} else {
keycode = e.which;
}
if(keycode == 27){
tb_remove();
} else if(keycode == 190){
if(!(TB_NextHTML == "")){
document.onkeydown = "";
goNext();
}
} else if(keycode == 188){
if(!(TB_PrevHTML == "")){
document.onkeydown = "";
goPrev();
}
}	
};
tb_position();
$("#TB_load").remove();
$("#TB_ImageOff").click(tb_remove);
$("#TB_window").css({display:"block"}); 
};
imgPreloader.src = url;
}else{
var queryString = url.replace(/^[^\?]+\??/,'');
var params = tb_parseQuery( queryString );
TB_WIDTH = (params['width']*1) + 30 || 630;
TB_HEIGHT = (params['height']*1) + 40 || 440;
ajaxContentW = TB_WIDTH - 30;
ajaxContentH = TB_HEIGHT - 45;
if(url.indexOf('TB_iframe') != -1){
urlNoQuery = url.split('TB_');
$("#TB_iframeContent").remove();
if(params['modal'] != "true"){
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>[cerrar]</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
}else{
$("#TB_overlay").unbind();
$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
}
}else{
if($("#TB_window").css("display") != "block"){
if(params['modal'] != "true"){
$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>[cerrar]</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
}else{
$("#TB_overlay").unbind();
$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
}
}else{
$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
$("#TB_ajaxContent")[0].scrollTop = 0;
$("#TB_ajaxWindowTitle").html(caption);
}
}		
$("#TB_closeWindowButton").click(tb_remove);		
if(url.indexOf('TB_inline') != -1){	
$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
$("#TB_window").unload(function () {
$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() );
});
tb_position();
$("#TB_load").remove();
$("#TB_window").css({display:"block"}); 
}else if(url.indexOf('TB_iframe') != -1){
tb_position();
if($.browser.safari){
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}
}else{
$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){
tb_position();
$("#TB_load").remove();
tb_init("#TB_ajaxContent a.thickbox");
$("#TB_window").css({display:"block"});
});
}		
}
if(!params['modal']){
document.onkeyup = function(e){ 	
if (e == null) {
keycode = event.keyCode;
} else {
keycode = e.which;
}
if(keycode == 27){
tb_remove();
}	
};
}
} catch(e) {
}
}
function tb_showIframe(){
$("#TB_load").remove();
$("#TB_window").css({display:"block"});
}
function tb_remove() {
$("#TB_imageOff").unbind("click");
$("#TB_closeWindowButton").unbind("click");
$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
$("#TB_load").remove();
if (typeof document.body.style.maxHeight == "undefined") {
$("body","html").css({height: "auto", width: "auto"});
$("html").css("overflow","");
}
document.onkeydown = "";
document.onkeyup = "";
if($.browser.msie) $("select, object").show();
return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) {
$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
}
}
function tb_parseQuery ( query ) {
var Params = {};
if ( ! query ) {return Params;}
var Pairs = query.split(/[;&]/);
for ( var i = 0; i < Pairs.length; i++ ) {
var KeyVal = Pairs[i].split('=');
if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
var key = unescape( KeyVal[0] );
var val = unescape( KeyVal[1] );
val = val.replace(/\+/g, ' ');
Params[key] = val;
}
return Params;
}
function tb_getPageSize(){
var de = document.documentElement;
var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
arrayPageSize = [w,h];
return arrayPageSize;
}
function tb_detectMacXFF() {
var userAgent = navigator.userAgent.toLowerCase();
if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
return true;
}
}
$.fn.pager = function(clas, options) {
var settings = {		
navId: 'nav',
navClass: 'nav',
navAttach: 'append',
highlightClass: 'highlight',
prevText: '&laquo;',
nextText: '&raquo;',
linkText: null,
linkWrap: null,
height: null
}
if(options) $.extend(settings, options);	
return this.each( function () {	
var me = $(this);
var size;
var i = 0;		
var navid = '#'+settings.navId;	
function init () {
size = $(clas, me).not(navid).size();
if(settings.height == null) {			
settings.height = getHighest();
}
if(size > 1) {
makeNav();
show();
highlight();
}			
sizePanel();
if(settings.linkWrap != null) {
linkWrap();
}
}
function makeNav () {		
var str = '<div id="'+settings.navId+'" class="'+settings.navClass+'">';
str += '<a href="#" rel="prev">'+settings.prevText+'</a>';
for(var i = 0; i < size; i++) {
var j = i+1;
str += '<a href="#" rel="'+j+'">';
str += (settings.linkText == null) ? j : settings.linkText[j-1];				
str += '</a>';
}
str += '<a href="#" rel="next">'+settings.nextText+'</a>';
str += '</div>';
switch (settings.navAttach) {		
case 'before':
$(me).before(str);
break;
case 'after':		
$(me).after(str);
break;
case 'prepend':
$(me).prepend(str);
break;
default:
$(me).append(str);
break;
}
}
function show () {
$(me).find(clas).not(navid).hide();
var show = $(me).find(clas).not(navid).get(i);
$(show).show();
}		
function highlight () {
$(me).find(navid).find('a').removeClass(settings.highlightClass);
var show = $(me).find(navid).find('a').get(i+1);			
$(show).addClass(settings.highlightClass);
}
function sizePanel () {
if($.browser.msie) {
$(me).find(clas).not(navid).css( {
height: settings.height
});	
} else {
$(me).find(clas).not(navid).css( {
minHeight: settings.height
});
}
}
function getHighest () {
var highest = 0;
$(me).find(clas).not(navid).each(function () {

if(this.offsetHeight > highest) {
highest = this.offsetHeight;
}
});
highest = highest + "px";
return highest;
}
function getNavHeight () {
var nav = $(navid).get(0);
return nav.offsetHeight;
}
function linkWrap () {
$(me).find(navid).find("a").wrap(settings.linkWrap);
}
init();
$(this).find(navid).find("a").click(function () {

if($(this).attr('rel') == 'next') {
if(i + 1 < size) {
i = i+1;
}
} else if($(this).attr('rel') == 'prev') { 
if(i > 0) {	
i = i-1;
}
} else {		
var j = $(this).attr('rel');	
i = j-1;		
}
show();
highlight();
return false;
});
});	
}
jQuery.fn.extend({
nextUntil: function(expr) {
var match = [];
this.each(function(){
for( var i = this.nextSibling; i; i = i.nextSibling ) {
if ( i.nodeType != 1 ) continue;
if ( jQuery.filter( expr, [i] ).r.length ) break;
match.push( i );
}
});
return this.pushStack( match );
},
Accordion: function(settings) {
settings = jQuery.extend({}, jQuery.Accordion.defaults, {
header: jQuery(':first-child', this)[0].tagName
}, settings);

if ( settings.navigation ) {
var current = this.find("a").filter(function() { return this.href == location.href; });
if ( current.length ) {
settings.active = current.parent().parent().prev();
current.addClass("current");
}
}
var container = this,
active = settings.active
? jQuery(settings.active, this)
: settings.active === false
? jQuery("<div>")
: jQuery(settings.header, this).eq(0),
running = 0;
var headers = container.find(settings.header);
headers
.not(active || "")
.nextUntil(settings.header)
.hide();
active.addClass(settings.selectedClass);

function toggle(toShow, toHide, data, clickedActive) {
var finished = function(cancel) {
running = cancel ? 0 : --running;
if ( running )
return;
container.trigger("change", data);
};
running = toHide.size() + toShow.size();
if ( settings.animated ) {
if ( !settings.alwaysOpen && clickedActive ) {
toShow.slideToggle(settings.showSpeed);
finished(true);
} else {
toHide.filter(":hidden").each(finished).end().filter(":visible").slideUp(settings.hideSpeed, finished);
toShow.slideDown(settings.showSpeed, finished);
}
} else {
if ( !settings.alwaysOpen && clickedActive ) {
toShow.toggle();
} else {
toHide.hide();
toShow.show();
}
finished(true);
}
}
function clickHandler(event) {
if ( !event.target && !settings.alwaysOpen ) {
active.toggleClass(settings.selectedClass);
var toHide = active.nextUntil(settings.header);
var toShow = active = jQuery([]);
toggle( toShow, toHide );
}
var clicked = jQuery(event.target);
if ( clicked.parents(settings.header).length )
while ( !clicked.is(settings.header) )
clicked = clicked.parent();		
var clickedActive = clicked[0] == active[0];
if(running || (settings.alwaysOpen && clickedActive) || !clicked.is(settings.header))
return;
active.toggleClass(settings.selectedClass);
if ( !clickedActive ) {
clicked.addClass(settings.selectedClass);
}
var toShow = clicked.nextUntil(settings.header),
toHide = active.nextUntil(settings.header),
data = [clicked, active, toShow, toHide];
active = clickedActive ? jQuery([]) : clicked;
toggle( toShow, toHide, data, clickedActive );
return !toShow.length;
};
function activateHandler(event, index) {
if ( index == null )
return;
clickHandler({
target: index >= 0
? jQuery(settings.header, this)[index]
: typeof index == "string"
? jQuery(index, this)[0]
: null
});
};
container.bind("activate", activateHandler);
return container.bind(settings.event, clickHandler)
},
activate: function(index) {
return this.trigger('activate', [index]);
}
});
jQuery.Accordion = {};
jQuery.extend(jQuery.Accordion, {
defaults: {
selectedClass: "selected",
showSpeed: 'fast',
hideSpeed: 'fast',
alwaysOpen: true,
animated: true,
event: "click"
}
});
function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
function getActiveStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
}
return null;
}
function getPreferredStyleSheet() {
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("rel").indexOf("alt") == -1
&& a.getAttribute("title")
) return a.getAttribute("title");
}
return null;
}
function recalcular(){
var parentHeight = getHeight("articleParent");
var tHeight = getHeight("at1");
var totalColumns = tHeight / parentHeight;
var totalPages = Math.ceil(totalColumns);
var tPos = (currentPos + columnMode) / columnMode;
var pagesTotal = Math.ceil(totalPages / columnMode);
var pagesCurrent = Math.round(tPos);
var obj = document.getElementById("tc_page_nav_middle");
obj.innerHTML = "P&aacute;gina " + pagesCurrent + " de " + pagesTotal;
}
(function($) {
$.ifixpng = function(customPixel) {
$.ifixpng.pixel = customPixel;
};	
$.ifixpng.getPixel = function() {
return $.ifixpng.pixel || '../images/pixel.gif';
};
var hack = {
ltie7  : $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
filter : function(src) {
return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
}
}; 
$.fn.ifixpng = hack.ltie7 ? function() {
return this.each(function() {
var $$ = $(this);
var base = $('base').attr('href');
if ($$.is('img') || $$.is('input')) {
if ($$.attr('src').match(/.*\.png([?].*)?$/i)) {
var source = (base && $$.attr('src').substring(0,1)!='/') ? base + $$.attr('src') : $$.attr('src');
$$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()})
.attr({src:$.ifixpng.getPixel()})
.positionFix();
}
} else {
var image = $$.css('backgroundImage');
if (image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)) {
image = RegExp.$1;
$$.css({backgroundImage:'none', filter:hack.filter(image)})
.positionFix();
}
}
});
} : function() { return this; }; 
$.fn.iunfixpng = hack.ltie7 ? function() {
return this.each(function() {
var $$ = $(this);
var src = $$.css('filter');
if (src.match(/src=["']?(.*\.png([?].*)?)["']?/i)) {
src = RegExp.$1;
if ($$.is('img') || $$.is('input')) {
$$.attr({src:src}).css({filter:''});
} else {
$$.css({filter:'', background:'url('+src+')'});
}
}
});
} : function() { return this; };
$.fn.positionFix = function() {
return this.each(function() {
var $$ = $(this);
var position = $$.css('position');
if (position != 'absolute' && position != 'relative') {
$$.css({position:'relative'});
}
});
};
})(jQuery);
(function($) {
var helper,
tTitle,
tBody,
tUrl,
current,
oldTitle,
tID;
$.fn.Tooltip = function(settings) {
settings = $.extend($.extend({}, arguments.callee.defaults), settings || {});
if( !helper ) {
helper = $('<div id="tooltip"><h3></h3><p class="body"></p><p class="url"></p></div>')
.hide()
.css({ position: 'absolute', zIndex: 3000 })
.appendTo('body');
tTitle = $('h3', helper);
tBody = $('p:eq(0)', helper);
tUrl = $('p:eq(1)', helper);
}
$(this).filter('[@title]')
.each(function() {
this.tSettings = settings;
})
.bind("mouseover", save)
.bind(settings.event, handle);
return this;
};
function handle(event) {
if( this.tSettings.delay )
tID = setTimeout(show, this.tSettings.delay);
else
show();
if(this.tSettings.track)
$('body').bind('mousemove', update);
update(event);
$(this).bind('mouseout', hide);
}
function save() {
if(this == current || !this.title)
return;
current = this;
var source = $(this),
settings = this.tSettings;
oldTitle = title = source.attr('title');
source.attr('title','');
if(settings.showBody) {
var parts = title.split(settings.showBody);
tTitle.html(parts.shift());
tBody.empty();
for(var i = 0, part; part = parts[i]; i++) {
if(i > 0)
tBody.append("<br/>");
tBody.append(part);
}
if(tBody.html())
tBody.show();
else
tBody.hide();
} else {
tTitle.html(title);
tBody.hide();
}
href = (source.attr('href') || source.attr('src'));
if( settings.showURL && href )
tUrl.html(href.replace('http://', '')).show();
else 
tUrl.hide();
if( settings.extraClass ) {
helper.addClass(settings.extraClass);
}
if (settings.fixPNG && $.browser.msie ) {
helper.each(function () {
if (this.currentStyle.backgroundImage != 'none') {
var image = this.currentStyle.backgroundImage;
image = image.substring(5, image.length - 2);
$(this).css({
'backgroundImage': 'none',
'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
});
}
});
}
}	
function show() {
tID = null;
helper.show();
update();
}	
function update(event)	{
if( current == null ) {
$('body').unbind('mousemove', update);
return;	
}		
var left = helper[0].offsetLeft;
var top = helper[0].offsetTop;
if(event) {
function pos(c) {
var p = c == 'X' ? 'Left' : 'Top';
return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
}
left = pos('X') + 15;
top = pos('Y') + 15;
helper.css({
left: left + 'px',
top: top + 'px'
});
}		
var v = viewport(),
h = helper[0];
if(v.x + v.cx < h.offsetLeft + h.offsetWidth) {
left -= h.offsetWidth + 20;
helper.css({left: left + 'px'});
}
if(v.y + v.cy < h.offsetTop + h.offsetHeight) {
top -= h.offsetHeight + 20;
helper.css({top: top + 'px'});
}
}
function viewport() {
var e = document.documentElement || {},
b = document.body || {},
w = window;
return {
x: w.pageXOffset || e.scrollLeft || b.scrollLeft || 0,
y: w.pageYOffset || e.scrollTop || b.scrollTop || 0,
cx: min( e.clientWidth, b.clientWidth, w.innerWidth ),
cy: min( e.clientHeight, b.clientHeight, w.innerHeight )
};
function min() {
var v = Infinity;
for( var i = 0;  i < arguments.length;  i++ ) {
var n = arguments[i];
if( n && n < v ) v = n;
}
return v;
}
}
function hide() {
if(tID)
clearTimeout(tID);
current = null;
helper.hide();
if( this.tSettings.extraClass ) {
helper.removeClass( this.tSettings.extraClass);
}
$(this)
.attr('title', oldTitle)
.unbind('mouseout', hide);
if( this.tSettings.fixPNG && $.browser.msie ) {
helper.each(function () {
$(this).css({'filter': '', backgroundImage: ''});
});
}
}
$.fn.Tooltip.defaults = {
delay: 250,
event: "mouseover",
track: false,
showURL: true,
showBody: null,
extraClass: null,
fixPNG: false
};
})(jQuery);