/* 
	IGZ JS Lib Website v0.83 [6.3.2009]
	© 2009 Intelygenz

  [VER] --> _igz/ig42_04_01_igz_web_js.txt
	
*/


g_maMiniIcos = new MArray(['Seccion','Nombre','Enlace']
	,[
	// ['googlemaps','Google Maps','http://maps.google.es/maps?f=q&source=s_q&hl=es&geocode=&q=intelygenz&sll=40.396764,-3.713379&sspn=8.514282,13.688965&ie=UTF8&ll=40.444432,-3.7028&spn=0.008949,0.013647&z=16&iwloc=A']
	 ['googlemaps','Google Maps','http://maps.google.es/maps?f=q&source=s_q&hl=es&geocode=&q=intelygenz&sll=40.396764,-3.713379&sspn=8.514282,13.688965&ie=UTF8&ll=40.444432,-3.7028&spn=0.008949,0.013647&z=16&iwloc=A']
	,['linkenid','Linken ID','http://www.linkedin.com/']
	]
)

function DrawWindowTitle(sSection) {
	var sTitle = "Intelygenz :: " + sSection;
	return sTitle;
}

function PrintColumnaIZ(sCual){ document.write(DrawColumnaIZ(sCual)) }
function DrawColumnaIZ(sCual){
		var sHtml = "";

		for (var f=0; f<g_maAreasFuncionales.f_length(); f++){

			var sSeccion	= g_maAreasFuncionales.f_getVal("NsElementTitle@Module_Element", f);
			var sNombre		= g_maAreasFuncionales.f_getVal("NsElementBody@Module_Element", f);
			var sEnlace		= oGesta.f_drawSEOLink(g_maAreasFuncionales.f_getVal("NsElementSEOChild@Module_Element", f));		
			var sClass		= "";
			
			if( sCual == sSeccion ) {
				sClass = " class='miotON' ";
			}
				
			sHtml +="<DIV class='menuIZOpcion' title='"+sNombre+"'>"
						+ 	"<DIV class='clearB'><A href='"+sEnlace+"' title='"+sNombre+"'>"
						+			"<IMG src='"+oIGZ.m_sRootPath+"pix/magic.gif'"
						+ 		"class='sprites menuIZOpc_"+sSeccion+"' border='0' alt='"+sNombre+"' /></A>"
						+		"</DIV>"
						+ 	"<DIV class='menuIZOpcTxt'><A href='"+sEnlace+"' "+sClass+" title='"+sNombre+"'>"+sNombre+"</A></DIV>"
						+ "</DIV>"
						;
		}

		return sHtml;
}

function PrintBusqueda(){ document.write(DrawBusqueda()) }
function DrawBusqueda() {
		var sHtml =	" <FORM name='FBusquedaGlobal' method='GET' action='"+oIGZ.m_sRootPath+"busqueda.aspx'>"
							+ "<DIV class='menuIZBusqueda' title='Búsqueda'>"
							+ 	"<DIV class='menuIZContent'>"
		
							+ 		g_maGeneral.f_getValIf("NsElementCd@Module_Element", "busqueda", "NsElementTitle@Module_Element") + "<BR />"
							+ 		"<INPUT type='text' name='A_Busqueda' maxlength='50' />"
		
							+ 	"</DIV>"
							+ 	"<DIV class='menuDCBusqueda' onClick='Busqueda()'><IMG src='"+oIGZ.m_sRootPath+"pix/magic.gif' border='0' /></DIV>"
							+ "</DIV>"
							+ "</FORM>"
							;

		return sHtml;
}

function Busqueda() {
	var oForm = document.forms["FBusquedaGlobal"];
	if (oForm["A_Busqueda"].value != "") {
		oForm.submit();
	}
	else {
		alert(g_maGeneral.f_getValIf("NsElementCd@Module_Element", "busqueda", "NsElementBody@Module_Element"));
	}
}


