var today = new Date()
var DayW = today.getDay()
var DateW = today.getDate()
var MonthW = today.getMonth()
var YearW = today.getYear()
var DayString = "Missing day"
if (DayW == 0) {
	DayString = "Domingo"	
	}
  else if (DayW == 1) {
     DayString = "Lunes"
	}
  else if (DayW == 2) {
     DayString = "Martes"
	}
  else if (DayW == 3) {
     DayString = "Miercoles"
	}
  else if (DayW == 4) {
     DayString = "Jueves"
	}
  else if (DayW == 5) {
     DayString = "Viernes"
  	}
  else if (DayW == 6) {
     DayString = "Sábado"
  	}
     else DayString = "We got trouble!"
MonthString = "Don't know the month"
  if (MonthW == 0) {
     MonthString = "Enero"
	}
  else if (MonthW == 1) {
     MonthString = "Febrero"
  	}
  else if (MonthW == 2) {
     MonthString = "Marzo"
	}
  else if (MonthW == 3) {
     MonthString = "Abril"
	}
  else if (MonthW == 4) {
     MonthString = "Mayo"
	}
  else if (MonthW == 5) {
     MonthString = "Junio"
	}
  else if (MonthW == 6) {
     MonthString = "Julio"
	}
  else if (MonthW == 7) {
     MonthString = "Agosto"
	}
  else if (MonthW == 8) {
     MonthString = "Septiembre"
	}
  else if (MonthW == 9) {
     MonthString = "Octubre"
	}
  else if (MonthW == 10) {
     MonthString = "Noviembre"
 	}
  else if (MonthW == 11) {
     MonthString = "Diciembre"
	}
  else MonthString = ""
var DateString = ""
   DateString = "" + ((DateW < 10) ? "0" : "") + DateW
var YearString = "Don't know year"
YearW = YearW + 0000
YearString = "" + YearW

var CurrentBrowser = navigator.appName;
if (CurrentBrowser != 'Microsoft Internet Explorer') {
document.write(" " + DayString + ", " + DateString + " de " + MonthString +  " ")
	} else {
	document.write(" " + DayString + ", " + DateString + " de " + MonthString + 
	" de " + YearString + " ")
	}


	

function show5(){
	if (!document.layers&&!document.all)
		return;

	var Digital=new Date();
	var hours=Digital.getHours();
	var minutes=Digital.getMinutes();
	var seconds=Digital.getSeconds();
	var dn="AM";
	if (hours>12){
		dn="PM";
		hours=hours-12;
	}
	if (hours==0)
		hours=12;
	if (minutes<=9)
		minutes="0"+minutes;
	if (seconds<=9)
		seconds="0"+seconds;

	myclock=hours+":"+minutes+":"
 +seconds+" "+dn;

	if (document.layers){
		document.layers.liveclock.document.write(myclock);
		document.layers.liveclock.document.close();
	}
	else if (document.all)
		liveclock.innerHTML=myclock
		setTimeout("show5()",1000)
}

//Creating the EZ resources

var CurrentKey ='searchgoogle';
var Helptext = '';
var URLtogo = '';
var testtext ='';

ButtonValue = new Array(16);
ButtonHelp = new Array(16);
URLs = new Array(16);

ButtonValue['searchgoogle'] = 'Iniciar busqueda';
ButtonHelp['searchgoogle'] = 'Haga click en el boton "Iniciar busqueda" para buscar "%query%" con Google.';
URLs['searchgoogle'] = 'http://www.google.com/search?ie=UTF-8&oe=UTF-8&q=%query%';
				
ButtonValue['searchyahoo'] = 'Iniciar busqueda';
ButtonHelp['searchyahoo'] = 'Haga click en el boton "Iniciar busqueda" para buscar "%query%" con Yahoo.';
URLs['searchyahoo'] = 'http://espanol.search.yahoo.com/search?p=%query%&fr=FP-tab-web-t&toggle=1&ei=ISO-8859-1&meta=all%3D1';
		
ButtonValue['searchmsn'] = 'Iniciar busqueda';
ButtonHelp['searchmsn'] = 'Haga click en el boton "Iniciar busqueda" para buscar "%query%" con MSN.';
URLs['searchmsn'] = 'http://search.msn.com/results.asp?q=%query%';
				
ButtonValue['buyamazon'] = 'Iniciar busqueda';
ButtonHelp['buyamazon'] = 'Haga click en el boton "Iniciar busqueda" para encontrar "%query%" en Amazon.';
URLs['buyamazon'] = 'http://www.amazon.com/exec/obidos/external-search?mode=blended&tag=wwwroboformco-20&keyword=%query%';
				
