///////////////////////////////////////////////
// Pop Up /////////////////////////////////
//////////////////////////////////////

ventanas=new Array();
function abre(destino,name,ancho,alto){
	
	anchura="";
	altitud="";
	anchura+="width=";
	anchura+=ancho;
	altitud+="height=";
	altitud+=alto;
	tamany="";
	tamany=anchura;
	tamany+=",";
	tamany+=altitud;
	
            if (ventanas[name]!=undefined) ventanas[name].close();{	
	ventanas[name]=window.open(destino,name,tamany);
			}			
	
	x = (screen.width - ancho) / 2;
    y = (screen.height - alto) / 2;
    ventanas[name].moveTo(x, y);
}

///////////////////////////
// ROLLS OVERS //////////
////////////////////////


	function cambia(etiqueta, imagen){
		document.getElementById(etiqueta).src = imagen;
	}

/////////////////////////////////////////////////////////////////////
// Carga de Flashes                                //////////////////
////////////////////////////////////////////////////////

function insertFlash(movie,variables,ancho,alto){
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+ancho+'" height="'+alto+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain">');
	document.write('<param name="scale" value="noscale">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="flashVars" value="'+variables+'">');
	document.write('<param name="bgcolor" value="#ffffff">');
	document.write('<param name="movie" value="'+movie+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="wmode" value="transparent">');
	document.write('<embed src="'+movie+'" quality="high" scale="noscale" bgcolor="#ffffff" align="middle" allowScriptAccess="sameDomain" pluginspage="http://www.macromedia.com/go/getflashplayer" menu="false" flashVars="'+variables+'" wmode="transparent" type="application/x-shockwave-flash" width="'+ancho+'" height="'+alto+'"></embed>');
	document.write('</object>');
}

//

	// Funcion Nativa Dreamweaver
	
	function preCarga() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preCarga.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	
	// Status
	
	function textoStatus(texto){
		
	window.status = texto;	
		
	}
	
	function verImagen(esta){
		
		abre('popups/ver_imagen.php?img=' + esta, 'img', 400,400);
		
	}
	
	function verVideo(){
	
	abre('popups/ver_video.php', 'video', 438,336);
		
	}
	
	function texto(este){
		
	switch(este){
		
	//CAT
	case '1cat': mensa = "Escriu el teu nom"; break;
	case '2cat': mensa = "Escriu el teu cognom"; break;
	case '3cat': mensa = "Escriu el nom de la teva Empresa"; break;
	case '4cat': mensa = "Escriu el teu email"; break;
	//ESP
	case '1esp': mensa = "Escribe tu nombre"; break;
	case '2esp': mensa = "Escribe tu apellido"; break;
	case '3esp': mensa = "Escribe el nombre de tu Empresa"; break;
	case '4esp': mensa = "Escribe tu email"; 
		
	}
	
	alert(mensa);	
		
	}
	
	function compruebaContacto(lang){
		
	if(document.contactar.nombre.value != ""){
		
		if(document.contactar.apellidos.value != ""){
		
			if(document.contactar.empresa.value != ""){
			
				if(document.contactar.email.value != ""){
				
				document.contactar.submit();
				
				}else{
					
				document.contactar.email.focus();
				texto('4'+lang);
					
				}				
			
			}else{
				
			texto('3'+lang);
			document.contactar.empresa.focus();
				
			}		
		
		}else{
			
		texto('2'+lang);
		document.contactar.apellidos.focus();
			
		}
		
	}else{
		
	texto('1'+lang);
	document.contactar.nombre.focus();
		
	}
		
	}
	
	
	function tamanyDirect(ancho,alto){
		window.resizeTo(ancho,alto);
		
		x = (screen.width - ancho) / 2;
		y = (screen.height - alto) / 2;
		ventanas2[name].moveTo(x, y);
		
	}
	
	function ampliaInfoCurso(id, lang){
		
	dire = 'popups/ver_info_calendario.php?id=' + id + '&lang=' + lang;
		
	abre(dire, 'infos', 480, 340);
		
	}
	
	function texto2(este){
		
	switch(este){
		
	//CAT
	case '1cat': mensa = "Escriu el teu nom"; break;
	case '2cat': mensa = "Escriu el nom de la teva Empresa"; break;
	case '3cat': mensa = "Escriu el teu email"; break;
	//ESP
	case '1esp': mensa = "Escribe tu nombre"; break;
	case '2esp': mensa = "Escribe el nombre de tu Empresa"; break;
	case '3esp': mensa = "Escribe tu email"; 
		
	}
	
	alert(mensa);	
		
	}
	
	function compruebaMasInfo(lang){
		
	if(document.apuntarse.nombre.value != ""){
		
		if(document.apuntarse.empresa.value != ""){
		
			if(document.apuntarse.email.value != ""){				
			
			document.apuntarse.submit();
				
			}else{
			
			texto2("3" + lang);
			document.apuntarse.email.focus();
				
			}
			
		}else{
		
		texto2("2" + lang);
		document.apuntarse.empresa.focus();
			
		}
		
	}else{
	
	texto2("1" + lang);
	document.apuntarse.nombre.focus();
		
	}
		
		
	}
	
	function politiques(lang){
	
	dire = 'popups/politiques.php?lang=' + lang;
	abre(dire, 'polis', 400, 400);
		
	}
	
	function apuntat(lang, id){
	
	dire = 'popups/ver_info_calendario.php?lang=' + lang + "&id=" + id;
	abre(dire, 'apuntat', 500, 450);
		
	}
	
	function marcameProcesos(id){
		iden = 'lista' + id;	
		document.getElementById(iden).innerHTML = "*";
	}
	
	var id_marcat;
	function marcaMe(este){
		if(id_marcat != "")$("#" + id_marcat).attr("color", "#6f94c8");
		$("#" + este).attr("color", "#234082");	
		id_marcat = este;
	}
	
	function iraAncla(esta){
		
		document.location.href = "#" + esta;	
	}
