// JavaScript Document
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->

// Set SlideShowSpeed (milliseconds)
var SlideShowSpeed = 3000

// Duration of crossfade (seconds)
var crossFadeDuration = 3

// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below

Pic[0] = 'images/portada/img4.jpg'
Pic[1] = 'images/portada/img1.jpg'
Pic[2] = 'images/portada/img2.jpg'
Pic[3] = 'images/portada/img3.jpg'

// =======================================
// do not edit anything below this line
// =======================================

var t
var j = 0
var p = Pic.length

var preLoad = new Array()
for (i = 0; i < p; i++){
   preLoad[i] = new Image()
   preLoad[i].src = Pic[i]
}

function runSlideShow(){
   if (document.all){
      document.images.SlideShow.style.filter="blendTrans(duration=2)"
      document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)"
      document.images.SlideShow.filters.blendTrans.Apply()      
   }
   document.images.SlideShow.src = preLoad[j].src
   if (document.all){
      document.images.SlideShow.filters.blendTrans.Play()
   }
   j = j + 1
   if (j > (p-1)) j=0
   t = setTimeout('runSlideShow()', SlideShowSpeed)
}
<!--
function imprimir() {
if (window.print)
window.print()
else
alert("Disculpe, su navegador no soporta esta opción.");
}
// -->
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=1,border=0,location=0,statusbar=0,status=0,menubar=0,resizable=0,width=537,height=425,left = 140,top = 25');");
}
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-->

function generate(form){
var txt = '<!-- ONE STEP TO INSTALL PULLDOWN MENU:\r\n\r\n'
+ '   1.  Paste the code into the BODY of your HTML document  -->\r\n\r\n'
+ '<!-- STEP ONE: Copy this code into the BODY of your HTML document  -->\r\n\r\n'
+ '<BODY>\r\n\r\n'
+ '<!-- Original:  Ricocheting (ricocheting@hotmail.com)  -->\r\n'
+ '<!-- Web Site:  http://free.prohosting.com/~ric  -->\r\n\r\n'
+ '<!-- This script and many more are available free online at -->\r\n'
+ '<!-- The JavaScript Source!! http://javascript.internet.com -->\r\n\r\n';

if (document.jump.go[0].checked) {
txt += "<form name=\"jump\">\n<select name=\"menu\" onChange=\"location=document.jump.menu.options[document.jump.menu.selectedIndex].value;\" value=\"GO\">\n";
}
if (document.jump.go[1].checked) {
txt += "<form name=\"jump\">\n<select name=\"menu\">\n";
var Button = "<input type=\"button\" onClick=\"location=document.jump.menu.options[document.jump.menu.selectedIndex].value;\" value=\"GO\">\n";
}
if (document.jump.go[2].checked) {
txt += "<form name=\"jump\">\n<script>\nfunct" +
"ion jumpMenu(){\nlocation=document.jump.menu.options[document.jump.menu.selectedIndex].value;\n}\n" +
"</sc" + "ript>\n<select name=\"menu\">\n";
var Button = "<a href=\"Javascript:jumpMenu()\">"+
"<IMG SRC=\""+document.jump.image.value+"\" border=0></a>\n";
}
for (jig = 5; jig <= 24; jig = jig + 2) {
if (form[jig].value)
{
   txt += "<option";
   if (form[jig+1].value)
   {
   txt += " value=\""+form[jig+1].value+"\"";
   }
   else
   {
   txt += " value=\"#\"";
   }
   txt += ">"+form[jig].value+"</option>\n";
}

}

if (document.jump.go[0].checked) {
txt += "</select>\n</form>\n";
}
if (document.jump.go[1].checked) {
txt += "</select>\n"+Button+"</form>\n";
}
if (document.jump.go[2].checked) {
txt += "</select>\n"+Button+"</form>\n";
   }
document.mail.source.value=txt;
document.mail.source2.value=txt;

uncode();
}
// End -->
function formHandler(form) {
var windowprops = "height=470,width=563,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable=no";

var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}

