
function pagina(){
	var pagina=Window.location.href;
	return pagina;
}


getMyHref = function()
{	var hrefa = location.href;
	var posi=hrefa.lastIndexOf("/");
	var href=hrefa.substring(posi+1)
	document.menu.SetVariable("/:href",href);
	//document.banner.SetVariable("/:delay",3000);
}

 
var bgcolor = "#FFFFFF"; // background color, must be valid browser hex color (not color names)
var fcolor = "#6A9989";  // foreground or font color
var steps = 100; // number of steps to fade
var show = 6000; // milliseconds to display message
var sleep = 1000; // milliseconds to pause inbetween messages
var loop = true; // true = continue to display messages, false = stop at last message

// Do Not Edit Below This Line
var colors = new Array(steps);
getFadeColors(bgcolor,fcolor,colors);
var color = 0;
var text = 0;
var step = 1;
var opaci=700;
function dameimagen()
{
	return '<table border=1><tr><td> </td></tr></table>';
}

function fade() 
{
	pasa=texts[text].lastIndexOf("{COLOR}");
	if(pasa > 0)
	{
		var text_out = texts[text].replace("{COLOR}", colors[color]); 
	}
	else
	{
		var text_out = texts[text].replace("filter:alpha(opacity=100); -moz-opacity:0.5", "filter:alpha(opacity="+opaci+"); -moz-opacity:0.5"); 	}


if (document.all) fader.innerHTML = text_out; // document.all = IE only
if (document.layers) { document.fader.document.write(text_out); document.fader.document.close(); } 


color += step; 
opaci=opaci-10;

if (color >= colors.length-1) {
step = -1; 


if (!loop && text >= texts.length-1) return;
}


if (color == 0) {
step = 1; // traverse colors array forward to fade in again


text += 1;

if (text == texts.length) text = 0; // loop back to first message
}


setTimeout("fade()", (color == colors.length-2 && step == -1) ? show : ((color == 1 && step == 1) ? sleep : 50)); 
}

function getFadeColors(ColorA, ColorB, Colors) {
len = Colors.length; 

if (ColorA.charAt(0)=='#') ColorA = ColorA.substring(1);
if (ColorB.charAt(0)=='#') ColorB = ColorB.substring(1);

// substract rgb compents from hex string 
var r = HexToInt(ColorA.substring(0,2));
var g = HexToInt(ColorA.substring(2,4));
var b = HexToInt(ColorA.substring(4,6));
var r2 = HexToInt(ColorB.substring(0,2));
var g2 = HexToInt(ColorB.substring(2,4));
var b2 = HexToInt(ColorB.substring(4,6));

// calculate size of step for each color component
var rStep = Math.round((r2 - r) / len);
var gStep = Math.round((g2 - g) / len);
var bStep = Math.round((b2 - b) / len);

// fill Colors array with fader colors
for (i = 0; i < len-1; i++) {
Colors[i] = "#" + IntToHex(r) + IntToHex(g) + IntToHex(b);
r += rStep;
g += gStep;
b += bStep;
}
Colors[len-1] = ColorB; // make sure we finish exactly at ColorB
}

// IntToHex: converts integers between 0-255 into a two digit hex string.
function IntToHex(n) {
var result = n.toString(16);
if (result.length==1) result = "0"+result;
return result;
}

// HexToInt: converts two digit hex strings into integer.
function HexToInt(hex) {
return parseInt(hex, 16);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_openBrWindow(theURL,winName,features) 
{
	window.open(theURL,winName,features);
}

function checkBrowser()
{
	this.ver=navigator.appVersion
	this.dom=document.getElementById?1:0
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
	this.ie4=(document.all && !this.dom)?1:0;
	this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
	return this
}

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_validateForm() 
{ //v5.0 by SaRuRo :)
	//Definimos las variables necesarias  
	var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

	//Inicio del bucle de elementos del formulario
	for (i=0; i<(args.length-2); i+=3) 
	{ 
		test=args[i+2]; 
		val=MM_findObj(args[i]);
		if (val) 
		{ 
			nm=val.name; 
			if ((val=val.value)!="") 
			{
				if (test.indexOf('isEmail')!=-1) 
				{ 
					p=val.indexOf('@');
					if (p<1 || p==(val.length-1)) errors+='- '+nm+': Destinatari incorrecte.\n';
				} 
				else if (test!='R') 
				{ 
					num = parseFloat(val);
					if (isNaN(val)) errors+='- El camp '+nm+' ha de ser un n&uacute;mero.\n';
					if (test.indexOf('inRange') != -1) 
					{ 
						p=test.indexOf(':');
						min=test.substring(8,p); 
						max=test.substring(p+1);
						if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
					} 
				} 
			} else if (test.charAt(0) == 'R') errors +='- '+nm+': Obligatori.\n'; 
		}
	} 
	if (errors) alert("Revisi aquest(s) camp(s):\n"+errors);
	document.MM_returnValue = (errors == '');
}

