/*------------------------------------------------
|             Clair et Net. © 2007                |
--------------------------------------------------*/
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function insertSymbol(id, str) {

	var ele = document.getElementById(id);

	if (document.selection) {
		ele.focus();
		sel = document.selection.createRange();
		sel.text = str;
	} else if (ele.selectionStart || ele.selectionStart == '0') {
		var startPos = ele.selectionStart;
		var endPos = ele.selectionEnd;
		ele.value = ele.value.substring(0, startPos)+ str + ele.value.substring(endPos, ele.value.length);
	} else {
		ele.value += str;
	}
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
function getCaretPosition (ctrl) {
	var CaretPos = 0;
	// IE Support
	if (document.selection) {
		ctrl.focus ();
		var Sel = document.selection.createRange ();
		Sel.moveStart ('character', -ctrl.value.length);
		CaretPos = Sel.text.length;
	} else if (ctrl.selectionStart || ctrl.selectionStart == '0'){
		CaretPos = ctrl.selectionStart;
	}
	return (CaretPos);
}

function setCaretPosition(ctrl, pos) {
	if(ctrl.setSelectionRange) {
		ctrl.focus();
		ctrl.setSelectionRange(pos,pos);
	} else if (ctrl.createTextRange) {
		var range = ctrl.createTextRange();
		range.collapse(true);
		range.moveEnd('character', pos);
		range.moveStart('character', pos);
		range.select();
	}
}
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
//PATCH getEelementById
if (!document.getElementById) {
	if (document.all)
		document.getElementById=function() {
		if ( typeof(document.all[arguments[0]]) != "undefined")
			return document.all[arguments[0]];
		else
			return null;
		}
	else if (document.layers)
		document.getElementById=function() {
			if ( typeof(document[arguments[0]]) != "undefined")
				return document[arguments[0]];
			else
				return null;
	}
}

function sendFriend(){
	href = window.location;
	html = '<a href="mailto:?body='+href+'" class="ami">Envoyer à un ami</a>';
	document.write(html);	
}




/*
function favoris() {
	if (navigator.appName != 'Microsoft Internet Explorer'){
		window.sidebar.addPanel("NomSite",window.location.href,"");
	}else{
		window.external.AddFavorite(window.location.href,"NomSite");
	}
}
*/

/*
function PopUp(url,largeur,hauteur,option) {
	if(!option){
		option="toolbar=0,location=0,directories=0,status=0,scrollbars=0,resizable=0,menubar=0";
	}
	t=(window.screen.height-hauteur)/2;
	l=(window.screen.width-largeur)/2;
	window.open(url, "MC", "top="+t+",left="+l+",width="+largeur+",height="+hauteur+","+option);
}
*/


/*
function changeURL(args){
	url = window.location.href;
	url = url.split("#");
	newUrl = url[0] + "#" + args;
	window.location.href = newUrl;
	document.title = "Mon site :: " + args;
}
*/


/*
////////////////////////////////////////////////////////////////////////////
// SCROLLBARS pour FLASH 100%                                             //
////////////////////////////////////////////////////////////////////////////
// pour afficher une zone flash minimum
// et ajouter des scrollbars si besoin
////////////////////////////////////////////////////////////////////////////

window.onload = resizeFlash;
window.onresize = resizeFlash;

largeurFlash = 950;
hauteurFlash = 600;

function resizeFlash(){
	w = document.body.scrollWidth;
	h = document.body.scrollHeight;
	if(w < largeurFlash){
		w = largeurFlash + "px";
	}else{
		w = "100%";
	}
	if(h < hauteurFlash){
		h = hauteurFlash + "px";
	}else{
		h = "100%";
	}
	document.getElementById("bodyInner").style.width = w;
	document.getElementById("bodyInner").style.height = h;

	if(w == "100%" && h == "100%"){
		document.body.style.overflow = "hidden";
	}else{
		document.body.style.overflow = "scroll";
	}
}
////////////////////////////////////////////////////////////////////////////
*/

/*
window.onload = patchFooter;
function patchFooter(){
	if(navigator.userAgent.indexOf("Safari")!=-1){
		//patch pour SAFARI
		//alert("Vous utilisez Safari !!!");
	}else{
		document.getElementById("foot").style.position = "absolute";
		document.getElementById("foot").style.bottom = "1px";
		document.getElementById("foot").style.bottom = "0px";
	}
}
*/

/*
//PATCH FOOTER

function getWindowHeight() {
	var windowHeight = 0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	}
	else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		}
		else {
			if (document.body && document.body.clientHeight) {
				windowHeight = document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function setFooter() {
	if (document.getElementById) {
		var windowHeight = getWindowHeight();
		//alert("windowHeight : " + windowHeight);
		if (windowHeight > 0) {
			var contentHeight = document.getElementById('bodyInner').offsetHeight;
			//alert("contentHeight : " + contentHeight);
			var footerElement = document.getElementById('foot');
			var footerHeight  = footerElement.offsetHeight;
			footerElement.style.top = (contentHeight - (footerHeight)) + 'px';
		}
	}
}
window.onload = function() {
	setFooter();
}
window.onresize = function() {
	setFooter();
}

*/
