var g_strSearchFormOption = 'internet';


//==========================================================================
// Implementa la lógica para los buscadores ASK, NOTICIAS y TIENDA de la cabecera.
//==========================================================================
function searchForm( t_strSearchString, t_strPortal )
{
	switch( g_strSearchFormOption.toUpperCase() )
	{
		case 'INTERNET':
		{
			document.getElementById('formularioDeBusqueda').action = 'http://es.ask.com/ar?q=' + t_strSearchString + '&l=dis&siteid=1088&qsrc=999&qenc=UTF-8';
			break;
		}
		case 'ELPERIODICO':
		{
			document.getElementById('formularioDeBusqueda').action = 'http://www.diariocordoba.com/noticias/hemeroteca.asp?texto=' + t_strSearchString + '&tipo=1';
			break;
		}
		case 'TIENDA':
		{
			document.getElementById('formularioDeBusqueda').action = 'http://tienda.diariocordoba.com/share-cgi/search.ftcb?lc=es_ES&f=1&id=351&c=0&k=' + t_strSearchString;
			//document.getElementById('formularioDeBusqueda').target = '_blank';
			break;
		}
	}
	
	document.getElementById('formularioDeBusqueda').submit();
}


//==========================================================================
// Implementa la lógica para el buscador de NOTICIAS de las pestañas de portada.
//==========================================================================
function pestanaSearchFormNews( t_strSearchString, scURLPeriodico )
{
	document.getElementById('pestanaFormularioDeBusquedaNoticias').action = 'http://'+scURLPeriodico+'/noticias/hemeroteca.asp?texto=' + t_strSearchString + '&dia=&mes=&anio=&seccion_id=&Submit=Buscar+noticias';
	document.getElementById('pestanaFormularioDeBusquedaNoticias').submit();
}


//==========================================================================
// Implementa la lógica para el buscador de PRODUCTOS de las pestañas de portada.
//==========================================================================
function pestanaSearchFormProducts( t_strSearchString, t_strPortal )
{
	document.getElementById('pestanaFormularioDeBusquedaProductos').action = 'http://tienda.diariocordoba.com/share-cgi/search.ftcb?lc=es_ES&f=1&id=351&c=0&k=' + t_strSearchString;
	//document.getElementById('pestanaFormularioDeBusquedaProductos').target = '_blank';
	document.getElementById('pestanaFormularioDeBusquedaProductos').submit();
}


