// JavaScript Document

//Funcion para abrir chat fonacot
function OpenCCs(http,callcenters,hhlang,referer,pwd,rows,cc,un,dni,custid,email) {
     browserVer = parseInt(navigator.appVersion);
     if(browserVer>2 )
	if (callcenters=='1') {	
		hWnd=window.open(http+'userlogin.php?custid='+custid+'&langkey='+hhlang+'&email='+email+'&dni='+dni+'&referer='+referer+'&pwd='+pwd+'&rows='+rows+'&un='+un+'&cc=&EN','','hotkeys=no,screenX=0,screenY=0,left=0,top=0,width=260,height=380,scrollbars=yes');
     } else {
		window.open(http+'fm_userlogin.php?cust_id='+custid+'&langkey='+hhlang+'&email='+email+'&dni='+dni+'&referer='+referer+'&pwd='+pwd+'&rows='+rows+'&un='+un+'&cc='+cc+'&EN','','hotkeys=no,screenX=0,screenY=0,left=0,top=0,width=260,height=380,scrollbars=yes');
     }
}

// Funcion para imprimir pagina
var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HEAD>\n<BODY>\n<BR>\n<BR>\n<div style=\"padding-right:10px; padding-left:15px;\">';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n<HR>\n<CENTER>\n<font face=\"Verdana\" size=\"2\">\nInstituto Fonacot 2008\n</font>\n<BR>\n<BR>\n<font face=\"Verdana\" size=\"1\">Esta informaci&oacute;n se obtuvo del sitio http://www.fonacot.gob.mx\n</font>\n<BR>\n<BR>\n</div>\n</CENTER>\n</BODY>\n</HTML>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("Esta funcion solo esta disponible en el navegador web");
}
}

// Funcion para enviar nota
function enviar_nota(){
	window.open("http://www.fonacot.gob.mx/scripts/envia_nota/default.asp", "Fonacot", "width=460,height=350,toolbar=0,resizable=0")
}

// Funcion para agregar a favoritos
function agregaFavorito(){
title=document.title;
url=location.href;

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
}
//Encuesta SIP

var ventanaEncuesta = null;

function abrirEncuesta(){

if(ventanaEncuesta == null || ventanaEncuesta.closed){

ventanaEncuesta=window.open("http://www.sip.gob.mx/encuesta/index.php?id=16","Encuesta","width=510,height=695,menubar=no,toolbar=no,resizable=no,scrollbars=yes,status=yes");

//Verifica que el Id es el correspondiente a tu dependencia.

}else{

ventanaEncuesta.focus();

}

}


//Plecas Credito Fonacot
	function cambiaOpcion(mnu){
		switch(mnu){
			case "opc1":
				document.getElementById('CF_MnuOpc1').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuTrabajadorOver.gif)";
				document.getElementById('CF_ImgTrabajador').style.visibility='visible';
				document.getElementById('CF_SubTrabajador').style.visibility='visible';
				
				document.getElementById('CF_MnuOpc2').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuEmpresa.gif)";
				document.getElementById('CF_ImgEmpresa').style.visibility='hidden';
				document.getElementById('CF_SubEmpresa').style.visibility='hidden';
				
				document.getElementById('CF_MnuOpc3').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuDistribuidor.gif)";
				document.getElementById('CF_ImgDistribuidor').style.visibility='hidden';
				document.getElementById('CF_SubDistribuidor').style.visibility='hidden';
				break;
			case "opc2":
				document.getElementById('CF_MnuOpc1').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuTrabajador.gif)";
				document.getElementById('CF_ImgTrabajador').style.visibility='hidden';
				document.getElementById('CF_SubTrabajador').style.visibility='hidden';
				
				document.getElementById('CF_MnuOpc2').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuEmpresaOver.gif)";
				document.getElementById('CF_ImgEmpresa').style.visibility='visible';
				document.getElementById('CF_SubEmpresa').style.visibility='visible';
				
				document.getElementById('CF_MnuOpc3').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuDistribuidor.gif)";
				document.getElementById('CF_ImgDistribuidor').style.visibility='hidden';
				document.getElementById('CF_SubDistribuidor').style.visibility='hidden';
				break;
			case "opc3":
				document.getElementById('CF_MnuOpc1').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuTrabajador.gif)";
				document.getElementById('CF_ImgTrabajador').style.visibility='hidden';
				document.getElementById('CF_SubTrabajador').style.visibility='hidden';
				
				document.getElementById('CF_MnuOpc2').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuEmpresa.gif)";
				document.getElementById('CF_ImgEmpresa').style.visibility='hidden';
				document.getElementById('CF_SubEmpresa').style.visibility='hidden';
				
				document.getElementById('CF_MnuOpc3').style.backgroundImage="url(http://www.fonacot.gob.mx/PublishingImages/Principal/CF_MnuDistribuidorOver.gif)";
				document.getElementById('CF_ImgDistribuidor').style.visibility='visible';
				document.getElementById('CF_SubDistribuidor').style.visibility='visible';
				break;
			}
		}

	function Cliente(){
			location.href="/creditofonacot/trabajador/";
			}
		
	function Empresa(){
			location.href="/creditofonacot/centrodetrabajo/";
			}
		
	function Distribuidor(){
			location.href="/creditofonacot/estabcomercial/";
			}
		
function validaBusqueda(){
	var valorBusca;
	var frm=document.forms[0];
	valorBusca=document.getElementById("vbuscar").value;
	if(valorBusca==""){
		alert("Ingrese el texto a buscar");
		return false;
		}
		else
		{
		location.href="/Search/results.aspx?k="+valorBusca+"";
		}
}
//Enviar formulario al presionar enter
function iSubmitEnter(event){
	if (event !=null)
	{
     	var charCode;
		var bKeyModifiers;
		if (browseris.ie)
		{
			charCode=event.keyCode;
			bKeyModifiers=event.altKey || event.ctrlKey;
		}
		else
		{
			charCode=event.which;
			bKeyModifiers=event.modifers &
						   (event.ALT_MASK | event.CONTROL_MASK);
		}
		if ((charCode==13) && !bKeyModifiers){
			event.returnValue=false;
			event.cancel=true;
			validaBusqueda();
		}
			return true;
	}
	return false;
}

//mostrar popup tradicional
function PopupFonacot( )
{
	//ventana=window.open("http://www.fonacot.gob.mx/Paginas/popupFonacot.aspx", "pop1", "directories=no, menubar =no,status=no,toolbar=no,location=no,scrollbars=no,fullscreen=no,height=400,width=350,left=200,top=200");
	ventana=window.showModalDialog("http://www.fonacot.gob.mx/Paginas/popupFonacot.aspx", "pop1", "dialogWidth:350px; dialogHeight:400px; center:yes");
}

