﻿// JavaScript Document
/**********************************************************************************   
NewsSlideFade 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/

function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()

function avui(){
	var data=new Date();
	return data.getDate()-21;
}
function concert(){
	var text=new Array();
	text[0]=new Array();
	text[1]=new Array();
	text[2]=new Array();
	text[3]=new Array();
	text[4]=new Array();
	text[5]=new Array();
	var n=avui();
	//Divendres
	text[0][0]='De 19.30 a 21.00 <br />Concert/audici&oacute; amb <strong>VOLCAN</strong>';
	text[0][1]='De 23.30 a 02.00 <br />Ball amb <strong>VOLCAN</strong>';
	text[0][2]='De 02.00 a 03.30 <br />Concert amb <strong>SABOR DE GRACIA</strong> (Rumba Catalana) <br /> <a href="http://www.sabordegracia.com">www.sabordegracia.com</a>'
	text[0][3]='A continuaci&oacute;<br />Concert amb <strong>GERTRUDIS</strong> <br /> <a href="http://www.gertrudis.com">www.gertrudis.com</a>'
	//Dissabte
	text[1][0]='De 23.30 a 2.00<br />Ball  amb Orquestra EMPORIUM.'
	text[1][1]='De 2.00 a 4.30<br />Concert amb LOQUILLO <br /><a href="http://www.loquillo.com/">www.loquillo.com</a>'
	text[1][2]='A les 4.30 Correfoc a  c&agrave;rrec dels DIABLES D&rsquo;EN PERE BOTERO  <a href="http://www.perebotero.org/">www.perebotero.org</a>'
	//Diumenge
	text[2][0]='De 19;30 a 21;00  Concert / audici&oacute; amb Orquestra MARAVELLA &agrave; <a href="http://www.maravella.com/">www.maravella.com</a>'
	text[2][1]='De 23;30 a 2;00 Ball  amb Orquestra MARAVELLA <a href="http://www.maravella.com/">www.maravella.com</a>'
	text[2][2]='A 2;00 Concert amb  Obrint Pas'
	//Dilluns
	text[3][0]='De 19;30 a 21;00  Concert / audici&oacute; amb Orquestra SALVATANA'
	text[3][1]='De 23;30 a 2;00 Ball  amb Orquestra SALVATANA'
	text[3][2]='De 2;00 a 3;30  Concert amb HOTEL COCHAMBRE <a href="http://www.hotelcochambre.com/">www.hotelcochambre.com</a>'
	text[3][3]='A 3;30 Concert amb 005, grup guanyador del concurs de maquetes SALT THE MUSICS'
	//Dimarts
	text[4][0]='De 19;30 a 21;00  Concert / audici&oacute; amb Orquestra LA PRINCIPAL DE LA BISBAL <a href="http://www.laprincipaldelabisbal.com/">www.laprincipaldelabisbal.com</a>'
	text[4][1]='De 23;30 a 2;00 Ball  amb Orquestra LA PRINCIPAL DE LA BISBAL'
	text[4][2]='A 2;00 Concert amb  FRENETIC  <a href="http://www.freneticweb.com/">www.freneticweb.com</a>'
	//Dimecres
	text[5][0]='A 2/4 de 12 de la nit, a l\'era de cal Cigarro, <strong/>CASTELL DE FOCS<strong/> de Fi de Festa.<a href="http://www.freneticweb.com/"></a> '
	
	for(i=0;i<text[n].length;i++){
		nConcert[i]=new Array();
		nConcert[i]["text"]=text[n][i];
		nConcert[i]["link"]="#";
	}
}
function activitat(){
	var text=new Array();
	text[0]=new Array();
	text[1]=new Array();
	text[2]=new Array();
	text[3]=new Array();
	text[4]=new Array();
	text[5]=new Array();
	
	var n=avui();
	//Divendres
	text[0][0]="A les 18 h  INAUGURACI&Oacute; de l&rsquo;<strong>EXPOSICI&Oacute; DELS TREBALLS  DELS ALUMNES DE L&rsquo;ESCOLA MUNICIPAL DE BELLES ARTS</strong> curs 2005-2006.  L&rsquo;exposici&oacute; restar&agrave; oberta fins el 30 de juliol a l&rsquo;Escola Municipal de Belles  Arts de Salt, pla&ccedil;a de la Vila n&uacute;m. 1 amb el seg&uuml;ent horari: feiners d&rsquo;11 a 13  h i de 18 a 20 h., festius d&rsquo;11 a 14 h.";
	text[0][1]="A les 19:30 h <strong>CONCERT DE M&Uacute;SICA POPULAR</strong> amb  l&rsquo;orquestra <strong>VOLC&Aacute;N</strong> a l&rsquo;Era de Cal  Cigarro.";
	text[0][2]="A les 8 del vespre, <strong>CERCAVILA DE PREG&Oacute;</strong> amb <strong>ELS GEGANTS DE SALT</strong> i <strong>ELS DIABLES D&rsquo;EN PERE BOTERO</strong>. Sortiran  de la Coma Cros i seguiran pel carrer Major fins a la pla&ccedil;a Llu&iacute;s Companys  (davant de l&rsquo;Ajuntament).";
	text[0][3]="A les 21 h <strong>PREG&Oacute; DE FESTA MAJOR</strong> des del balc&oacute; de  l&rsquo;Ajuntament.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ";
	text[0][4]="A les 21 h <strong>SOPAR DE FESTA MAJOR</strong> al CEIP La Farga.  Organitzat per l&rsquo;Agrupaci&oacute; Local del PSC de Salt.";
	text[0][5]="De 21 a 23 h <strong>ASSAIG ESPECIAL</strong> dels MARRECS a la  Factoria Cultural Coma Cros per preparar la Festa Major. Organitzat pels  Marrecs de Salt.";
	text[0][6]="A les 21:30 h PRESENTACI&Oacute; SALT THE M&Uacute;SICS III. Salt The M&uacute;sics (STM) &eacute;s la tercera edici&oacute; d&rsquo;un CD de grups de m&uacute;sica del municipi que  comencen.";
	
	//Dissabte
	text[1][0]="De&nbsp; 9 a 14 h, a la pla&ccedil;a de la Vila, <strong>3a TROBADA D&rsquo;INTERCANVI DE PLAQUES DE CAVA</strong>."
	text[1][1]="De 10 del mat&iacute; fins  2/4 de 2 de la tarda, <strong>XXVIII SIMULT&Agrave;NIES  FESTA MAJOR</strong> a la pla&ccedil;a del Ve&iuml;nat. Organitzades pel Club d&rsquo;Escacs Salt i  Girona."
	text[1][2]="D&rsquo;11 del mat&iacute; a 13 h, <strong>JOCS AQU&Agrave;TICS PER MAINADA</strong> de 4 a 12  anys a la Piscina Descoberta"
	text[1][3]="D&rsquo;11:30 a 12:15 h a  la Piscina Coberta, <strong>MASTER OBERT  AIGUAGIM MAJORS 16 ANYS </strong>&ndash; activitat gratu&iuml;ta. Cal portar banyador esportiu,  tovallola, xancletes i casquet."
	text[1][4]="A les 11 h. INAUGURACI&Oacute; de l&rsquo;exposici&oacute; temporal <strong>LA COMA I CROS, EL RELLEU</strong> amb projecte  de Josep Maria Oliveras "
	text[1][5]="A les 12 del mat&iacute;, <strong>PRESENTACI&Oacute; DEL LLIBRE</strong> <strong>&ldquo;La infantesa esva&iuml;da&rdquo;</strong> de Joaquim Riera  amb il&middot;lustracions de Pilar&iacute;n Bay&eacute;s a la Sala de Plens de l&rsquo;Ajuntament de Salt."
	text[1][6]="A les 16 h <strong>CAMPIONAT DE BOTIFARRA</strong> al carrer Ramon  Sambola n&uacute;m. 80. Organitzat per Cafeteria Igl&uacute;"
	text[1][7]="A les 17:30 h <strong>TROBADA GEGANTERA</strong>. Plantada de Gegants  a la pla&ccedil;a Sant Jaume. Organitza: Amics dels Gegants de Salt."
	text[1][8]="A les 18 h. <strong>CERCAVILA DE GEGANTS</strong> amb sortida de la  pla&ccedil;a Sant Jaume fins a la pla&ccedil;a del Mercat passant pel carrer Llarg, pla&ccedil;a de  la Vila, Doctor Fleming, Major i Marqu&egrave;s de Camps. Tot seguit <strong>SOPAR DE GERMANOR</strong> al CEIP El Pla."
	text[1][9]="A les 18:30 h a la pla&ccedil;a del Mercat, <strong>ESPECTACLE INFANTIL</strong> a c&agrave;rrec de <strong>COP</strong> <strong>DE CLOWN</strong>."
	text[1][10]="A les 19:00 h <strong>AUDICI&Oacute; DE SARDANES</strong> al passeig Ciutat  de Girona a c&agrave;rrec de la cobla <strong>ROSSINYOLETS</strong>."
	text[1][11]="A les 19:30 h <strong>CONCERT PELS M&Eacute;S JOVES</strong> amb el grup <strong>MACED&Ograve;NIA</strong> a l&rsquo;Era de Cal Cigarro."
	text[1][12]="A les 21:30 h Segon Concert de presentaci&oacute; de SALT THE M&Uacute;SICS III. a la sala La Mirona amb l&rsquo;actuaci&oacute; dels grups, PANGEA (Jazz/Blues), TOM&Aacute;S Y LOS DEM&Aacute;S (Rock), KAOS L&Iacute;RICO (Rap), 005 (Rap)."
	
	//Diumenge
	text[2][0]="A les 6 del mat&iacute;, a  la pla&ccedil;a de la Vila, <strong>BALL DEL PIJAMA, FESTA DE L&rsquo;ESCUMA</strong> i <strong>DISCOM&Ograve;BIL</strong> amb <strong>LA BOMBOLLA</strong>."
	text[2][1]="A les 8 <strong>MATINADES</strong>. Organitzat pels Marrecs de  Salt."
	text[2][2]="A partir de les 11  del mat&iacute;, <strong>43&egrave;. CONCURS DE COLLES  SARDANISTES MEMORIAL EMILI CROUS</strong>, amb la cobla <strong>CIUTAT DE GIRONA</strong> al carrer President Francesc Maci&agrave;."
	text[2][3]="D&rsquo;11 del mat&iacute; a 13 h, <strong>JOCS AQU&Agrave;TICS PER MAINADA</strong> de 4 a 12  anys a la Piscina Descoberta "
	text[2][4]="D&rsquo;11:30 a 12:15 h a  la Piscina Coberta, <strong>MASTER OBERT  AIGUAGIM MAJORS 16 ANYS </strong>&ndash; activitat gratu&iuml;ta. Cal portar banyador esportiu,  tovallola, xancletes i casquet."
	text[2][5]="A les 18 h <strong>DIADA CASTELLERA</strong> a la pla&ccedil;a Llu&iacute;s  Companys amb l&rsquo;actuaci&oacute; de les colles <strong>CASTELLERS  D"
	text[2][6]="A les 19:30 h <strong>CONCERT DE M&Uacute;SICA CATALANA I POPULAR</strong> a  c&agrave;rrec de l&rsquo;<strong>ORQUESTRA MARAVELLA</strong> a  l&rsquo;Era de Cal Cigarro."
	text[2][7]="A les 19:30 h. <strong>FESTA DE L&rsquo;ESCUMA INFANTIL</strong> a c&agrave;rrec de <strong>LA BOMBOLLA</strong> a la pla&ccedil;a Tres de Mar&ccedil;."
	text[2][8]="A les 22 h. al Padr&oacute;  de la pla&ccedil;a de la Vila <strong>CINEMA A LA  FRESCA</strong> amb la projecci&oacute; de la pel&middot;l&iacute;cula <strong>OLIVER TWIST</strong> de Roman Polanski. Entrada gratu&iuml;ta."
	
	//Dilluns
	text[3][0]="A les 19:30 h <strong>CONCERT DE M&Uacute;SICA CATALANA I POPULAR</strong> a  c&agrave;rrec de l&rsquo;orquestra <strong>SELVATANA</strong> a  l&rsquo;Era de Cal Cigarro."
	text[3][1]="A les 22 h. a la  pla&ccedil;a de Catalunya <strong>CINEMA A LA FRESCA</strong> amb la projecci&oacute; de la pel&middot;l&iacute;cula <strong>CHARLIE  I LA F&Agrave;BRICA DE XOCOLATA</strong> de Tim Burton. Entrada gratu&iuml;ta."

	
	//Dimarts
	text[4][0]="D&rsquo;11 del mat&iacute; a 13 h, <strong>JOCS AQU&Agrave;TICS PER MAINADA</strong> de 4 a 12  anys a la Piscina Descoberta"
	text[4][1]="D&rsquo;11:30 a 12:15 h a  la Piscina Coberta, <strong>MASTER OBERT  AIGUAGIM MAJORS 16 ANYS </strong>&ndash; activitat gratu&iuml;ta. Cal portar banyador esportiu,  tovallola, xancletes i casquet."
	text[4][2]="A les 12 del migdia,  a la parr&ograve;quia de Sant Cugat, <strong>OFICI  SOLEMNE DE FESTA MAJOR </strong>amb l&rsquo;acompanyament de la<strong> CORAL TRIBANA.</strong>"
	text[4][3]="A les 12 del migdia,  a la parr&ograve;quia de Sant Jaume, <strong>OFICI  SOLEMNE DE</strong> <strong>FESTA MAJOR</strong> amb  l&rsquo;acompanyament del <strong>COR PARROQUIAL</strong>."
	text[4][4]="A 2/4 de 8 de la tarda, a l'era de cal Cigarro, concert de música catalana i popular amb l'orquestra <strong>LA PRINCIPAL DE LA BISBAL</strong>, i presentació del CD de Salt Sardanista “Salt i les seves Sardanes II”."
	text[4][5]="A les 19 h <strong>VISITA-ITINERARI TEATRALITZADA &ldquo;FEM UN SALT  HIST&Ograve;RIC&rdquo;.</strong> Una divertida manera de con&egrave;ixer la hist&ograve;ria de Salt a trav&eacute;s de  teatre. Cal fer reserva pr&egrave;via als tel&egrave;fons 972402148 &ndash; 972231681, les places  s&oacute;n limitades. Organitzada pel Museu de l&rsquo;Aigua."
	text[4][6]="A les 19:00 h al parc  de la Massana, <strong>ESPECTACLE INFANTIL</strong> a  c&agrave;rrec de <strong>TOT CIRC</strong>"
	text[4][7]="A les 19:30 h <strong>CONCERT DE M&Uacute;SICA CATALANA I POPULAR</strong> a  c&agrave;rrec de l&rsquo;orquestra <strong>LA PRINCIPAL DE LA  BISBAL</strong> a l&rsquo;Era de Cal Cigarro."
	text[4][8]="A les 20:30 <strong>PARTIT DE FUTBOL DE FESTA MAJOR</strong> entre  el <strong>GIRONA FC</strong> (tercera divisi&oacute;) i el <strong>CF SALT</strong> (Segona regional) al Camp  Municipal de Salt."

	for(i=0;i<text[n].length;i++){
		nAltres[i]=new Array();
		nAltres[i]["text"]=text[n][i];
		nAltres[i]["link"]="#";
	}
}


/***************************************************************************
Use the style tag to change the placement and width of the layers.
If you are trying to place this into a table cell or something make the
position of the divNewsCont layer relative...Remeber that that might crash
Netscape 4 though, Good luck!
********************************************************************************/

