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_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_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_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];}



}







function obreadmin() {



	//new Effect.Opacity('container');



}





function checkMenuObra(obrirs) {

	if (obrirs) {

		if (jQuery("#obramenu").css("display")=="none") jQuery("#obramenu").show();

		if (isoverflash) isoverlayer=true;

	} else {

		if (!isoverlayer&&!isoverflash) {

			jQuery("#obramenu").hide();

			isoverlayer=false;

			isoverflash=false;

		}

	}



}





function obm() {



	var ph=0;



	if( typeof( window.innerWidth ) == 'number' ) {



		ph = window.innerWidth;



	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {



		ph = document.documentElement.clientWidth;



	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {



		ph = document.body.clientWidth;



	}



	document.getElementById("obramenu").style.left=(ph/2-75)+"px";



	pmbto=setTimeout("obm();",50);



}











function obra(id) {



		$('content').innerHTML=$('ob-'+id).innerHTML;



}







function obreany(any) {



	new Ajax.Updater( 'escriptor', 'inc/ajax.escriptorAny.php', { method: 'post' , parameters: 'dany='+any }); 



}







function include(fullUrl) {



	var e = document.createElement("script");



	e.src = fullUrl;



	e.type="text/javascript";



	document.getElementsByTagName("head")[0].appendChild(e);



}



  



function seccio(codiseccio) {



	function loadedsec() {



		switch(codiseccio) {



				case 'fun-Visites':



					include("omw/mod/llvisites/funcions.js");



					MM_preloadImages('../img/botoEnviarOn.gif');



				break;



				case 'ped-Cites':



					include("omw/mod/pedcites/funcions.js");



					MM_preloadImages('img/afegirCitaOn.gif');



				break;



				case 'fun-Multimedia':



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pVisual.flv");



					so.write("flv0");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "estudisIlerdencs.flv");



					so.write("flv1");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "puyalEntrevista.flv");



					so.write("flv2");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pedroloPoble.flv");



					so.write("flv3");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "temps.flv");



					so.write("flv4");



				break;



		}		



	}







	codis=codiseccio.split("-");



	$('contingut').innerHTML='';



	document.title='Fundació Pedrolo';



	strcont="";



	if (codis[0]=="ped") {



		$('container').className='cped';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantg.gif" alt="Carregant..." /><br />Carregant...</div>';



	} else {



		$('container').className='cfun';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantb.gif" alt="Carregant..." /><br />Carregant...</div>';



	}



	



	$('contingut').innerHTML=strcont;



	var url = 'inc/ajax.php';



	new Ajax.Updater( 'contingut', url, { method: 'post' , parameters: 'seccio='+codiseccio, onComplete: loadedsec }); 



}



/* Seccio amb paginacio */



function seccio2(codiseccio,categoria,pagina,ordre) {

	

	function loadedsec() {



		switch(codiseccio) {



				case 'fun-Visites':



					include("omw/mod/llvisites/funcions.js");



					MM_preloadImages('../img/botoEnviarOn.gif');



				break;



				case 'ped-Cites':



					include("omw/mod/pedcites/funcions.js");



					MM_preloadImages('img/afegirCitaOn.gif');



				break;



				case 'fun-Multimedia':



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pVisual.flv");



					so.write("flv0");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "estudisIlerdencs.flv");



					so.write("flv1");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "puyalEntrevista.flv");



					so.write("flv2");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pedroloPoble.flv");



					so.write("flv3");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "temps.flv");



					so.write("flv4");



				break;



		}		



	}







	codis=codiseccio.split("-");



	$('contingut').innerHTML='';



	document.title='Fundació Pedrolo';



	strcont="";



	if (codis[0]=="ped") {



		$('container').className='cped';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantg.gif" alt="Carregant..." /><br />Carregant...</div>';



	} else {



		$('container').className='cfun';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantb.gif" alt="Carregant..." /><br />Carregant...</div>';



	}



	//document.getElementById ('content2').style.display = "none";

	$('contingut').innerHTML=strcont;



	var url = 'inc/ajax.php';



	new Ajax.Updater( 'contingut', url, { method: 'post' , parameters: 'seccio='+codiseccio+'&categoria='+categoria+'&pagina='+pagina+'&ordreSQL='+ordre, onComplete: loadedsec }); 



}



/* Seccio links propis */



