function popup() {
	var vUrl = document.aPopupSemaine.aDate.options[document.aPopupSemaine.aDate.selectedIndex].value ;
	if (vUrl != "")
	{
		location.href= vUrl ;
	}
}

function browser(type) {
		url = "/browser/index.php?destination=" + type ;
		window.open( url, 'MGZ','status=yes,resizable=yes,scrollbars=yes,height=500,width=700') ;
}

function browser_global()
{
	window.open('/browser/index.php?destination=news', 'MacGameZone', 'status=yes,resizable=yes,scrollbars=yes,height=700,width=700') ;
}

function insertSimpleTag( zoneId, startTag, endTag )
{
	var myField = document.getElementById( zoneId );
	var myValue = '';

	//IE support
	if ( document.selection )
	{
		myField.focus();
		var sel = document.selection.createRange();

		if ( sel.text == '' )
		{
			var text = prompt( "Entrez le texte :", "" );
			myValue = startTag+text+endTag;
		}
		else
		{
			myValue = startTag+sel.text+endTag;
		}

		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if ( myField.selectionStart || myField.selectionStart == '0' )
	{
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;

		if ( startPos == endPos )
		{
			var text = prompt( "Entrez le texte :", "" );
			myValue = startTag+text+endTag;
		}
		else
		{
			myValue =	startTag
			+ myField.value.substring( startPos, endPos )
			+ endTag;
		}

		myField.value =	myField.value.substring( 0, startPos )
		+ myValue
		+ myField.value.substring( endPos, myField.value.length );
	}
	else
	{
		myValue = prompt( "Entrez le texte :", "" );
		myField.value += startTag+myValue+endTag;
	}
	myField.focus();
}

function insertAtCursor( myField, myValue )
{
	//IE support
	if (document.selection)
	{
		myField.focus();
		sel = document.selection.createRange();
		sel.text = myValue;
	}
	//MOZILLA/NETSCAPE support
	else if ( myField.selectionStart || myField.selectionStart == '0' )
	{
		var startPos = myField.selectionStart;
		var endPos = myField.selectionEnd;

		myField.value = myField.value.substring( 0, startPos )
		+ myValue
		+ myField.value.substring(endPos, myField.value.length);
	}
	else
	{
		myField.value += myValue;
	}
	
	myField.focus();
}

/** 
 * Insert a bold tag
 */
function bold( zone )
{
	insertSimpleTag( zone, '*g*', '*/g*' );
}

/** 
 * Insert a italic tag
 */
function italic( zone )
{
	insertSimpleTag( zone, '*i*', '*/i*' );
}

/** 
 * Insert a link tag
 */
function link( zone )
{
	var url = prompt( "Entrez l'url", "http://" );
	if ( url != undefined && url != null && url != '' && url != 'http://' ) {
		insertSimpleTag( zone, '*l*'+url+'*/a*', '*/l*' );
	}
}

function browser2( path, resize, x, y, fixed, id )
{
	var url = "browser/browser.php?path="+path
	url += "&resize="+resize
	url += "&x="+x
	url += "&y="+y
	url += "&fixed="+fixed;
	url += "&id="+id;

	window.open( url, 'MGZ, browser','status=yes,resizable=yes,scrollbars=yes,height=500,width=700');
}

function setPicture( value, id )
{
	var input = parent.parent.opener.document.getElementById( id );
	input.value = value;
	top.close() ;
}


