GXportal = {
	Variables:{
		iframehide:"no",
		browser:new GXPChkBrw()
	}
}		
	
var version4 = (navigator.appVersion.charAt(0) == "4"); 
var popupHandle;

function GXPClosePopup() {
if(popupHandle != null && !popupHandle.closed) popupHandle.close();
}

function GXPOpenPopup(position,url,wName,wWidth,wHeight,wOptions) {
evnt = (version4 ? event : null);

// position=1 POPUP: makes screen display up and/or left, down and/or right 
// depending on where cursor falls and size of window to open
// position=2 CENTER: makes screen fall in center

var leftprop, topprop, screenX, screenY, cursorX, cursorY, padAmt;
if(navigator.appName == "Microsoft Internet Explorer") {
//screenY = document.body.offsetHeight;
screenY = window.screen.availHeight;
screenX = window.screen.availWidth;
}
else {
screenY = window.outerHeight
screenX = window.outerWidth
}
if(wWidth == 0) {
 wWidth = screenX;
}
if(wHeight == 0) {
 wHeight = screenY;
}
var properties = "toolbar = 0, location = 0, scrollbars = 1 ,height = " + wHeight;
properties = properties + ", width=" + wWidth;
if(position == 1)	{ // if POPUP not CENTER
cursorX = evnt.screenX;
cursorY = evnt.screenY;
padAmtX = 10;
padAmtY = 10;
if((cursorY + wHeight + padAmtY) > screenY) {
// make sizes a negative number to move left/up
padAmtY = (-30) + (wHeight * -1);
// if up or to left, make 30 as padding amount
}
if((cursorX + wWidth + padAmtX) > screenX)	{
padAmtX = (-30) + (wWidth * -1);	
// if up or to left, make 30 as padding amount
}
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = cursorX + padAmtX;
topprop = cursorY + padAmtY;
}
else {
leftprop = (cursorX - pageXOffset + padAmtX);
topprop = (cursorY - pageYOffset + padAmtY);
   }
}
else{
leftvar = (screenX - wWidth) / 2;
rightvar = (screenY - wHeight) / 2;
if(navigator.appName == "Microsoft Internet Explorer") {
leftprop = leftvar;
topprop = rightvar;
}
else {
leftprop = (leftvar - pageXOffset);
topprop = (rightvar - pageYOffset);
   }
}
if(evnt != null) {
properties = properties + ", left = " + leftprop;
properties = properties + ", top = " + topprop;
}
if(position != 3) { 
GXPClosePopup();
}
if(wOptions != null) {
properties = properties + ", " + wOptions;
}
popupHandle = open(url,wName,properties);
}

function GXPConfOpenPopup(MsgConf,wURL,wName,wWidth,wHeight,wOptions){
	if (confirm(MsgConf)) {GXPOpenPopup(2,wURL,wName,wWidth,wHeight,wOptions)}
}

//Compare two URLs and return true if the same server
function GXPSameServer(url1,url2){
var i=0;var j=0;var prt_url1;var srv_url1;var prt_url2;var srv_url2;
i=url1.indexOf('://');prt_url1=url1.substr(0,i);i+=3;
j=url1.indexOf('/',i);srv_url1=url1.substr(i,j-i);
i=url2.indexOf('://');prt_url2=url2.substr(0,i);i+=3;
if(prt_url1==prt_url2){
  j=url2.indexOf('/',i);
  srv_url2=url2.substr(i,j-i);
  if(srv_url1==srv_url2){return true}
}else{
  if(prt_url2==''){return true}
}
return false;
}

//Change color of the row when Mouse Over
function ClrMouseOvr(src,clrOver) {
	src.style.backgroundColor = clrOver;
}

function ClrMouseOut(src,clrIn) {
	src.style.backgroundColor = clrIn;
}

//Change image of the row when Mouse Over
function ImgMouseOvr(src,clrOver) {
	src.style.backgroundImage = 'url('+clrOver+')';
}

function ImgMouseOut(src,clrIn) {
	src.style.backgroundImage = 'url('+clrIn+')';
}

