
//preload images - insert the names of your images here:
a1 = new Image;
a1.src = "../images/casa2.gif";
a2 = new Image;
a2.src = "../images/casa.gif";

b1 = new Image;
b1.src = "../images/arbre2.gif";
b2 = new Image;
b2.src = "../images/arbre.gif";

c1 = new Image;
c1.src = "../images/torre2.gif";
c2 = new Image;
c2.src = "../images/torre.gif";

d1 = new Image;
d1.src = "../images/passeig2.gif";
d2 = new Image;
d2.src = "../images/passeig.gif";

e1 = new Image;
e1.src = "../images/siurana2.gif";
e2 = new Image;
e2.src = "../images/siurana.gif";

iLang = 1; //default to Catala
iCurrentPage = 1; //default to Home Page
iNumAltText = 9; //Numero de strings

//preload Page names
var altPages = new Array();
altPages[ 1]= "home.html";
altPages[ 2]= "products.html";
altPages[ 3]= "history.html";
altPages[ 4]= "support.html";
altPages[ 5]= "quality.html";

//preload Texts
var alttext = new Array();
alttext[ 1]= "Principal";
alttext[ 2]= "Productes";
alttext[ 3]= "Emplaçament";
alttext[ 4]= "Suport, Comandes";
alttext[ 5]= "Qualitat";
alttext[ 6]= "Prinicipi";
alttext[ 7]= "Nova Collita";
alttext[ 8]= "Novetats";
alttext[ 9]= "Afegir als Favorits";

alttext[10]= "Principal";
alttext[11]= "Productos";
alttext[12]= "Situación";
alttext[13]= "Soporte, Encargos";
alttext[14]= "Calidad";
alttext[15]= "Principio";
alttext[16]= "Nueva Cosecha";
alttext[17]= "Novedades";
alttext[18]= "Añadir a Favoritos";

alttext[19]= "Main";
alttext[20]= "Products";
alttext[21]= "Location";
alttext[22]= "Support";
alttext[23]= "Quality";
alttext[24]= "Top";
alttext[25]= "New Season";
alttext[26]= "What's new";
alttext[27]= "Add to Favorites";

function CheckBrowser() {
	browserName = navigator.appName;   // detect browser 
	browserVer = parseInt(navigator.appVersion);
	if (browserName == "Netscape" && browserVer >= 3) return 1;
	else if (browserName == "Microsoft Internet Explorer" && browserVer >= 4) return 1;
	else alert("Pagina optimitzada per a navegadors una mica més moderns!");
	return 0;
}

function CheckPage() {
	if (location.href.indexOf(altPages[1]) != -1)
		iCurrentPage= 1;
	else { if (location.href.indexOf(altPages[2]) != -1)
		iCurrentPage= 2;
	else { if (location.href.indexOf(altPages[3]) != -1)
		iCurrentPage= 3;
	else { if (location.href.indexOf(altPages[4]) != -1)
		iCurrentPage= 4;
	else { if (location.href.indexOf(altPages[5]) != -1)
		iCurrentPage= 5;
	else { iCurrentPage= -1;
	}}}}}
	return iCurrentPage;
}


function CheckLanguage() {
	if (location.href.indexOf("/cat/") != -1)
		iLang= 1;
	else {if (location.href.indexOf("/esp/") != -1)
		iLang= 2;
	else {if (location.href.indexOf("/eng/") != -1)
		iLang= 3;
	}}
	return iLang;
}

function GetaltText(imgDocID) {
	var numImg;
	numImg = imgDocID + ((iLang-1)*iNumAltText);
	return alttext[numImg];
}

function GetLinkText(imgDocID) {
	strLink = '<a href=' + altPages[imgDocID] + '>' + GetaltText(imgDocID) + '</a>';
	return strLink;
}

function GetLinkOrAltText(imgDocID) {
	if (iCurrentPage == imgDocID) return GetaltText(imgDocID)
	else return GetLinkText(imgDocID)
}

function hiLite(imgDocID,imgObjName) {
	document.images[imgDocID].src = eval(imgObjName + ".src")
}

function AddToFavorites() {
	document.write("<p CLASS='favo'>[&nbsp;<img SRC='../images/favorites.gif' ALIGN=absbottom BORDER=0>&nbsp;<a href='javascript:window.external.AddFavorite(location.href, document.title);'>");
	document.write(GetaltText(9),"</a>&nbsp;]");
}

function ShowNews() {
	document.write("<p><h5>[&nbsp;<img SRC='../images/nou.gif' ALIGN=absbottom BORDER=0>&nbsp;<a href=whatsnew.html>");
	document.write(GetaltText(8),"</a>&nbsp;]</h5>");
}

CheckBrowser();
CheckLanguage();
document.write("<a NAME='top'></a>")
document.write("<table WIDTH='770'><tr><td WIDTH='200'></td><td><p align='right'>")
document.write("<a href='",altPages[1],"' onmouseout=\"hiLite('a','a1')\" onmouseover=\"hiLite('a','a2')\"><img NAME='a' ALT=", GetaltText(1), " BORDER=0 src=\"", a1.src, "\"></a>")
document.write("<a href='",altPages[2],"' onmouseout=\"hiLite('b','b1')\" onmouseover=\"hiLite('b','b2')\"><img NAME='b' ALT=", GetaltText(2), " BORDER=0 src=\"", b1.src, "\"></a>")
document.write("<a href='",altPages[3],"' onmouseout=\"hiLite('c','c1')\" onmouseover=\"hiLite('c','c2')\"><img NAME='c' ALT=", GetaltText(3), " BORDER=0 src=\"", c1.src, "\"></a>")
document.write("<a href='",altPages[4],"' onmouseout=\"hiLite('d','d1')\" onmouseover=\"hiLite('d','d2')\"><img NAME='d' ALT=", GetaltText(4), " BORDER=0 src=\"", d1.src, "\"></a>")
document.write("<a href='",altPages[5],"' onmouseout=\"hiLite('e','e1')\" onmouseover=\"hiLite('e','e2')\"><img NAME='e' ALT=", GetaltText(5), " BORDER=0 src=\"", e1.src, "\"></a>")
document.write("</p><br></td></tr>")
document.write("<tr><td VALIGN=TOP WIDTH='200'><img SRC='../images/Logo.gif' height=80 width=197>")
if (iLang == 1)
	document.write("<p>&nbsp;<p><h5>[&nbsp;<a href='news/mail.html'>Nova collita</a>&nbsp;&nbsp;<img SRC='../images/envelope.gif' BORDER=0>&nbsp;]</h5>")
ShowNews();
document.write("</td><td CLASS='fulltext' WIDTH='600'>")