function preCarga() {
	//if (!document.images) return;
	var ar = new Array();
	var arguments = preCarga.arguments;
	for (var i = 0; i < arguments.length; i++) {
		ar[i] = new Image();
		ar[i].src = arguments[i];
	}
}
function dibujarLinea(x1,y1,x2,y2)
{
  jg_doc.setColor("#ff0000"); // green
  jg_doc.setStroke(3);
  jg_doc.drawLine(parseInt(x1),parseInt(y1),parseInt(x2),parseInt(y2));
  jg_doc.paint(); // draws, in this case, directly into the document

}

var pressRel1=-1;
var relPos;
var nRel=0;
var Relaciones=new Array();var ruta;
function dibujarLineas()
{
jg_doc.clear();
	for (i=0; i<nRel; i++){
		datos=Relaciones[i].split(",");
		dibujarLinea(datos[0],datos[1],datos[2],datos[3]);
	}
}
function rel1(num){
	pressRel1=num;
}
function rel2(num){
  if (parseInt(pressRel1)>=0){
	relDibujar(pressRel1, num);
  }
}
function relDibujar(pos1,pos2){
	cambio=0;
	Relaciones[nRel]="";
	for (i=0; i<nRel; i++){
		datos=Relaciones[i].split(",");
		if ((datos[0]+","+datos[1])==relPos[pos1*2]){
			Relaciones[i]=relPos[pos1*2]+","+relPos[((pos2*2)+1)];
			cambio=1;
		}
		if ((datos[2]+","+datos[3])==relPos[((pos2*2)+1)]){
			Relaciones[i]=relPos[pos1*2]+","+relPos[((pos2*2)+1)];
			cambio=1;
		}
	}
	if (!cambio)
		Relaciones[nRel++]=relPos[pos1*2]+","+relPos[((pos2*2)+1)];
	dibujarLineas()
	pressRel1=-1;	
}

function CalificarRel(){
	bien=0;
	for (i=0; i<(relPos.length/2); i++){
		for (j=0; j<nRel; j++){
			if (Relaciones[j]==relPos[i*2]+","+relPos[((i*2)+1)])
				bien++;
		}
	}
	location.href="calificacion.php?rel="+parseInt(relPos.length/2)+"&bien="+ bien +"&ruta="+ ruta;
}

