var pathname = window.location.pathname;
if(pathname.indexOf('promociones.php')>=0){
$('.Pimg-bg a').colorbox({close: "CERRAR"})
if(document.URL.indexOf('id=')>=0){
        $Pid='promocion.php?idpromocion='+document.URL.substring(document.URL.indexOf('id=')+3)
		$(document).ready(function(){$.colorbox({href:$Pid})})
		
    }
}
if(pathname.indexOf('empresas')>=0 || pathname.indexOf('local')>=0 || pathname.indexOf('pelicula')>=0 || 
pathname.indexOf('presentacion')>=0){
$st='../'
$('link').css('',function(){
						  $css= $(this).attr('href')
						  $(this).attr('href','../'+$css)
						  })
$('img').css('',function(){
						  $src= $(this).attr('src')
						  $(this).attr('src','../'+$src)
						  })
$('a').css('',function(){
						  $src= $(this).attr('href')
                          $cl=$(this).attr('class')
						  if($src && $cl.indexOf('c18')==-1)$(this).attr('href','../'+$src)
						  })

}else{
$st=''
}
$('body').prepend('<script type="text/javascript" src="'+$st+'js/ie6.js"></script>')

$('#plaza').load($st+'menu.html #plazam',function(){
    $('#plaza ul li a').hover(function(){
					$(this).parent().css({'background-position':'0 -33px'}).find('ul.submenu').stop(true,true).slideDown()
					$(this).parent().hover(function(){},
											function(){$(this).parent().find('ul.submenu').slideUp()}
																								  )
											},function(){
											 $(this).parent().css({'background-position':'0 0'})
											})
    if($st){
		$('li a',this).css('',function(){
									   $href=$(this).attr('href')
									   $(this).attr('href','../'+$href)
									   })
        $('img',this).css('',function(){
            $mim= $(this).attr('src')
            $(this).attr('src',$st+$mim)
        })
									  }     
})
$('#menu').load($st+'menu.html #menum', function(){
	$('input.buscar').focusout(function () {$(this).val('Buscar')}).focus(function(){$(this).val('')})
	$('#menu ul li span').hover(function(){
					$(this).parent().find('ul.submenu').stop(true,true).slideDown()
					$(this).parent().hover(function(){},
											function(){$(this).parent().find('ul.submenu').slideUp()}
																								  )
											})
	if($st){
		$('li a',this).css('',function(){
									   $href=$(this).attr('href')
									   $(this).attr('href','../'+$href)
									   })
		$('form').attr('action','../'+$('form').attr('action'))
		}
									  })

$i=1;
$navi=''
$('.scroll .items img').css('',function(){
										$navi=$navi+'<a href="'+$i+'" class=""></a>'
										$i++
										})


if(pathname.replace('/plazamayor','')=='/' || pathname.replace('/2011','')=='/'){
$(".scroll").scrollable({circular: true, mousewheel: true}).autoscroll({
	interval: 3000		
}).navigator()
}

$('a.Nb').click(function(){
						 $('a.Nb').removeClass('active')
						 $(this).addClass('active')
						 $cl=$(this).attr('class')
						 if($cl.indexOf('Ncuadro')>=0){CSS('noticias2')}
						 if($cl.indexOf('Nline')>=0){CSS('noticias')}
						 return false
						 })

$('.Eb').click(function(){
						 $('.Eb').removeClass('active')
						 $cl=$(this).attr('class')
						 if($cl.indexOf('Ecuadro')>=0){CSS('eventos2'); $('.Ecuadro').addClass('active')}
						 if($cl.indexOf('Eline')>=0){CSS('eventos'); $('.Eline').addClass('active')}
						 
						 })

function CSS(n){
    $('link[title="noticias"]').attr('href', 'css/'+n+'.css').load().css('',function(){
        setTimeout(function(){
            $('li.E_informacion').css('',function(){
                $hv=$(this).height()
                $('.date',this).height($hv-10)
                s=$('a.ofset').offset()
            })
        },500) 
    })
    }

$('ul.noticias li img.over').parent().hover(function(){$('a.leer',this).animate({top:0},{queue:false,duration:300})},
								   function(){$('a.leer',this).animate({top:'190px'},{queue:false,duration:300})}
								   )


$Tcolor= new Array('bc18','bcc8','bcf7','bc7e','bc1b','bccf','bc4a','bc62','bc5b','bce1','bc93','bc14','bc60','bc7d','bc58','bc64')
$Ttxt= new Array(   'articulos deportivos',
                    'entretenimiento',
                    'especialidades',
                    'hogar y electr&oacute;nica',
                    'joyeria y relojeria',
                    'juguetes y regalos',
                    'lenceria y corseteria',
                    'musica y libros',
                    'opticas y lentes',
                    'restaurantes y comida rapida',
                    'ropa y accesorios para dama',
                    'ropa y accesorios para cabalero',
                    'salud y belleza',
                    'servicios generales',
                    'zapaterias y calzado',
					'ropa y accesorios para ninos')

