  window.close_shadow = Shadowbox.close;    
  var ShadowboxOptions = {
    overlayOpacity: 0.65, 
    noTroubleshooting: true,
    viewportPadding: 0, 
    assetURL: 'http://callback.ncl.com/',
    text: {
	  title: "this is the title",
      cancel: 'Cancel', 
      loading: 'Loading',
      close: '',
      next: '<span class="shortcut">N</span>ext',
      prev: '<span class="shortcut">P</span>revious',
      errors: {
        single: 'You must install the <a href="{0}">{1}</a> browser plugin to view this content.',
        shared: 'You must install both the <a href="{0}">{1}</a> and <a href="{2}">{3}</a> browser plugins to view this content.',
        either: 'You must install either the <a href="{0}">{1}</a> or the <a href="{2}">{3}</a> browser plugin to view this content.'
      }
    }
  };
    
  function has_seen_shadowbox() {
    return YAHOO.util.Cookie.get("seen_modal");
  }  
  
  function isFamilyAndFriends() {
    return (Dom.get("ffAgencyId") != null);
  }  
  
  function shadowbox_link() {
    return Dom.get('modal_link');
  }
  
  function h_ensure_modal_link(type, link,  height, width) {
    if (shadowbox_link()) {
      shadowbox_link().parentNode.removeChild(shadowbox_link());
    }
	
	sb_height = height;
	sb_width  = width;
	sb_rule   = "shadowbox;width="+sb_width+";height="+sb_height+";";
	
    return ce('a', {
        'id': 'modal_link', 
        'rel': sb_rule,
        'href': link,
	    'title': "<img  src='http://callback.ncl.com/images/close.gif' />",
	    'style': 'visibility:hidden'
    }, type, document.body);
  }
  
  function set_shadowbox_expiration(date_to_expire) {    
	var options = {path: "/"};
	if (date_to_expire) { options.expires = date_to_expire; }
  	YAHOO.util.Cookie.set("seen_modal", "true", options);
  }
  
  function create_shadowbox() {
    if(isFamilyAndFriends()){return;}
    if (!shadowbox_link()) {return;} 
    Shadowbox.init(ShadowboxOptions);                      
    Shadowbox.open(Dom.get('modal_link'));
    Evt.onAvailable("shadowbox_title_inner", function(){
	    Evt.on(Dom.get("shadowbox_title_inner"), "click", function(){
		    Shadowbox.close();
	    });
    });
  }

  function form_url_for(form_type) {
  	
	if (form_type == "callback" || form_type == "signup") {
		return 'http://callback.ncl.com/' + form_type + '?no_close=true&ref=' + document.location.href;	
	}else  {
		return window.location.protocol + "//" + window.location.host + "/nclweb/cruiser/cmsPagesPopup.html?pageId=" + form_type;
	}
	}  


  function open_general_window(pageId, height,width ) {
	h_ensure_modal_link('Callback', form_url_for(pageId), height, width);      
    create_shadowbox();
  } 
  

  
