// =========================
// Dominik Fusina : v1.0
// ｩ2005
// =========================
// fonction d'仕itions
// =========================

imagePath="http://www.fusina.net/images/";

function addTags (obj,objInfos,typeTags)
{
// obj : objet du form
// typeTags : nom de la balise
// ---------------------------
// on d四imite la zone de s四ection

	switch(typeTags)
	{
		case "bold":
		//obj.select;
		objInfos.value = "<b></b>";
		//obj.select();
		//obj.focus();
		insertBalise(obj,"<b>","</b>")
		break;
		
		case "italic":
		//obj.select;
		objInfos.value = "<i></i>";
		obj.select();
		obj.focus();
		break;
		
		case "url":
		//obj.select;
		objInfos.value = "<a href='http://'>votre lien</a>";
		obj.select();
		obj.focus();
		break;
		
		case "image":
		//obj.select;
		objInfos.value = "<img src='"+imagePath+"' border=0 align='left'>";
		obj.select();
		obj.focus();
		break;
		
		case "retour":
		//obj.select;
		objInfos.value = "<br>";
		obj.select();
		obj.focus();
		break;
		
		case "paragraphe":
		//obj.select;
		objInfos.value = "[**]";
		obj.select();
		obj.focus();
		break;
		
		default:
		alert("Erreur");
		break;
	}
}

function insertBalise(obj,tagStart,tagEnd)
{
	var textedebut = obj.value.substring(0,obj.selectionStart);
    var textefin = obj.value.substring(obj.selectionEnd, obj.value.length);
    var texteSelection = obj.value.substring(obj.selectionStart, obj.selectionEnd);
    obj.value = textedebut + tagStart + texteSelection + tagEnd + textefin;
}


function pasteImgUrl(obj)
{
	formName = obj.form;
	//alert("coucou");
	//formName.imgLink_result.select;
	lien = obj.options[obj.selectedIndex].text;
	formName.imgLink_result.value = "<img src='/pictImport/"+lien+"' border='0'>";
	formName.imgLink_result.select();
	formName.imgLink_result.focus();
}


function showPict(pict)
{
	// t四残hargement de l'image
	//zoom = new Image();
	//zoom.src = pict;
	//larg = zoom.width;
	//haut = zoom.height;
	//alert(larg+"/"+haut);
	//if(larg>=600)larg=600;
	//if(haut>=600)haut=600;
	larg = 600;
	haut = 500;
	objWind = window.open(pict,"Zoom","scrollbars=true,status=true,toolbar=false,width="+larg+",height="+haut);
	//objWind.title = pict;
}