//Change image of the option when Mouse Over
function PutImage(nameimg,imagen){
	document.images[nameimg].src = imagen;
}

//Display application in IFRAME selected
function GXPAppIntDsp(Container,url,wintitle){
	GXPSetWinTitle(wintitle);document.getElementById(Container).src = url;
}

function GXPShowTable(){
if (GXportal.Variables.browser.ie){
	return "inline";}
else{
	return "table-row";}
}
function GXPShowCollapse(){
if (GXportal.Variables.browser.ie){
	return "inline";}
else{
	return "inline-table";}
}

//Get Application Operation Services
function GXPAppIntGetOpe(CntNro,OpeKey,SrvId){
	//alert('1 Refrezcar Container:'+CntNro+'  OpeKey:'+OpeKey+'  Servicio:'+SrvId);
	var CntNroInt = CntNro/1; 
	if (CntNro.lenght == 1 || CntNroInt < 10) CntNro = '0'+ CntNroInt;
	GXPAppIntSetOpeSrvSel(CntNro,SrvId);
	if (OpeKey!=""){
		var lastsfsectorTDNode;
		var parNode = document.getElementById("GXPAppIntCnt"+CntNro+"IF");
		var found = false;
		do{
			if (parNode){
				parNode = parNode.parentNode;
				if (parNode){
					if (parNode.nodeName == 'TD') lastsfsectorTDNode = parNode;
					if (parNode.nodeName == 'TABLE'){
						if (parNode.id.indexOf('SFSECTOR') != -1) found = true;
					}
				}
			}
		}
		while (parNode && !found)
		//alert('2 Refrezcar Container:'+CntNro+'  OpeKey:'+OpeKey+'  Servicio:'+SrvId);
		if (lastsfsectorTDNode){
			if (OpeKey == "none"){
				lastsfsectorTDNode.style.display = "none";
			}
			else if (OpeKey == "refresh"){
				lastsfsectorTDNode.style.display = "inline";
				URL = document.getElementById("GXPAppIntCnt"+CntNro+"IF").src;
				GXPAppIntDsp("GXPAppIntCnt"+CntNro+"IF",URL);
			}
			else{
				lastsfsectorTDNode.style.display = "inline";
				URL = document.getElementById("GXPAppIntCntURL"+CntNro).value+','+OpeKey+','+SrvId;
				GXPAppIntDsp("GXPAppIntCnt"+CntNro+"IF",URL);
			}
		}
	}
}

//Set Application Operation Service Selected 
function GXPAppIntSetOpeSrvSel(CntNro,SrvId){
	var CntNroInt = CntNro/1; 
	if (CntNro.lenght == 1 || CntNroInt < 10) CntNro = '0'+ CntNroInt;
	GXPAppIntCntOpeSrv = parent.document.getElementById("GXPAppIntCntOpeSrv"+CntNro);
	if (GXPAppIntCntOpeSrv) GXPAppIntCntOpeSrv.value = SrvId;
}
	

//Get Application Operation Service Selected 
function GXPAppIntGetOpeSrvSel(CntNro){
	var CntNroInt = CntNro/1; 
	if (CntNro.lenght == 1 || CntNroInt < 10) CntNro = '0'+ CntNroInt; var SrvId = 0;
	GXPAppIntCntOpeSrv = parent.document.getElementById("GXPAppIntCntOpeSrv"+CntNro);
	if (GXPAppIntCntOpeSrv) SrvId = GXPAppIntCntOpeSrv.value;
	return SrvId;
}

//Refresh IFRAME and Windows title
function GXPRedirToIF(url,wintitle){
	GXPSetWinTitle(wintitle);
	document.getElementById('gxpiframe').src = url;
}

//Redir from iFRAME
function GXPRedirFromIF(url){
	parent.location.href = url;
}

//Redir from iFRAME
function GXPRedirTo(url,wintitle){
	if (wintitle!='') parent.document.title = wintitle;
	location.href = url;
}

//Change Windows title
function GXPSetWinTitle(wintitle){
	if (wintitle) document.title = wintitle;
}

