﻿var xmlHttp_Logout;
var gWindow;
var gCaller = {Name: "idxfrm_1", acccountUser: "", acccountPassword: ""};

function close_session() {
	try {
		logout(false);
		parent.idxfrm_1.document.getElementById("sts_session").innerHTML = "";
		parent.idxfrm_2.idxfrm_21.idxfrm_211.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2121.idxfrm_21211.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2121.idxfrm_21212.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21221.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21222.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222211.Del_All_Map();
		parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222211.document.getElementById("loader").style.display = "none";
		parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222212.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22222.idxfrm_222221.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22222.idxfrm_222222.location.replace("idxfrm_void.htm");
		parent.idxfrm_2.idxfrm_22.idxfrm_222.document.getElementById("idxfrm_222").cols = "0px,*";
		parent.idxfrm_2.idxfrm_22.document.getElementById("idxfrm_22").rows = "*,0px";
		parent.idxfrm_2.document.getElementById("idxfrm_2").cols = "0px,*";
		parent.idxfrm_2.idxfrm_22.idxfrm_221.stopSound();
		parent.idxfrm_2.idxfrm_22.idxfrm_221.document.getElementById("info_selected").innerHTML = "";
		parent.idxfrm_2.idxfrm_22.idxfrm_221.document.getElementById("alerts").innerHTML = "";
		parent.idxfrm_2.idxfrm_22.idxfrm_221.document.getElementById("info_panel").style.display = "none";
		parent.idxfrm_2.idxfrm_22.idxfrm_221.document.getElementById("logout_options").style.display = "block";
		parent.idxfrm_2.idxfrm_22.idxfrm_221.tmr_choice_optapp(60000)
	}
	catch(err) {
		parent.idxfrm_2.document.location = 'idxfrm_2.aspx'
	}
}

var tmr_new_session;
function new_session() {
	parent.idxfrm_2.idxfrm_21.idxfrm_211.location.replace("idxfrm_211.aspx");
	parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2121.idxfrm_21211.location.replace("idxfrm_21211.aspx");
	parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2121.idxfrm_21212.location.replace("idxfrm_21212.aspx");
	parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21221.location.replace("idxfrm_21221.aspx");
	parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21222.location.replace("idxfrm_21222.aspx");
	parent.idxfrm_2.idxfrm_22.idxfrm_221.location.replace("idxfrm_221.aspx");
	parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222212.location.replace("idxfrm_222212.aspx");
	parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22222.idxfrm_222221.location.replace("idxfrm_222221.aspx");
	parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22222.idxfrm_222222.location.replace("idxfrm_222222.aspx");
	parent.idxfrm_2.document.getElementById("idxfrm_2").cols = "228px,*";
	parent.idxfrm_2.idxfrm_22.document.getElementById("idxfrm_22").rows = "22px,*";
	parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222211.document.getElementById("mapa").style.display = "block";
	tmr_new_session = setTimeout('set_idxfrm_221();', 3000)
}

function set_idxfrm_221() {
	parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222211.CenterOneTime = 0;
	if (parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21221.SetDvComplete == undefined) setTimeout("parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21221.SetDvComplete();", 3500);
	else parent.idxfrm_2.idxfrm_21.idxfrm_212.idxfrm_2122.idxfrm_21221.SetDvComplete()
}

function logout(pajax) {
	xmlHttp_Logout = GetXmlHttpObjLogout();
	if (xmlHttp_Logout == null) {
		alert("Su explorador no soporta AJAX!!");
		return
	}
	if (pajax) xmlHttp_Logout.onreadystatechange = stsChangedLogout;
	xmlHttp_Logout.open("GET", "idxfrm_1_get_logout.aspx", true);
	xmlHttp_Logout.send(null)
}

function stsChangedLogout() {
	if (xmlHttp_Logout.readyState == 4) {
		var xmlDoc = xmlHttp_Logout.responseXML.documentElement;
		if (xmlDoc.getElementsByTagName("Status_Connection")[0].childNodes[0].nodeValue == "Ok") {} else {
			if (xmlDoc.getElementsByTagName("Status_Connection")[0].childNodes[0].nodeValue != "Error_0") {
				alert('Logout :: Codigo de Error [' + xmlDoc.getElementsByTagName("Status_Connection")[0].childNodes[0].nodeValue + ']')
			}
		}
		alert('salio');
		document.getElementById("sts_session").innerHTML = "";
		parent.idxfrm_2.location.replace("idxfrm_reset.htm")
	}
}

function GetXmlHttpObjLogout() {
	var xmlHttp = null;
	try {
		xmlHttp = new XMLHttpRequest()
	} catch(e) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.xmlHttp")
		} catch(e) {
			xmlHttp = new ActiveXObject("Microsoft.xmlHttp")
		}
	}
	return xmlHttp
}

function changePassword(){
	var lParameters = "directories=no,location=no,resizable=no,status=no,scrollbars=no,toolbar=no,width=260,height=250";
	
	gCaller.Name = "idxfrm_1";	
	gWindow = window.open("changePassword.htm", "changePWD", lParameters);
	gWindow.moveTo(screen.availWidth/2, screen.availHeight/2);
}//
