<?php

session_start();


function pon_java_menu(){
	
	

	
		echo "<script type=\"text/javascript\" src=\"js/validate.js\"></script>\n";
		echo "<link href=\"css/validate.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
		$sql_secciones = mysql_query("select s.titulo as titulo, s.id,s.url as url from secciones s inner join categorias c on s.id=c.id_seccion group by s.id   order by s.orden");
	$i=0;
	while($fila_secciones = mysql_fetch_array($sql_secciones)){
		$i++;
		?>
	

	<script type="text/javascript">
	
     window.addEvent('load', function()
	{
	
	
	var slider<?echo $i;?> = new Fx.Slide('caja_menu<?echo $i;?>');
	slider<?echo $i;?>.hide();
	$('effect-<?echo $i;?>').addEvent('click', function(ev)
	{
		new Event(ev).stop();
		slider<?echo $i;?>.toggle();
	});	
	
	
	
	
    }); 
	
</script>
	<?

	}
	/*
	$sql_secciones = mysql_query("select s.titulo as titulo, s.id,s.url as url from secciones s inner join categorias c on s.id=c.id_seccion group by s.id   order by s.orden");
	$i=0;
	while($fila_secciones = mysql_fetch_array($sql_secciones)){
		$i++;
		?>
	
	
	   
      <script type="text/javascript">
	
     window.addEvent('load', function()
{
	
	
	var slider3 = new Fx.Slide('caja_menu');
	slider3.hide();
	$('efecto-3').addEvent('click', function(ev)
	{
		new Event(ev).stop();
		slider3.toggle();
	});	
	
	
	
	
         }); 
	
</script>


	<?
	}
	*/
	
	
	
}
function PonCabecera2($seccion,$meta_titulo,$meta_desc,$meta_key)
{
	global $idioma,$enlace,$config,$seccion;
	
	
	
	if (isset($seccion)) {
		$corta_seccion = explode("|",$seccion);
		$seccion = $corta_seccion[0];
		$titulo = $corta_seccion[1];
	}

	

	$hora=date('H:i:s');
	$fecha=date('Y-m-d');
	$now=$fecha.' '.$hora;
	
/*	require ('admin/xajax/xajax.inc.php');
	$xajax = new xajax();
	$xajax->registerFunction("pon_imagenes");
	
	include("admin/includes/fns_ajax.php");


	$xajax->processRequests();*/

	
	echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">";
	echo "<html  xml:lang=\"es\">\n";
	echo "<head>\n";
		
echo "<title>".$meta_titulo."</title>\n";
	echo "<meta name=\"Description\" content=\"".$meta_desc."\"  />\n";
	echo "<meta name=\"keywords\" content=\"".$meta_key."\"  />\n";
	
	
	 if ($_SERVER['SERVER_NAME']=="localhost") {
echo "<base href=\"http://localhost/lorcaepis2/\" />"; 
}
else {
echo "<base href=\"http://www.lorcaepis.com/\" />";
}
//$xajax->printJavascript('admin/xajax/');

if($seccion=='contacto' ){
	
		
		
		

	?>

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-7939942-1");
pageTracker._trackPageview();
} catch(err) {}</script>

    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
	  <?php
	
		$coor_google_map = "37.658814787869034,-1.6916799545288086";
		$nom_pro_google_map = "Lorcaepis";
		$dir_google_map = " Ctra. de Aguilas, 40";
		$loc_google_map = "30800 Lorca (Murcia - España)";
	
	  ?>

        var icon = new GIcon();
        icon.image = "http://lorcaepis.com/images/globito-mapas-google.png";
        icon.shadow = "";
        icon.iconSize = new GSize(60, 61);
        //icon.shadowSize = new GSize(101, 30);
        icon.iconAnchor = new GPoint(24, 74);
        icon.infoWindowAnchor = new GPoint(31, 8);

        var santi_html = "\
                <address class='googlemap'>\
                    <strong><? echo $nom_pro_google_map;?></strong><br />\
					<strong><? echo "" ?></strong><br />\
                    <strong><? echo $dir_google_map;?></strong><br />\
                    <strong><? echo $loc_google_map;?> <? echo $prov_google_map;?></strong><br /><br />\ ";
        
        var santi = new GMarker(new GLatLng(<? echo $coor_google_map;?>), icon);
        GEvent.addListener(santi, "click", function(){santi.openInfoWindowHtml(santi_html);});

		

        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(<? echo $coor_google_map;?>), 17);
	 	map.setMapType(G_HYBRID_MAP);
        map.addControl(new GSmallMapControl());
        <?php if($seccion!=contacto)
        {
        	?>map.addControl(new GMapTypeControl());<?php
        }
        ?>
     //   map.addControl(new GMapTypeControl());
    	map.addOverlay(santi);
	
    	
    	
    	
    	
    	

      }
    }

    //]]>
    </script>
	
	<?php