//Open NewWindow
function GXPOpenWin(wURL,wName,wOptions)
{wOptions1='scrollbars=1,location=1,menubar=1,toolbar=1,directories=1,status=1,resizable=1,'+wOptions;window.open(wURL,wName,wOptions1);}

//Auto-Resize iFrame
function GXPResizeiFrame(frameid){
    var currentfr=document.getElementById(frameid)
	try{
	    if (currentfr){
	        currentfr.style.display="block"
			if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight){ //ns6 syntax
			    currentfr.height = 5;
			    currentfr.height = currentfr.contentDocument.body.scrollHeight;
			    currentfr.height = currentfr.contentDocument.body.scrollHeight+1;
			} else{
				if (currentfr.Document && currentfr.Document.body.scrollHeight){ //ie5+ syntax
					currentfr.height = currentfr.Document.body.scrollHeight;				
				}
			}
			if (currentfr.addEventListener){
		  		currentfr.addEventListener("load", GXPReadjustiFrame, false); 				
			} else{
				if (currentfr.attachEvent){
		    		currentfr.detachEvent("onload", GXPReadjustiFrame) // Bug fix line
		    		currentfr.attachEvent("onload", GXPReadjustiFrame)
				}
			}
		}
	} 
	catch(error){
		if (currentfr)
			currentfr.style.height = "100%";
	}
	if ((document.all || document.getElementById) && GXportal.Variables.iframehide=="no"){
	    var tempobj=document.all? document.all[frameid] : document.getElementById(frameid)
		if (tempobj) tempobj.style.display="block"
	}

	var url_cur=document.location.href;
	var pos=url_cur.indexOf('hgxpp004');
	if(pos>1){
		var iFrameName = document.getElementById("GXPAppIntCntName");
		if (iFrameName)
			parent.GXPResizeiFrame(iFrameName.value);
	}
}


function GXPReadjustiFrame(loadevt) {
	var crossevt=(window.event)? event : loadevt
	var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
	if (iframeroot)
	     GXPResizeiFrame(iframeroot.id);
}

function GXPAutoResizeiFrame(Idif){
	var my_iframe=document.getElementById(Idif);

	if (window.addEventListener){
	    my_iframe.addEventListener("load", function(){GXPResizeiFrame(Idif)}, false);
	    window.addEventListener("resize", function(){GXPResizeiFrame(Idif)}, false);
	}
	else {
	    if (window.attachEvent){
	        my_iframe.attachEvent("onload", function(){GXPResizeiFrame(Idif)})
	        window.attachEvent("onresize", function(){GXPResizeiFrame(Idif)})
	    }
		else{
		    my_iframe.onload=function(){GXPResizeiFrame(Idif)}
		    window.onresize=function(){GXPResizeiFrame(Idif)}
		}
	}
}


//Redir de Menú de combos
function GXPMnuCombo(selObj){
link=selObj.options[selObj.selectedIndex].value;
//Open PopUp?
if (link.substr(0,1)!='Y'){
 link = link.substr(1,500);
 if (link.substr(0,11)=='javascript:'){
  link=link.substr(11,500);eval(link);
 }else{
  if(link!='*'){
   eval("location='"+link+"'");}}
}else{link=link.substr(1,500);GXPOpenWin(link,'','');}
}

//To collapse sectors
function gxptablestatus(tableName, flag, image, imgExpand, imgCollapse)
{table = document.getElementById(tableName);
 if( table.style.display == "none"){table.style.display = GXPShowCollapse();image.src = imgCollapse;flag.value = "0";}
 else {	table.style.display = "none";image.src = imgExpand;flag.value = "1";}}

//To Hide and show Tables
function gxptableHS(tableName)
{table = document.getElementById(tableName);
if (table){
	if( table.style.display == "none"){table.style.display = GXPShowTable();}
	else {	table.style.display = "none";}
}
}

//To change Anchor and TD class
function GXPChgClassOve(src,AnchId,ClassName) 
{if (src) 
  {src.style.cursor = 'pointer';
   if (ClassName!=''){AnchId.className='A'+ClassName;src.className='TD'+ClassName;}
}}