function PrintLogo(){ document.write(DrawLogo()) }
function DrawLogo() {
	var sHtml	=	"<DIV id='logotipo'>"
						+ 	"<A href='"+oIGZ.m_sRootPath+"'><IMG src='"+oIGZ.m_sRootPath+"pix/magic.gif' class='sprites logoIGZ' border='0' alt='IntelyGenZ' /></A>"
						+ 	"<BR />"+ g_maGeneral.f_getValIf("NsElementCd@Module_Element", "cabecera-pagina", "NsElementTitle@Module_Element")
						+ "</DIV>"
						;
	return sHtml;
}


function PrintColumnaDC(sCual){ document.write(DrawColumnaDC(sCual)) }
function DrawColumnaDC(sCual){
	var sHtml = "";

	var sSeccion, sNombre, sEnlace, sClass;

	for (var f=0; f<g_maServicios.f_length(); f++){
		sSeccion  = g_maServicios.f_getVal("NsElementTitle@Module_Element", f);
		sNombre  = g_maServicios.f_getVal("NsElementBody@Module_Element", f);
		sEnlace  = oGesta.f_drawSEOLink(g_maServicios.f_getVal("NsElementSEOChild@Module_Element", f));
		sClass   = "";

		if ( sCual == sSeccion ) {
			sClass = " class='mdotON' ";
		}

		sHtml +="<DIV class='menuDCOpcion' title='"+sNombre+"'>"
					+ 	"<DIV class='flotarL'><A href='"+sEnlace+"' title='"+sNombre+"'><IMG "
					+ 		"	src='"+oIGZ.m_sRootPath+"pix/magic.gif' class='sprites menuDCOpc_"+ sSeccion +"' border='0' alt='"+ sNombre +"' /></A>"
					+		"</DIV>"
					+ 	"<DIV class='menuDCOpcTxt'><A href='"+sEnlace+"' "+sClass+" title='"+sNombre+"'>"+sNombre+"</A></DIV>"
					+ "</DIV>"
					;
	}
	
	return sHtml;
}

function PrintTecnologiasDC(){ document.write(DrawTecnologiasDC()) }
function DrawTecnologiasDC(){
	var sHtml	="<DIV class='menuDCTecnologias'>"
	
	for (i=0; i<g_maTecnoIconos.f_length(); i++) {
		sHtml += DrawIcoTech( g_maTecnoIconos.f_getVal("NsElementTarget@Module_Element", i) );
	}
	
	sHtml += "</DIV>";
						
	return sHtml;
}

function PrintPieIconos(){ document.write(DrawPieIconos()) }
function DrawPieIconos(){
	var sHtml = "<CENTER>"
						+ "<DIV class='pieContenedor'>"
						;

		for (var f=0; f<g_maSiteIconos.f_length(); f++){
			var sSeccion = g_maSiteIconos.f_getVal("NsElementBody@Module_Element", f);
			var sNombre  = g_maSiteIconos.f_getVal("NsElementTitle@Module_Element", f);
			var sEnlace  = g_maSiteIconos.f_getVal("NsElementLink@Module_Element", f);
			var sTarget  = g_maSiteIconos.f_getVal("NsElementTarget@Module_Element", f);

			var sOpcion  = f+1;
			
			if (sTarget !="") {
				sTarget = " target='_blank' ";
			}

			sHtml +="<DIV class='pieOpcion' title='"+sSeccion+"'>"
						+ 	"<DIV class='clearB'><A href='"+sEnlace+"' "+sTarget+" title='"+sSeccion+"'><IMG src='pix/magic.gif'"
						+ 		" class='sprites sitesGfx"+sOpcion+"' border='0' alt='"+sSeccion+"' /></A>"
						+		"</DIV>"
						+ 	"<DIV class='sitesTxt'><A href='"+sEnlace+"' "+sTarget+" title='"+sSeccion+"'>"+sNombre+"</A></DIV>"
						+ "</DIV>"
						;
		}
			
		sHtml +="</DIV>"
					+ "</CENTER>"
					;

	return sHtml;
}


