jQassinter = {}; 

// caricamento css

jQassinter.Css = {
    load   : function(options){
    	if(options.constructor === String)
    		var _options = {url : options, media : "screen"};
    	else
    		var _options = jQuery.extend({media : "screen"}, options);
    	
    	jQuery('head').append('<link type="text/css" href="'+_options.url+'" rel="stylesheet" media="'+_options.media+'" />'); 
    }
};

jQuery.fn.loadcss = jQassinter.Css.load;

// voce menu "home"

jQuery(document).ready(function(){
    var _li = jQuery("ul#mainlevel-nav > li");
    if(_li.eq(0)){
        _li.eq(0).addClass("home");
    }
});

// apertura finestre

jQassinter.Apri = {
    build   : function(options)
    {
    	
    	var _options = jQuery.extend({
    	   message     : "Attenzione: questo link si apre in una nuova finestra",
	       toolbar     : "no",
           location    : "no",
           directories : "no",
           status      : "no",
           menuBar     : "no",
           scrollbars  : "yes",
           resizable   : "yes",
           width       : 400,
           height      : 300,
           top         : false,
           left        : false,
           screenX     : false,
           screenY     : false
    	}, options);
    	
        return this.each(function(nr){
                var _prop = '';
                for (_option in _options)
                    if (_options[_option])
                        _prop += _option + "=" + _options[_option] + ",";
                
                var that = this;
                var _j = jQuery(that);
                var _t = _j.attr("title") ? _j.attr("title") : _j.text();  
                _j.attr("title", _t + " - " + _options.message);

			    var _href = _j.attr("href");
			    _j.click(function () {window.open(_href, '_blank', _prop); return false;});
         });
    }
};
   
jQuery.fn.apri = jQassinter.Apri.build;

// autoload

jQuery(document).ready(function(){
  jQuery("a.esterno").apri({toolbar : "yes", location : "yes", directories : "yes", status : "yes", menuBar : "yes", scrollbars : "yes", resizable : "yes", width : 800, height : 600, top : 0, left : 0});
});
