// JavaScript Document

/*
function encodeEmail(email) { 
	// CETTE FONCTION VA ENCODER L ADRESSE EMAIL
	var result=""; 
	var len= email.length; 
	for(var x=0;x<len;x++) { 
		$ord=ord(substr(email,x,1)); 
		result.="&#$ord;"; 
	} 
	return result; 
}
*/


// onload="openBottomRightWindow('http://www.asmaart.com/popup.html', 'popup', 400, 630, 0, 0, 0, 0, 0, '', '')"
function openWindow(src,name,width, height, screenx, screeny, scrollbar, resize, toolbar, status, menubar, location, directories) {
	var size, pos;
	size = '';
	pos = '';
	if (width > 0)		size = ',width='+width;
	if (height > 0)		size = size + ',height='+height;
	if (screenx >= 0)	pos = ',screenX='+screenx+',left='+screenx;
	if (screeny >= 0)	pos = pos + ',screenY='+screeny+',top='+screeny;
	scrollbar = (scrollbar == 1)?'yes':'no';
	resize = (resize == 1)?'yes':'no';
	toolbar = (toolbar == 1)?'yes':'no';
	status = (status == 1)?'yes':'no';
	menubar = (menubar == 1)?'yes':'no';
	location = (location == 1)?'yes':'no';
	directories = (directories == 1)?'yes':'no';
	//Ouverture de la pop-up
	var popUpWindow = window.open(src, name,'scrollbars='+scrollbar+',resizable='+resize+',toolbar='+toolbar+',status='+status+',menubar='+menubar+',location='+location+',directories='+directories+size+pos);
	popUpWindow.focus();
	return popUpWindow;
}



function openCenteredWindow(src,name,width, height, scrollbar, resize, toolbar, status, menubar, location, directories) {
	var posx = (screen.width - width) / 2;
	var posy = (screen.height - height) / 2;

	return openWindow(src, name, width, height, posx, posy, scrollbar, resize, toolbar, status, menubar, location, directories);
}

function openBottomRightWindow(src,name,width, height, scrollbar, resize, toolbar, status, menubar, location, directories) {
	var hmargin = 20;
	var vmargin = 100;
	var posx = screen.width - width - hmargin;
	var posy = screen.height - height - vmargin;

	return openWindow(src, name, width, height, posx, posy, scrollbar, resize, toolbar, status, menubar, location, directories);
}


// D'autres scripts et des tutoriaux sur http://www.toutjavascript.com
function autoFitPopupImage(title, img, name, screenx, screeny, scrollbar, resize, toolbar, status, menubar, location, directories) {

	var w = openWindow("", name, 400, 400, screenx, screeny, scrollbar, resize, toolbar, status, menubar, location, directories);
	
	w.document.write("<HTML><HEAD><TITLE>"+title+"</TITLE></HEAD>");
	w.document.write("<SCRIPT language=javascript>function checksize()  { if (document.images[0].complete) {  window.resizeTo(document.images[0].width+12,document.images[0].height+30); window.focus();} else { setTimeout('check()',250) } }</"+"SCRIPT>");
	w.document.write("<BODY onload='checksize()' leftMargin=0 topMargin=0 marginwidth=0 marginheight=0><IMG src='"+img+"' border=0>");
	w.document.write("");
	w.document.write("</BODY></HTML>");
	w.document.close();
}