function GXPChgClassOut(src,AnchId,ClassName) 
{if (src) 
  {src.style.cursor = 'default';
   if (ClassName!=''){AnchId.className='A'+ClassName;src.className='TD'+ClassName;}
}}

//Add class Over to Anchor and TD
function GXPAddClsOve(src,anchId,subMenu) 
{if (src){
	src.style.cursor = 'pointer';
	if (anchId)
		var sectorId = anchId.id.substring(1, 13);
	else
		var sectorId = src.id.substring(2, 14);
	var className = 'S' + sectorId
	if (subMenu == 1){ className += 'SM'; }
	className += 'Ove';	
	if (className!=''){
		if (anchId) $(anchId).addClassName("A" + className);
		$(src).addClassName("TD" + className);
	}
}
}

//Remove class Over in Anchor and TD
function GXPRemClsOve(src,anchId,subMenu) {
if (src){
	src.style.cursor = 'default';
	if (anchId)
		var sectorId = anchId.id.substring(1, 13);
	else
		var sectorId = src.id.substring(2, 14);
	var className = 'S' + sectorId
	if (subMenu == 1){ className += 'SM'; }
	className += 'Ove';
	if (className!=''){
		if (anchId) $(anchId).removeClassName("A" + className);
		$(src).removeClassName("TD" + className);
	}
}
}
			
function GXPMnuOptClk(clickId, btnMode, mnuStyle, subMnuWhenDisplay){
	var sectorId = clickId.substring(0, 12);
	var subMenuLevel = clickId.substring(12, 13);
	var subMnuChild = parseInt(subMenuLevel) + 1;
	//Actualizo clase de los Anchor
	if (subMenuLevel==1){
		//Analizo primer nivel del menu
		$$("table#TMNU" + sectorId + " .AS" + sectorId + "Sel").each(function(element){
			element.removeClassName("AS" + sectorId + "Sel").addClassName("AS" + sectorId);
		});
		$("A" + clickId).removeClassName("AS" + sectorId).addClassName("AS" + sectorId + "Sel");
	}
	else{
		//Analizo los submenus del sector
		$$("table#TS" + sectorId + " .TSM" + subMenuLevel ).each(function(element){
				$$("table#" + element.id + " .AS" + sectorId + "SMSel" ).each(function(element2){
					element2.removeClassName("AS" + sectorId + "SMSel").addClassName("AS" + sectorId + "SM");
				});
			});		
		$("A" + clickId).removeClassName("AS" + sectorId + "SM").addClassName("AS" + sectorId + "SMSel");
	}
	
	//Actualizo clase de las celdas de la tabla
	if (btnMode == 1){
		if (subMenuLevel==1){
			//Analizo primer nivel del menu
			if (mnuStyle=='T'){
				//Menu Tabs no cambio el fondo 
			}
			else{
				$$("table#TMNU" + sectorId + " .TDS" + sectorId + "Sel").each(function(element){
					element.removeClassName("TDS" + sectorId + "Sel").addClassName("TDS" + sectorId);
				});
				$("TD" + clickId).removeClassName("TDS" + sectorId).addClassName("TDS" + sectorId + "Sel");
			}
		}
		else{
			//Analizo los submenus en el sector
			$$("table#TS" + sectorId + " .TSM" + subMenuLevel ).each(function(element){
				$$("table#" + element.id + " .TDS" + sectorId + "SMSel" ).each(function(element2){
					element2.removeClassName("TDS" + sectorId + "SMSel").addClassName("TDS" + sectorId + "SM");
				});
			});
			$("TD" + clickId).removeClassName("TDS" + sectorId + "SM").addClassName("TDS" + sectorId + "SMSel");
		}
	}
	
	if (subMnuWhenDisplay == "O"){
			$$("table#TS" + sectorId + " table.TSM" + subMnuChild ).each(function(element){
				element.setStyle({
					display: ("TSM" + clickId == element.id) ? ((element.getStyle("display") == GXPShowTable())? "none" : GXPShowTable()) : "none"
				});
			});
	}
	else{
		gxptableHS("TSM" + clickId);
	}
}
 
