/*
   Example:
   onclick="initFancybox(false,'example.fbox.html')"
*/
function initFancybox(selector,href, optsExtend) {
  var opts = {
    'type'            : 'ajax',
    'padding'		      : 0,
    'transitionIn'	  : 'none',
    'transitionOut'	  : 'none',
    "margin"	        : 0,
    "scrolling"       : "auto",
    "autoScale"	      : false,
    "autoDimensions"  :  false,
    "width"           : 500,
    "height"          : "90%",
    "overlayOpacity"  : 0.26,
    "overlayColor"    : "#373737",
    "titleShow"       : false,
    "showCloseButton" : true,
    "showNavArrows"   : false,
    "overlayShow"     : true/*,
    "onComplete"      : function() {
      initFancybox(".fbox .fboxLink");
      $(".fboxDialogTabs").tabs("div.fboxDialogPanes > div", {tabs: 'li'});
    }*/
  };
  if (typeof selector == "undefined" ) {
    var selector = ".fboxLink";
  } else if ( selector == false) {
    var selector = ".fboxLink";
  }

  if ( typeof optsExtend !== "undefined" ) {
    
    if ( typeof optsExtend.width !== "undefined" ) {
      optsExtend.autoDimensions = false;
    }

    jQuery.extend( opts, optsExtend );
  }

  if (typeof href !== "undefined" ) {
    if ( href !== false ) {
      jQuery.extend(opts, {'href':href});
    } else { 
      delete(opts.type);
    }
    opts.href = false;
    $.fancybox(opts);
  } else {
    $(selector).fancybox(opts);
  }

  return false;
}
initFancybox();
 
