// Initialize sIFR
if (typeof sIFR == "function"){
    sIFR.replaceElement("#intro h1", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#ffffff", sWmode: "transparent", nPaddingTop: "30"}))
    sIFR.replaceElement("#home #intro h1", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#ffffff", sWmode: "transparent"}))
    sIFR.replaceElement("#intro p.sifr", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#000000", sWmode: "transparent"}))
    sIFR.replaceElement("#intro p.bill", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#ffffff", sWmode: "transparent"}))
	sIFR.replaceElement("#home #content h2.black", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#000000", sWmode: "transparent", nPaddingTop: "18"}))	
    sIFR.replaceElement("#home #content h2", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#FF3C00", sWmode: "transparent", nPaddingTop: "18"}))
	sIFR.replaceElement("#content .meeting h2", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#000000", sWmode: "transparent"}))
    sIFR.replaceElement("#content h2.portfolio", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#333333", sWmode: "transparent"}))
    sIFR.replaceElement("#content h2", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#FF3C00", sWmode: "transparent"}))
	sIFR.replaceElement(".article h3", named({sFlashSrc: "/images/fonts/lucida.swf", sColor: "#FF3C00", sWmode: "transparent"}))
}


// LIBRARIES

// Open Links in new window 
function initOpenInNewWindow() {
  
  if(!document.getElementsByTagName) {
    return;
  }
  var links = document.getElementsByTagName('a');
  
  for(var i=0; i < links.length; i++) {
      if (cssjs('check', links[i], 'new-window')) {
          links[i].onclick = openInNewWindow;
      }
  }
}


// Create the new window
function openInNewWindow() {
  var newWindow = window.open(this.getAttribute('href'), '_blank');
  newWindow.focus();
  return false;
}


// Cross-browser event handling for IE5+, NS6 and Mozilla 
// By John Resig 
function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
 }	else if (obj.attachEvent)	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

// Applying classes via Javascript
// http://www.onlinetools.org/articles/unobtrusivejavascript/cssjsseparation.html
function cssjs(a,o,c1,c2) {
  switch (a) {
    case 'swap':
      o.className=!cssjs('check',o,c1)?o.className.replace(c2,c1):o.className.replace(c1,c2);
    break;
    case 'add':
      if(!cssjs('check',o,c1)){o.className+=o.className?' '+c1:c1;}
    break;
    case 'remove':
      var rep=o.className.match(' '+c1)?' '+c1:c1;
      o.className=o.className.replace(rep,'');
    break;
    case 'check':
      return new RegExp('\\b'+c1+'\\b').test(o.className)
    break;
  }
}

// ADD EVENT HANDLERS
addEvent(window, 'load', initOpenInNewWindow);