//Close Windows
function GXPClose() {
	window.close();
}

//
function GXPCloseAndRefresh() {
window.close();
if (window.opener) {parentdoc = window.opener.document;} 
else {parentdoc = window.dialogArguments.document;}
parentdoc.forms[0].submit();
}

//
function GXPCloseAndReload(){
window.close();
if (window.opener) {parentdoc = window.opener.location.reload(true);} 
else {parentdoc = window.dialogArguments.document;}
parentdoc.location.reload(true);}

//
function GXPCloseAndRedir(vURL) {
if (opener != null) {self.close();window.opener.document.location.replace(vURL);}}

//To display Flash
function GXPShowSWF(fileSWF,widthSWF,heightSWF){
var quality="high";
var linehtml="";
if (fileSWF){
  linehtml ='<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"'
  if (!widthSWF){widthSWF=100};if (!heightSWF){heightSWF=100};
  linehtml+='WIDTH="'+widthSWF+'" HEIGHT="'+heightSWF+'" >\n'
  document.write(linehtml);
  linehtml ='<PARAM NAME=movie VALUE="'+fileSWF+'" />\n'
  document.write(linehtml);
  linehtml ='<PARAM NAME=quality VALUE='+quality+'>\n'
  document.write(linehtml);
  linehtml ='<PARAM NAME=wmode VALUE="transparent" /\n>'
  document.write(linehtml);
  linehtml ='<EMBED SRC="'+fileSWF+'" QUALITY="'+quality+'" WMODE="transparent" WIDTH="'+widthSWF+'" HEIGHT="'+heightSWF+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>'
  document.write(linehtml);
  linehtml ='</OBJECT>\n'
  document.write(linehtml);
}}

//
function InitScrollbar(SectorId, SizeDragBar, ScrollSchema, EnableHScroll, EnableVScroll, ShowTrack, ShowSector){
var wndo = new dw_scrollObj('WN' + SectorId, 'LYR' + SectorId, 'TS' + SectorId);
wndo.bSizeDragBar = SizeDragBar;
if (ScrollSchema != 'Y' & ShowTrack == 'Y'){
if (EnableVScroll == 'Y'){wndo.setUpScrollbar('DBV' + SectorId, 'TRV' + SectorId, 'v', 1, 1);}
if (EnableHScroll == 'Y'){wndo.setUpScrollbar('DBH' + SectorId, 'TRH' + SectorId, 'h', 1, 1);}}
if (ShowSector == 'N'){document.getElementById('SCR' + SectorId).style.display = 'none';}}

//
function GXPChgSecSize(sectorId, sectorHeight, sectorWidth)
{sectorTable = document.getElementById(sectorId);
if (sectorHeight != '' || sectorWidth != ''){
if (sectorTable){
var parNode = sectorTable;var found = false;var sfsectorNode;var sfsectorverNode;var lastsfsectorverTDNode;var lastsfsectorTDNode;
do{if (parNode){
parNode = parNode.parentNode;
if (parNode){
if (parNode.nodeName == 'TD' && !sfsectorNode){lastsfsectorTDNode = parNode;}
if (parNode.nodeName == 'TD' && !sfsectorverNode){lastsfsectorverTDNode = parNode;}
if (parNode.nodeName == 'TABLE'){
if (parNode.id.indexOf('SFSECTORVER') != -1){found = true;sfsectorverNode = parNode;}
else{
if (parNode.nodeName == 'TABLE' && parNode.id.indexOf('SFSECTOR') != -1){sfsectorNode = parNode;}}}}}}
while (parNode && !found)
if (sfsectorNode && sfsectorverNode && lastsfsectorverTDNode && lastsfsectorTDNode){
if (sectorHeight != ''){sfsectorNode.style.height = '100%';sfsectorverNode.style.height = '100%';lastsfsectorverTDNode.style.height = sectorHeight;}
if (sectorWidth != ''){lastsfsectorTDNode.style.width = sectorWidth;}}}}}

