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_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_findObj(n, d) { //v3.0
  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); 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];}
}



//***********************codi de javascript per les corbates*****************************

//identifica el tipus de navegador //identify the broser type
navegador = 0
if (document.layers) {navegador=1}
if (document.all) {navegador=2}
if (document.getElementById) {navegador=3}



//funció per obrir finestres (no pots maximitzar amb explorer) //function to open windows
function MM_openBrWindow(theURL,winName,features,ie) {
		
		
		//if (navegador == 2) {
			//					if (features=='width=400,height=425,scrollbars=auto') {
				//			    features=features.replace('width=400,height=425,scrollbars=auto','dialogwidth: 360px; dialogheight: 1000px; status: 0;');
					//			window.showModalDialog(theURL,null,features)}
							
						//	if (features=='width=400,height=300,scrollbars=auto'){
							//    features=features.replace('width=400,height=300,scrollbars=auto','dialogwidth: 406px; dialogheight: 323px; status: 0;');
								//window.showModalDialog(theURL,null,features)}
							//else
							//if (ie != null) {window.showModalDialog(theURL,null,ie)}
							//}
							
							
		if (navegador == 3){ 
					if (document.all){
					
							if (features=='width=400,height=425,scrollbars=auto') {
							    features=features.replace('width=400,height=425,scrollbars=auto','dialogwidth: 406px; dialogheight: 448px; status: 0;');
								window.showModalDialog(theURL,null,features)}
							
							if (features=='width=400,height=300,scrollbars=auto'){
							    features=features.replace('width=400,height=300,scrollbars=auto','dialogwidth: 406px; dialogheight: 323px; status: 0;');
								window.showModalDialog(theURL,null,features)}
								
							if (features=='width=400,height=350,scrollbars=auto'){
							    features=features.replace('width=400,height=350,scrollbars=auto','dialogwidth: 406px; dialogheight: 373px; status: 0;');
								window.showModalDialog(theURL,null,features)}
							else
							if (ie != null) {window.showModalDialog(theURL,null,ie)}
					 }
					
					 else
							{window.open(theURL,winName,features);}
				 }
					
		else {window.open(theURL,winName,features);}
		
		
}


//ensenya un misatge a la barra d'estat //displays a message on the status bar
function MM_displayStatusMsg(msgStr) { //v2.0
  status=msgStr;
  document.MM_returnValue = true;
}

var statusMsg = ' ';


//ensenya i amaga capes //show hide layers
function show_hide(opcio,filla,mare) {
    if (navegador==3)
         document.getElementById(filla).style.visibility= opcio;
    if (navegador==1)
        {
			if (mare != null)
        		document.layers[mare].document.layers[filla].visibility = opcio;
			 else
			 	document.layers[filla].visibility = opcio;
		}
    if (navegador==2)
        document.all[filla].style.visibility = opcio;
}


//mou capes (es fa servir per moure els botons de les corbates
function moveto(filla,x,y,mare){
	if (navegador==3) 
	{
         document.getElementById(filla).style.left= x +"px";
		 document.getElementById(filla).style.top= y +"px";
		 
	}
		 
	if (navegador==1)
        {
			if (mare != null)
        		document.layers[mare].document.layers[filla].moveTo(x,y);
			 else
			 	document.layers[filla].moveTo(x,y);
						 
		}

	if (navegador==2)
		{
        document.all[filla].style.pixelLeft= x;
		document.all[filla].style.pixelTop= y;
		}

}

//variables per el menu dinamic
var tie_default;
var buy = 0
var nosconseils =0

//canvia les imatges //change the images
function changeImage(id,img_name,ruta) {
		if (document.layers && id!=null)
			{
			eval('document.layer1.document.'+id+'.document.images["'+img_name+'"].src = ruta');
			
			}
		else
			{
			document.images[img_name].src = ruta;
			}
}	

//calcula el desplaçament dels butons
var posbuttonsone;
var posbutnosconseils;
var posotherbuttons;
var posarrownosconseils
var loaded = 0

function detectarbuto(){
 loaded = 1;
 if (navegador==1) {
  					var alcada = document.layer1.document.butbuybig.document.images["bigbuy"].height
					var alcada_nosconseils = document.layer1.document.butnosconseilsbig.document.images["bignos"].height
					}
  else 
  {
  var alcada = document.images["bigbuy"].height
  var alcada_nosconseils = document.images["bignos"].height
  }

desplacament = (alcada - 25);
desplacament_nosconseils = (alcada_nosconseils - 24);

posbuttonsone = (75 + desplacament);
posbutnosconseils = (29 + desplacament);
posotherbuttons = (105 + desplacament);
posarrownosconseils = (30 + desplacament);

posotherbuttons_nosconseils = ( 83 + desplacament_nosconseils )

}