echo "<script type=\"text/javascript\" src=\"js/validate.js\"></script>\n";
		echo "<link href=\"css/validate.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
}
	
		
	
	
	

	
	echo '<link href="css/general.css" rel="stylesheet" type="text/css" />';
	echo '<link href="css/enlaces.css" rel="stylesheet" type="text/css" />';
	echo '<link href="css/textos.css" rel="stylesheet" type="text/css" />';
	echo "<SCRIPT src=\"js/mootools.v1.11.js\" type=\"text/javascript\"></SCRIPT>";
	echo "<link rel=\"stylesheet\" href=\"css/images.css\" type=\"text/css\">";
echo "<link rel=\"stylesheet\" href=\"css/thickbox.css\" type=\"text/css\">";
//
if($seccion=='articulo' || $seccion=='noticia'){echo "<SCRIPT src=\"js/slimbox.js\" type=\"text/javascript\"></SCRIPT>";}
	pon_java_menu();
	echo "<script type=\"text/javascript\" src=\"js/mootools.js\"></script>\n";
	
	









	
	
	//==========================================================================================




	echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n";
	echo "<meta http-equiv=\"Pragma\" content=\"no-cache\" />\n";
	echo "<meta name=\"Author\" content=\"Agencia Creativa Comunicación Multimedia S.L.L.\" />\n";

	echo "<meta name=\"Copyright\" content=\"Agencia Creativa Comunicación Multimedia S.L.L.\" />\n";


//	echo '<script type="text/javascript" src="js/menu_desplegable.js"></script>';
	
	
	echo "</head>";
echo "<body  xml:lang=\""._CLAVE_IDIOMA."\" onload=\"";
	
	
	
	if ($seccion=="contacto") {
		
		echo "load();\" onunload=\"GUnload()\"";
	
	}	



	echo "\">\n";
	?>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5202051-1");
pageTracker._trackPageview();
</script>
<?
	
	
	
	echo '<div id="contenedor">';
	echo '<div id="cabecera">';


	if($seccion=='inicio'){
		echo '<h1>Ropa Laboral&nbsp;&nbsp;&nbsp;</h1>';
	}
	else{
		echo '<h1>'.$meta_titulo.'&nbsp;&nbsp;&nbsp;</h1>';
	}
	
	echo '<div id="menu_horizontal">';
	
	echo '<a class="menu" href="./">inicio</a>';
	echo '<a class="menu" href="novedades/">novedades</a>';
	echo '<a class="menu" href="empresa.php">empresa</a>';
	echo '<a class="menu" href="ofertas.php">ofertas</a>';
	echo '<a class="menu" href="catalogo.php">catálogos</a>';
	echo '<a class="menu" href="contacto.php">contacto</a>';
	echo '</div>';
	echo '</div>'; //fin cabecera
	// *************************** FIN CABECERA **********************
	
	
}

function pon_banner(){
	echo '<div id="banner">
	';
	?>
	<iframe frameborder="0" src="banners/imagerotator.html" width="100%" height="244px" scrolling="No" style="padding:0px"></iframe>
	
	<? echo '</div>';
}