function  Stool(n){
    for(i in $Tcolor){
        if($Tcolor[i]==n){
            return $Ttxt[i];
        }
    }
}            

$giro=1;
$('.giro').css('',function(){
		$n= $(this).attr('class').replace('giro ','')
		$(this).parent().addClass('tool_'+$giro)
        $(' .giro').tooltip({ effect: 'slide', relative:'true', position:'center left'})
        $txtg=Stool($n)
        $('.tool_'+ $giro+' .tooltip').text($txtg)
		$giro++
        })

$('.Pimg-bg').hover(function(){$('.Ptop',this).animate({bottom:0},{queue:false,duration:300})},
					  function(){$('.Ptop',this).animate({bottom:'-121px'},{queue:false,duration:300})})
$('.Himg-bg').hover(function(){$('.Ptop',this).animate({bottom:0},{queue:false,duration:300})},
					  function(){$('.Ptop',this).animate({bottom:'-121px'},{queue:false,duration:300})})


if(pathname.indexOf('familia')>=0 || pathname.indexOf('jovenes')>=0 || pathname.indexOf('adultos')>=0){
$(".eventos").scrollable({mousewheel: true}).navigator()
$('.eventos .items').hover(	function(){$('.Rtop',this).animate({bottom:0},{queue:false,duration:300})},
							function(){$('.Rtop',this).animate({bottom:'-121px'},{queue:false,duration:300})
							})
	}
	
if(pathname.indexOf('eventos')>=0){
$('.Einfo').tooltip({offset: [10, 0],effect: 'slide', /*position: "top center",*/ relative: true})
}
$sv=0;
$('ul.eventos li .Etooltip ').css('',function(){
											  $(this).parent().addClass('E_informacion')
											  })
$('ul.eventos li.E_informacion').css('',function(){
    $(this).prepend('<a name="'+ $sv++ +'" class="ofset">')
})

$('ul.Cestreno li').hover(	function(){$('a',this).animate({bottom:0},{queue:false,duration:300})},
							function(){$('a',this).animate({bottom:'-138px'},{queue:false,duration:300})
							})

$("select.Cselect").change(function () {
          var str = "";
          $("select.Cselect option:selected").each(function () {
                str += $(this).val() + " ";
              });
		  top.window.location.href=str
        })

$('#ConCart').height($('#Cbanner').height()+50)

$('ul.CItem li').hover(	function(){$('.CItop',this).animate({bottom:0},{queue:false,duration:300})},
							function(){$('.CItop',this).animate({bottom:'-48px'},{queue:false,duration:300})
							})

if(pathname.indexOf('cartelera')>=0 || pathname.indexOf('pelicula')>=0){
	$('a.Ctri').colorbox({iframe:true, innerWidth:510, innerHeight:470, href:$(this).attr('href')})
}

$('#point-A').hide()
$('#point-B').hide()
$('.abc ul li a.c0').hover(function(){
    $('.abc ul li').removeClass('active')
    $(this).parent().addClass('active')
})
function COORD(x,y,planta){
    $('#point-A').hide()
    $('#point-B').hide()
	planta= planta.toLowerCase()
    if(planta=='baja') Cpoint(x,y,$('#point-B'))
    else if(planta=='alta') Cpoint(x,y,$('#point-A'))
    else if(planta=='ambas' || planta=='exterior') {
        Cpoint(x,y,$('#point-A'))
        Cpoint(x,y,$('#point-B'))
    } 
}
function Cpoint(x,y,id){
    $imgW=0.374
    id.show().css({'left':(x*$imgW)+'px', 'top':(y*$imgW)+'px'})
}


$('#prod_recomendado a').click(function(){
    $hre=$(this).attr('href')
    $.colorbox({href:'galeria.php'+$hre,onComplete:function(){
        $('#galeria .galeria').scrollable({mousewheel: true})
        $('#galeria ul li a').click(function(){
            $imG=$(this).attr('href')
            $('#galeria .imagen span img').fadeOut(function(){
                $(this).attr('src',$imG)
            }).load().fadeIn()
            return false
        })
    }})
    
    return false
})

if(	pathname.indexOf('promociones')>=0 || pathname.indexOf('revista_familia')>=0 || 
	pathname.indexOf('revista_jovenes')>=0 || pathname.indexOf('revista_adultos')>=0)
$('.Cpromo a').colorbox({close: "CERRAR"})

if(pathname.indexOf('directorio')>=0)
{
    $('.abc').accordion({autoHeight: false})
    $('#mdir').scrollFollow({offset: 60});
}
    

if(!$st) $('a.Hevento').hover(	function(){
									$('span',this).animate({bottom:'0px'},{queue:false,duration:300})
									},
								function(){
									$('span',this).animate({bottom:'-68px'},{queue:false,duration:300})
									})