ButtonValue['buyebay'] = 'Iniciar busqueda';
ButtonHelp['buyebay'] = 'Haga click en el boton "Iniciar busqueda" para encontrar "%query%" en Ebay.';
URLs['buyebay'] = 'http://www.qksrv.net/click-1692177-5463217?loc=http%3A//search.ebay.com/search/search.dll%3Fcgiurl%3Dhttp%253A%252F%252Fcgi.ebay.com%252Fws%252F%26krd%3D1%26from%3DR8%26MfcISAPICommand%3DGetResult%26ht%3D1%26SortProperty%3DMetaEndSort%26query%3D%query%';
				
ButtonValue['transentosp'] = 'Traducir';
ButtonHelp['transentosp'] = 'Haga click en el boton "Traducir" para traducir "%query%" a español.';
URLs['transentosp'] = 'http://www.wordreference.com/es/translation.asp?tranword=%query%';
				
ButtonValue['transsptoen'] = 'Traducir';
ButtonHelp['transsptoen'] = 'Haga click en el boton "Traducir" para traducir "%query%" a ingles.';
URLs['transsptoen'] = 'http://www.wordreference.com/es/en/translation.asp?spen=%query%';
				
ButtonValue['sententosp'] = 'Traducir';
ButtonHelp['sententosp'] = 'Haga click en el boton "Traducir" para traducir "%query%" a español.';
URLs['sententosp'] = 'http://translate.google.com/translate_t?langpair=en|es&text=%query%';
		
ButtonValue['sentsptoen'] = 'Traducir';
ButtonHelp['sentsptoen'] = 'Haga click en el boton "Traducir" para traducir "%query%" a ingles.';
URLs['sentsptoen'] = 'http://translate.google.com/translate_t?langpair=es|en&text=%query%';
				
ButtonValue['conjspword'] = 'Conjugar';
ButtonHelp['conjspword'] = 'Haga click en el boton "Conjugar" para ver la conjugación de "%query%".';
URLs['conjspword'] = 'http://www.wordreference.com/conj/ESverbs.asp?v=%query%';
				
ButtonValue['spwordrae'] = 'Ver Definición';
ButtonHelp['spwordrae'] = 'Haga click en el boton "Ver Definición" para buscar definición de  "%query%".';
URLs['spwordrae'] = 'http://buscon.rae.es/draeI/SrvltGUIBusUsual?TIPO_HTML=2&TIPO_BUS=3&LEMA=%query%';
				
ButtonValue['newsgoogle'] = 'Iniciar busqueda';
ButtonHelp['newsgoogle'] = 'Haga click en el boton "Iniciar busqueda" para buscar noticias acerca de "%query%" con Google.';
URLs['newsgoogle'] = 'http://news.google.com/news?hl=es&ned=es_us&q=%query%';
				
ButtonValue['enwordreference'] = 'Lookup';
ButtonHelp['enwordreference'] = 'Click on the button to lookup %query% in WordReference.com';
URLs['enwordreference'] = 'http://www.wordreference.com/definition/%query%';
				
ButtonValue['enwordwebster'] = 'Lookup';
ButtonHelp['enwordwebster'] = 'Click on the button to lookup %query% in Merriam Webster Dictionary';
URLs['enwordwebster'] = 'http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=%query%';
			
ButtonValue['lookupencarta'] = 'Lookup';
ButtonHelp['lookupencarta'] = 'Click on the button to lookup %query% in Encarta.';
URLs['lookupencarta'] = 'http://encarta.msn.com/encnet/refpages/search.aspx?q=%quey%';
				
ButtonValue['lookupanswers'] = 'Lookup';
ButtonHelp['lookupanswers'] = 'Click on the button to lookup %query% in Answers.com';
URLs['lookupanswers'] = 'http://www.answers.com/%query%';

ButtonHelp['maps'] = 'Haga click en el boton para mostrar el mapa.';
URLs['maps'] = 'http://www.mapquest.com/maps/map.adp?country=US';

var temptext = '';
var tempsource = '';
var temptarget = '';
var Replacedline = '';

function replacequery(Textsource, Text1, Text2, Target) {
//temptext = new String(eval(Value + '["' + type + '"]')); 
temptext = new String(Textsource);
var querypos = temptext.indexOf("%query%");
var sidea = temptext.substr(0,querypos);
var sideb = temptext.substr(querypos + 7);
var wholeline = sidea + Text1 + sideb;
Replacedline = wholeline;  
/*	if (Text2 != '') {
	temptext = new String(wholeline);
	querypos = temptext.indexOf("%query2%");
	sidea = temptext.substr(0,querypos);
	sideb = temptext.substr(querypos + 8);
	wholeline = sidea + Text2 + sideb;
	Replacedline = wholeline;
	}*/
}

