/*
	Copyright © 2006, JFG Networks, All rights reserved
*/

// JavaScript Document

function jfg_addCss(basePath) {
	
 	var legals= document.getElementById('legals');
	legals.style.display='block';
	legals.style.visibility='visible';
	legals.style.height='auto';
	legals.style.width='auto';
	
	var text = '<style type="text/css">'
	+ '@import "'+basePath+'legals.css";'
	+ '</style>';
	document.write(text);
}
function load_comment_fck(){
	oFCKeditor = new FCKeditor( 'Texte' ) ;
	oFCKeditor.BasePath = basePath+'fckeditor/';
	oFCKeditor.ToolbarSet = 'Comments' ;
	oFCKeditor.Width = 600;
	oFCKeditor.Height = 600;
	oFCKeditor.ReplaceTextarea() ;	
}

function load_trackback_fck(){
	oFCKeditor = new FCKeditor( 'text' ) ;
	oFCKeditor.BasePath = basePath+'fckeditor/';
	oFCKeditor.ToolbarSet = 'Comments' ;
	oFCKeditor.Width = 600;
	oFCKeditor.Height = 600;
	oFCKeditor.ReplaceTextarea() ;	
}

function quitte(){
	if(window.opener){
		window.close();
		RetParam = false;
	}else{
		RetParam = true;
	}
}


function addOnloadEvent(func) {
	var onld= window.onload;
	if (onld) {
		window.onload = function() {
			onld();
			func();
		}
	} else {
		window.onload = func;
	}
}


rewriteLinks = function() {
	var elmts = document.body.getElementsByTagName('*');
	for (var i = 0; elmts[i]; i++) {
		var className = elmts[i].getAttribute('class')?elmts[i].getAttribute('class'):elmts[i].getAttribute('className');
		
		if(typeof(className) == 'string'){
			var classNames = className.split(' ');
			for (var j = 0; classNames[j]; j++) {
				

				if (classNames[j] == 'newWindow') {
					elmts[i].onclick = function() {
						window.open(this);
						return false;
					}
				}

				if (classNames[j] == 'closeWindow') {
					elmts[i].onclick = function() {
						window.close();
					}
				}
				
			}
		}
	}
}
addOnloadEvent(rewriteLinks);