function buyonline(){
if (loaded == 0) detectarbuto();
loaded = 1;

show_hide('visible','butnosconseils','layer1');
show_hide('hidden','butnosconseilsbig','layer1');
show_hide('hidden','butclosenosconseils','layer1'); 

show_hide('visible','butno3','layer1');
show_hide('hidden','butno3big','layer1');
show_hide('hidden','butcloseno3','layer1'); 

show_hide('hidden','butbuy','layer1'); 
show_hide('visible','butbuybig','layer1');
show_hide('visible','butclosebuy','layer1');

moveto('butnosconseils','0','320','layer1'); 
moveto('arrownosconseils','135','322','layer1'); 
moveto('butno3','0','339','layer1'); 
moveto('arrowno3','135','335','layer1'); 
moveto('buttonsone','0','359','layer1');
moveto('otherbuttons','0','395','layer1'); 

buy = 1; nosconseils = 0 
}

function closebuyonline() {
show_hide('hidden','butbuybig','layer1');
show_hide('visible','butbuy','layer1'); 
show_hide('hidden','butclosebuy','layer1');

moveto('butnosconseils','0','29','layer1');
moveto('arrownosconseils','135','30','layer1'); 
moveto('butno3','0','49','layer1'); 
moveto('arrowno3','135','44','layer1'); 
moveto('buttonsone','0','70','layer1');
moveto('otherbuttons','0','106','layer1');

buy = 0;
}

function nosconseilsopen() {
if (loaded == 0) detectarbuto();
loaded = 1;
show_hide('hidden','butnosconseils','layer1');
show_hide('visible','butnosconseilsbig','layer1'); 
show_hide('visible','butclosenosconseils','layer1');

show_hide('visible','butbuy','layer1');
show_hide('hidden','butbuybig','layer1');
show_hide('hidden','butclosebuy','layer1');

show_hide('visible','butno3','layer1');
show_hide('hidden','butno3big','layer1');
show_hide('hidden','butcloseno3','layer1'); 

moveto('butnosconseils','0','29','layer1');
moveto('arrownosconseils','135','32','layer1'); 
moveto('butno3','0','300','layer1'); 
moveto('arrowno3','135','295','layer1'); 
moveto('buttonsone','0','320','layer1');
moveto('otherbuttons','0','355','layer1'); 

nosconseils = 1 ; 
buy = 0;

}

function noscoseilsclose() {
show_hide('hidden','butnosconseilsbig','layer1');
show_hide('visible','butnosconseils','layer1');
show_hide('hidden','butclosenosconseils','layer1');

moveto('arrownosconseils','135','30','layer1'); 
moveto('butno3','0','49','layer1'); 
moveto('arrowno3','135','44','layer1'); 
moveto('buttonsone','0','70','layer1');
moveto('otherbuttons','0','106','layer1');
 
nosconseils = 0;

}

function no3open() {
if (loaded == 0) detectarbuto();
loaded = 1;
show_hide('hidden','butno3','layer1');
show_hide('visible','butno3big','layer1'); 
show_hide('visible','butcloseno3','layer1');

show_hide('visible','butbuy','layer1');
show_hide('hidden','butbuybig','layer1');
show_hide('hidden','butclosebuy','layer1');

show_hide('visible','butnosconseils','layer1');
show_hide('hidden','butnosconseilsbig','layer1');
show_hide('hidden','butclosenosconseils','layer1');

moveto('butnosconseils','0','29','layer1');
moveto('arrownosconseils','135','30','layer1'); 
moveto('butno3','0','49','layer1'); 
moveto('arrowno3','135','46','layer1'); 
moveto('buttonsone','0','285','layer1');
moveto('otherbuttons','0','320','layer1'); 

nosconseils = 1 ; 
buy = 0;

}

function no3close() {
show_hide('hidden','butno3big','layer1');
show_hide('visible','butno3','layer1');
show_hide('hidden','butcloseno3','layer1');

moveto('arrowno3','135','44','layer1'); 
moveto('buttonsone','0','70','layer1');
moveto('otherbuttons','0','106','layer1');
 
nosconseils = 0;

}

function overnosconseils(){
moveto('arrownosconseils','135',posarrownosconseils,'layer1');
}