//Change cursor image on MouseOver/MouseOut
function GXPSwapCursor(object){
 if ((object.style.cursor=="default") || (object.style.cursor=="")) {
  if (GXportal.Variables.browser.ie){object.style.cursor="hand";}else{object.style.cursor="pointer";}
 }else{object.style.cursor="default";}
}

//Check Browser
function GXPChkBrw(){
	var brwsr = {ie: !(navigator.userAgent.indexOf("MSIE")==-1), ns: (navigator.userAgent.indexOf("MSIE")==-1)};
	return brwsr;
}

//
function GXPDynCode(codeTxt, codeType)
{
	this.code = codeTxt;
	this.type = codeType;
	return this;
}

//
function GXPProcessDynCode(aDynCode, aDynCodeCounter){
	i = 0;
	while (i < aDynCodeCounter)
	{
		if ((aDynCode[i] != null) & (aDynCode[i].code != null))
		{
			if (aDynCode[i].type != null)
			{
				if (aDynCode[i].type == "JS"){
					eval(aDynCode[i].code);
				}
				else {
					if (aDynCode[i].type == "HTML") {
						document.write(aDynCode[i].code);
					}
				}
			}
		}
		i += 1;
	}
}

//
function GXPChangeLng(LngId, CallerId, InFrame)
{
	if (InFrame == 1)
		docLocation = parent.location;
	else
		docLocation = document.location;
	
	qMarkPos = docLocation.href.indexOf("?");
	if (qMarkPos > -1)
		locHref = docLocation.href.substring(0, qMarkPos);
	else
		locHref = docLocation.href + ((CallerId == 1) ? "" : "?");
		
	GXPParms = docLocation.search.split(",");
	queryString = "";
	if (CallerId == 1 || (CallerId == 3 && docLocation.href.indexOf("/hgxpp001") == -1))
	{
		if (CallerId == 1)
		{
			sitePos = 3;
			pgmName = "hgxpt001";
		}
		else
		{
			sitePos = 2;
			pgmName = "hgxpt002";
		}
		locHref = locHref.replace(pgmName, "hgxpp003");
		hgxpt00xPos = docLocation.href.lastIndexOf("/") + 1;
		hgxpt00x = docLocation.href.substr(hgxpt00xPos, docLocation.href.length - hgxpt00xPos + 1);
		queryString = "?" + ((GXPParms[sitePos]) ? GXPParms[sitePos] : "") + ",P," + LngId + "," + escape(hgxpt00x);
	}
	else
	{		
		for (i = 0; (i < 8); i++)
		{
			if (i == 4)
				queryString += LngId;
			else
			{
				if (i == 6 && InFrame == 1)
				{
					queryString += "0";
				}
				else
				{
					if (GXPParms[i])
						queryString += GXPParms[i];
				}
				
			}
			if (i < 7)
				queryString += ",";
		}
	}
	docLocation.href = locHref + queryString;
}

function getElementId(el)
{
	if (el)
	{
		if (el.id && el.id != "")
			return el.id;
		else
		{
			if (el.name)
				return el.name;
		}
	}
	else
		return "";
}

/***************************************22/03/2010********************
/*agregado por esteban*/
/////////////////////////////////////////////////////////////////////
function handleHttpResponse() {
////////////////////////////////////////////////////////////////////
				//alert(http.readyState);
				//alert(http.status);
				//alert(http.responseText.indexOf('invalid'));
				//alert(global_campo);
				var campo=global_campo;

				if (http.readyState == 4) {//termino de cargar la pagina
				   
				   if (http.status == 200) {//cargo con exito
					  
					  if (http.responseText.indexOf('invalid') == -1) {
 						//alert(http.responseText);
						//alert(campo);
						document.getElementById(campo).innerHTML = http.responseText;
						enProceso = false;
					  }
					  
				   }
				   else{
						document.getElementById(campo).innerHTML = "<b>No se encontraron datos</b>";
						document.getElementById(campo).innerHTML = http.responseText;
						enProceso = false;
				   }
				}
				else if(http.readyState==1){
					//document.getElementById(campo).innerHTML = "<b>Procesando...<IMG src='http://www.ffyb.uba.ar/gxpfiles/ws001/design/style000001/loading.gif' border=0></b>";
					document.getElementById(campo).innerHTML = "<IMG SRC='/t.gif' WIDTH='20' HEIGHT='16' BORDER=0 ALT=''>";
				}
}
	


	///////////////////////////////////////////////////////////			
	function getHTTPObject() {
	//////////////////////////////////////////////////////////
	/*
	crea el objeto para usar con ajax
	*/
					var xmlhttp;
					/*@cc_on
					@if (@_jscript_version >= 5)
					   try {
						  xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
					   } catch (e) {
						  try {
							 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
						  } catch (E) { xmlhttp = false; }
					   }
					@else
					xmlhttp = false;
					@end @*/
					if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
					   try {
						  xmlhttp = new XMLHttpRequest();
					   } catch (e) { xmlhttp = false; }
					}
					return xmlhttp;
	}