function PrintPieCopyright(){ document.write(DrawPieCopyright()) }
function DrawPieCopyright(){
	
	var sHtml = "<DIV class='pieEnlaces'>";

	var sNombre, sEnlace;
	for (var f=0; f<g_maAreasFuncionales.f_length(); f++){
		sNombre  = g_maAreasFuncionales.f_getVal("NsElementBody@Module_Element", f);
		sEnlace  = oGesta.f_drawSEOLink(g_maAreasFuncionales.f_getVal("NsElementSEOChild@Module_Element", f));
		sHtml += "<A href='"+sEnlace+"' title='"+sNombre+"'>"+sNombre+"</A>";
		if( f != (g_maAreasFuncionales.f_length()-1) ) {
			sHtml +=" - ";
		}
	}

	sHtml += "<BR />";

	for (var f=0; f<g_maServicios.f_length(); f++) {
		sNombre  = g_maServicios.f_getVal("NsElementBody@Module_Element", f);
		sEnlace  = oGesta.f_drawSEOLink(g_maServicios.f_getVal("NsElementSEOChild@Module_Element", f));
		
		sHtml += "<A href='"+sEnlace+"' title='"+sNombre+"'>"+sNombre+"</A>";
		if( f != (g_maServicios.f_length()-1) ) {
			sHtml += " - ";
		}
	}			
			
	sHtml +=  "</DIV>"
			+ "<DIV class='pieLogo' title='IntelyGenZ'>"
			+ 	"<DIV class='clearB'><IMG src='"+oIGZ.m_sRootPath+"pix/magic.gif' "
			+ 		" class='sprites pieLogoGfx' border='0' alt='IntelyGenZ' />"
			+	"</DIV>"
			+ "</DIV>"
	//				+ g_maGeneral.f_getValIf("NsElementCd@Module_Element", "pie-de-pagina", "NsElementBody@Module_Element")
	
			+ "&#169; Intelygenz. Desde 2002.<BR />"
	//		+ "C/ Santa Engracia 151, 1ª planta. 28003 Madrid "+DrawMiniIco("googlemaps")
			+ "Plaza Santa Maria Soledad Torres Acosta 2, 5ª planta puerta C. 28004 Madrid "//+DrawMiniIco("googlemaps")
	//		+ "<BR />915 359 612 / <A href='mailto:informacion@intelygenz.com?subject="+RequestParam("feed", "Web")+"' style='color:#868686;text-decoration:none;text-transform:lowercase;font-size:9px;'>informacion@intelygenz.com</A>"
			+ "<BR />915 359 612 / <A href='mailto:informacion@intelygenz.com?subject="+RequestParam("feed", "Web")+"' style='color:#868686;text-decoration:none;text-transform:lowercase;font-size:9px;'>informacion@intelygenz.com</A>"
	
			;
	
	return sHtml;
	
}

function PrintTags(sTags) { document.write( DrawTags(sTags) ); }
function DrawTags(sTags) {
	var sHtml = "";
	if(sTags!=""){
		var a_tag = sTags.split(",");
		for (var f=0; f<a_tag.length; f++) {
			sHtml += DrawIcoTech(a_tag[f]);
		}
	}
	return sHtml;
}

function PrintIcoTech(sCual){ document.write( DrawIcoTech(sCual) ) }
function DrawIcoTech(sCual) {
	var sHtml = "";

	var f = 0, sSeccion="", sNombre, sEnlace;
	while ( f<g_maTecnoIconos.f_length() && sSeccion!=sCual ) {
		sSeccion = g_maTecnoIconos.f_getVal("NsElementTarget@Module_Element", f, "");
		sNombre  = g_maTecnoIconos.f_getVal("NsElementTitle@Module_Element", f);
		sEnlace  = oGesta.f_drawSEOLink( g_maTecnoIconos.f_getVal("NsElementSEOChild@Module_Element", f) );
		f++;
	}

	if (sCual==sSeccion) {
			sHtml += "<DIV class='icoTecnologia' title='"+ sNombre +"'>"
					+ 	"<A href='"+ sEnlace +"'>"
					+ 		"<IMG src='pix/magic.gif' class='sprites ico"+ sSeccion +"' border='0' alt='"+ sNombre +"' />"
					+ 	"</A>"
					+ "</DIV>"
					;
	}
	return sHtml;
}