function updatesearchform() {
document.forms['Searchform'].Begin.value = ButtonValue[CurrentKey];
Helptext = ButtonHelp[CurrentKey];
}

var Deftextchanged = 'no';

function cleartextbox(formname,formelement) {
if (Deftextchanged == 'no') {
document.forms[formname].elements[formelement].value = '';
Deftextchanged = 'Yes'
}}

function Updatestuff(Text) {
CurrentKey = Text;
updatesearchform();
}

function ShowHelpBox(TextSource, Replacetext, Texttoadd, xno,yno){
Helptextbox = document.getElementById('Helpbox');
Helptextbox.style.visibility = "visible";
if (Replacetext == 'Yes') {
	replacequery(TextSource,Texttoadd);
Helptextbox.innerHTML = Replacedline }
else {
Helptextbox.innerHTML = TextSource;}
UpdatemouseXY();
if (xno > 0) {
	Helptextbox.style.left = tmpX-xno;
}else {
	Helptextbox.style.left = tmpX;
}
	Helptextbox.style.top = tmpY+20;
//	Helptextbox.style.left = xno;
//	Helptextbox.style.top = yno;
}
function HideHelpBox(){
Helptextbox = document.getElementById('Helpbox');
Helptextbox.style.visibility = "hidden";
}

function GotoURL(keytouse, text) {
var tmpURL = URLs[keytouse];
replacequery(tmpURL,text,'','');
URLtogo = Replacedline;
window.open(URLtogo);
//document.forms['Searchform'].Begin.value = URLtogo;
}
var Enterkeypressed = '';

function FocusElement(formname,formelement) {
EnterPressed();
if (Enterkeypressed == 'Yes') {
document.forms[formname].submit();
}
}

function EnterPressed(e) {
// Code adapted from Jennifer Madden
// http://jennifermadden.com/162/examples/stringEnterKeyDetector.html

  var characterCode
  if(e && e.which){           // NN4 specific code
    e = e
    characterCode = e.which
  }
  else {
    e = event
    characterCode = e.keyCode // IE specific code
  }
  if (characterCode == 13) {
  Enterkeypressed = 'Yes'   // Enter key is 13
  }
  else {
  Enterkeypressed = 'No'
}
}


function UpdateForms(formname){
	Helptext = ButtonHelp[formname];
	CurrentKey = formname;
}

var MapAddress = '';

function StringMap() {
MapAddress = 'http://www.mapquest.com/maps/map.adp?country=US' + '&address=' + document.Mapsform.Address.value + '&city=' + document.Mapsform.City.value + '&state=' + document.Mapsform.State.value + '&zipcode=' + document.Mapsform.Zip.value;
}
function openmappage(){
if (MapAddress == '') {alert('Por favor introduzca una dirección valida.')}
else{
temptext = new String(MapAddress);
var querypos = temptext.indexOf("-");
var sidea = temptext.substr(0,querypos);
var sideb = temptext.substr(querypos + 1);
var wholeline = sidea + sideb;
Replacedline = wholeline;  
window.open(Replacedline)
}
}

function findplacesnearby(findwhat,where){
URLtogo = 'http://www.google.com/local?hl=en&lr=&q=' + findwhat + '&near=' + where + '&sa=X&oi=localr';
tempstr = new String(where)	
	if (tempstr.length == 5){
	window.open(URLtogo);
	}
	else {
	alert('Por Favor introduzca un Zip Code valido.');
	} 
}

function seeshowtime(Zipcode) {
TmpStr = new String(Zipcode);
	if (TmpStr.length < 5) {
	alert('Por Favor introduzca un Zip Code valido.');
	} 
	else {
	var ShowtimeURL = 'http://www.google.com/movies?sc=1&hl=en&near=' + Zipcode;
	window.open(ShowtimeURL)}
	}
	
function opennewpage() {

if (!document.newwindow.URLtext.value) {
window.open('http://www.ezsolutions-ny.com/goez/ezinfo.htm')
} else {
temptext = new String(document.newwindow.URLtext.value);
var httpontext = temptext.indexOf('http://');
if (httpontext == -1) {
window.open('http://' + document.newwindow.URLtext.value) }
else
window.open(temptext)
}
}