/*
Scroller
FairSky Pages Component
-----------------------
Copyright 2004 Joshua Paine
Created by Joshua Paine of FairSky Networks <http://fairsky.us/>
Contact at <http://fairsky.us/contact>
Updated 2005-08-10

The latest version should be available at
<http://demo.fairsky.us/javascript/scroller.html>

You may copy, reuse, or produce derivative works of this code
only under the terms of the Linky License v0.1 or later.
The Linky License can be found at <http://fairsky.us/linky>.
The main points of the license are:
	1) Do not alter or remove this notice.
	2) Notify me of your usage through one of the means listed
	   at <http://fairsky.us/contact>.
*/

var gScrollers = new Array();
var gScrollerDefaultDelay = 60;
var gScrollerDefaultIncrement = 1;
var gScrollerTimeouts = new Array();

function scrollerLoad()
{
	var pos;
	if(window.getComputedStyle && (pos = window.getComputedStyle(this,null).position))
		if(pos!="absolute" && pos!="fixed") this.style.position = "relative";
	else if(this.currentStyle && (pos = this.currentStyle.position))
		if(pos!="absolute" && pos!="fixed") this.style.position = "relative";
	while(!this.id || gScrollers[this.id]) this.id="a"+Math.floor(10000 * Math.random());
	gScrollers[this.id] = this;
	this.scrollIncrement = this.className.match(/Scroller\.Increment:([0-9]+)/);
	if(this.scrollIncrement && this.scrollIncrement[1]) this.scrollIncrement = 1*this.scrollIncrement[1];
	else this.scrollIncrement = gScrollerDefaultIncrement;
	this.scrollDelay = this.className.match(/Scroller\.Delay:([0-9]+)/);
	if(this.scrollDelay && this.scrollDelay[1]) this.scrollDelay = 1*this.scrollDelay[1];
	else this.scrollDelay = gScrollerDefaultDelay;
	this.style.overflow = "hidden";
	this.scrollChild = this.getElementsByTagName("*").item(0);
	this.scrollChild.style.position = "absolute";
	this.scrollCurrent = Math.round(this.clientHeight * 0.9);
	this.pauseScroll = scrollerOver;
	this.resumeScroll = scrollerOut;
	this.scrollChild.style.top = this.scrollCurrent + "px";
	moveScroller(this.id);
}

function moveScroller(id)
{
	var s;
	if(gScrollers && (s = gScrollers[id]))
	{
		s.scrollCurrent = s.scrollCurrent-s.scrollIncrement;
		if(s.scrollCurrent < (-1 * s.scrollChild.clientHeight)) s.scrollCurrent = (s.clientHeight);
		s.scrollChild.style.top = s.scrollCurrent + "px";
		setScrollTimeout(id);
	}
}

function scrollerOver()
{
	if(this.id && gScrollerTimeouts && gScrollerTimeouts[this.id]) clearTimeout(gScrollerTimeouts[this.id]);
}

function scrollerOut()
{
	if(this.id && gScrollers && gScrollers[this.id])
		setScrollTimeout(this.id);
}

function setScrollTimeout(id)
{
	gScrollerTimeouts[id] = setTimeout("clearTimeout(gScrollerTimeouts['"+id+"']);moveScroller('"+id+"');",gScrollers[id].scrollDelay);
}

function pauseAllScrollers()
{
	for(var x=0; x<gScrollers.length; x++) gScrollers[x].onMouseOver();
}

function resumeAllScrollers()
{
	for(var x=0; x<gScrollers.length; x++) gScrollers[x].onMouseOut();
}

document.register('div','Scroller',scrollerLoad,'load',false);
document.register('div','Scroller',scrollerOver,'mouseover',true);
document.register('div','Scroller',scrollerOut,'mouseout',true);


RightNow=new Date();
var themonth;
var month=RightNow.getMonth()+1;
if (month==1) themonth = "Enero";
if (month==2) themonth = "Febrero";
if (month==3) themonth = "Marzo";
if (month==4) themonth = "Abril";
if (month==5) themonth = "Mayo";
if (month==6) themonth = "Junio";
if (month==7) themonth = "Julio";
if (month==8) themonth = "Agosto";
if (month==9) themonth = "Septiembre";
if (month==10) themonth = "Octubre";
if (month==11) themonth = "Noviembre";
if (month==12) themonth = "Deciembre";

