//****************************** Funciones de andar **********************************
// NOTA:                                                                              
//       Solo funciones exclusivas de la página web de andar.                                                      
//************************************************************************************

function Novedades(n,h) 
{
    if (h == 0)
		var wWnd = window.open('/redsocial/andar/html/novedades/index.htm?n=' + n,'Novedades','width=620, height=520, status=no');
    else
		var wWnd = window.open('/redsocial/andar/html/novedades/index_h.htm','Novedades','width=620, height=520');

    wWnd.moveTo(10,10);
}


function accidentes() 
{
	var wWnd = window.open('prevencion/acc_domesticos.htm','Accidentes','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
}

function enfermedades() 
{
	var wWnd = window.open('prevencion/enf_estivales.htm','Enfermedades','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
}

function controles_salud() 
{
	var wWnd = window.open('prevencion/controles_salud.htm','Salud','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
} 

function lactancia() 
{
	var wWnd = window.open('prevencion/lactancia.htm','Lactancia','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
}

function invierno() 
{
	var wWnd = window.open('prevencion/invierno.htm','Invierno','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
}

function odontologia() 
{
	var wWnd = window.open('prevencion/odontologia.htm','Odontologia','width=600, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(10,10);
}


function masinfo() 
{
	var wWnd = window.open('pop_emergencias.htm','MasInfo','width=377, height=550, status=no, scrollbars=yes');
	wWnd.moveTo(150,30);
}

function operativa(puntero) 
{
	var wWnd = window.open('mod_operativa.htm#' + puntero ,'Operativa','width=377, height=350, status=no, scrollbars=yes');
	wWnd.moveTo(250,100);
}

function campana(nro) 
{
	var wWnd = window.open('../html/campanas/2005/camp' + nro + '.htm' ,'Campana','width=505, height=610, status=no, scrollbars=yes');
	wWnd.moveTo(200,40);
}

function campana2004(nro) 
{
	var wWnd = window.open('../html/campanas/2004/camp' + nro + '.htm' ,'Campana','width=505, height=585, status=no, scrollbars=yes');
	wWnd.moveTo(200,40);
}

function premio() 
{
	var wWnd = window.open('premio.htm','Premio','width=616, height=400, scrollbars=yes, resizable=no, location=no, status=no');
	wWnd.moveTo(200,40);
}

function concurso(dibujo,imagen) 
{
img = new Image();
img.src = '../../imagenes/novedades/concurso_tabaco/' + imagen + '.jpg';
w = img.width + eval(10); //Ancho;
h = img.height + eval(28); //Alto;

/*	alert(img.src);
	alert(w);
	alert(h);  */

	var wWnd = window.open('../novedades/concurso_tabaco/' + dibujo + '.htm' ,'Concurso','toolbar=no,scrollbars=no');
	wWnd.moveTo(200,40);
	wWnd.resizeTo(w, h);
}



function contactenos() {
 javascript:openIT('/pls/portal/redsocial.RPT_FORM_ANDAR_CONTACTENOS.show?p_arg_names=pPantalla&p_arg_values=1','Andar - Contáctenos',615,355);
}

function contacto_empresa(){
    javascript:openIT('/pls/portal/REDSOCIAL.RPT_FORM_UPDATE_EMPRESA.show','Contacto - Empresa',668,300);
}


function popup_obs(texto) { //v1.0
  if (texto == '') {
  texto = 'El solicitante no ha dejado observaciones';
  }
  var new_window = window.open('','Observaciones','resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,directories=no,width=550,height=300');
  new_window.document.write('<html><head><title>Contactos Web - andar</title></head><body>');
  new_window.document.write('<table width="100%"><tr><td valign="center" height="100%"><table width="100%" border="1" cellspacing="0" bordercolor="#D2D2D2"><tr><td><font size="2" face="Arial" color="red"><b>Observaciones:<br></td></tr>');
  new_window.document.write('<tr bgcolor="#F0F0F0"><td><font color="#000068" face="Arial" size="2">' + texto + '</font></b></font></td></tr></table></td></tr></table>');
  new_window.document.write('<p align="center"><font face="Arial" color="#000068" size="2"><a href="javascript:this.close()">Haga click aquí para cerrar esta ventana</a></font></p>');
  new_window.document.write('</BODY></HTML>');
}

function ampliar(foto) {
  var i_x = 110;
  var i_y = 110;
  var i_x2 = i_x  * 2;
  var i_y2 = i_y * 2;
  var w_x = 262;
  var w_y = 440;
  var imgurl = foto;
  var code = '<html><head><title>Fotograf&iacute;as</title></head><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table width=265 border=0 cellspacing=0 cellpadding=0><tr><td width="265"><table width="100%" border=0 cellspacing=0 cellpadding=0><div align="center"><img src="/images/fotografias_andar.jpg" width=240 height=38 alt="" border="0"></div></table></td></tr><tr bgcolor="#ededed"> <td><table width="261" height="406" border=0 cellspacing=10 background="/redsocial/andar/imagenes/fondo_foto.JPG"><tr><td width="239" height="386" valign="bottom"><div align="center"><div id="Layer1" style="position:absolute; width:200px; height:115px; z-index:1; left: 22px; top: 123px;"><IMG SRC=' + imgurl + ' WIDTH=' + i_x2 + ' HEIGHT=' + i_y2 + '></div></div>       <p><font size=1 face=verdana,sans-serif><div align="center"><a href="javascript:self.close();"><font size="1" face="tahoma" color=#ffffff>Cerrar Ventana</font></a></div><br></font></td></tr></table></td></tr></table></body></html>';
//  var code = '<HTML><HEAD><TITLE>Fotograf&iacute;as</TITLE></HEAD><BODY BGCOLOR=#FFFFFF MARGINWIDTH=0 MARGINHEIGHT=0 LEFTMARGIN=0 TOPMARGIN=0><TABLE WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=0><TR><TD><TABLE width="100%" BORDER=0 CELLSPACING=0 CELLPADDING=0><img src="/images/fotografias_andar.jpg" width=240 height=38 alt="" border="0"></TABLE></TD></TR><TR bgcolor="#ededed"><TD><TABLE CELLSPACING=10 BORDER=0><TR><TD><IMG SRC=' + imgurl + ' WIDTH=' + i_x2 + ' HEIGHT=' + i_y2 + '><BR><P><FONT SIZE=1 FACE=verdana,sans-serif><div align="center"><a href="javascript:self.close();"><font size="1" face="tahoma" COLOR=#000000>Cerrar Ventana</font></a></div><BR></FONT></TD></TR></TABLE></TD></TR></TABLE></BODY></HTML>';
  msgWindow = window.open("", "", "width=" + w_x +",height=" + w_y + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes");
  msgWindow.document.writeln(code);
}


		
function actualizaLcld()
{
	combo = document.Formulario.pProvincia
	prvnCodigo = combo.options[combo.selectedIndex].value
	var wWnd = window.open('REDSOCIAL.RPT_RRLL_LOCALIDADES.show?p_arg_names=prvnCodigo&p_arg_values=' + prvnCodigo,'Localidades','width=420, height=480, status=no,scrollbars=yes' );
	wWnd.moveTo(10,10);
}	

function cargarLcld(xLcldDesc, xLcldCod)
{
	window.opener.document.Formulario.pLcldDesc.value = xLcldDesc;
	window.opener.document.Formulario.pLcldCodigo.value = xLcldCod;
	window.close()
}	

function curriculum()
{
//	alert('Deshabilitado Momentaneamente');
	window.open('http://www.redsocialfuva.org.ar/pls/portal/REDSOCIAL.RPT_RRLL_MODIFICA_CURRICULUM.show','Curriculum','width=800, height=600, toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes' );
}



//***********************************************************************************
//   NO USAR ESTAS FUNCIONES                                                         
// ----------------------------------------------------------------------------------
// Estas funciones fueron movidas al archivo "funciones.js"                              
// No borrar, puede que las mismas esten siendo utilizadas por algunas aplicaciones. 
//***********************************************************************************

 function charsLeft(oObj) {
   var iLen = oObj.value.length;
   if (iLen >= 500) 
   {
   		 oObj.value = oObj.value.substring(0,499);
		 sStr = '(m&aacute;ximo 500 caracteres)';
   } else {
		 sStr = '(m&aacute;ximo 500 caracteres. Restan ' + eval(499 - iLen) + ')&nbsp;&nbsp;';
   }
   document.all.spnChars.innerHTML = sStr;
}

function isIE_5_6() { //v1.0
  if (document.getElementById) {
    return true;
  } else {
    return false;
  }
}

function getElementById_v4(sID, oDoc) { //v1.0
  // Alternativa a "document.getElementById()" que asegura compatibilidad con IE4.0+
  var iDL = oDoc.all.length;
  for (n = 0; n < iDL; n++) {
    if (oDoc.all[n].id == sID) {
      var oObj = oDoc.all[n];
      break;
    } else {
      var oObj = null;
    }
  }
  return oObj;
}

function ChgImg(name_obj, sSrc) { //v2.0
  if (isIE_5_6()) {
    var oImg = document.getElementById(name_obj);
  } else {
    var oImg = getElementById_v4(name_obj, document);
  }
  oImg.src = sSrc;
}

function GetElementInParent(id) { //v1.0
  if (isIE_5_6()) {
    return parent.document.getElementById(id);
  } else {
    return getElementById_v4(id, parent.document);
  }
}

function GetElementInIFrame(ElementID, iIFrame) { //v1.0
  var oIFrame = document.frames[iIFrame];
  if (isIE_5_6()) {
    var oImg = oIFrame.document.getElementById(ElementID);
  } else {
    var oImg = getElementById_v4(ElementID, oIFrame.document);
  }
  return oImg;
}

function InArray(aArray, sString) //v1.0
{ 
	for (n = 0; n < aArray.length	; n++) 
	{
    	var sElem = new String(aArray[n]);
    	var iMatch = sElem.indexOf(sString);
//		status = status + sElem;
    	if (iMatch != -1) 
		{
      		return n;
    	}
  	}
    return iMatch;
}

function MsgEsperar() { //v1.0
  var oDiv = document.getElementById('divProcesando');
  var oBody = document.getElementById('bCuerpo');
  oDiv.innerHTML = '<table width="100%" border="5" bordercolor="#FFFFFF" cellspacing="0" cellpadding="0">'                                                           +
                   '<tr><td>'   																							  			                             +
                   '<table width="100%" border="0" cellspacing="0" cellpadding="5">'                                                                                 +
                   '<tr align="center">'   																										                     +
                   '<td><font size="4"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF">Espere por favor...</font></font></td>'	                 +
                   '</tr><tr align="center">' 																									 	                 +
                   '<td><img src="/redsocial/andar/imagenes/icons/progreso.gif" width="143" height="20" style="filter: FlipH"></td>'	 +
                   '</tr></table></td></tr></table>';
  oDiv.style.visibility = 'visible';

}

function SetDiv() { //v1.0
  return '<div id="divProcesando" style="position:absolute; width:316px; height:56px; z-index:1; left: 20px; top: 20px; background-color: #000000; layer-background-color: #333333; visibility: hidden;"></div>';
}

function highlightButton(sClassName) { //v1.0
  if (event.srcElement.tagName == 'INPUT') {
    event.srcElement.className = sClassName;
  }
}

function ChgBgColor(src, sColor) { //v1.0
  src.bgColor = sColor;
  src.style.cursor = "default";
}

function SetStatus(sInst, oObj) { //v1.0
  if (sInst == 'andar') {
    window.status='Andar - Obra Social de los Viajantes Vendedores de la República Argentina';
    oObj.onMouseOut = window.status='';
    return true;
  }
}

function hide_it() {
  Id = "loadmessage";
  if (document.all) {
    document.all[Id].style.visibility = "hidden";
  } else if (document.layers) {
    document.layers[Id].visibility = "hide";
  } else if (document.getElementById) {
    document.getElementById(Id).style.visibility = "hidden";
  }
}

function popup(popup_url,name,width,height) {
  size = 'width=' + width + ',height=' + height;
  newwindow=window.open(popup_url,name,'resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=auto,directories=no,'+size);
}

function popup1(popup_url,name,width,height) {
  size = 'width=' + width + ',height=' + height;
  newwindow=window.open(popup_url,name,'resizable=no,menubar=no,location=no,toolbar=no,status=no,scrollbars=yes,directories=no,'+size);
}

function popup_plus(popup_url,name,width,height,s) {
  var size = 'width=' + width + ',height=' + height;
  var Wnd = window.open(popup_url,name,'resizable=no,menubar=no,location=no,toolbar=no,status=no,directories=no,scrollbars=' + s + ',' + size);
}

function JSEscribirFecha() { //v1.0
  var dia = new Array('Domingo','Lunes','Martes','Miércoles','Jueves','Viernes','Sabado');
  var meses = new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');
  var data = new Date();
  var index2 = data.getDay();
  var index = data.getMonth();
  var an = data.getYear();
  if (an<1000) {
    an = 1900 + an;
  }
  document.write('<font color="#DAE5EF">Impreso el ' + dia[index2] + ', ' + data.getDate() + ' de ' + meses[index] + ' de ' + an + '</font>');
}

function EscribirFecha_Ext(sColor, letras) { //v1.0
  dia = new Array ("Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sabado");
  meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
  data = new Date();
  index2 = data.getDay();
  index = data.getMonth();
  var nDia = data.getDate();
  var an=data.getYear();
  if (an<1000) {
    an = 1900+an;
  }
  if (letras == 0) {
    document.write('<font color="#' + sColor + '">' + nDia + '/' + index + '/' + data.getYear() + '</font>');
  } else if (letras == 1) {
    document.write('<font color="#' + sColor + '">' + dia[index2] + ', ' + data.getDate() + ' de ' + meses[index] + ' de ' + an + '</font>');
  }
}

//***********************************************************************************
//   NO USAR ESTAS FUNCIONES                                                         
// ----------------------------------------------------------------------------------
// Estas funciones fueron reemplazadas por otras mejores que hacen lo mismo.         
// No borrar, puede que esten siendo utilizadas por algunas aplicaciones.            
//***********************************************************************************

function RollOver(imgname, imgsrc) { //Reemplazada por ChgImg(name_obj, src);
  img = MM_findObj(imgname);
  img.src = imgsrc;
}

function sobre(src, color_entrada) { //Reemplazada por ChgBgColor()
  src.bgColor = color_entrada;src.style.cursor = "default";}

function fuera(src, color_default) { //Reemplazada por ChgBgColor()
  src.bgColor = color_default;src.style.cursor = "default";}

var msgWindow = null;
function test() {  //Reemplazada por MsgEsperar();
  var x, y;
  // The best we can do is center in screen.
  x = (screen.width - 300) / 2;
  y = (screen.height - 50) / 2;

  msgWindow = window.open("","GTCR","scrollbar=no,menubar=no,width=300,height=50,screenX="+x+",screenY="+y);
  msgWindow.document.write("<HEAD><TITLE>Andar</TITLE></HEAD>")
  msgWindow.document.write("<CENTER><BIG><img src=/images/progreso1.gif width=143 height=20></BIG></CENTER>")
  msgWindow.document.write("<CENTER><BIG>Procesando...</BIG></CENTER>")
  msgWindow.focus();
  msgWindow.moveTo(250, 200);
  document.forms[0].submit ();
  return true;
}

function WCargando() { //Reemplazada por MsgEsperar() y SetDiv()
  var x, y;
  x = (screen.width - 300) / 2;
  y = (screen.height - 50) / 2;

  wCargando = window.open("","GTCR","scrollbar=no,menubar=no,width=300,height=50,screenX="+x+",screenY="+y);
  wCargando.document.write("<HEAD><TITLE>Busqueda Cartilla</TITLE></HEAD>")
  wCargando.document.write("<CENTER><BIG><img src=/images/progreso1.gif width=143 height=20></BIG></CENTER>")
  wCargando.document.write("<CENTER><BIG>Procesando Consulta...</BIG></CENTER>")
  wCargando.focus();
  wCargando.moveTo(250, 200);
}

function WCargandoClose() {  //Reemplazada por MsgEsperar() y SetDiv()
var wCargando = null;
  if (wCargando) {
    wCargando.close();
  }
}

function closeDep() {  //Reemplazada por MsgEsperar() y SetDiv()
  if (msgWindow) {
    msgWindow.close();
  }
}

function do_event(form,objectName,instance,eventType,userArgs) { //Reemplazada por MsgEsperar() y SetDiv()
  test();
}

function esIFrame(sPath) { 
//v1.0  Comentada totalmente porque solo es compatible con IE6+
/*
  var oParentWnd = document.parentWindow;
 alert(oParentWnd);
  if (oParentWnd.frameElement == null) {
    var sURL = new String(sPath);
    var sFile = sURL.substring(sURL.lastIndexOf('/') + 1, sURL.length);
    window.navigate('/redsocial/andar/html/andar.htm?n='+ sFile);
  }
*/
}
