FSI.utils = (function(){
    var setObjectCreate = function(){
        if (typeof Object.create !== 'function') {
                Object.create = function (o) {
                function F() {}
                F.prototype = o;
                return new F();
            };
        } 
    };
    var setTargetBlank = function(){
       $('.blank').click(function(e){
            e.stopPropagation();
            window.open($(this).attr('href'));
            return false;
        });
    };
    var setIndexOf = function(){

        if(typeof Array.indexOf !== 'function'){
            Array.indexOf = function(item){
                $.each(this,function(i){if(item == this){return i;}});
            };
        }
    };
    return{
        init:function(){
            setObjectCreate(); // if there isn't an Object.create, then make one...
            setTargetBlank(); // allows us to use class="blank" instead of the deprecated target="blank"
            setIndexOf();
        }
    };
}()); 


FSI.StarSafetyModal = (function(){ // a very specific modal - it creates a more general modal inside itself
    var modal;
    var setup = function(){
        modal = TPM.UI.Modal.create({trigger:'.btn_inline_plus',target:'#modal_content_container'}); // allow StarSafetyModal to be responsible for making the modal...
        addListeners();
    };
    var addListeners = function(){
        $('.content_triggers li').click(function(){
            var id = $(this).attr('id');
            $('.content_triggers li').removeClass('active');
            $(this).addClass('active');
            $('.wrap_primary div').hide();
            $('.wrap_primary div#'+id+'_content').show();
            /* not sure why (or where) these are hidden below - if you can find it,then these two lines can be removed */ 
            $('.wrap_primary div#'+id+'_content div').show();
            $('.wrap_primary div#'+id+'_content object').css({display:'block'});
            return false;
        });
        $('.btn_inline_plus').click(function(){
            var cls = $(this).attr('rel');
            $("."+cls).click();
            return false;
        });
        if(TPM.Browser.is("iphone safari")){
            $('.star_safety_modal_link').css({"display":"none"});
        }
        
        
    };
    return{
        init:function(){
            setup();
        }
    };
}());