function pon_banner_grande(){
	echo '<div id="caja_banners_grande">';
$sql_banner = mysql_query("select * from banners where estado='si' and descripcion='grande 670x110px' order by rand() asc LIMIT 1");
while ($fila_banner=mysql_fetch_array($sql_banner)) {
	$sql_imagenes= mysql_query("select * from imagenes where  id_referencia = ".$fila_banner['id']." AND ruta = 'banners' LIMIT 1");
	while ($fila_imagenes = mysql_fetch_array($sql_imagenes)) {
		echo '<a href="'.$fila_banner['url'].'" style="margin-left:10px;"><img src="thumb.php?image=banners/'.$fila_imagenes['archivo'].'&w=645&z=115" /></a> ';
	}
}
echo '</div>';//fin caja pque banner

}

function pon_banner_pequeño(){
	echo '<div id="caja_banners_peque">';
$sql_banner = mysql_query("select * from banners where estado='si' and descripcion='pequeño 210x80px' order by rand() asc LIMIT 2");
while ($fila_banner=mysql_fetch_array($sql_banner)) {
	$sql_imagenes= mysql_query("select * from imagenes where  id_referencia = ".$fila_banner['id']." AND ruta = 'banners' LIMIT 1");
	while ($fila_imagenes = mysql_fetch_array($sql_imagenes)) {
		echo '<a href="'.$fila_banner['url'].'" style="margin-top:10px;float:left;"><img src="thumb.php?image=banners/'.$fila_imagenes['archivo'].'&w=200&z=80" /></a> ';
	}
}
echo '</div>';//fin caja pque banner
}








