//captant resolucio:
sw=screen.width;
sh=screen.height;
sw_mem=sw;
//stp_factor=0.20;


////////////////////////////////////////////////////////////////////////////////

//patro de variables:

//mImatges[i]['imatgeId']
//mImatges[i]['path']
//mImatges[i]['onMouseover']
//mImatges[i]['onMouseout']
//mImatges[i]['widthPx']
//mImatges[i]['heightPx']
//mImatges[i]['cursor']

function es_IE()  //declara var logica esIE=true si navegador es IE, declara variables de tamany de text i  resolucions
{
// browser test:
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);

screenSize=new Array();
ie7UserAgent=false;
netscapeAlert=false;
firefoxUserAgent=false;
operaUserAgent=false;
esIE=false;

if (navigator.userAgent.match('Netscape')!=null){netscapeAlert=true;}
else if (navigator.userAgent.match('Firefox')!=null){firefoxUserAgent=true;}
else if (navigator.userAgent.match('Opera')!=null){operaUserAgent=true;}

if (browserName == 'Netscape' && browserVer >= 4 )
{
    screenSize['w']=screen.width;
    screenSize['h']=screen.height;
    sw=screen.width;
    sh=screen.height;
}
else if (browserName == 'Microsoft Internet Explorer' && browserVer >= 4)
{
    screenSize['w']=screen.width;
    screenSize['h']=screen.height;
    sw=screen.width;
    sh=screen.height;
    arVersion = navigator.appVersion.split('MSIE');
    version = parseFloat(arVersion[1])
    if (version >= 5.5 ){esIE=true;}
    if(browserVer ==7){ie7UserAgent=true;}
}
else
{
    if (browserName == 'Netscape' && browserVer >= 3)
    {
	   toolkit = java.awt.Toolkit.getDefaultToolkit();
	   screen_size = toolkit.getScreenSize();
       screenSize['w']=screen_size.width;
       screenSize['h']=screen_size.height;
       sw=screenSize['w'];
       sh=screenSize['h'];
    }
    else
    {
        sw=screen.width;;
        sh=screen.width;;
    }
}
swp=sw/1280;

shp=sh/1280;

//resolucio=sw;
if(sw!=800 && sw!=1024 && sw!=1280)
{
    if(sw>800 && sw<1024){sw=800;}
    else if(sw>1024 && sw<1280){sw=1024;}
    else {sw=1280;}
}

stp=sw/1280;
// tamany lletres segons resolucio:
ieCorrection=0;
browserName = navigator.appName;
if(browserName=='Microsoft Internet Explorer'){ieCorrection=1;}
for (i=fontTypeSizeMin;i<fontTypeSizeMax;i++)
{
   eval('t'+i+'=('+i+'*stp)+'+ieCorrection);
}

return;
}

function pngIEfix(mImatge,esIE)
{
    var pF='';
    if(!esIE)
    {
        pF="<img id='"+mImatge['imatgeId']+"' "+mImatge['onMouseover']+" "+mImatge['onMouseout']+"  src=\""+mImatge['path']+"\" style=\""+mImatge['cursor']+";\">";
    }
    else
    {
        pF="<div id='"+mImatge['imatgeId']+"' "+mImatge['onMouseover']+" "+mImatge['onMouseout']+"  style=\"display:inline-block; "+mImatge['cursor']+"  width:"+mImatge[sw+'widthPx']+"px; height:"+mImatge[sw+'heightPx']+"px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'"+mImatge['path']+"\'); \"></div>";
    }
        document.writeln(pF);
return;
}


allowedCharsEmail='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.@';
emailNeededCharacters='@.';
function testName(elmId,asValue)
{
    isValid=false;
    mText['tN_valor_buit']=new Array();
    mText['tN_valor_buit']['cat']="Nom: Cal que introduiu un valor";
    mText['tN_valor_buit']['esp']="Nombre: Es necesario introducir un valor";
    mText['tN_email is not valid']=new Array();
    mText['tN_email is not valid']['cat']="Cal introduir un email vàl.lid";
    mText['tN_email is not valid']['esp']="Es necesario introducir un email válido";
    value=document.getElementById(elmId).value;

    if(asValue=='name' || asValue=='email' || asValue=='textArea')
    {
        if(value.length==0)
        {
            alert(mText['tN_valor_buit'][idioma]);
            return false;
        }
    }

    if(asValue=='email')
    {
        allowedChars=allowedCharsEmail;
        //check for prohibited characters
        for(i=0;i<value.length;i++)
        {
            for(j=0;j<allowedChars.length;j++)
            {
                if(value.charAt(i)==allowedChars.charAt(j)){isValid=true;}
            }
            if(!isValid)
            {
                alert(mText['tN_email is not valid'][idioma]);
                return false;
            }
            isValid=false;
        }
        //check for needed characters
        for(i=0;i<emailNeededCharacters.length;i++)
        {
            if(value.indexOf(emailNeededCharacters.charAt(i))<0)
            {
                alert(mText['tN_email is not valid'][idioma]);
                return false;
            }
        }
        //check for minimum length
        if(value.length<5)
        {
            alert(mText['tN_email is not valid'][idioma]);
            return false;
        }

    }

return true;
}

function setTagElementsFontSize(tagName,fontSize)
{
   mTagElements=document.getElementsByTagName(tagName);
   for(j=0;j<mTagElements.length;j++)
   {
       //mTagElements[i].style.fontFamily='Verdana';
       mTagElements[j].style.fontSize=fontSize;
   }
return;
}