function enviar_email(usuario) {
document.all("email").value="";
document.all("email").focus();
global_campo="correo"
if (!enProceso && http) {
  var url = "/graduados/escuela/cursos/correo.asp?usuario=" + usuario ;
   //alert(url);
   http.open("GET", url, true);
   http.onreadystatechange = handleHttpResponse;
   enProceso = true;
   http.send(null);	
}
enProceso=false;
}

function agregar(id_curso,id_alumno,titulo) {
global_campo="curso_actual"
if (!enProceso && http) {
  var url = "/graduados/escuela/cursos/agregar.asp?id_curso=" + id_curso + '&id_alumno=' + id_alumno + '&titulo=' + titulo;
   //alert(url);
   http.open("GET", url, true);
   http.onreadystatechange = handleHttpResponse;
   enProceso = true;
   http.send(null);	
}
enProceso=false;
}

function ver_deptos() {
global_campo="deptos";
document.getElementById("cursos1").innerHTML="";
document.getElementById("descripcion").innerHTML="";
if (!enProceso && http) {
//var url = "http://157.92.144.10/graduados/escuela/cursos/deptos.asp";
var url = "/graduados/escuela/cursos/deptos.asp";
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_deptos_posgrado(url,contenedor) {
//alert(url);
global_campo=contenedor;
if (!enProceso && http) {
var url = url;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_cursos_posgrado(url,contenedor,valor) {
//global_campo="cursos1";
global_campo=contenedor;
//document.getElementById("cursos1").innerHTML="";
document.getElementById("descripcion").innerHTML="";
this.http = new getHTTPObject();
if (!enProceso && http) {
//var url = "/graduados/escuela/cursos/buscar_cursos.asp?depto=" + valor;
var url=url
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_cursos(valor) {
global_campo="cursos1";
//document.getElementById("cursos1").innerHTML="";
document.getElementById("descripcion").innerHTML="";
this.http = new getHTTPObject();
if (!enProceso && http) {
var url = "/graduados/escuela/cursos/buscar_cursos.asp?depto=" + valor;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_deptos1(contenedor,contenedor2,tabla) {
global_campo=contenedor;
//alert(contenedor);
if (!enProceso && http) {
var url = "/globales/deptos.asp?tabla="+tabla+"&contenedor2="+contenedor2;
//alert(url);
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_materias(valor,contenedor) {
//alert(contenedor2);
global_campo=contenedor;
if (!enProceso && http) {
var url = "/globales/buscar_cursos.asp?depto="+valor+"&contenedor="+contenedor;
alert(url);
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_des(pagina) {
//alert(pagina);
pagina='/posgrado_gxp/'+pagina
global_campo="descripcion";

if (!enProceso && http) {
var url = pagina;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_pagina(pagina,div) {
//alert(pagina);
pagina=pagina;
global_campo=div;

if (!enProceso && http) {
var url = pagina;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function inscri(pagina,id,titulo) {
//alert(pagina);
global_campo="descripcion";
if (!enProceso && http) {
var url = "/graduados/escuela/cursos/login.asp?pagina=" + pagina +"&id=" + id + "&titulo="+ titulo;
http.open("GET", url, true);
http.onreadystatechange = handleHttpResponse;
enProceso = true;
http.send(null);
}
enProceso=false;
}

function ver_local(usuario,pwd) {
//texto=campo.value;
//alert(usuario);
global_campo="login"
//alert(usuario);
if (!enProceso && http) {
  var url = "/graduados/escuela/cursos/buscar_usuario.asp?usuario=" + usuario + '&pwd=' + pwd;
   //alert(url);
   http.open("GET", url, true);
   http.onreadystatechange = handleHttpResponse;
   enProceso = true;
   http.send(null);	
}
enProceso=false;
}

function logout() {
//texto=campo.value;
//alert(usuario);
document.getElementById("descripcion").innerHTML="";
document.getElementById("curso_actual").innerHTML="";
global_campo="login";
if (!enProceso && http) {
  var url = "/graduados/escuela/cursos/logout.asp";
   //alert(url);
   http.open("GET", url, true);
   http.onreadystatechange = handleHttpResponse;
   enProceso = true;
   http.send(null);	
}
enProceso=false;
}

function popup(pagina){
	ventana=window.open(pagina,"Configurarion","menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=500,height=250v,z-index=100px")
	ventana.focus();
	//ventana.close()
//day = new Date();
//id = day.getTime();
//eval("page" + id + " = window.open(pagina, '" + id + "','menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width=470,height=250v,z-index=100px');");

}

function popup2(pagina,ancho,alto){
	//alert(pagina);
	ventana=window.open(pagina,"Configurarion","menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,resizable=no,width="+ancho+",height="+alto)
	ventana.focus();
}

/**************************************************
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 * Script featured on Dynamic Drive (http://www.dynamicdrive.com) 12.08.2005
 **************************************************
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 **************************************************/

var Drag = {

	obj : null,

	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},

	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},

	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},

	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},

	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
}

function traer_resultado(url,contenedor) {
	var brw=new GXPChkBrw();
	var paso="";
	//url es la pagina que hace el proceso *.asp
	//contenedor es el div oculto que recibe la respuesta
	//alert(url);
	//alert(contenedor);

	global_campo=contenedor;
	this.http = new getHTTPObject();
	if (!enProceso && http) {
		var url = url;
		/*el get responde diferente*/
		if (brw.ie){
			paso=false;
		}else if(brw.moz){
			paso=true;
		}
		paso=true;
		http.open("GET", url, paso);
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
	}
	enProceso=false;
}

function traer_resultado2(url,contenedor) {
	var brw=new GXPChkBrw();
	var paso="";
	//document.getElementById("cursos1").innerHTML="";
	//document.getElementById("descripcion").innerHTML="";
	//url es la pagina que hace el proceso *.asp
	//contenedor es el div oculto que recibe la respuesta
	//alert(url);
	//alert(contenedor);

	global_campo=contenedor;
	
	this.http = new getHTTPObject();
	if (!enProceso && http) {
		var url = url;
		/*el get responde diferente*/
		if (brw.ie){
			paso=false;
		}else if(brw.moz){
			paso=true;
		}
		http.open("GET", url, paso);
		
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
	}
	enProceso=false;
		
}

function traer_resultado3(url,contenedor) {
//alert(url);
//alert(contenedor);

global_campo=contenedor;
	this.http = new getHTTPObject();
	if (!enProceso && http) {
		var url = url;
		paso=true;

		http.open("GET", url, paso);
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
	}
	
	enProceso=false;
	
}


function guardar_definitiva(url,contenedor) {
	//url es la pagina que hace el proceso *.asp
	//contenedor es el div oculto que recibe la respuesta
	//alert(url);
	//alert(contenedor);
	global_campo=contenedor;
	//alert(url);
	document.getElementById("descripcion").innerHTML="";
	this.http = new getHTTPObject();
	if (!enProceso && http) {
		var url = url;
		http.open("GET", url, true);
		//http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		//http.setRequestHeader("Content-Length: 800");
		http.onreadystatechange = handleHttpResponse;
		enProceso = true;
		http.send(null);
	}
	enProceso=false;
}


/*agregado por esteban*/
var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
var global_campo="";
//alert(enProceso);
/*fin*/
