﻿/*
Archivo:		     idxfrm_1.js
Fecha de creación:   24/Dic/2007
Desarrollado por:    Ing. Eduardo Briceño A., Cell. (867) 103-44-60
*/

var xmlHttp_Logout;

function close_session()
{   
    try
    {  
        /*Init Void*/   
        logout( false );    
        parent.idxfrm_1.document.getElementById("sts_session").innerHTML = "";        
        //Side Left:
        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");
        //Side Right:
        parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2221.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");        
        /*Redim Frames*/
        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,*";           
        /*idxfrm_221*/
        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(30000);                    
    }
    catch(err)
    {
        //alert("<close_session> -Error: " + err.description);
        parent.idxfrm_2.document.location = 'idxfrm_2.aspx';
    }      
}   

var tmr_new_session;

function new_session()
{   
    //Side Right:
    parent.idxfrm_2.idxfrm_22.idxfrm_221.location.replace("idxfrm_221.aspx");
    parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2221.location.replace("idxfrm_2221.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");    
    //Side Left:     
    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");
    /*Redim Frames*/    
    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();', 2500);
}

function set_idxfrm_221()
{
    parent.idxfrm_2.idxfrm_22.idxfrm_222.idxfrm_2222.idxfrm_22221.idxfrm_222211.Move_Selected('Init', 'Init', '23.300641', '-100.802764', '', '', 'i');
    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")
		{  
		    //alert('Logout :: 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(); // Firefox, Opera 8.0+, Safari
	}
	catch (e)
	{	 
	  try // Internet Explorer
      {
	    xmlHttp=new ActiveXObject("Msxml2.xmlHttp");
	  }
	  catch (e)
      {
	    xmlHttp=new ActiveXObject("Microsoft.xmlHttp");
      }
	}
	return xmlHttp;
}