/****
Variables to set 
****/

//How do you want the script to work? 
//0 = Fade in - Fade out
//1 = Slide in - Fade out
//2 = Random 
nWorks = 2

//If you use the slide set these variables:
nSlidespeed = 5 //in px
nNewsheight = 80 //This is how long down it should start the slide.

nBetweendelay = 10000 //The delay before fading out.
nFont = 'arial,helvetiva' //The font for the news.
nFontsize = 12 //Font size in pixel.
nFadespeed = 100 //The speed to fade in, in milliseconds.

//Set the colors, first color is same as background, last color is the color it stops at:
//You can have as many colors you want
nColor=new Array('#FFFFFF', '#EEEEEE','#CCCCCC','#999999','#666666','#333333','#000000')

//This is the news you wanna have, set the link and the text. If you don't wan't it to link anywhere
//use a # as the link
nAltres=new Array()
nConcert=new Array();
activitat();
concert();
//Copy there three lines and change the info and numbers to get more news.
//nNews[0]=new Array()
//nNews[0]["text"]="New scripts  is updated with more scripts then ever!"
//nNews[0]["link"]="/"

/********************************************************************************
Object code...Object constructors and functions...
********************************************************************************/
function makeNewsObj(obj,nest,font,size,color,news,fadespeed,betweendelay,slidespeed,works,newsheight){
    nest=(!nest) ? "":'document.'+nest+'.'
   	this.css=bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;	
   	this.writeref=bw.dom? document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
	if(font){this.color=new Array(); this.color=eval(color); this.news=new Array(); this.news=eval(news)
		this.font=font; this.size=size; this.speed=fadespeed; this.delay=betweendelay; this.newsheight=newsheight;
		this.fadeIn=b_fadeIn;this.fadeOut=b_fadeOut; this.newsWrite=b_newsWrite; this.y=1
		this.slideIn=b_slideIn; this.moveIt=b_moveIt; this.slideSpeed=slidespeed; this.works=works
		if(bw.dom || bw.ie4){this.css.fontFamily=this.font; this.css.fontSize=this.size; this.css.color=this.color[0]}
	}
	this.obj = obj + "Object"; 	eval(this.obj + "=this"); return this
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_moveIt(x,y){this.x=x; this.y=y; this.css.left=this.x+px; this.css.top=this.y+px;}

function b_newsWrite(num,i){
	if (bw.ns4){
		this.writeref.write("<a href=\""+this.news[num]['link']+"\" target=\"myTarget\" style=\"text-decoration:none; font-size:"+this.size+"px\">"
			+"<font face=\""+this.font+"\" color=\""+this.color[i]+"\">"+this.news[num]['text']+"</font></a>")
		this.writeref.close()
	}else this.writeref.innerHTML = '<a id="'+this.obj+'link' +'" target="myTarget"  style="text-decoration:none; font-size:'+this.size+'px; color:'+this.color[i]+'" href="'+this.news[num]['link']+'">'+this.news[num]['text']+'</a>'
}
//Slide in
function b_slideIn(num,i){
	if (this.y>0){
		if (i==0){this.moveIt(0,this.newsheight); this.newsWrite(num,this.color.length-1)}
		this.moveIt(this.x,this.y-this.slideSpeed)
		i ++
		setTimeout(this.obj+".slideIn("+num+","+i+");",50)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}
//The fade functions
function b_fadeIn(num,i){
	if (i<this.color.length){
		if (i==0 || bw.ns4) this.newsWrite(num,i)
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i ++
		setTimeout(this.obj+".fadeIn("+num+","+i+")",this.speed)
	}else setTimeout(this.obj+".fadeOut("+num+","+(this.color.length-1)+")",this.delay)
}

function b_fadeOut(num,i){
	if (i>=0){
		if (i==0 || bw.ns4) this.newsWrite(num,i)	
		else{
			obj = bw.ie4?eval(this.obj+"link"):document.getElementById(this.obj+"link")
			obj.style.color = this.color[i]
		}
		i --
		setTimeout(this.obj+".fadeOut("+num+","+i+")",this.speed)
	}else{
		num ++
		if(num==this.news.length) num=0
		works = !this.works?0:this.works==1?1:Math.round(Math.random())
		if(works==0) setTimeout(this.obj+".fadeIn("+num+",0)",500)
		else if (works==1){this.y=1; setTimeout(this.obj+".slideIn("+num+",0)",500)
		}
	}
}
/********************************************************************************************
The init function. Calls the object constructor and set some properties and starts the fade
*********************************************************************************************/
function fadeInit(){
	oAltres = new makeNewsObj('NAltres','NAltresCont',nFont,nFontsize,"nColor","nAltres",nFadespeed,nBetweendelay,nSlidespeed,nWorks,nNewsheight)
	oAltresCont = new makeNewsObj('NAltresCont')
	works = !oAltres.works?0:oAltres.works==1?1:Math.round(Math.random())
	if (works==0) oAltres.fadeIn(0,0)
	else if (works==1) oAltres.slideIn(0,0)
	oAltresCont.css.visibility = "visible"

	oConcerts = new makeNewsObj('NConcerts','NConcertsCont',nFont,nFontsize,"nColor","nConcert",nFadespeed,nBetweendelay*0.5,nSlidespeed,nWorks,nNewsheight)	
	oConcertsCont = new makeNewsObj('NConcertsCont')	
	works = !oConcerts.works?0:oConcerts.works==1?1:Math.round(Math.random());
	if (works==0) oConcerts.fadeIn(0,0)
	else if (works==1) oConcerts.slideIn(0,0)
	oConcertsCont.css.visibility = "visible"
}

//Calls the init function on pageload. 
//if(bw.bw) onload = fadeInit()