var date=RightNow.getDate();
var year=RightNow.getYear();
var day=RightNow.getDay();
if (year==100){year="2000";}
if (year==101){year="2001";}
if (year==102){year="2002";}
if (year==103){year="2003";}
if (year==104){year="2004";}
if (year==105){year="2005";}

function iFlash( asrc, aw, ah ){
        document.write( "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"" );
        document.write( "       width=\""+aw+"\"" );
        document.write( "       height=\""+ah+"\">" );
        document.write( "       <param name=\"movie\" value=\""+asrc+"\">" );
        document.write( "       <param name=\"quality\" value=\"high\">" );
        document.write( "       <embed  src=\""+asrc+"\"" );
        document.write( "               quality=\"high\"" );
        document.write( "               type=\"application/x-shockwave-flash\"" );
        document.write( "               width=\""+aw+"\"" );
        document.write( "               height=\""+ah+"\">" );
        document.write( "       </embed></object>");
}


/*APARTIR DE AQUI SE PASO TODO EL TEXTO DE fsp.js 	POR LO QUE YA NO SE NECESITO TENER EL ARCHIVO
function documentRegister(tag,effect,func,ev,exclusive)
{
	document.toRegister[document.toRegister.length] = {
		tag:tag,
		effect:effect,
		func:func,
		event:ev,
		exclusive:exclusive
	};
}

function doRegister(n)
{
	if(!n) n = document;
	var t, y;
	var r = document.toRegister;
	for(var x=0; x<r.length; x++)
	{
		t = n.getElementsByTagName(r[x].tag);
		if(r[x].tag=='*' && t.length==0) t = document.all;
		for(y=0; y<t.length; y++)
		{
			if(!r[x].effect || hasClassName(t[y],"Fsp."+r[x].effect) || hasClassName(t[y],r[x].effect) || t[y].className.indexOf("Fsp."+r[x].effect+":") > -1 || t[y].className.indexOf("Fsp."+r[x].effect+".") > -1)
			{
				if(r[x].event == 'load')
				{
					t[y].load = r[x].func;
					t[y].load({ currentTarget:t[y] });
				}
				else
				{
					addEventHandler(t[y],r[x].event,r[x].func,r[x].exclusive);
				}
			}
		}
	}
}

function addEventHandler(el,ev,func,exclusive)
{
	if(exclusive)
	{
		if(eval("el.on"+ev+" = func;")) return true;
		else return false;
	}
	else
	{
		if(el.addEventListener)
		{
			el.addEventListener(ev,func,false);
			return true;
		}
		else if(el.attachEvent)
		{
			return el.attachEvent("on"+ev, func);
		}
		else return false;
	}
}

function dumpProps(obj)
{
	var str, p, i, val;
	i = 0;
	str='';
	for(p in obj)
	{
		val = ''+eval('obj.'+p);
		val = val.substring(0,300);
		str += p+' = '+val+'\n';
		if(i++==15){ alert(str); str=''; i=0; }
	}
	alert(str);
}

function fspImageToolbarRemoval()
{
	this.setAttribute('galleryimg','false');
}

function addClassName(el,newClass)
{
	var ary = el.className.split(' ');
	var x=0;
	while(x<ary.length && ary[x]!=newClass) x++;
	if(x<ary.length) return false;
	else
	{
		ary[ary.length] = newClass;
		el.className = ary.join(' ');
		return true;
	}
}

function removeClassName(el,oldClass)
{
	var ary = el.className.split(' ');
	var className = new Array();
	for(var x=0; x<ary.length; x++) if(ary[x]!=oldClass) className[className.length] = ary[x];
	if(ary.length==className.length) return false;
	else
	{
		el.className = className.join(' ');
		return true;
	}
}

function replaceClassName(el,oldClass,newClass)
{
	var ary = el.className.split(' ');
	var x = 0;
	while(x<ary.length && ary[x]!=oldClass) x++;
	if(x<ary.length)
	{
		el.className = ary.join(' ');
		return true;
	}
	else return false;
}

function hasClassName(el,searchClass)
{
	var ary = el.className.split(' ');
	var x = 0;
	while(x<ary.length && ary[x]!=searchClass && ary[x].substr(0,ary[x].search(":"))!=searchClass) x++;
	return (x<ary.length);
}

document.toRegister = new Array();
document.register = documentRegister;
document.fspUpdate = doRegister;

addEventHandler(window,'load',function(){ doRegister(); },false);

document.register('img',null,fspImageToolbarRemoval,'load',false);*/