var con=0;
var corr=0;
function cambiar(img,ref) {
    document.images[img].src = ref;
}
function popUp (URL, wid, hei){
	var W3=window.open(URL,"ventana1","width="+wid+", height="+hei+", scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popBlog (){
	var W9=window.open("/AndoNET/comentarios.php","n","width=520, height=700, scrollbars=yes, menubar=no, location=no, resizable=yes")
}

function Ayuda (){
	var a1=window.open("/ayuda.php","a","width=500, height=500, scrollbars=yes, menubar=no, location=no, resizable=yes")
}
function Calendario (){
	var a7=window.open("/colores.html","a","width=250, height=650, scrollbars=yes, menubar=no, location=no, resizable=yes")
}

function popChat (){
	var W9=window.open("/chat","n","width=750, height=650, scrollbars=yes, menubar=no, location=no, resizable=yes")
}
function popBusca (){
	var W15=window.open("/busca","m","width=750, height=520, scrollbars=no, menubar=no, location=no, resizable=yes")
} 
function popInf (){
	var W8=window.open("/informacion","l","width=750, height=520, scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popContacto (){
	var W10=window.open("/contacto","l","width=720, height=350, scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popInv (){
	var W7=window.open("/OpenInviter/recommend.php","k","width=500, height=500, scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popCal (){
	var W4=window.open("/calculadora","x","width=250, height=350, scrollbars=no, menubar=no, location=no, resizable=no")
} 
function popDib (){
	var W5=window.open("/eje/editor.php","d","width=750, height=520, scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popDoc (){
	var W6=window.open("/cqs/doc.php","f","width=730, height=520, scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popUpS (URL, wid, hei){
	var W1=window.open(URL,"ventana3","width="+wid+", height="+hei+", scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function popUp2 (URL, wid, hei){
	var W2=window.open(URL,"ventana2","width="+wid+", height="+hei+", scrollbars=yes, menubar=no, location=no, resizable=yes")
} 
function inicioMover(mov,nombres){
	lista=nombres.split("|");
	con=con+(mov*1);
	for (i=0; i<6; i++)
		document.getElementById("nom"+(i+1)).innerHTML='<a href="interfas.php?nom='+lista[(con+i)*2]+'" onMouseover="slowhigh(document.images[\''+lista[(con+i)*2+1]+'\'])" onMouseout="slowlow(document.images[\''+lista[(con+i)*2+1]	+'\'])"><B>'+lista[(con+i)*2]+'</a>';
	document.getElementById('arriba').style.visibility='visible'; 
	document.getElementById('abajo').style.visibility='visible'; 

	if ((con+7)>(lista.length/2))
		document.getElementById('abajo').style.visibility='hidden'; 
	if (con==0)
		document.getElementById('arriba').style.visibility='hidden'; 
}
function Entrar(nombres, sex){
	lista=nombres.split("|");
	for (i=0; i<lista.length-2; i+=2){
		if (lista[i].toLowerCase()==document.getElementById('nom').value.toLowerCase() ){
			alert("Ya existe este nombre, para iniciar con este seleccionalo de la lista");
			return ;
		}
	}
	if((document.getElementById('nom').value=="")&&(document.getElementById('email').value==""))
		alert("Escribe tu Nombre e email para crear una cuenta");
	else{
		document.getElementById('sex').value=sex
		location.href="interfas.php?nom="+document.getElementById('nom').value+"&sex="+document.getElementById('sex').value+"&email="+document.getElementById('email').value;
	}
}
	// popUp("interfas.php?nom="+document.getElementById('nom').value+"&sex="+document.getElementById('sex').value,750,520)
	// }
// }
function pulsar(e) {
  tecla = (document.all) ? e.keyCode :e.which;
  return (tecla!=13);
} 
var ruta;
function cuestionario(preguntas, num, res){
if (res=="si")corr++;
num=parseInt(num);
preguntas=preguntas.toUpperCase();
pregunta=new Array();
pregunta=preguntas.split(",");
if (num==pregunta.length)
	location.href="/calificacion.php?cue="+pregunta.length+"&bien="+corr+"&ruta="+ruta;

	partes=pregunta[num].split("/");
	document.getElementById('pregunta').innerHTML='<b>'+partes[0];
num=parseInt(num)+1;
	document.getElementById('r1').innerHTML= '<a href="/aud.php?track=mal" target="sonido"  onclick="cuestionario(\'' + preguntas + '\',\'' + num + '\',\'no\');"><b>'+partes[1]+'</a>';

	document.getElementById('r2').innerHTML= '<a href="/aud.php?track=mal" target="sonido" onclick="cuestionario(\'' + preguntas + '\',\'' + num + '\',\'no\');"><b>'+partes[2]+'</a>';
	document.getElementById('r3').innerHTML= '<a href="/aud.php?track=mal" target="sonido" onclick="cuestionario(\'' + preguntas + '\',\'' + num + '\',\'no\');"><b>'+partes[3]+'</a>';
	document.getElementById('r'+partes[4]+'').innerHTML= '<a href="/aud.php?track=bien" target="sonido" onclick="cuestionario(\'' + preguntas + '\',\'' + num + '\',\'si\');"><b>'+partes[partes[4]]+'</a>';
}



var baseopacity=50
var browserdetect=""
function slowhigh(which2){
which2=document.images[which2];
imgobj=which2
browserdetect=which2.filters? "ie" : typeof which2.style.MozOpacity=="string"? "mozilla" : ""
instantset(baseopacity)
highlighting=setInterval("gradualfade(imgobj)",50)
}

function slowlow(which2){
cleartimer()
instantset(baseopacity)
}

function instantset(degree){
if (browserdetect=="mozilla")
imgobj.style.MozOpacity=degree/100
else if (browserdetect=="ie")
imgobj.filters.alpha.opacity=degree
}

function cleartimer(){
if (window.highlighting) clearInterval(highlighting)
}

 function gradualfade(cur2){
if (browserdetect=="mozilla" && cur2.style.MozOpacity<1)
cur2.style.MozOpacity=Math.min(parseFloat(cur2.style.MozOpacity)+0.1, 0.99)
else if (browserdetect=="ie" && cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=10
else if (window.highlighting)
clearInterval(highlighting)
} 
//ejemplo <img src="bienvenida.jpg" border=0  class="gradualshine" onMouseover="slowhigh(this)" onMouseout="slowlow(this)">
