function canviaTamany(idcapa)
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myWidth = window.innerWidth;
	myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myWidth = document.documentElement.clientWidth;
	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	}
	if (myHeight>864)
	{
		document.getElementById(idcapa).style.top=((myHeight-864)/2)+2+"px";
	}
	if (myWidth>1152)
	{
		myWidth=1152;
	}
	
	document.getElementById(idcapa).style.width=myWidth+"px";
	document.getElementById(idcapa).style.height=myHeight+"px";
}
function centraCapa(idcapa)
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
	//Non-IE
	myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	//IE 6+ in 'standards compliant mode'
	myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	//IE 4 compatible
	myHeight = document.body.clientHeight;
	}
	if (myHeight>600)
	{
		document.getElementById(idcapa).style.top=((myHeight-600)/2)+2+"px";
	}
}

function inicia(){
	canviaTamany('taula');
}
function emailCheck(emailStr,idioma) {
	/* Verificar si el email tiene el formato user@dominio. */
	var emailPat=/^(.+)@(.+)$/ 
	var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]" 
	var validChars="\[^\\s" + specialChars + "\]" 
	var quotedUser="(\"[^\"]*\")" 
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom=validChars + '+'
	var word="(" + atom + "|" + quotedUser + ")"
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	var matchArray=emailStr.match(emailPat)
	var err=""
	if (matchArray==null) {
		err="i"
	}
	var user=matchArray[1]
	var domain=matchArray[2]
	if (user.match(userPat)==null) {
		err=err+"i"
	}

	var IPArray=domain.match(ipDomainPat)
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				err=err+"i"
			}
		}
		err=err+"i"
	}
	
	var domainArray=domain.match(domainPat)
	if (domainArray==null) {
		err=err+"i"
	}
	
	var atomPat=new RegExp(atom,"g")
	var domArr=domain.match(atomPat)
	var len=domArr.length
	if (domArr[domArr.length-1].length<2 || 
		domArr[domArr.length-1].length>3) { 
		err=err+"i"
	}
	
	if (len<2) {
		err=err+"i"
	}
	if (err.length!=0)
	{
		var missatge
		switch(idioma)
		{
			case "ca":
				missatge="Adreça email errònia"
				break
			case "es":
				missatge="Direccion de email incorrecta"
				break
			case "en":
				missatge="Wrong email address."
				break
		}
		alert(missatge)
		return false
	}
	else
	{
		return true
	}
}
function obrirFinestra(url,alsada,llargada)
{
	finestra=window.open(url,'nom','height='+alsada+',width='+llargada+',scrollbars=no,status=no');
	if (window.focus) {finestra.focus()}
}






