function escriu_flash(archivo,ancho,alto) // tutorial by IVI CONCEPT - www.ivi-concept.com
  {
  var version="7,0,0,0"; // version del flash player
  var quality="high"; // calidad de visualización de la peli
  var bgcolor="#ffffff"; // color de fondo de la peli
  // --fin parametros--------------------------------------------------
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+version+'" width='+ancho+' height='+alto+'>\n');
document.write('<param name="movie" value='+archivo+' />\n');
document.write('<param name="quality" value='+quality+'>\n');
document.write('<param name="bgcolor" value='+bgcolor+'>\n');
document.write('<embed src='+archivo+' bgcolor='+bgcolor+' quality='+quality+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+'></embed>');
document.write('</object>\n');
}


	function obre(myUrl,am,al,nom){
	  var ampla = am;
	  var altura = al;
	  strURL = myUrl;
	  poshoritz = (screen.width) ? (screen.width-ampla)/2 : 0;
	  posvert = (screen.height) ? (screen.height-altura)/2 : 0;
	  strW = 'toolbar=0,directories=0,location=0,status=no,menubar=0,resizable=0,copyhistory=0,scrollbars=1,width='+ ampla + ',height='+ altura + ',top='+ posvert + ',left='+ poshoritz;
	  eval("window.open('" + strURL + "',nom,'" + strW + "')");
	}
	

	
function getObject(objname)
{    
    var obj = null ;
    if (document.getElementById) {
        obj = document.getElementById(objname) ;
    } else {
        if (document.all) {
            obj = document.all[objname] ;
            }
        }

    return obj ;
}

 function ShowBlock(nom) {
 	var capa ;
	capa = getObject(nom) ;
	if (capa) {
		if (arguments.length==2) {
			//explicit mode
			if (arguments[1]) capa.style.display="block" ;
			else capa.style.display="block" ;
		} else {
			//toggle mode
			if (capa.style.display!="block") capa.style.display="block";
			else capa.style.display="block";
			}
		}
	}	

 function HideBlock(nom) {
 	var capa ;
	capa = getObject(nom) ;
	if (capa) {
		if (arguments.length==2) {
			//explicit mode
			if (arguments[1]) capa.style.display="none" ;
			else capa.style.display="none" ;
		} else {
			//toggle mode
			if (capa.style.display!="none") capa.style.display="none";
			else capa.style.display="none";
			}
		}
	}
	
 function ampliainfo(idfit) {
 	fotop = "foto"+idfit;
	fotog = "fotog"+idfit;
	infoad = "infoad"+idfit;
	infodes = "infodes"+idfit;
	document.getElementById(fotop).style.display="none";
	//document.getElementById(fotog).style.display="block";
	//document.getElementById(infoad).style.display="block";
	//document.getElementById(infodes).style.display="block";	
	
		$("#"+fotog).fadeIn(500);
		$("#"+infoad).fadeIn(500);
		$("#"+infodes).fadeIn(500);
	
	}
		
 function redueixinfo(idfit) {
 	fotop = "foto"+idfit;
	fotog = "fotog"+idfit;
	infoad = "infoad"+idfit;
	infodes = "infodes"+idfit;
//	document.getElementById(fotop).style.display="block" ;
//	document.getElementById(fotog).style.display="none" ;
//	document.getElementById(infoad).style.display="none" ;
//	document.getElementById(infodes).style.display="none" ;	
	
		$("#"+fotog).fadeOut(250,function(){
			$("#"+fotop).fadeIn(500)
		});	
		$("#"+infoad).fadeOut(500);
		$("#"+infodes).fadeOut(500);
	
	
	}

function Afegir(){
	valorChecks = new Array();
	totchecks = 0;
	j=0;
 var miLista=document.getElementById("form1");   
  for (i=0;i<miLista.elements.length;i++){
     if (miLista.elements[i].type=="checkbox"){   
		if (miLista.elements[i].checked) {  
      totchecks++;
      valorChecks[j] = miLista.elements[i].value;
       j++;
      }
     }  
  }  
/* 
  */
 
//location.href="omple_cistell.php?totalchecks="+totchecks+"&isbns="+valorChecks;  
 
/*
$.ajax({
                    type: "POST",
                    url:"omple_cistell.php",
                    data:"totalchecks="+totchecks+"&isbns="+valorChecks,   
                    success:function(nump){alert(nump)}
}); 
*/
 
}

function escriure_items(nump){
 if (nump != 1) document.getElementById("idcarro").innerHTML = nump + " items";
 else document.getElementById("idcarro").innerHTML = nump + " item&nbsp;";
}


function veuremenu(qm,numrows){
	for (i=1;i<(numrows+1);i++){
	opciosubcat = "opciosubcat"+i;
	opciocat = "opciocat"+i;
	//alert(opciosubcat);	
		if(document.getElementById(opciosubcat)) {
		document.getElementById(opciosubcat).style.display="none";
		document.getElementById(opciocat).className="smv";
		}
	}
	if (qm!=1){
	opciosubcat = "opciosubcat"+qm;
	opciocat = "opciocat"+qm;
	document.getElementById(opciosubcat).style.display="block" ;
	document.getElementById(opciocat).className="smv ac";
	} 
	else {document.getElementById("opciocat1").className="smv ac";}
}

/*
function plegarmenu(qm,numrows){
	for (i=2;i<(numrows+1);i++){
		opciosubcat = "opciosubcat"+i;
		document.getElementById(opciosubcat).style.display="none";
	}

}*/
