/*

.........................

::   JavaScript Lib v0.1   ::

:: www.httpcomunicacio.com ::

.........................

*/





/*

.........................

:: Window Popper ::

.........................

*/



function pop(u,n,f, w, h, c) {

  if(window.screen)if(c)if(c=="1"){

    var l = (screen.width-w)/2;

    var t = (screen.height-h)/2;

    f+=(f!='')?',':'';

    f+='left='+l+',top='+t;

  }

  flop=window.open(u,n,f+((f!='')?',':'')+'width='+w+',height='+h);

  flop.focus();

}



function popo(u,n,f, w, h, c) {

  if(window.screen)if(c)if(c=="1"){

    var l = (screen.width-w)/2;

    var t = (screen.height-h)/2;

    f+=(f!='')?',':'';

    f+='left='+l+',top='+t;

  }

  flop=window.open(u,n,f+((f!='')?',':'')+'width='+w+',height='+h);

  flop.focus();

}





function ventanaSecundaria (URL){

window.open(URL,"ventana1","width=320, height=450, scrollbars=no, menubar=no, location=no, resizable=yes")

}



var popUpWin=0;



function popUpWindow(URLStr, left, top, width, height)



{



  if(popUpWin)



  {



    if(!popUpWin.closed) popUpWin.close();



  }



  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');



}





/*

.........................

:: Switch Div ::

.........................

*/



function switchDiv(divNum){

	x=document.getElementById("s" + divNum);

	y=document.getElementById("i" + divNum);

	if(x.style.display != "block"){

		x.style.display="block";

		y.src="img/menuOpen.gif";

	}else{

		x.style.display="none";

		y.src="img/menuClosed.gif";

    }

}





/*

.........................

:: The xRollovers ::

.........................

*/



function xOn(theId) {

	xfile=document.getElementById(theId)

	xname=xfile.getAttribute('src')

	x=xname.length

	xext=xname.substring(x-4,xname.length)

	xname=xname.substring(0,x-4)

	xfile.src=xname+".on"+xext

}



function xOff(theId) {

	xfile=document.getElementById(theId)

	xname=xfile.getAttribute('src')

	x=xname.length

	xext=xname.substring(x-4,xname.length)

	xname=xname.substring(0,x-7)

	xfile.src=xname+xext

}





/*

.........................

:: Cookie Recipes ::

.........................

*/



function saveCookie(name,value,days) {

        if (days) {

                var date = new Date();

                date.setTime(date.getTime()+(days*24*60*60*1000))

                var expires = "; expires="+date.toGMTString()

        }

        else expires = ""

        document.cookie = name+"="+value+expires+"; path=/"

}



function readCookie(name) {

        var nameEQ = name + "="

        var ca = document.cookie.split(';')

        for(var i=0;i<ca.length;i++) {

                var c = ca[i];

                while (c.charAt(0)==' ') c = c.substring(1,c.length)

                if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length)

        }

        return null

}



function deleteCookie(name) {

        saveCookie(name,"",-1)

}

function checkTheCookie() {
	x=readCookie('dentaidLang');
	if (x){
		saveCookie('dentaidLang', x, 666);
		if ((x=="es") || (x=="uk")) location = "new_web/"+x+"/";
		else  location=x+"/";
	}
}



/*

.........................

:: Event Listener Interface ::

.........................

*/



function addEvent(obj, evType, fn, useCapture){

  if (obj.addEventListener){

    obj.addEventListener(evType, fn, useCapture);

    return true;

  } else if (obj.attachEvent){

    var r = obj.attachEvent("on"+evType, fn);

    return r;

  } else {

    //alert("Handler could not be attached");

  }

}



function removeEvent(obj, evType, fn, useCapture){

  if (obj.removeEventListener){

    obj.removeEventListener(evType, fn, useCapture);

    return true;

  } else if (obj.detachEvent){

    var r = obj.detachEvent("on"+evType, fn);

    return r;

  } else {

    //alert("Handler could not be removed");

  }

}