/**
 *																-tab-size = 3;	-enc = utf-8
 *	
 *	js/cosmetics.js
 *	-----------------------------------------------------------------------------
 *	This file is part of the www.idea-recherche.com's design.
 *	Last Modif.: 2007-01
 *	-----------------------------------------------------------------------------
 *	(c) Copyright 2007 Fabrice Luraine / sofa-design.net.
 *	All Rights Reserved.
 *	-----------------------------------------------------------------------------  
 */

//	DomLoaded
//	--
//	© copyright 2005, Dean Edwards / Rob Cherny
//	http://www.cherny.com/webdev/27/domloaded-updated-again
//
//	use: DomLoaded.load(func) to add a function to run when dom is loaded
//


var DomLoaded =
{
	onload: [],
	loaded: function()
	{
		if (arguments.callee.done) return;
		arguments.callee.done = true;
		for (i = 0;i < DomLoaded.onload.length;i++) DomLoaded.onload[i]();
	},
	load: function(fireThis)
	{
		this.onload.push(fireThis);
		if (document.addEventListener) 
			document.addEventListener("DOMContentLoaded", DomLoaded.loaded, null);
		if (/KHTML|WebKit/i.test(navigator.userAgent))
		{ 
			var _timer = setInterval(function()
			{
				if (/loaded|complete/.test(document.readyState))
				{
					clearInterval(_timer);
					delete _timer;
					DomLoaded.loaded();
				}
			}, 10);
		}
		/*@cc_on @*/
		/*@if (@_win32)
		var proto = "src='javascript:void(0)'";
		if (location.protocol == "https:") proto = "src=//0";
		document.write("<scr"+"ipt id=__ie_onload defer " + proto + "><\/scr"+"ipt>");
		var script = document.getElementById("__ie_onload");
		script.onreadystatechange = function() {
		    if (this.readyState == "complete") {
		        DomLoaded.loaded();
		    }
		};
		/*@end @*/
	   window.onload = DomLoaded.loaded;
	}
};


//
// Open external links in a new window
//
function changeExtLinks()
{
	var as,i,islink;
	as=document.getElementsByTagName('a');
	for(i=0;i<as.length;i++){
		islink=as[i].href;
		if(islink.indexOf(window.location.hostname)==-1 &&
		   islink.indexOf("javascript:")==-1 && 
		   islink.indexOf("mailto:")==-1)
		{
			as[i].title += ' ('+islink+')';
			as[i].onclick = function(){
									window.open(this.href,'newwin','');
									return false;
								 };
			as[i].onkeypress = as[i].onclick;
		}
	}
}

//
// execute changeExtLinks when DOM is ready
//
DomLoaded.load(changeExtLinks);




