$(function(){

    var base_url = $("meta[name='DC.url']").attr('content');        
    
    // Cufon
    Cufon.replace('#sidebar ul li a', { hover: true, hoverables: {a:true, li:true, strong:true }, fontFamily: 'avantgarde' });
	Cufon.replace('#sidebar .claim h2', { hover: true, hoverables: {a:true, li:true, strong:true }, fontFamily: 'avantgarde' });
	Cufon.replace('#sidebar .claim p', { hover: true, hoverables: {a:true, li:true, strong:true }, fontFamily: 'avantgarde' });
    
    // Equal heights
    equalHeight($(".columns"));
	equalHeight($(".columns-f1"));
    
    $(".external").attr("target","_blank");

    if($("#btn-samsung").length > 0){
        u=location.href;
        t=document.title;
        furl = base_url + 'img/enlace_samsung.jpg';
        $("#btn-samsung").attr("href", furl).facebox({                      
            ajax        : $("#btn-samsung").attr("href"),
            opacity      : 0.4,
            overlay      : true,
            loadingImage : base_url  + 'img/facebox/loading.gif',
            closeImage   : base_url + 'img/facebox/closelabel.gif'      
        }); 
     } 
    
    // compartir facebook
    $("#btn-facebook").click(function() { 
        u=location.href;
        t=document.title;
        window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');return false;    
    });   
    
    // login campos
    var input_user =  $("#email").val();
    var input_pass =  $("#psw").val();    
    $("#email").focus(function() {if ($(this).val() == input_user) { $(this).val(''); }});
    $("#email").blur(function() {if (! $(this).val().length) { $(this).val(input_user); }});     
    $("#psw").focus(function() { if ( $(this).val() == input_pass) { $(this).val(''); }});
    $("#psw").blur(function() {if (! $(this).val().length) { $(this).val(input_pass); }});  
    
	// Botones
	simpleTristate("#btn1", base_url  + "img/botones/btn1_off.png", base_url  + "img/botones/btn1_on.png", base_url  + "img/botones/btn1_hover.png");
	simpleTristate("#btn2", base_url  + "img/botones/btn2_off.png", base_url  + "img/botones/btn2_on.png", base_url  + "img/botones/btn2_hover.png");
	simpleTristate("#btn3", base_url  + "img/botones/btn3_off.png", base_url  + "img/botones/btn3_on.png", base_url  + "img/botones/btn3_hover.png");
	simpleTristate("#btn4", base_url  + "img/botones/btn4_off.png", base_url  + "img/botones/btn4_on.png", base_url  + "img/botones/btn4_hover.png");
	simpleTristate("#btn5", base_url  + "img/botones/btn5_off.png", base_url  + "img/botones/btn5_on.png", base_url  + "img/botones/btn5_hover.png");
});