function PrintIcoSite(sCual){ document.write( DrawIcoSite(sCual) ) }
function DrawIcoSite(sCual) {
	var sHtml = "";

		for (var f=0; f<g_maSiteIconos.f_length(); f++){
			var sSeccion = g_maSiteIconos.f_getVal("NsElementBody@Module_Element", f);

			if (sCual==sSeccion){
				var sNombre  = g_maSiteIconos.f_getVal("NsElementTitle@Module_Element", f);
				var sEnlace  = g_maSiteIconos.f_getVal("NsElementLink@Module_Element", f);
				var sTarget  = g_maSiteIconos.f_getVal("NsElementTarget@Module_Element", f);
				var sOpcion  = f+1;
				
				if (sTarget !="") {
					sTarget = " target='"+ sTarget +"' ";
				}
	
				sHtml +="<DIV class='busquedaSiteBloque' title='"+sSeccion+"'>"
							+ 	"<DIV class='clearB'><A href='"+sEnlace+"' "+sTarget+" title='"+sSeccion+"'><IMG src='pix/magic.gif'"
							+ 		" class='sprites sitesGfx"+sOpcion+"' border='0' alt='"+sSeccion+"' /></A>"
							+		"</DIV>"
							+ 	"<DIV class='sitesTxt'><A href='"+sEnlace+"' "+sTarget+" title='"+sSeccion+"'>"+sNombre+"</A></DIV>"
							+ "</DIV>"
							;
					
			}
		}

	return sHtml;
}

function PrintMiniIco(sCual){ document.write( DrawMiniIco(sCual) ) }
function DrawMiniIco(sCual) {
	var sHtml = "";

	var f = 0, sSeccion="", sNombre, sEnlace;
	while ( f<g_maMiniIcos.f_length() && sSeccion!=sCual ) {
		sSeccion = g_maMiniIcos.f_getVal("Seccion", f, "");
		sNombre  = g_maMiniIcos.f_getVal("Nombre", f);
		sEnlace  = g_maMiniIcos.f_getVal("Enlace", f);
		f++;
	}

	if (sCual==sSeccion) {
			sHtml +="<DIV class='icomini' title='"+ sNombre +"'>"
						+ 	"<A href='"+ sEnlace +"' target='_blank'>"
						+ 		"<IMG src='pix/magic.gif' class='sprites ico"+ sSeccion +"' border='0' alt='"+ sNombre +"' align='absmiddle' />"
						+ 	"</A>"
						+ "</DIV>"
						;
	}
	
	return sHtml;
}

function PrintTituloSeccion(sCual){ document.write( DrawTituloSeccion(sCual) ) }
function DrawTituloSeccion(sCual){
	var sHtml = "<DIV class='tituloContenedor tituloBg"+sCual+"'></DIV>";
	return sHtml;
}

function PrintTituloPestanha(sTitulo,bCual){ document.write( DrawTituloPestanha(sTitulo,bCual) ) }
function DrawTituloPestanha(sTitulo,bCual){
	var sHtml = "";
	var nTipo = "";
	
	if (bCual!=undefined) {
		nTipo = bCual;
	}

	sHtml +="<DIV class='tituloPestanha"+nTipo+"' title='"+sTitulo+"'>"
				+ 	"<DIV class='tituloPestanha"+nTipo+"IZ'></DIV>"
				+ 	"<DIV class='tituloPestanha"+nTipo+"CT'>"+sTitulo+"</DIV>"
				+ 	"<DIV class='tituloPestanha"+nTipo+"DC'></DIV>"
				+ "</DIV>"
				;

	return sHtml;
}

function DrawBloqueTxtPeque(sTexto) {
	var sHtml = "<DIV class='bloqueTxtPeque'>"+ sTexto +"</DIV>";
	return sHtml;
}


