//*****Parametritzador*****

params=self.location.search.substring(1).split('&')
if (params[0]!='')
{
 for (t=0;t<params.length;t++) 
 { 
  newvar=params[t].split('=') 
  eval(newvar[0]+'="'+newvar[1]+'"') 
 }
}

//Auto window resize
//beetle - http://www.codingforums.com/showthread.php?s=&threadid=9836
function sizeImgWin(img) {
   	var new_w = img.width+20;
	var new_h = img.height+20;
	var old_w = window.innerWidth || window.document.body.offsetWidth;
	var old_h = window.innerHeight || window.document.body.offsetHeight;
	if (!new_w) { new_w = old_w; }
	if (!new_h) { new_h = old_h; }
	new_w -= old_w; new_h -= old_h;
	window.resizeBy(new_w,new_h);
}


function isEmail(who) {
	var email=/^[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*@[A-Za-z0-9]+([_\.-][A-Za-z0-9]+)*\.([A-Za-z]){2,4}$/i;
	return(email.test(who));
}

//*******TESTEJA FORMULARI********
function Testeja2(nomform)
{
 enviar=true

 with (nomform)
 {
  compos=dades_testeja.value.split(',')

  for (t=0;t<compos.length;t++)
  {
   if (compos[t].indexOf('.')==-1) compos[t]+='.value'
   variable=eval(compos[t])
   if (variable=='' || !variable)
   {
    alert(dades_missatge.value)    
    enviar=false
    eval(compos[t].substring(0,compos[t].indexOf('.'))+'.focus()')
    break
   }//end if
  }//end for
 }//end with
 return enviar

}

function chkURL()
{
 args=chkURL.arguments
 redir=args[0]?'':('?reURL='+self.location)
 if ((self.name!='iConts' && self.name!='Cistella') || top.location == self.location) top.location='index.htm'+redir
}