function ponMenuCatalogo(){
	echo '<div style="float:left;width:210px;;padding-left:5px;boder:1px solid red;margin-top:5px">';
	//session_destroy();
	
	
	
	echo '<div style="float:left;background-color:#f7f7f7;width:200px;border-bottom:1px solid #ccc">';
	echo "<form id=\"buscar\" name=\"buscar\" action=\"resultados.php\" method=\"post\" enctype=\"multipart/form-data\" style=\"float:left;margin:2px 5px\"  >";
	echo "<p class=\"trebuchet t10 negrita derecha\">BUSCADOR &nbsp;&nbsp;&nbsp;<input type=\"image\"  src=\"images/lupa.jpg\" style=\"vertical-align:middle\" name=\"enviar\" style=\"width:42px; height:34px;\" />";
	echo "<input type=\"text\" name=\"nombre\" class=\"required input_home t9\" style=\"width: 175px;border:1px solid #fff;border-bottom:1px solid #ccc;border-right:1px solid #ccc;\" /></p>";
	
	echo "</form>";
	echo '</div>';
	$_SESSION["ocarrito"]->imprime_carrito_peque();
	
	echo '<div id="catalogo_c" style="margin-top:5px"><p class="trebuchet t10">Catálogo</p></div>';
	
	echo '<div style="padding:10px 5px; background-color:#f7f7f7;;float:left">';
	$sql_secciones = mysql_query("select s.titulo as titulo, s.id,s.url as url from secciones s inner join categorias c on s.id=c.id_seccion group by s.id   order by s.orden");
	$i=0;
	while($fila_secciones = mysql_fetch_array($sql_secciones)){
		$i++;
		
		//echo '<p class="izquierda trebuchet c1 t16">&nbsp;<img src="images/cruz.jpg" /> '.Acentos_con_Mayuscula(strtoupper($fila_secciones['titulo'])).'</p>';
			echo "<p class=\"izquierda trebuchet c1 t16\">  <a href=\"#\" id=\"effect-".$i."\" class=\"a_c1 trebuchet izquierda  negrita\"><img src=\"images/cruz.jpg\" style=\"vertical-align:middle\" /> ".Acentos_con_Mayuscula(strtoupper($fila_secciones['titulo']))."</a></p>";
		echo "<div id=\"caja_menu".$i."\" style=\"\">";
		$sql_categorias = mysql_query("select * from categorias where id_seccion=".$fila_secciones['id']." order by orden");
		while ($fila_categorias = mysql_fetch_array($sql_categorias)) {
			
			echo '<p class="izquierda t7" style="margin-left:10px;_margin-left:5px;"><img style="vertical-align:middle" src="images/flechita.jpg"/> <a href="articulos/'.$fila_categorias['url'].'.html" class="a_c3" > '.$fila_categorias['titulo'].'</a></p>';
			
			
			$sql_subcategorias = mysql_query("select distinct * from subcategorias where id_categoria=".$fila_categorias['id']." order by orden ");
			while ($fila_subcategorias = mysql_fetch_array($sql_subcategorias)) {
				echo '<p class="izquierda t7" style="margin-left:20px;_margin-left:10px;"><img src="images/flechita2.jpg" style="vertical-align:middle"/><a href="articulos/'.$fila_subcategorias['url'].'.html" class="a_c1 t6" > '.$fila_subcategorias['titulo'].'</a></p>';
			}
		}
		//echo '<p class="trebuchet izquierda t7 " ><img src="images/cruz.jpg" /> '.strtoupper($fila_secciones['titulo']).'</p>';
		echo '</div>';
		
	}
	echo '</div>';

	echo '<div id="catalogo_c" style="margin-top:5px"><p class="trebuchet t10">OFERTAS</p></div>';
	
$sql_articulos = mysql_query("SELECT * from articulos where estado='si' and nuevo='si' order by rand() LIMIT 2");

while($fila_articulos=mysql_fetch_array($sql_articulos)){

	
	$sql_imagenes= mysql_query("select * from imagenes where  id_referencia = ".$fila_articulos['id']." AND ruta = 'articulos'  LIMIT 1");
	while ($fila_imagenes = mysql_fetch_array($sql_imagenes)) {
		echo '<p style="text-aling:center;margin-top:20px;" class="t7 c3 negrita"><img src="thumb.php?image=articulos/'.$fila_imagenes['archivo'].'&w=180&z=120" style="vertical-align:center;border: 0;" /> <br>
';
		$imagen = 'thumb.php?image=articulos/'.$fila_imagenes['archivo'].'&w=80&z=50';
	}
	
	

	
	echo '
	<a href="'.$fila_articulos['url'].'_'.$fila_articulos['id'].'.html" class="a_c5" >'.limitaCaracteres($fila_articulos['titulo'],33).'</a><br>
	<span class="c1">'.$fila_articulos['precio'].'€</span>
	 <img src="images/separador.jpg" style="vertical-align:middle" /> 
	<a href="'.$fila_articulos['url'].'_'.$fila_articulos['id'].'.html" class="a_c1" title="más información"><img src="images/mas_info.jpg" style="border:0px;vertical-align:middle" /></a>
</p>';
	
	


}
		
	
	echo '</div>';
	
	
	/*	echo '<div style="float:left;width:210px;background-color:#f5f5f5;border:1px solid #d6d6d6;padding-left:5px;">';
	echo '<div style="width:205px;background-color:#fff;margin:5px auto 0 0;padding:5px 0 5px 0"><p class="trebuchet t9">Catálogo</p></div>';
	
	
	echo "<p style=\"width:99%;border-bottom:1px dashed #ccc\"> <a href=\"#\" id=\"effect-3\" class=\"a_c1 trebuchet izquierda t14 negrita\">Para mas información</a></p>";
	echo "<div id=\"caja_menu\" style=\"width:325px;height:280px\">sdfasdfasdfasdfasdfasdfasdfasd";
	echo '</div>';
	echo '</div>';*/
	
}

function Ponpie(){
	
	


	echo '</div>';//contenedor
	echo '<div id="pie"><div id="pie_contenedor">';
		$sql_pie = mysql_query("select * from categorias");
		echo '<p class="c2 trebuchet" style="margin-top:10px;">';
while($fila_pie= mysql_fetch_array($sql_pie)){
	echo '<a href="articulos/'.$fila_pie['url'].'.html" class="c2"><span style="font-size:'.rand(13,20).'px"> '.$fila_pie['titulo'].' </span></a>';
}	
echo '<br>
&nbsp;</p>';
	echo '
	<p class="izquierda t14 verdana c1 negrita" style="width:50%;float:left;background-color:#fff; ">
	&nbsp;&nbsp;&nbsp;Lorca epis. Ropa laboral. Teléfono 968 442 544</p>
	<p class="derecha t14 verdana c1 negrita" style="width:49%;float:left;background-color:#fff;  ">
	<a href="aviso-legal.php" class="a_c1">Aviso Legal</a>&nbsp;|&nbsp;
	<a href="admin/" class="a_c1">Administración</a>&nbsp;|&nbsp;
	<a href="http://www.agenciacreativa.net" title="Diseño web y publicidad" target="_blank" class="a_c1">Diseño web</a>&nbsp;&nbsp;
	</p>
	</div></div>';


echo "</body>";
echo "</html>";

}