function seccio3(codiseccio,categoria) {



	function loadedsec() {



		switch(codiseccio) {



				case 'fun-Visites':



					include("omw/mod/llvisites/funcions.js");



					MM_preloadImages('../img/botoEnviarOn.gif');



				break;



				case 'ped-Cites':



					include("omw/mod/pedcites/funcions.js");



					MM_preloadImages('img/afegirCitaOn.gif');



				break;



				case 'fun-Multimedia':



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pVisual.flv");



					so.write("flv0");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "estudisIlerdencs.flv");



					so.write("flv1");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "puyalEntrevista.flv");



					so.write("flv2");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pedroloPoble.flv");



					so.write("flv3");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "temps.flv");



					so.write("flv4");



				break;



		}		



	}







	codis=codiseccio.split("-");



	$('contingut').innerHTML='';



	document.title='Fundació Pedrolo';



	strcont="";



	if (codis[0]=="ped") {



		$('container').className='cped';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantg.gif" alt="Carregant..." /><br />Carregant...</div>';



	} else {



		$('container').className='cfun';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantb.gif" alt="Carregant..." /><br />Carregant...</div>';



	}



	



	$('contingut').innerHTML=strcont;



	var url = 'inc/ajax.php';



	new Ajax.Updater( 'contingut', url, { method: 'post' , parameters: 'seccio='+codiseccio+'&categoria='+categoria, onComplete: loadedsec }); 



}	



//NOVA FUNCIONE PER CONTES

function seccio4(codiseccio,categoria,ordre) {

	

	function loadedsec() {



		switch(codiseccio) {



				case 'fun-Visites':



					include("omw/mod/llvisites/funcions.js");



					MM_preloadImages('../img/botoEnviarOn.gif');



				break;



				case 'ped-Cites':



					include("omw/mod/pedcites/funcions.js");



					MM_preloadImages('img/afegirCitaOn.gif');



				break;



				case 'fun-Multimedia':



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pVisual.flv");



					so.write("flv0");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "estudisIlerdencs.flv");



					so.write("flv1");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "puyalEntrevista.flv");



					so.write("flv2");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "pedroloPoble.flv");



					so.write("flv3");



					var so = new SWFObject("video/video.swf", "index", "307", "262", "8.0.0", "#FFFFFF", true);



					so.addVariable("url", "temps.flv");



					so.write("flv4");



				break;



		}		



	}







	codis=codiseccio.split("-");



	$('contingut').innerHTML='';



	document.title='Fundació Pedrolo';



	strcont="";



	if (codis[0]=="ped") {



		$('container').className='cped';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantg.gif" alt="Carregant..." /><br />Carregant...</div>';



	} else {



		$('container').className='cfun';



		strcont+='<div style="padding:100px; text-align:center; height:600px;"><img align="center" src="img/carregantb.gif" alt="Carregant..." /><br />Carregant...</div>';



	}



	



	$('contingut').innerHTML=strcont;



	var url = 'inc/ajax.php';



	new Ajax.Updater( 'contingut', url, { method: 'post' , parameters: 'seccio='+codiseccio+'&categoria='+categoria+'&ordreSQL='+ordre, onComplete: loadedsec }); 

}







function popup(url,name,w,h) {



	var altura = screen.height;



	var anchura = screen.width;



	var vent_x = w;



	var vent_y = h;	



	var posx2 = Math.round(anchura/2-(vent_x/2));



	var posy2 = Math.round(altura/2-(vent_y/2)) - 60;







	var newWindow = window.open(url,name,'resizable=0,resizable=no,scrollbars=1,status=0,location=0,toolbar=0,menubar=0,width='+vent_x+',height='+vent_y+',screenX='+posx2+',screenY='+posy2+',left='+posx2+',top='+posy2+'');



	newWindow.focus();



	return newWindow;



}







function init() {



		jQuery("#obramenu").hover(

			function() { //Over

				isoverlayer=true;

				checkMenuObra(1);

			},

			function() { //Out

				isoverlayer=false;

				checkMenuObra(0);

			}

		);

		jQuery("#obramenu a").mouseup(

			function() {

				isoverlayer=false;

				isoverflash=false;

				checkMenuObra(0);

			}

		);



		MM_preloadImages('img/botoBuscarOn.gif','img/botoSubscripcioOn.gif','img/carregantb.gif','img/carregantg.gif'); 



		om=document.getElementById("obramenu");



		om.style.top="150px";



		//om.style.display='none';



		obm(); 



}

function pr(valor) {

	alert(valor);	

}

function logout() {

	new Ajax.Request( 'omw/mod/common/sortir.php', { onComplete: function() { document.location='./'; } });

}
