var nivDir = "";
aPositNom = 'MWUSR';
usrDias = 183;
usrDat = new Array();

function sigueNav(){
	var appNumero; 
 	var verZion;
	appNumero = ("" + navigator.appVersion);
 
	verZion =  appNumero.substring(0,1);

	if (verZion.valueOf() < 4) {
		window.location = "NWNAV.HTML";
	}
}
//-----------------------

function laListita(){	
	var p,p1=0,p2=0;
	var aPosit;
	aPosit = leeAposit();
	if (aPosit == "*"){
		return false;
		}
		else{
			p = aPosit.indexOf('`', 0);
	
			if (p != -1){
				aPosit = aPosit.substring(p+1, aPosit.length);
				for (i=0; i < 116 ; i++){
					p2 = aPosit.indexOf(",", p1);
					if(p2==-1){
						break;
					}
					usrDat[i] = aPosit.substring(p1, p2);
					p1=p2 +1;
					}
				usrDat[i] = aPosit.substring(p1, aPosit.length);
			}
		}
		
	return usrDat;
}
//
function prevmReg(){
	var usrDat = laListita();
	var dkt = 0;
	
	if (usrDat != "*"){
		for (i=0; i < 13 ; i++){	
			document.forms[0].elements[i].value= usrDat[i];//
		}
		//--del 13 al 18 campos menu
		for (i=13; i < 18 ; i++){
			document.forms[0].elements[i].selectedIndex=usrDat[i];
		}
		dkt=parseInt(usrDat[18]);
		if (dkt>15){
			dkt += 1;
		}
		
		document.forms[0].elements[18].selectedIndex= dkt;
		//--del 19 al 112 campos check
		for (i=19; i < 26; i++){
			document.forms[0].elements[i].checked = parseInt(usrDat[i]);
		}
		
		for (i=26; i < usrDat.length ; i++){
			document.forms[0].elements[i + 1].checked = parseInt(usrDat[i]);
		}
	}	
}
//---------------------
function leeAposit() {
  var cname = aPositNom + "=";
  var i = 0;
  while (i < document.cookie.length) {
    var j = i + cname.length;
    if (document.cookie.substring(i, j) == cname){
		var leng = document.cookie.indexOf (";", j);
		if (leng == -1) leng = document.cookie.length;
		return unescape(document.cookie.substring(j, leng));
    }
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return "*";
}

//-----------------------
function mwok(){
	var slx="o";
	var usrDat = laListita();
	//alert("Debug2"+usrDat);
	if (usrDat[0] == "MWRGOK"){
	//if (usrDat.length == 4){
		//con reg anterior
		if(usrDat[1]==1){
			slx="a";
		}
		
		//window.status = ("Bienvenid" + slx + " a MEDWAVE " + usrDat[3] + " " + usrDat[4]);
		window.status = "Bienvenido a MEDWAVE";
	}
	else{
		window.status = ("Necesita registrarse para navegar en MEDWAVE");
		window.location = "../FRMRGMW.HTML";
	}
}

//----------------------
function chupaMono(x) { //v2.0
	//var nivDir = "";
	imgFiles = new Array("TRANS", "BT01C", "BT02C", "BT03C", "BT04C", "BT05C", "BT06C", "BT07C", "BT08C", "BT09C","PI101C", "PI102C", "PI103C", "PI104C", "PI105C", "PI106C", "PI107C");
 	if (x == 1){nivDir = "../";}
	
	if (document.images) {
		if (document.bdgMonos==null){document.bdgMonos = new Array();}
		var i = document.bdgMonos.length;
		with (document) for (j=0; j<imgFiles.length; j++) if (imgFiles[j].charAt(0)!="#"){
      		bdgMonos[i] = new Image;
			bdgMonos[i++].src = nivDir + imgFiles[j] + ".GIF";
  		}
  	}
}
//---------------------------
function chiCharrones() { 
	var i,j=0,objStr,obj,nwlstMonos=new Array,xlstMonos=document.lstMonos;
	for (i=0; i < (chiCharrones.arguments.length-2); i+=3) {
    	objStr = chiCharrones.arguments[(navigator.appName == 'Netscape')?i:i+1];
		if ((objStr.indexOf('document.layers[')==0 && document.layers==null) || (objStr.indexOf('document.all[')==0 && document.all==null)){objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);}
    	obj = eval(objStr);
    	if (obj != null) {
      		nwlstMonos[j++] = obj;
      		nwlstMonos[j++] = (xlstMonos==null || xlstMonos[j-1]!=obj)?obj.src:xlstMonos[j];
      		obj.src = nivDir + chiCharrones.arguments[i+2];      		
  		}
  	}
	document.lstMonos = nwlstMonos; 
}
//--------------------------
function werken(msgStr) { 
  window.status=msgStr;
  document.RetornoValor = true;
}
//----------------------------
function vuelePag(){
	history.go(-1);
}

function OpenWin(url,name,param)
{
	window.open('',name,param);
	document.form.target = name;
	document.form.submit();
}

function VerEncuesta(url,name,param)
{
	window.open(url,name,param);
}

function OpenPopUp(url,name,param)
{
	window.open(url,name,param);
	return true;
}