function Acentos_con_Mayuscula($cadena){
	$cadena = str_replace("á","Á",$cadena);
	$cadena = str_replace("é","É",$cadena);
	$cadena = str_replace("i","í",$cadena);
	$cadena = str_replace("ó","Ó",$cadena);
	$cadena = str_replace("ú","Ú",$cadena);
	$cadena = str_replace("ñ","Ñ",$cadena);
	return $cadena;
}

function Ponfecha() {
global $idioma;

	if ($idioma==1 or !isset($idioma)) {

	$cadena = date(l) .", ". date(j) . " de " . date(F) . " de " . date(Y);

	$cadena = ereg_replace("Monday","Lunes",$cadena);
	$cadena = ereg_replace("Tuesday","Martes",$cadena);
	$cadena = ereg_replace("Wednesday","Miércoles",$cadena);
	$cadena = ereg_replace("Thursday","Jueves",$cadena);
	$cadena = ereg_replace("Friday","Viernes",$cadena);
	$cadena = ereg_replace("Saturday","Sábado",$cadena);
	$cadena = ereg_replace("Sunday","Domingo",$cadena);

	$cadena = ereg_replace("January","Enero",$cadena);
	$cadena = ereg_replace("February","Febrero",$cadena);
	$cadena = ereg_replace("March","Marzo",$cadena);
	$cadena = ereg_replace("April","Abril",$cadena);
	$cadena = ereg_replace("May","Mayo",$cadena);
	$cadena = ereg_replace("June","Junio",$cadena);
	$cadena = ereg_replace("July","Julio",$cadena);
	$cadena = ereg_replace("August","Agosto",$cadena);
	$cadena = ereg_replace("September","Septiembre",$cadena);
	$cadena = ereg_replace("October","Octubre",$cadena);
	$cadena = ereg_replace("November","Noviembre",$cadena);
	$cadena = ereg_replace("December","Diciembre",$cadena);

	echo $cadena;
	}
	elseif ($idioma==2) {
	//echo date(l) ." ". date(j) . " of " . date(F) . " of " . date(Y);
	if (date(j)==1) {$pon_dia = date(j)."st";}
	elseif (date(j)==2) {$pon_dia = date(j)."nd";}
	elseif (date(j)==3) {$pon_dia = date(j)."rd";}
	else {$pon_dia = date(j)."th";}
	echo date(F).", ".$pon_dia." ".date(Y);
	}

}

function filtro_url($cadena) {
$cadena = strtolower($cadena);
$cadena = eregi_replace( '\(', '', $cadena);
$cadena = eregi_replace( '\)', '', $cadena);
$cadena = eregi_replace( '\/', '', $cadena);
$cadena = eregi_replace( 'ñ', 'n', $cadena);
$cadena = eregi_replace( 'Ñ', 'N', $cadena);
$cadena = eregi_replace( ',', '.', $cadena);
$cadena = eregi_replace( 'ã³', 'o', $cadena);
$cadena = eregi_replace( 'cã©', 'e', $cadena);
$cadena = eregi_replace( 'ã©', 'e', $cadena);
$cadena = eregi_replace( '\+', '', $cadena);
$cadena = eregi_replace( '\&', '', $cadena);
$cadena = eregi_replace( '=', '', $cadena);
$cadena = trim($cadena);
$cadena = eregi_replace( ' ', '-', $cadena);
$cadena = strtr($cadena,"áéíóúÁÉÍÓÚ","aeiouAEIOU");

return $cadena;
}

?>