//==========================================================================
// Función de apertura de ventanas flotantes.
//==========================================================================
function openw(foto,ancho,alto,scrol)
{
	var centroy=((screen.availHeight - alto)/2);
	var centrox=((screen.availWidth - ancho)/2);
	window.open(foto,"IWIN","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+scrol+",resizable=no,copyhistory=no,width="+ancho+",height="+alto+",left="+centrox+",top="+centroy)
}


//==========================================================================
// Función de apertura de ventanas flotantes.
//==========================================================================
function openw2(foto,ancho,alto,scrol)
{
	var centroy=((screen.availHeight - alto)/2);
	var centrox=((screen.availWidth - ancho)/2);
	window.open(foto,"IWIN","toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars="+scrol+",resizable=yes,copyhistory=no,width="+ancho+",height="+alto+",left="+centrox+",top="+centroy)
}


//==========================================================================
// JAVASCRIPT DE PUBLI PARA PESTAÑAS
//==========================================================================
function writeDartCodeIFrame(elemId,seccion,ancho,alto)
{
	script2=document.getElementById(elemId);	
	script2.src="http://www.diariocordoba.com/banner140x140.asp?codificacion="+seccion;
	script2.width=ancho;	
	script2.height=alto;
	script2.frameborder=0;
}


//==========================================================================
// JAVASCRIPT DE OJD Y NIELSEN PARA PESTAÑAS
//==========================================================================
function writeOJDNielsenCode(elemId,seccion){
	//OJD
	var IVW="http://dcordoba.ojdinteractiva.com/cgi-bin/ivw/CP/"+seccion	
	script3=document.getElementById("ojdPestanya_"+elemId);
	script3.src=IVW+"?r="+escape(document.referrer);
	//NIELSEN
	script4=document.getElementById("nielsenPestanya_"+elemId);
	var _rsCI="es-grupozeta";
	var _rsCG="0";
	var _rsCL='';
	var _rsDT=0;
	var _rsDU=0;
	var _rsDO=0;
	var _rsX6=0;
	var _rsSI=escape(window.location);
	var _rsLP=location.protocol.indexOf('https')>-1?'https:':'http:';
	var _rsRP=escape(document.referrer);
	var _rsND=_rsLP+'//secure-uk.imrworldwide.com/';
	script4.src=_rsND+'cgi-bin/m?ci='+_rsCI+'&amp;cg='+_rsCG+'&amp;si='+_rsSI+'&amp;rp='+_rsRP;
}


//==========================================================================
// .
//==========================================================================
function setSearchCriteriaQuickSearch_Upper()
{
	document.getElementById('InputHiddenSearchType').value		 = '1';
	document.getElementById('InputHiddenOrderCriteria').value	 = '0';
	document.getElementById('InputHiddenCurrentPage').value		 = '0';
	document.getElementById('InputHiddenRowsPerPage').value		 = '0';
	document.getElementById('InputHiddenSearchText').value		 = document.getElementById('InputTextQuickSearchText_Upper').value;
	document.getElementById('InputHiddenSearchDateRange').value	 = document.getElementById('SelectQuickSearchDateRange_Upper').options[document.getElementById('SelectQuickSearchDateRange_Upper').selectedIndex].value;
	document.getElementById('InputHiddenSearchBeginDay').value	 = '0';
	document.getElementById('InputHiddenSearchBeginMonth').value = '0';
	document.getElementById('InputHiddenSearchBeginYear').value	 = '0';
	document.getElementById('InputHiddenSearchEndDay').value	 = '0';
	document.getElementById('InputHiddenSearchEndMonth').value	 = '0';
	document.getElementById('InputHiddenSearchEndYear').value	 = '0';
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// .
//==========================================================================
function setSearchCriteriaQuickSearch_Lower()
{					
	document.getElementById('InputHiddenSearchType').value		 = '1';
	document.getElementById('InputHiddenOrderCriteria').value	 = '0';
	document.getElementById('InputHiddenCurrentPage').value		 = '0';
	document.getElementById('InputHiddenRowsPerPage').value		 = '0';
	document.getElementById('InputHiddenSearchText').value		 = document.getElementById('InputTextQuickSearchText_Lower').value;
	document.getElementById('InputHiddenSearchDateRange').value	 = document.getElementById('SelectQuickSearchDateRange_Lower').options[document.getElementById('SelectQuickSearchDateRange_Lower').selectedIndex].value;
	document.getElementById('InputHiddenSearchBeginDay').value	 = '0';
	document.getElementById('InputHiddenSearchBeginMonth').value = '0';
	document.getElementById('InputHiddenSearchBeginYear').value	 = '0';
	document.getElementById('InputHiddenSearchEndDay').value	 = '0';
	document.getElementById('InputHiddenSearchEndMonth').value	 = '0';
	document.getElementById('InputHiddenSearchEndYear').value	 = '0';
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// .
//==========================================================================
function setSearchCriteriaAdvancedSearch()
{
	document.getElementById('InputHiddenSearchType').value		 = '2';
	document.getElementById('InputHiddenOrderCriteria').value	 = '0';
	document.getElementById('InputHiddenCurrentPage').value		 = '0';
	document.getElementById('InputHiddenRowsPerPage').value		 = '0';
	document.getElementById('InputHiddenSearchText').value		 = document.getElementById('InputTextAdvancedSearchText').value;
	document.getElementById('InputHiddenSearchSection').value	 = document.getElementById('SelectAdvancedSearchSections').options[document.getElementById('SelectAdvancedSearchSections').selectedIndex].value;
	document.getElementById('InputHiddenSearchBeginDay').value	 = document.getElementById('SelectAdvancedSearchBeginDay').options[document.getElementById('SelectAdvancedSearchBeginDay').selectedIndex].value;
	document.getElementById('InputHiddenSearchBeginMonth').value = document.getElementById('SelectAdvancedSearchBeginMonth').options[document.getElementById('SelectAdvancedSearchBeginMonth').selectedIndex].value;
	document.getElementById('InputHiddenSearchBeginYear').value	 = document.getElementById('SelectAdvancedSearchBeginYear').options[document.getElementById('SelectAdvancedSearchBeginYear').selectedIndex].value;
	document.getElementById('InputHiddenSearchEndDay').value	 = document.getElementById('SelectAdvancedSearchEndDay').options[document.getElementById('SelectAdvancedSearchEndDay').selectedIndex].value;
	document.getElementById('InputHiddenSearchEndMonth').value	 = document.getElementById('SelectAdvancedSearchEndMonth').options[document.getElementById('SelectAdvancedSearchEndMonth').selectedIndex].value;
	document.getElementById('InputHiddenSearchEndYear').value	 = document.getElementById('SelectAdvancedSearchEndYear').options[document.getElementById('SelectAdvancedSearchEndYear').selectedIndex].value;
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// .
//==========================================================================
function setRowsPerPage( t_intRowsPerPage )
{
	document.getElementById('InputHiddenRowsPerPage').value = t_intRowsPerPage;
	document.getElementById('InputHiddenCurrentPage').value = 0;
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// .
//==========================================================================
function setOrder( t_intOrderCriteria )
{
	document.getElementById('InputHiddenOrderCriteria').value = t_intOrderCriteria;
	document.getElementById('InputHiddenCurrentPage').value	  = 0;
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// .
//==========================================================================
function setPage( t_intPage )
{
	document.getElementById('InputHiddenCurrentPage').value = t_intPage;
	
	document.getElementById('FormSearchParameters').submit();
}


//==========================================================================
// Agiliza las busquedas en hemeroteca habilitando la pulsación del intro.
//==========================================================================
function searchJump( t_objEvent, t_objSearchButton  )
{	
	if (window.event)
	{
		// Explorer
		l_intKey = t_objEvent.keyCode; 
	}
	else if(t_objEvent.which)
	{
		// Netscape
		l_intKey = t_objEvent.which; 
	}
	else
	{
		// Sin eventos
		return true;
	}
	
	if (l_intKey == '13')
	{
		t_objSearchButton.click();
		return false;
	}
	else
	{
		return true;
	}
}


//==========================================================================
// JAVASCRIPT DE OJD PARA ESPECIALES EN PDF.
//==========================================================================

function sR(target)
{
    pixel = new Image(); 
    pixel.src = "http://dcordoba.ojdinteractiva.com/cgi-bin/ivw/CP/descarga_documentos";
    var wnd = window.open(target,"_blank");
}


//==========================================================================
// .
//==========================================================================

function Ir(canal)
{
	parent.top.location = canal;
}


//==========================================================================
// Corrector de Bug PNG para Explorer. Opera y Mozilla funcionan correctamente sin este JS
//==========================================================================
function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }

   }
var ua = navigator.userAgent.toLowerCase();
function detect(text) {
   stringposition = ua.indexOf(text) + 1;
   data = text;
   return stringposition;
}

if (detect('opera')) {
	 
 } else if (detect('firefox')){
	 
} else if (detect('msie')){
	 window.attachEvent("onload", correctPNG);	
}	 