// *************************************************************
// Codigo javascript
// Escrito por: E-Pulse S.C.
// Todo el código aqui presente es propriedad de E-Pulse S.C
// *************************************************************

function overTD(td,color){td.style.cursor='default';td.bgColor=color;}
function outTD(td,color){td.style.cursor='default';td.bgColor=color;}
function clickTD(td){td.children.tags('A')[0].click();}

// Comprobacion de formulario config principal
function CheckFormContacto(obj)
{

	if (obj.tNombre.value == "")
    {
		alert("El campo `Nombre` es obligatorio");
		obj.tNombre.focus();
        return false;
    }

	if (obj.tEmail.value == "")
    {
		alert("El campo `E-Mail` es obligatorio");
		obj.tEmail.focus();
        return false;
    }

	if (obj.tTexto.value == "")
    {
		alert("El campo `Texto` es obligatorio");
		obj.tTexto.focus();
        return false;
    }

    return true;

}

function ShowGoogleMap()
{
    document.getElementById('sEmp').style.display='none';
    document.getElementById('sMap').style.display='';
}

function ShowEmpresa()
{
    document.getElementById('sEmp').style.display='';
    document.getElementById('sMap').style.display='none';
}

function confirmLink(theText)
{
    return confirm(theText);
}

function ChangeImage(img_name, img_src)
{
    document.images[img_name].src='imagenes/loadimage.gif';
	document.images[img_name].src=img_src;
}


function Preload()
 {

  if (document.images)
   {

     var link_inicio=new Image(91,49);
     link_inicio.src="imagenes/btn-inicio-on.gif";
     link_inicio_over=new Image(91,49);
     link_inicio_over.src="imagenes/btn-inicio-off.gif";

     var link_empresa=new Image(91,49);
     link_empresa.src="imagenes/btn-empresa-on.gif";
     link_empresa_over=new Image(91,49);
     link_empresa_over.src="imagenes/btn-empresa-off.gif";

     var link_productos=new Image(91,49);
     link_productos.src="imagenes/btn-productos-on.gif";
     link_productos_over=new Image(91,49);
     link_productos_over.src="imagenes/btn-productos-off.gif";

     var link_asociados=new Image(91,49);
     link_asociados.src="imagenes/btn-asociados-on.gif";
     link_asociados_over=new Image(91,49);
     link_asociados_over.src="imagenes/btn-asociados-off.gif";

     var link_trabajos=new Image(91,49);
     link_trabajos.src="imagenes/btn-trabajos-on.gif";
     link_trabajos_over=new Image(91,49);
     link_trabajos_over.src="imagenes/btn-trabajos-off.gif";

     var link_contactar=new Image(91,49);
     link_contactar.src="imagenes/btn-contactar-on.gif";
     link_contactar_over=new Image(91,49);
     link_contactar_over.src="imagenes/btn-contactar-off.gif";

   }

 }

function imgopen(img_link)
{

	// Centramos la ventana en la pantalla
	var wleft = (screen.width - 700) / 2;
	var wtop = (screen.height - 490) / 2;

	popup = window.open ('', 'Imagen',
	'toolbar=0,location=0,directories=0,status=0,menubar=0,' +
	'left='+wleft+',top='+wtop+','+
	'scrollbars=0,resizable=0,width=700,height=490'
	);

	popup.document.write('<html>');
	popup.document.write('<head>');
	popup.document.write('<title>Ferrocar S.L.</title>');
	popup.document.write('<link rel=\"stylesheet\" href=\"../style/main.css\" type=\"text/css\">');
	popup.document.write('</head>');
	popup.document.write('<body>');
	popup.document.write('<div align=\"center\">');

	popup.document.write('<img src=\"' + img_link +'\"><p>');

	popup.document.write('<a href=\"javascript:window.close();\">cerrar ventana</a>');

	popup.document.write('</div></body></html>');
	popup.focus()

}

 function ShowLopd()
 {
 	if (document.getElementById('tdLopd').style.display == '')
    {
    	document.getElementById('tdLopd').style.display='none';
    }
    else
    {
     	document.getElementById('tdLopd').style.display='';
    }
 }

 function ShowHid(num)
 {
 	// Ocultamos todas las TD
 	document.getElementById('tdHid1').style.display = 'none';
    document.getElementById('tdHid2').style.display = 'none';

    if (num > 0)
    {
    	//Mostramos la que corresponde
 		document.getElementById('tdHid'+num).style.display = '';
    }
 }

 function doOnFocus(obj, strText)
 {
 	// Ocultamos todas las TD
	if (FrmBuscar.tBuscar.value == strText) { FrmBuscar.tBuscar.value = ""; }
 }

 function doOnLostFocus(obj, strText)
 {
 	// Ocultamos todas las TD
	if (FrmBuscar.tBuscar.value == "") { FrmBuscar.tBuscar.value = 'Buscar aqui'; }
 }
