// js for common frontend layout
jQuery(function() {    
        
    // register newsletter
    $('#newsletter-subscribe').fancybox({
        hideOnContentClick: false,
        titleShow: false,
        href: '/ajax/newsletter-subscribe',
        centerOnScroll: true
    });
    
    jQuery.validator.addMethod("zeroInvalid", function(value, element) 
    {
        if (element.value == 0)
        {
            return false;
        }
        return true;
    });
    
    
    /* fix youtube */
    $("iframe").each(function(){
        var ifr_source = $(this).attr('src');
        var wmode = "wmode=transparent";
        if(ifr_source.indexOf('?') != -1) {
            var getQString = ifr_source.split('?');
            var oldString = getQString[1];
            var newString = getQString[0];
            $(this).attr('src',newString+'?'+wmode+'&'+oldString);
        }
        else $(this).attr('src',ifr_source+'?'+wmode);
    });
    

    $('a.link-blank').click( function() {
        window.open(this.href);
        return false;
    });
    
});
