// JavaScript Document


/////////////////////////////////////////
function registro(){
	myLink="registro.php?mail="+document.registro.email.value;
	window.open(myLink,'registro','top=20,left=20,width=441,height=652');
}

function tallas(){
	myLink="tallas.php";
	window.open(myLink,'tallas','top=20,left=20,width=641,height=452,scrollbars=yes');
}

function glosario(){
	myLink="glosario.php";
	window.open(myLink,'glosario','top=20,left=20,width=641,height=452,scrollbars=yes');
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


function changeObjectVis(objectId, newVisibility) {
	
	var styleObject = getStyleObject(objectId, document);
    styleObject.visibility = newVisibility;
} 

function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
var winleft = (screen.width - popW) / 2;
var winUp = (screen.height - popH) / 2;
}

function MM_openBrWindow2(theURL,winName,features) { //v2.0
window.open(theURL,winName,'height=200,width=250,scrollbars=yes');
}




opac=0
goIn=null


function overmenu1(nombre,modo){
	if(modo=="hidden")dir=0;
	if(modo=="visible")dir=1;
	//if(document.all){document.all("fadimg").filters.alpha.Opacity=opac}
	if(document.getElementById && !document.all){
		document.getElementById("menu1").style.MozOpacity=(opac/100)-0.01
		document.getElementById("menu1").style.KHTMLOpacity=(opac/100)-0.01
		document.getElementById("menu1").style.opacity=(opac/100)-0.01
	}
	//if(document.getElementById && !document.all){document.getElementById("menu1").style.KHTMLOpacity=(opac/100)-0.01}
	//if(document.getElementById && !document.all){document.getElementById("menu1").style.opacity=(opac/100)-0.01}
	
	if(dir==1 && opac<=100){opac=opac+2} else{clearTimeout(goIn)}
	if(dir==0 && opac>=0){opac=opac-2} else{clearTimeout(goIn)}
	goIn=setTimeout("overmenu1('" + dir + "')", 10)
	//changeObjectVis(nombre,modo);
}



function overmenu2(nombre,modo){
	if(modo=="hidden")dir=0;
	if(modo=="visible")dir=1;
	//if(document.all){document.all("fadimg").filters.alpha.Opacity=opac}
	if(document.getElementById && !document.all){document.getElementById("menu2").style.MozOpacity=(opac/100)-0.01}
	if(document.getElementById && !document.all){document.getElementById("menu2").style.KHTMLOpacity=(opac/100)-0.01}
	if(document.getElementById && !document.all){document.getElementById("menu2").style.opacity=(opac/100)-0.01}
	if(dir==1 && opac<=100){opac=opac+2} else{clearTimeout(goIn)}
	if(dir==0 && opac>=0){opac=opac-2} else{clearTimeout(goIn)}
	goIn=setTimeout("overmenu2('" + dir + "')", 10)
	//changeObjectVis(nombre,modo);
}



function overmenu(nombre,modo){
	//if(modo=="hidden")dir=0;
	//if(modo=="visible")dir=1;
	//if(document.getElementById && !document.all){
	//	document.getElementById("menu1").style.MozOpacity=(opac/100)-0.01
	//	document.getElementById("menu1").style.KHTMLOpacity=(opac/100)-0.01
	//	document.getElementById("menu1").style.opacity=(opac/100)-0.01
	//}
	
	//if(dir==1 && opac<=100){opac=opac+2} else{clearTimeout(goIn)}
	//if(dir==0 && opac>=0){opac=opac-2} else{clearTimeout(goIn)}
	//goIn=setTimeout("overmenu1('" + dir + "')", 10)
	changeObjectVis(nombre,modo);
}

function amplia(theURL,winName){

	window.open(theURL,winName,'top=20,left=20,width=20,height=20');
	
}
/////////////////////////////////////////

function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility, modo) {
	if(modo!='load'){
		frames['fichaframe'].location.href="blank.htm";
	}
	
	//document.layers[objectId].visibility= newVisibility;
    var styleObject = getStyleObject(objectId, document);
    styleObject.visibility = newVisibility;
} 


function detalle(id,carpeta,seccion){
	frames['fichaframe'].location.href="window.php?&num="+id+"&modo=win&carpeta="+carpeta+"&seccion="+seccion;
	changeObjectVisibility('menu', 'visible','load');
}



function enviar(id){
	frames['fichaframe'].location.href="../window_enviar.php?&id="+id+"&modo=win&";
	changeObjectVisibility('menu', 'visible','load');
}






// Menu flotante by Peter-Paul Koch
// Pagina personal del autor: http://www.xs4all.nl/~ppk/js/?version5.html
//
// Este script y otros muchos pueden
// descarse on-line de forma gratuita
// en El Código: www.elcodigo.com

// numero de pixels de separacion con la parte superior de la ventana
var theTop = 0

var menu, scrollIt

// posicion actual
var old = theTop
// a true, la posición del menu se mantiene a "theTop" pixels, aunque se desplace la pagina verticalmente
// a false, el menu es fijo
var scrollIt = true

// INICIALIZACION
function init() {
	// obtiene referencia al objeto con el menu
	menu = new getObj('menu')
	// obtiene si hay que mantenerlo fijo o moverlo, a partir del checkbox del propio menu
	//scrollIt = (document.layers) ?
		//document.menu.document.forms[0].elements[0].checked :
		//document.forms["capamenu"].elements[0].checked
	// inicia el proceso que mantiene la posicion a "theTop" pixels
	movemenu()
}

//MOVIMIENTO
function movemenu() {
	if (scrollIt) {
		if (window.innerHeight) {
			  pos = window.pageYOffset
		} else if (document.documentElement && document.documentElement.scrollTop) {
			pos = document.documentElement.scrollTop
		} else if (document.body) {
			  pos = document.body.scrollTop
		}
		
		if (pos < theTop)
			pos = theTop
		else
			//pos += 30
			
		if (pos == old)
			menu.style.top = pos + 'px'

		old = pos
	}
	
	moveID = setTimeout('movemenu()',200)
}

//OBTENCION DE REFERENCIA AL OBJETO
/*
function getObj(name) {
  // si soporta DOM Lelvel 2
  if (document.getElementById) {
  	this.obj = document.getElementById(name)
	this.style = document.getElementById(name).style
  // si soporta el DOM del IE4.x
  } else if (document.all) {
	this.obj = document.all[name]
	this.style = document.all[name].style
  // si soporta el DOM del N4.x
  } else if (document.layers) {
   	this.obj = document.layers[name]
   	this.style = document.layers[name]
  }
}*/

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
  }
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}

/*
window.onload = init
if (document.captureEvents) {		//N4 requiere invocar la funcion captureEvents
	document.captureEvents(Event.LOAD)
}*/


function tracking(v_url){
	if (v_url!='' && v_url!=' '){
		var url_track =  '/tracking/'+v_url;
		pageTracker._trackPageview( url_track );
	}
}