/*
    richhtmlticker.js
    Copyright (c) 2005-2011 MedicosCubanos.com, Inc. All rights reserved. Todos los derechos reservados.

    Rich HTML Ticker by JavaScript Kit (http://www.javascriptkit.com)
    Freeware. Created Sept 13th, 08'
    This credit must stay intact for use
*/
var richhtmlticker={loadingtext:"<em>Fetching Ticker Contents. Please wait...</em>",getajaxcontent:function(B,A){A.$ticker.html(this.loadingtext);B.ajax({url:A.msgsource,error:function(C){A.$ticker.html("Error fetching content.<br />Server Response: "+C.responseText)},success:function(C){A.$ticker.html(C);richhtmlticker.setupticker(A)}})},rotate:function(A){if(A.$ticker.get(0)._hoverstate=="over"){setTimeout(function(){richhtmlticker.rotate(A)},A.rotatespeed)}else{A.$messages.eq(A.currentmsg).fadeOut(A.animateduration,function(){A.currentmsg=(A.currentmsg<A.$messages.length-1)?A.currentmsg+1:0;A.$messages.eq(A.currentmsg).fadeIn(A.animateduration,function(){setTimeout(function(){richhtmlticker.rotate(A)},A.rotatespeed)})})}},getCookie:function(A){var B=new RegExp(A+"=[^;]+","i");if(document.cookie.match(B)){return document.cookie.match(B)[0].split("=")[1]}return null},setCookie:function(A,B){document.cookie=A+"="+B},setupticker:function(A){A.$messages=A.$ticker.find("div."+A.msgclass).hide();A.currentmsg=Math.min(parseInt(richhtmlticker.getCookie(A.id)||0),A.$messages.length-1);A.$messages.hide().eq(A.currentmsg).fadeIn(A.animateduration);setTimeout(function(){richhtmlticker.rotate(A)},A.rotatespeed);$(window).bind("unload",function(){richhtmlticker.cleanup(A)})},define:function(A){jQuery(document).ready(function(B){A.$ticker=B("#"+A.id);if(A.$ticker.length==0){return }A.$ticker.css({overflow:"hidden"}).hover(function(){this._hoverstate="over"},function(){this._hoverstate="out"});if(A.msgsource=="inline"){richhtmlticker.setupticker(A)}else{richhtmlticker.getajaxcontent(B,A)}})},cleanup:function(A){this.setCookie(A.id,A.currentmsg)}};richhtmlticker.define({id:"myhtmlticker",msgclass:"messagediv",msgsource:"inline",rotatespeed:5000,animateduration:1000});
