/*
 * clairely.com
 * Code (c) Marie Ly & Mikael Grave
 */
 
var pageTracker = null;

function track( path ) {
	if ( !pageTracker ) return;
	path = path.replace( /^https?:\/\/[\w\-\.]+/, '' );
	pageTracker._trackPageview( path );
}

function startLinkTracker() {
  if ( !pageTracker ) return;
  var bodies = document.getElementsByTagName( 'body' );
  if ( !bodies ) return;
  var body = bodies[ 0 ];
  YAHOO.util.Event.addListener( body, 'click', _onClick );

  function _onClick( e, obj ) {
    var target = YAHOO.util.Event.getTarget( e );
    if ( target.tagName.toLowerCase() == "img" && target.parentNode.tagName.toLowerCase() == "a" ) {
	    target = target.parentNode;
    } else if ( target.tagName.toLowerCase() == "a" ) {
	    /* We're good */
    } else {
	    return; /* We ignore the click event */
    }
    var protocol = target.protocol;
    var pathname = target.pathname;
    if ( !pathname.match( /^\// ) ) pathname = '/' + pathname; /* For IE */
    var path = '';
    switch ( protocol ) {
    case 'https:':
    case 'http:':
      if ( target.hostname == document.domain ) {
        /* Internal */
        path = pathname;
        if ( !path.match( /\.(pdf|mp3|doc|ppt|xls|csv|txt|avi|rm|mpeg|mpg|wmv|exe)$/i ) ) return; // Nothing to log
      } else {
        /* External */
        path = '/external/' + target.hostname + pathname;
      }
      break;
    case 'mailto:':
      path = target.href.replace( /^mailto:/i, '/mailto/' );
      break;
    default: return;
    }
    if ( path ) pageTracker._trackPageview( path );
  }
}

function initGallery() {
  var re = /^javascript:zoomPhoto\(\s*'([^']*)'\s*,[\s\d]+,[\s\d]+,\s*'(.*)'\s*\)\s*;?\s*$/;
  $('a[href^=javascript\:zoom]').each( function() {
    var m;
    if ( !( m = re.exec( this.href ) ) ) return;
    this.href    = m[1];
    this.title   = decodeURI( m[2].replace( /\\'/g, "'" ) ); 
    this.gallery = "1";
  });
  $('a[gallery=1]').lightBox( {
    imageBlank:    'http://www.planetezebulon.com/photos/lib/images/lightbox-blank.gif',
    imageLoading:  'http://www.planetezebulon.com/photos/lib/images/lightbox-ico-loading.gif',
	  imageBtnClose: 'http://www.planetezebulon.com/photos/lib/images/lightbox-btn-close.gif',
	  imageBtnPrev:  'http://www.planetezebulon.com/photos/lib/images/lightbox-btn-prev.gif',
	  imageBtnNext:  'http://www.planetezebulon.com/photos/lib/images/lightbox-btn-next.gif'
  } );
}

function zoomPhoto( path, w, h, label ) {
    ww = w + 20;
	wh = h + 60;
    attributes = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width="
	           + ww + ",height=" + wh;
    pm = window.open( "", "jsWindow", attributes );
    pm.document.open();
	pm.document.write(
		  "<html><head><title>Claire Ly - Photos</title></head>"
		+ "<link rel=\"stylesheet\" type=\"text/css\" href=\"" + root_dir + "stylesheet.css\">"
		+ "<body bgcolor=#000000 text=#ffffff link=#999999 vlink=#999999 alink=#ffffff"
		+ "marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>\n"	      
		+ "<div align=\"center\"><img src=\""
		+ path + "\" width=\""
		+ w + "\" height=\""
		+ h + "\"></div><div align=\"center\" class=\"legend\">\n" + label
        + "</div><div align=\"center\"><font face=\"helvetica\" size=\"-2\" color=\"#999999\">[<a href=\"javascript:window.close()\">fermer</a>]</font>"
		+ "</div>\n"
		+ "</body>\n</html>\n" );
        pm.document.close();	
	pm.focus();
	if ( pageTracker ) {
		path.replace( /^[\.\/]+/, '' );
		pageTracker._trackPageview( '/photos/' + path );
	}
}

function rollIn(image_name)
{
  document[image_name].src = eval(image_name + "_on.src");
}

function rollOut(image_name)
{
  document[image_name].src = eval(image_name + "_off.src");
}

<!-- Compute root dir -->
ref_url    = document.getElementById('rd').getAttribute('href');
root_dir   = ref_url.substring( 0, ref_url.indexOf( 's' ) );

<!-- preload rollover images -->
n1_on      = new Image(74,20)
n1_on.src  = root_dir + "img/navbar-auteur-on.gif"
n1_off     = new Image(74,20)
n1_off.src = root_dir + "img/navbar-auteur-off.gif"
n2_on      = new Image(69,20)
n2_on.src  = root_dir + "img/navbar-livres-on.gif"
n2_off     = new Image(69,20)
n2_off.src = root_dir + "img/navbar-livres-off.gif"
n3_on      = new Image(89,20)
n3_on.src  = root_dir + "img/navbar-articles-on.gif"
n3_off     = new Image(89,20)
n3_off.src = root_dir + "img/navbar-articles-off.gif"
n4_on      = new Image(124,20)
n4_on.src  = root_dir + "img/navbar-conferences-on.gif"
n4_off     = new Image(124,20)
n4_off.src = root_dir + "img/navbar-conferences-off.gif"
n5_on      = new Image(71,20)
n5_on.src  = root_dir + "img/navbar-presse-on.gif"
n5_off     = new Image(71,20)
n5_off.src = root_dir + "img/navbar-presse-off.gif"
n6_on      = new Image(102,20)
n6_on.src  = root_dir + "img/navbar-cambodge-on.gif"
n6_off     = new Image(102,20)
n6_off.src = root_dir + "img/navbar-cambodge-off.gif"
n7_on      = new Image(91,20)
n7_on.src  = root_dir + "img/navbar-voyages-on.gif"
n7_off     = new Image(91,20)
n7_off.src = root_dir + "img/navbar-voyages-off.gif"