function PrintListado () { document.write(DrawListado()); }
function DrawListado () {
	var sFecha, sTitulo ,sFoto ,sTexto, sFuente, sEnlace, sHtml="", sTags;
	
	for ( var i=0; i<oGesta.f_length(); i++) {
		sEnlace = oGesta.f_drawSEOLink ( oGesta.f_getValByPos(i, "SEOChild", "") );
		sFecha  = oGesta.f_getValByPos(i, "DtElement", "");
		sTitulo = oGesta.f_getValByPos(i, "Title", "");
		sFoto   = oGesta.f_getValByPos(i, "FullUriFile", "");
		sTexto  = oGesta.f_getValByPos(i, "Body", "");
		sFuente = oGesta.f_getValByPos(i, "Link", "");
		sTags = oGesta.f_getValByPos(i, "Tag", "");

		sHtml +="<DIV class='separador'></DIV>"
					+		"<TABLE class='noticiaBloque'>"
					;
		
		if (sFoto!="") {
			sHtml +=	"<TR><TD class='valignT'><IMG src='"+ sFoto +"' class='foto' border='0' alt='"+ sTitulo +"' /></TD>";
		}
		sHtml +=		"<TD class='noticiaContenido'>"
					+				"<P><B>"+ sTitulo +"</B></P>"
					+				sTexto
					+				"<DIV class='noticiaFooter'>"
					+ 				DrawTags(sTags)
					;

		if (sFuente!="") {
			sHtml +=			"<SPAN><A href='"+ sFuente +"'>"+ g_maGeneral.f_getValIf("NsElementCd@Module_Element","busqueda-mensajes","NsElementTarget@Module_Element") +"</A></SPAN>";
		}
		sHtml +=				"<SPAN>"+ sFecha +"</SPAN>"
					+					"<SPAN><A href='"+ sEnlace +"'>"+ g_maGeneral.f_getValIf("NsElementCd@Module_Element","busqueda-mensajes","NsElementLink@Module_Element") +"</A></SPAN>"
					+			"</TD>"
					+		"</TR>"
					+	"</TABLE>"
					;
	}

	return sHtml;
}

function PrintTecnologias () {
	document.write( DrawTecnologias() );
}
function DrawTecnologias () {
	var sFoto ,sTexto, sEnlace, sHtml="";
	
	for (var i=0; i<oGesta.f_length() ; i++) {
		sFoto   = oGesta.f_getValByPos(i, "FullUriFile", "");
		sTexto  = oGesta.f_getValByPos(i, "Body", "").f_maxLength(250, "...", 1) ;
		sEnlace = oGesta.f_drawSEOLink( oGesta.f_getValByPos(i, "SEOChild", "") );
		
		sHtml += "<TABLE width='100%' border='0' cellspacing='10' cellpadding='0'>"
					+ "<TR>"
					+ 	"<TD width='120' align='center'>"
					;
					
		sImg = oGesta.f_getValByPos(i, "FullUriFile", "");
		if (sImg!="") {
			sHtml += 		"<IMG src='"+ sImg +"' />";
		}
		sHtml +=	"</TD>"
					+ 	"<TD>"
					+ 		sTexto
					+ 	"</TD>"
					+ "</TR>"
					+"<TR>"
					+		"<TD colspan='2' align='right'>"
					+			"<BR />"
					+			"<A href='"+ sEnlace +"'>"+ g_maGeneral.f_getValIf("NsElementCd@Module_Element","busqueda-mensajes","NsElementLink@Module_Element") +"</A>"
					+		"</TD>"
					+"</TR>"
					+"</TABLE>"
					;
		}
						
		return sHtml;
}

function DrawSearchDone () {
	var sTitulo , sEnlace;
	var sHtml="";
	
	for ( var i=0; i<g_maModuleElements.f_length(); i++) {
		sTitular = g_maModuleElements.f_getVal("NsModuleDs@Module_Element",i);
		sTexto = g_maModuleElements.f_getVal("NsSearchContext@Module_Element",i);

		sEnlace = oGesta.f_drawSEOLink( g_maModuleElements.f_getVal("NsModuleSEOName@Module_Element",i) );

		sHtml +="<DIV class='separador'></DIV>"
					+ "<TABLE width='100%'>"
					+ "<TR>"
					+	"<TD>"
					+ 		"<DIV class='search-entry' onMouseOver='this.className=\"search-entryOn\"' onMouseOut='this.className=\"search-entry\"' onClick='document.location.href=\""+ sEnlace +"\"'>"
					+   		"<B style='color:#15B6F8'>"+ sTitular +"</B>"+sTexto
					+ 		"</DIV>"
					+	"</TD>"
/*
					+	"<TD align='right'>"
					+		"[<A href='"+sEnlace+"' class='enlace2'>Más información</A>]"
					+	"</TD>"
*/
					+ "</TR>"
					+ "</TABLE>"

					;
	}

	return sHtml;
}


