

	function $(v)	{ return (document.getElementById(v)); }



	function getEventSrc(e)
		{
		return window.event?window.event.srcElement:e.target; 
		}



	function CancelEvent(e)
		{
		if ((typeof(e			)=="undefined")
		 && (typeof(window.event)!="undefined"))
			{
			e = window.event;
			}

		if (typeof(window.event)!="undefined")
			{
			e.cancelBubble=true;		// IE		
			}
		  else
			{
			e.stopPropagation();		// Firefox	
			}
		}



	function AjaxCreate()
		{
		try	{return new XMLHttpRequest();					}	catch(e) {}
		try	{return new ActiveXObject ("MSXML2.XMLHTTP"	  );}	catch(e) {}
		try	{return new ActiveXObject ("Microsoft.XMLHTTP");}	catch(e) {}
			 return false ;
		}



	function AjaxExecute (url, data, funct)
		{
		var xhr = AjaxCreate();

		xhr.onreadystatechange=function()
			{
			if ((xhr.readyState==  4)
			  &&(xhr.status	   ==200))
				{
			//	alert(xhr.responseText)		////////////////
				funct (xhr.responseText);
				}
			};

		xhr.open("POST",url,true);
		xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
		xhr.send(data);
		}


	function AjaxDummy (data)	{}





	function ltrim(s)	{ return s.replace(/^\s*/,"");	}
	function rtrim(s)	{ return s.replace(/\s*$/,"");	}
	function trim(s)	{ return rtrim(ltrim(s));		}




	function setFavorite (iURL,iTitle)
		{
		if (navigator.appVersion.indexOf("Mac",0)>0)
			{
			alert("This function is not available on Macintosh.\n\nUse instead the key combination \"Apple-D\".");
//			alert("Cette fonction n\'est pas disponible sur Macintosh.\n\nUtilisez plutôt la combinaison de touches \"Pomme-D\".");
			return;
			}


		if ((navigator.appName.indexOf("Microsoft",0)>=0) && (parseInt(navigator.appVersion)>=4))
			{
			window.external.AddFavorite (iURL,iTitle);
			}
		  else
			{
			alert("This function is only available on Internet Explorer.\n\nFor Netscape, you can use instead the key combination \"Control-D\".");
//			alert("Cette fonction n'est disponible que pour Internet Explorer 4 et +.\n\nPour Netscape, utilisez plutôt la combinaison de touches \"Control-D\".");
			}
		}




	function showHelp(iShow)
		{
		$('help').style.display = (iShow?'block':'none');
		return false;
		}





//																					
//	Project Functions																
//																					





function on_load(i)
	{
	set_sound(i);
	}


function set_sound(i)
	{
	document.getElementById('bg_sound').src		  = (i==1?bg_sound_src:'inc/no-sound.mid');
	document.getElementById('save_var').src       = 'http://e-pla.net/save_var.gif.php?sound='+i;
	document.getElementById('sound'   ).innerHTML = '<a href="#" onclick="set_sound('+((i==1)?0:1)+'); return false;">'+((i==1)?'No sound':'Sound')+'<\/a>';
	}






