/* 
 * JS - All In One (2009-2010)
 * Date + Clock + Tooltip + PiniMenu (dropdown menu) + MegaSlide (deprecated) + jDock + Innerfade + Savescreen
 * PInicio | pinicio.com.ar
 */
function Fecha(){data=new Date;months=["enero","febrero","marzo","abril","mayo","junio","julio","agosto","septiembre","octubre","noviembre","diciembre"];index=data.getMonth();dayofweek=["domingo","lunes","martes","mi\u00e9rcoles","jueves","viernes","s\u00e1bado"];indexday=data.getDay();year=data.getYear();if(year<1900)year=1900+year;document.write(dayofweek[indexday]+" "+data.getDate()+" de "+months[index]+" de "+year)} this.tooltip=function(){xOffset=20;yOffset=10;$("a.tooltip, img.tooltip, span.tooltip").hover(function(f){this.t=this.title;this.title="";$("body").append("<p id='tooltip'>"+this.t+"</p>");$("#tooltip").css("top",f.pageY-xOffset+"px").css("left",f.pageX+yOffset+"px").fadeIn("fast")},function(){this.title=this.t;$("#tooltip").remove()});$("a.tooltip, img.tooltip, span.tooltip").mousemove(function(f){$("#tooltip").css("top",f.pageY-xOffset+"px").css("left",f.pageX+yOffset+"px")})}; (function(f){f.fn.jclock=function(i){var e=f.extend({},f.fn.jclock.defaults,i);return this.each(function(){$this=f(this);$this.timerID=null;$this.running=false;var b=f.meta?f.extend({},e,$this.data()):e;$this.timeNotation=b.timeNotation;$this.am_pm=b.am_pm;$this.utc=b.utc;$this.utc_offset=b.utc_offset;$this.css({fontFamily:b.fontFamily,fontSize:b.fontSize,backgroundColor:b.background,color:b.foreground});f.fn.jclock.startClock($this)})};f.fn.jclock.startClock=function(i){f.fn.jclock.stopClock(i); f.fn.jclock.displayTime(i)};f.fn.jclock.stopClock=function(i){i.running&&clearTimeout(i.timerID);i.running=false};f.fn.jclock.displayTime=function(i){var e=f.fn.jclock.getTime(i);i.html(e);i.timerID=setTimeout(function(){f.fn.jclock.displayTime(i)},1E3)};f.fn.jclock.getTime=function(i){var e=new Date,b,a,c;if(i.utc==true){b=e.getTime();a=e.getTimezoneOffset()*6E4;e=new Date(b+a+36E5*i.utc_offset)}b=e.getHours();a=e.getMinutes();c=e.getSeconds();e="";b>=12?e=" P.M.":e=" A.M.";if(i.timeNotation=="12h")b= b>12?b-12:b;else{if(i.timeNotation=="12hh")b=b>12?b-12:b;b=(b<10?"0":"")+b}a=(a<10?"0":"")+a;c=(c<10?"0":"")+c;b=b+":"+a+":"+c;if((i.timeNotation=="12h"||i.timeNotation=="12hh")&&i.am_pm==true)b+=e;return b+" hs"};f.fn.jclock.defaults={timeNotation:"24h",am_pm:false,utc:false,fontFamily:"",fontSize:"",foreground:"",background:"",utc_offset:0}})(jQuery); (function(f){f.fn.piniMenu=function(){return f(this).each(function(){f(this).children("li").hover(function(){f(this).children("span").fadeIn();f(this).children("a").css("display","block")},function(){f(this).children("span").hide();f(this).children("a").hide()})})}})(jQuery);(function(f){f.fn.megaSlide=function(){return f(this).each(function(){w=f(this).width();f(this).css({display:"block",overflow:"hidden","white-space":"nowrap",padding:"6px 0 6px 5px"}).width(0).animate({width:w+"px"},250)})}})(jQuery); (function(f){if(!f.fn.jqDock){var i=function(){return{version:1.2,defaults:{size:36,distance:54,coefficient:1.5,duration:500,align:"bottom",labels:false,source:false,loader:null},useJqLoader:f.browser.opera||f.browser.safari,shrinkInterval:100,docks:[],X:0,Y:0,verthorz:{v:{wh:"height",xy:"Y",tl:"top",lead:"Top",trail:"Bottom",act:"ActualInv"},h:{wh:"width",xy:"X",tl:"left",lead:"Left",trail:"Right",act:"Actual"}},elementCss:{position:"relative",borderWidth:0,borderStyle:"none",verticalAlign:"top"}, vanillaDiv:'<div style="position:relative;margin:0px;padding:0px;border:0px none;background-color:transparent;">',initDock:function(e){var b=this,a=this.docks[e],c=a.Opts,g=0,d=f("a, img",a.Menu),h=0,j;j=f.browser.opera&&1*(f.browser.version.match(/^(\d+\.\d+)/)||[0,0])[1]<9.5;this.removeText(a.Menu);if(c.orient.vh=="h"){d.css(this.elementCss);if(j||!f.boxModel)d.filter("a").css({lineHeight:0,fontSize:"0px"});else{j={display:"block"};j["float"]="left";d.filter("img").css(j)}}else d.not(f("a img", a.Menu)).wrap(this.vanillaDiv+"</div>").end().css(this.elementCss).css({display:"block"});for(;h<a.Elem.length;){d=a.Elem[h++];j=this.keepProportion(d,c.size,{vh:c.orient.inv,inv:c.orient.vh});d.Actual=d.Final=d.Initial=j[c.vh.wh];d.SizeDiff=d[c.vh.wh]-d.Initial;d.Img.css(j);d.Img.removeAttr("title").attr({alt:""}).parent("a").removeAttr("title");d.ShrinkStep=Math.floor(d.SizeDiff*this.shrinkInterval/c.duration);a[c.vh.inv.wh]=Math.max(a[c.vh.inv.wh],c.size+d.Pad[c.vh.inv.lead]+d.Pad[c.vh.inv.trail]); d.Offset=g;d.Centre=d.Offset+d.Pad[c.vh.lead]+d.Initial/2;g+=d.Initial+d.Pad[c.vh.lead]+d.Pad[c.vh.trail]}for(h=0;h<a.Elem.length;){d=a.Elem[h++];g=0;j=d.Pad[c.vh.lead]+d.Pad[c.vh.trail];a.Spread+=d.Initial+j;this.setSizes(e,d.Centre);for(d=a.Elem.length;d;)g+=a.Elem[--d].Final+j;a[c.vh.wh]=Math.max(a[c.vh.wh],g)}for(;h;){d=a.Elem[--h];d.Final=d.Initial}g=[this.vanillaDiv,'<div class="jqDock" style="position:absolute;top:0px;left:0px;padding:0px;margin:0px;overflow:visible;height:',a.height,"px;width:", a.width,'px;"></div></div>'].join("");a.Yard=f(a.Menu).wrapInner(g).find("div.jqDock");f.each([c.vh.lead,c.vh.trail],function(k,l){a.Borders[l]=b.asNumber(a.Yard.css("border"+l+"Width"))});for(a.Borders[c.vh.lead]&&a.Yard.css(c.vh.tl,Math.ceil(a.Borders[c.vh.lead]/2));h<a.Elem.length;){d=a.Elem[h];this.changeSize(e,h,d.Final,true);d.Img.addClass("jqDockMouse"+e+"_"+h++)}f(a.Menu).show();if(a.Opts.labels){f.each(a.Elem,function(){b.setLabel(e,this.Label)});a.Label.hide()}a.Yard.bind("mouseover mouseout mousemove", function(k){b.mouseHandler(k)})},altImage:function(){var e=f(this).attr("alt");return e&&e.match(/\.(gif|jpg|jpeg|png)$/i)?e:false},removeText:function(e){for(var b=e.childNodes.length,a;b;){a=e.childNodes[--b];if(a.childNodes&&a.childNodes.length)this.removeText(a);else a.nodeType==3&&e.removeChild(a)}},asNumber:function(e){e=parseInt(e,10);return isNaN(e)?0:e},keepProportion:function(e,b,a){var c={},g=this.verthorz[a.vh];a=this.verthorz[a.inv];c[g.wh]=b;c[a.wh]=Math.round(b*e[a.wh]/e[g.wh]);return c}, deltaXY:function(e){var b=this.docks[e];if(b.Current!==false){var a=b.Opts,c=b.Elem[b.Current],g=c.Pad[a.vh.lead]+c.Pad[a.vh.trail],d=c.Img.offset();b.Delta=Math.floor((this[a.vh.xy]-d[a.vh.tl])*(g+c.Initial)/(g+c.Actual))+c.Offset;this.doLabel(e,d)}},setLabel:function(e,b){var a=this.docks[e],c=this,g={};if(!a.Label)a.Label=f('<div class="jqDockLabel jqDockMouse'+e+'_00 jqDockLabelImage" style="position:absolute;margin:0px;"></div>').hide().bind("click",function(){a.Elem[a.Current].Img.trigger("click")}).appendTo(a.Yard); if(b.txt){a.Label.text(b.txt);f.each(["Top","Right","Bottom","Left"],function(d,h){g[h]=c.asNumber(a.Label.css("padding"+h))});f.each(this.verthorz,function(d,h){b[h.wh]=a.Label[h.wh]();b[h.wh+"Pad"]=g[h.lead]+g[h.trail]})}},doLabel:function(e,b){var a=this.docks[e];if(a.Opts.labels&&a.Current!==false){var c=a.Elem[a.Current],g=c.Label,d=a.Opts,h=typeof b=="string"?b:"move";switch(h){case "show":case "hide":a.Label[g.txt?h:"hide"]();break;case "change":a.Label[0].className=a.Label[0].className.replace(/(jqDockLabel)(Link|Image)/, "$1"+(c.Linked?"Link":"Image"));a.Label.text(g.txt).css({width:g.width,height:g.height}).hide();break;default:h=a.Yard.offset();h={top:b.top-h.top,left:b.left-h.left};var j=d.labels.split("");if(j[0]=="m")h.top+=Math.floor((c[d.vh.inv.act]-g.height-g.heightPad)/2);else if(j[0]=="b")h.top+=c[d.vh.inv.act]+c.Pad.Top+c.Pad.Bottom-g.height-g.heightPad;if(j[1]=="c")h.left+=Math.floor((c[d.vh.act]-g.width-g.widthPad)/2);else if(j[1]=="r")h.left+=c[d.vh.act]+c.Pad.Left+c.Pad.Right-g.width-g.widthPad;a.Label.css(h)}}}, mouseHandler:function(e){var b=null,a=e.target.className.match(/jqDockMouse(\d+)_(\d+)/),c=!!e.relatedTarget&&e.relatedTarget.tagName!==undefined;if(a){b=false;var g=1*a[1],d=this.docks[g];a=a[2]=="00"?d.Current:1*a[2];this.X=e.pageX;this.Y=e.pageY;if(e.type=="mousemove"){if(a==d.Current){this.deltaXY(g);if(d.OnDock&&d.Expanded){this.setSizes(g);this.factorSizes(g)}}}else{var h=c&&e.relatedTarget.className.match(/jqDockMouse(\d+)_(\d+)/);if(e.type=="mouseover"&&(!d.OnDock||a!==d.Current)){d.Current= a;this.doLabel(g,"change");this.deltaXY(g);d.Expanded&&this.doLabel(g,"show");if(c&&(!h||h[1]!=g)){d.Timestamp=(new Date).getTime();this.setSizes(g);d.OnDock=true;this.overDock(g)}}else if(c&&e.type=="mouseout")if(!h||h[1]!=g){d.OnDock=false;this.doLabel(g,"hide");for(e=d.Elem.length;e--;)d.Elem[e].Final=d.Elem[e].Intial;this.offDock(g)}}}return b},overDock:function(e){var b=this.docks[e];if(b.OnDock){for(var a=this,c=b.Elem,g=c.length;g--&&!(c[g].Actual<c[g].Final););if(g<0){b.Expanded=true;this.deltaXY(e); this.doLabel(e,"show")}else{this.setSizes(e);this.factorSizes(e);setTimeout(function(){a.overDock(e)},60)}}},offDock:function(e){var b=this.docks[e];if(!b.OnDock){for(var a=this,c=true,g=b.Elem.length,d,h;g;){d=b.Elem[--g];if(d.Actual>d.Initial){h=d.Actual-d.ShrinkStep;if(h>d.Initial)c=false;else h=d.Initial;this.changeSize(e,g,h)}}this.deltaXY(e);if(c){for(;g<b.Elem.length;){d=b.Elem[g++];d.Actual=d.Final=d.Initial}b.Current=b.Expanded=false}else setTimeout(function(){a.offDock(e)},this.shrinkInterval)}}, setSizes:function(e,b){var a=this.docks[e],c=a.Opts,g=a.Elem.length,d,h;for(b=b||a.Delta;g;){d=a.Elem[--g];h=Math.floor(d.SizeDiff*Math.pow(Math.abs(b-d.Centre),c.coefficient)/c.attenuation);d.Final=h<d.SizeDiff?d[c.vh.wh]-h:d.Initial}},factorSizes:function(e){var b=this.docks[e],a=b.Opts,c=a.duration+60;if(b.Timestamp){c=(new Date).getTime()-b.Timestamp;if(c>=a.duration)b.Timestamp=0}if(c>60){a=c<a.duration?c/a.duration:0;c=0;for(var g;c<b.Elem.length;){g=b.Elem[c];this.changeSize(e,c++,a?Math.floor(g.Initial+ (g.Final-g.Initial)*a):g.Final)}}},changeSize:function(e,b,a,c){var g=this.docks[e];b=g.Elem[b];if(c||b.Actual!=a){var d=g.Opts,h=f.boxModel||d.orient.vh=="v"?0:g.Borders[d.vh.lead]+g.Borders[d.vh.trail];if(b.Source[2]&&!c&&b.Actual==b.Initial)b.Img[0].src=b.Source[1];g.OnDock&&this.deltaXY(e);g.Spread+=a-b.Actual;e=this.keepProportion(b,a,d.orient);var j=d.size-e[d.vh.inv.wh],k=d.vh.inv;switch(d.align){case "bottom":case "right":e["margin"+k.lead]=j;break;case "middle":case "center":e["margin"+k.lead]= (j+j%2)/2;e["margin"+k.trail]=(j-j%2)/2;break;case "top":case "left":e["margin"+k.trail]=j}g.Yard[d.vh.wh](g.Spread+h);b.Img.css(e);g.Yard.css("margin"+d.vh.lead,Math.floor(Math.max(0,(g[d.vh.wh]-g.Spread)/2)));b.Actual=a;b.ActualInv=e[d.vh.inv.wh];if(b.Source[2]&&!c&&b.Actual==b.Initial)b.Img[0].src=b.Source[0]}}}}();f.fn.jqDock=function(e){return this.filter(function(){for(var b=i.docks.length;b--&&this!=i.docks[b].Menu;);return b<0&&f("img",this).length}).hide().each(function(){var b=i.docks.length; i.docks[b]={Elem:[],Menu:this,OnDock:false,Expanded:false,Timestamp:0,width:0,height:0,Spread:0,Borders:{},Yard:false,Opts:f.extend({},i.defaults,e||{}),Current:false,Delta:0,Loaded:0,Label:false};var a=i.docks[b],c=a.Opts;c.attenuation=Math.pow(c.distance,c.coefficient);c.orient={left:1,center:1,right:1}[c.align]?{vh:"v",inv:"h"}:{vh:"h",inv:"v"};c.vh=f.extend({},i.verthorz[c.orient.vh],{inv:i.verthorz[c.orient.inv]});c.loader=c.loader&&typeof c.loader=="string"&&/^image|jquery$/i.test(c.loader)? c.loader.toLowerCase():"";c.labels=c.labels===true?{top:"bc",left:"tr",right:"tl"}[c.align]||"tc":typeof c.labels=="string"&&{tl:1,tc:1,tr:1,ml:1,mc:1,mr:1,bl:1,bc:1,br:1}[c.labels]?c.labels:false;f("img",this).each(function(d){var h=f(this),j=h.attr("src"),k=(c.source?c.source.call(h[0],d):false)||i.altImage.call(this)||j,l=c.labels?h.attr("title")||h.parent("a").attr("title")||"":"";a.Elem[d]={Img:h,Source:[j,k,j!=k],Label:{txt:l,width:0,height:0,widthPad:0,heightPad:0},Initial:0,Actual:0,ActualInv:0, Final:0,Offset:0,Centre:0,Pad:{},Linked:!!h.parent("a").length,width:0,height:0};f.each(["Top","Right","Bottom","Left"],function(n,m){a.Elem[d].Pad[m]=i.asNumber(h.css("padding"+m))})});var g=!c.loader&&i.useJqLoader||c.loader=="jquery";f.each(a.Elem,function(){var d=this,h=function(){d.height=this.height;d.width=this.width;++a.Loaded>=a.Elem.length&&setTimeout(function(){i.initDock(b)},0)};if(g)f("<img />").bind("load",h).attr({src:this.Source[1]});else{var j=new Image;j.onload=function(){h.call(this); j.onload=function(){}};j.src=this.Source[1]}})}).end()};f.jqDock=function(e){return i[e]?i[e]:null}}})(jQuery); (function(f){f.fn.innerfade=function(i){return this.each(function(){f.innerfade(this,i)})};f.innerfade=function(i,e){var b={animationtype:"fade",speed:"normal",type:"sequence",timeout:2E3,containerheight:"auto",runningclass:"innerfade",children:null};e&&f.extend(b,e);var a=b.children===null?f(i).children():f(i).children(b.children);if(a.length>1){f(i).css("position","relative").css("height",b.containerheight).addClass(b.runningclass);for(var c=0;c<a.length;c++)f(a[c]).css("z-index",String(a.length- c)).css("position","absolute").hide();if(b.type=="sequence"){setTimeout(function(){f.innerfade.next(a,b,1,0)},b.timeout);f(a[0]).show()}else if(b.type=="random"){var g=Math.floor(Math.random()*a.length);setTimeout(function(){do d=Math.floor(Math.random()*a.length);while(g==d);f.innerfade.next(a,b,d,g)},b.timeout);f(a[g]).show()}else if(b.type=="random_start"){b.type="sequence";var d=Math.floor(Math.random()*a.length);setTimeout(function(){f.innerfade.next(a,b,(d+1)%a.length,d)},b.timeout);f(a[d]).show()}else alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'")}}; f.innerfade.next=function(i,e,b,a){if(e.animationtype=="slide"){f(i[a]).slideUp(e.speed);f(i[b]).slideDown(e.speed)}else if(e.animationtype=="fade"){f(i[a]).fadeOut(e.speed);f(i[b]).fadeIn(e.speed,function(){removeFilter(f(this)[0])})}else alert("Innerfade-animationtype must either be 'slide' or 'fade'");if(e.type=="sequence")if(b+1<i.length){b+=1;a=b-1}else{b=0;a=i.length-1}else if(e.type=="random")for(a=b;b==a;)b=Math.floor(Math.random()*i.length);else alert("Innerfade-Type must either be 'sequence', 'random' or 'random_start'"); setTimeout(function(){f.innerfade.next(i,e,b,a)},e.timeout)}})(jQuery);function removeFilter(f){f.style.removeAttribute&&f.style.removeAttribute("filter")};var idleTime = 0; var standby = false; function CheckInactivity() { idleTime += 10; if(idleTime > 600) { InitializeStandBy(); } } function InitializeStandBy() { if(!standby) { var h = 0; h = jQuery(window).height(); jQuery("#energysaving").show().css({ height: "0", width: "0", left: "50%", top: "50%" }).animate({ width: "100%", height: h, left: "0", top: "0", opacity: "1" }, 1000); standby = true; } } function StopStandBy() { if(standby) { jQuery("#energysaving").animate({ width: "0", height: "0", opacity: "0", left: "50%", top: "50%" }, 500); setTimeout('jQuery("#energysaving").hide();', 800); standby = false; } } if(typeof(jQuery) == "undefined") { document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>'); } function InitJQuery() { if(typeof(jQuery) == "undefined") { setTimeout("InitJQuery();", 50); } else { jQuery(function() { jQuery(document).ready(function() { setInterval("CheckInactivity();", 10000); jQuery(this).mousemove(function(e) { idleTime = 0; StopStandBy(); }); jQuery(document).keypress(function(e) { idleTime = 0; StopStandBy(); }); jQuery("body").append('<div id="energysaving"><p>Modo "Ahorro de Energ&iacute;a"<br /><span>Mueva el mouse para volver a PInicio.</span></p><div id="copyrightOnlineLeaf" style="display:none">Copyright 2009 <font style="color: #666666;">OnlineLeaf.com</font> - All rights reserved</div></div>'); jQuery("#energysaving").hide(); }); }); } } InitJQuery();