function PrintShare (sTitle,sDesc,a_sRedes) {
	document.write (DrawShare (sTitle,sDesc,a_sRedes) )
}
function DrawShare (sTitle,sDesc,a_sRedes) {
	if (!a_sRedes){
		a_sRedes = ["facebook","twitter"]
	}
	var sHtml =	 "<DIV class='noticiaShare alignL'>"
			+	 DrawRedes (a_sRedes
, "<A href='<sLink>' target='redes'><IMG src='pix/redes_sociales/<sRed>.gif' alt='Compártelo en <sNombre>' width='16' height='16' border='0' hspace=3></A>"
, {TITULO:sTitle,URL:null,DESCRIPCION:sDesc}
, 2)
		+	 "</DIV>"
	return sHtml
}


function PrintListadoNoticias () { document.write(DrawListadoNoticias()); }
function DrawListadoNoticias () {
	var sFecha, sTitulo ,sFoto ,sTexto, sFuente, sEnlace, sHtml="", sTags;
	
	for ( var i=0; i<oGesta.f_length(); i++) {
		sEnlace = oGesta.f_drawSEOLink ( oGesta.f_getValByPos(i, "SEOChild", "") );
		sFecha  = oGesta.f_getValByPos(i, "DtElement", "");
		sTitulo = oGesta.f_getValByPos(i, "Title", "");
		sFoto   = oGesta.f_getValByPos(i, "FullUriFile", "");
		sTexto  = oGesta.f_getValByPos(i, "Leadin", "");
		sFuente = oGesta.f_getValByPos(i, "Link", "");
		sTags   = oGesta.f_getValByPos(i, "Tag", "");
		sEnlace = oIGZ.m_sRootPath + "noticia.aspx?feed="+g_maModuleElements.f_getVal("NsModuleSEOName@Module_Element",i)+ "&pos=" + i;

		sHtml += "<DIV class='noticiaSep'>&#160;</DIV>"
		+	"	<DIV class='noticiaBloque'>";

/*		
		if (sFoto!="") {
			sHtml +=	"			<IMG src='"+ sFoto +"' class='foto' border='0' alt='"+ sTitulo +"' />";
		}
*/

		sHtml +="<DIV class='noticiaContenido' onClick=\"document.location.href='"+sEnlace+"'\" onMouseOver='this.className=\"noticiaContenidoOn\"' onMouseOut='this.className=\"noticiaContenido\"'>"
					+	 "<SPAN class='noticiaContenidoTit'>"+ sTitulo +"</SPAN><BR />"
					+	 sTexto + "<BR />"

				+	 "<DIV class='noticiaFooter'>"+DrawTags(sTags)+"</DIV>"
				+	 DrawShare (sTitulo,sTexto,["twitter"])
				+	 "<DIV class='noticiaVolver alignR'>"
					+	 "<A href='"+sEnlace+"'>Leer más</A>"
				+	 "</DIV>"
				;
		
/*
		if (sFecha)	{
			sHtml +=		"<SPAN>"+ sFecha +"</SPAN>";
		}
		if (sFuente!="") {
			sHtml +=		"&nbsp;&nbsp;<SPAN><A href='"+ sFuente +"'>"+ g_maGeneral.f_getValIf("NsElementCd@Module_Element","busqueda-mensajes","NsElementTarget@Module_Element") +"</A></SPAN>";
		}
*/

		sHtml +="</DIV>"
				+	"</DIV>";

	}
	return sHtml;
}