function tancarsessio(nom){
	this.open('abandon.asp', 'CtrlWindow', 'toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=150,height=150');
}

//per obrir una finestra
function finestra(theURL, Name, popW, popH, scroll) { // V 1.0
var winleft = (screen.width - popW) / 2;
var winUp = (screen.height - popH) / 2;
winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable'
Win = window.open(theURL, Name, winProp)
if (parseInt(navigator.appVersion) >= 4) { Win.window.focus(); }
}

function mostra(apartat) {
var cela = document.getElementById('tedemenu');
var e = document.getElementById(''+apartat+'');
var esObert = false;
if(e.className=='menu_visible') {
	esObert = true; 
}

for (i=0;i<cela.childNodes.length;i++){
	if(cela.childNodes[i].className=='menu_visible'){
	cela.childNodes[i].className = 'menu_ocult';
	}
}

if(esObert){
	e.className= 'menu_ocult';
	}
	else {
	e.className= 'menu_visible';
	}
}

//per obrir la cerca avançada
function mostraAmaga(caixa) {
var caixa = document.getElementById(caixa);
	if(caixa.className == 'deRes') {
		caixa.className = 'deBloc';
	}
	else {
		caixa.className = 'deRes';	
	}
}

function confirmaEliminar(missatge,adreca){
var m = window.confirm(missatge)
	if (m==true){
	window.location = adreca
	}
}
function popup(url,windowname,width,height,features) { 
width=(width)?width:screen.width/2; 
height=(height)?height:screen.height/2; 
var screenX = (screen.width/2 - width/2); 
var screenY = (screen.height/2 - height/2); 

var features= "width=" + width + ",height=" + height +",scrollbars=no,status=no"; 
features += ",screenX=" + screenX + ",left=" + screenX; 
features += ",screenY=" + screenY + ",top=" + screenY; 

var mywin=window.open(url, windowname, features); 
if (mywin) 
mywin.focus(); 
return mywin; 
}

function pregunta(tipus){
	
	if (tipus == "email"){	
			
		
		
		if (!(confirm('Segur que no vols rebre més comunicats?'))){
			   return false; }
				
	}
}
 function limpiar()	{
	foto = document.getElementById("foto1");
	nouFile = document.createElement("input");
	nouFile.id = foto.id;
	nouFile.type = "file";
	nouFile.name = "foto1";
	nouFile.className = "camps";
	nouFile.value = "";
	
	nouFile.onchange = foto.onchange;
	nodoPadre = foto.parentNode;
	nodoSiguiente = foto.nextSibling;
	nodoPadre.removeChild(foto);
	(nodoSiguiente == null) ? nodoPadre.appendChild(nouFile):
		nodoPadre.insertBefore(nouFile, nodoSiguiente);
}

function checkear_extension(fichero)	{
	function prever() {
		return;
	}

	function no_prever() {
		alert("Format de foto no compatible, només jpg");
		limpiar();
	}

	(/\.(jpg)$/i.test(fichero.value)) ? prever() : no_prever();
}
/*function mostra_nova2(divId) {
	//var lText = link.innerHTML;
	var esObert = false;
    var d = getObject(divId);
    //if (lText == '+') {
	if(d.style.display=='none'){
    	//link.innerHTML = '&#8722;';
        d.style.display = 'block';
    } else {
        //link.innerHTML = '+';
        d.style.display = 'none';
    }
}*/