function formHandler_2(form) {
var windowprops = "height=435,width=563,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable=no";

var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}

function formHandler_3(form) {
var windowprops = "height=500,width=770,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable=yes";

var URL = form.site.options[form.site.selectedIndex].value;
popup = window.open(URL,"MenuPopup",windowprops);
}


function IfZero(num) {
	return ((num <= 9) ? ("0" + num) : num);
}

// get selected date
function getDate(curdate, month, day, hour) {
	return Date.UTC(curdate.getUTCFullYear(), month, day, hour);
}

// DST for selected areas
function getDST(area, dif, utctime) {
	var curdate = new Date();
	var curyear = curdate.getUTCFullYear();

	switch(area) {
		case "EU":
    	var dstDayB = 31 - (Math.floor(5*curyear/4) + 1) % 7;
    	dstDayA = 31 - (Math.floor(5*curyear/4) + 4) % 7;
		  var dstStart = getDate(curdate, 2, dstDayA, 1);   // GMT time
			var dstEnd = getDate(curdate, 9, dstDayB, 1);     // GMT time

			if(utctime >= dstStart && utctime < dstEnd) return 1;

			return 0;
		break;

		case "US":
			var dstDayB = 7 - (Math.floor(5*curyear/4) + 4) % 7;
			dstDayA = 31 - (Math.floor(5*curyear/4) + 1) % 7;
			var dstStart = getDate(curdate, 3, dstDayB, 2);
			var dstEnd = getDate(curdate, 9, dstDayA, 3);

			utctime = utctime-(dif*3600000);

			if(utctime >= dstStart && utctime < dstEnd) return 1;
			return 0;
 		break;

		default:
 			return 0;
		break;
	}
}

// return full string time
function getInfoTime(dt, text, area, differ, utctime, end){
	return text + toGetHourForPlace(dt, differ,getDST(area, differ, utctime)) + end;
}

// init
function initTime() {
	this.dt = new Date();
	this.dif = this.dt.getTimezoneOffset()/60;
	this.UTCTime = Date.UTC(this.dt.getUTCFullYear(), this.dt.getUTCMonth(), this.dt.getUTCDate(), this.dt.getUTCHours());
	this.end = ":" + IfZero(this.dt.getMinutes());// + ":" +  IfZero(this.dt.getSeconds());
}

// get Hour for selected place
function toGetHourForPlace(date, TimeUTCOffset, TimeZoneOffset) {
  var hour = date.getUTCHours()+TimeUTCOffset+TimeZoneOffset;
  return IfZero((hour>=24)?hour-24:((hour<0)?24+hour:hour));
}

// show all times
function GetTime() {
	var init = new initTime();

	//var localTime = "Local: " + init.dt.getHours() + init.end;
	var buenosairesTime = getInfoTime(init.dt, "Hora Local: ", "SA", -3, init.UTCTime, init.end);
	var rioTime = getInfoTime(init.dt, "Rio de Janeiro: ", "SA", -2, init.UTCTime, init.end);
	var baselTime = getInfoTime(init.dt, "Basilea: ", "UE", 1, init.UTCTime, init.end);
	var tokyoTime = getInfoTime(init.dt, "Tokyo: ", 0, 9, init.UTCTime, init.end);
	var sanfranciscoTime = getInfoTime(init.dt, "San Francisco: ", "US", -8, init.UTCTime, init.end);
	
	var space="&nbsp;&nbsp;&nbsp;";
	//document.getElementById("timeBar").innerHTML = buenosairesTime + space + space + space + space + rioTime + space + baselTime + space + tokyoTime;
	document.getElementById("timeBar").innerHTML = buenosairesTime + space + rioTime + space + baselTime + space + tokyoTime;


	setTimeout("GetTime()", 1000);
}


/***
 * this function get called by body onload event
 */
function initPage() {
	GetTime();		
}
