/* Funcions javascript per a enviament del missatge a un amic */
var theUrl;
function getUrl(localizacion,fitxer) {
	var pepe;
	
	pepe=location.href;
	y=pepe.replace(fitxer,localizacion);
	
	document.write(y);
}	
function init() {
	theUrl = location.href;
}

function pop(url) {
	window.open(url,'pop','width=500,height=160,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=no,status=no');
}

function redirect()
{
if(document.layers)
{
var index=document.layers['eines'].document.formu.idioma.options[document.layers['eines'].document.formu.idioma.selectedIndex].value;
}else{
var index=document.formu.idioma.options[document.formu.idioma.selectedIndex].value;
}
	
var wp=index.substr(1,5);
if (index.charAt(0)==1) location.href="../" + wp + "/index.html"
 	else
 	 	if (index.charAt(0)==2) location.href="../" + wp + "/index.html"
 	 	else
 	 		if (index.charAt(0)==3) location.href="../" + wp + "/index.html"
	 	 	else
   	 		if (index.charAt(0)==5) location.href="../" + wp + "/" + wp + "_resum.html"
  	 	 	else
     	 		if (index.charAt(0)==6) location.href="../" + wp + "/" + wp + "_resumen.html"
    	 	 	else
    				theAbstract(wp + "_abs.html")
}

function redirect2()
{
if(document.layers)
{
var index=document.layers['eines'].document.formu.idioma.options[document.layers['eines'].document.formu.idioma.selectedIndex].value;
}else{
var index=document.formu.idioma.options[document.formu.idioma.selectedIndex].value;
}
	
var wp=index.substr(1,5);
var wp=index.substr(1,5);
if (index.charAt(0)==1) location.href="../" + wp + "/index.html"
 	else
 	 	if (index.charAt(0)==2) location.href="../" + wp + "/index.html"
 	 	else
 	 		if (index.charAt(0)==3) location.href="../" + wp + "/index.html"
	 	 	else
   	 		if (index.charAt(0)==5) location.href="../" + wp + "/" + wp + "_resumen.html"
  	 	 	else
     	 		if (index.charAt(0)==6) location.href="../" + wp + "/" + wp + "_resum.html"
    	 	 	else
    				location.href= wp + "_abs.html"
}

function envia(titol, autor) {
		window.open('http://www.uoc.es/web/esp/articles/formulari/formulario.html?Titol='+titol+'&Autor='+autor+'&url='+theUrl+'','Formulari','width=540,height=450,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=no,status=no');
}

function curriculum(url_cv) {
	window.open(url_cv,'Curriculum','width=500,height=400,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=yes,status=no');
}

function theAbstract(url_abs) {
	window.open(url_abs,'Abstract','width=500,height=400,location=no,toolbar=no,directories=no,menubar=no,resizable=no,scrollbars=yes,status=no');
}

/*function Note2See(evnt, strId) {
	if (document.all) {
		eval(strId).style.visibility = "visible";	
		eval(strId).style.top = (evnt.y + document.body.scrollTop - 15) + 22;
	} else {
		document.layers[eval('\''+strId+'\'')].visibility = "visible";	
		document.layers[eval('\''+strId+'\'')].top = (evnt.pageY - 15) + 22;	
	}
}

function Note2Hide(strId) {
	if (document.all) {
		eval(strId).style.visibility = "hidden";	
	} else {
		document.layers[eval('\''+strId+'\'')].visibility = "hidden";
	}
}*/

function Note2See(evnt, strId) {
	
	if (document.all){
    eval(strId).style.visibility = "visible";  
    eval(strId).style.top = evnt.y + document.body.scrollTop - 15;
   }else{
   		if (document.layers){
    			document.layers[eval("'"+strId+"'")].visibility = "visible";
    			document.layers[eval("'"+strId+"'")].top = evnt.pageY - 15;
    		}else{
			document.getElementById(eval("'"+strId+"'")).style.visibility = "visible";
			document.getElementById(eval("'"+strId+"'")).style.top = evnt.pageY - 15;
   		}
   }   
}


function Note2Hide(strId) {
	
	if (document.all){
    eval(strId).style.visibility = "hidden";
   }else{
   		if (document.layers){
    			document.layers[eval("'"+strId+"'")].visibility = "hidden";    			
    		}else{
			document.getElementById(eval("'"+strId+"'")).style.visibility = "hidden";
   		}
   }  
}


function doblar(url) {

	var longitud1=0,longitud2=0,barras=0,longitudtotal=0;
	var i=0;	
	var cadena1='',cadena2='',cadena3='';
	
	longitudtotal=url.length;		
	
	if (longitudtotal>80)
	{		
		longitud1=url.indexOf('//');
		cadena1=url.substring(0,longitud1+2);				
		cadena2=url.substring(longitud1+2,longitudtotal);				
		longitud2=cadena2.length;
	
		for (i=0;i<longitud2;i++) 
		{
			if ( (cadena2.charAt(i)=='/') && ( (cadena2.charAt(i-1)!='/') && (cadena2.charAt(i+1)!='/')) )
			{
				barras=barras+1;
				cadena3=cadena3+cadena2.charAt(i);						
			}
			else if (barras==3) 
			{			
				cadena3=cadena3+'<br>'+cadena2.substring(i,longitud2);						
				i=longitud2;
								
			}
			else
			{
				cadena3=cadena3+cadena2.charAt(i);				
			}
		}				
		url=cadena1+cadena3;
	}		
	return(url);
}

