addExplorerHook ( "topFlash_FSCommand", "topFlash_DoFSCommand" )	;
function topFlash_DoFSCommand ( command, paramValue ) {
	if ( command == "movieClip" ) {
		if ( document.getElementById("leftFlash") ) {
			window.document.leftFlash.TGotoFrame ( "/", 2 )	;
			window.document.leftFlash.TPlay ( "/" )	;
		}
	}
}

var FlashMode = 0;
if (navigator.plugins && navigator.plugins.length > 0)
{
        if (navigator.plugins["Shockwave Flash"])
        {
                var plugin_version = 0;
                var words = navigator.plugins["Shockwave Flash"].description.split(" ");

                for (var i = 0; i < words.length; ++i)
                {
                        if (isNaN(parseInt(words[i])))
                        continue;
                        plugin_version = words[i];
                }
                if (plugin_version >= 6)
                {
                        var plugin = navigator.plugins["Shockwave Flash"];
                        var numTypes = plugin.length;
                        for (j = 0; j < numTypes; j++) 
                        {
                                mimetype = plugin[j];
                                if (mimetype)
                                {
                                        if (mimetype.enabledPlugin && (mimetype.suffixes.indexOf("swf") != -1))
                                                FlashMode = 1;
                                        // Mac wierdness
                                        if (navigator.mimeTypes["application/x-shockwave-flash"] == null)
                                                FlashMode = 0;
                                }
                        }
                }
        }
}

function addExplorerHook ( fNameVB, fNameJS ) {
	if ( navigator.appName && navigator.appName.indexOf("Microsoft") != -1 
		&& navigator.userAgent.indexOf("Windows") != -1 
		&& navigator.userAgent.indexOf("Windows 3.1") == -1) {
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('  On Error Resume Next \n');
		document.write('  Sub ' + fNameVB + '(ByVal command, ByVal paramValue)\n');
		document.write('    Call ' + fNameJS + '(command, paramValue)\n');
		document.write('  End Sub\n');
		document.write('</SCRIPT\> \n');
	}
}



function insertSWFTop ( movieURL, strParams, width, height , name, animName, XMLURL ) {
	var strHTML														;
	var transparency = ""											;
	var anime = 0													;
	var date_exp = new Date()										;
	var loc = window.location.href									;
	var domaine= ( loc.substring(loc.indexOf("LINK=",0)) )			;
	var filedomaine=  domaine.substring(0,domaine.indexOf("&",0)) ;

	domaine=filedomaine.substring(filedomaine.indexOf("=",0)+1) 	;
//	anime = getCookie(escape("AnimeFlash"+domaine+"_"+animName) )		;
	anime = getCookie(escape("AnimeFlash"+animName+name) )		;
	if ( anime == "" ) anim = 1										;
	else anim= 0													;
//	alert ( anim );

	strParams += "&strNavigator="+navigator.appName					;
	strParams += "&strPlatform="+navigator.platform					;
	strParams += "&isAnimated="+anim								;
	strParams += "&dataXMLURL="+XMLURL								;

	strHTML = '<OBJECT name='+name+' id='+name+' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
			+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" '
			+ ' WIDTH="'+width+'" HEIGHT="'+height+'">'
			+ '<PARAM name=movie VALUE="'+movieURL+'?'+strParams+'">'
			+ '<PARAM NAME=FlashVars VALUE="'+strParams+'" />'	;
	strHTML+= '<PARAM name=quality VALUE=high />';

//	strHTML="";
//	FlashMode=0;
	if (FlashMode == 1) {
		strHTML += '<embed src="'+movieURL+'?'+strParams+'" quality=high '
				+ '    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" '
				+ '    type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">'
				+ '</embed>' ;
	} else {
		if ( name == "topFlash") {
			strHTML += '<img src="/gonesse/images/topBarre.gif" width="750" height="100" border="0" usemap="#Map">';
			strHTML += '<map name="Map"><area shape="rect" coords="1,25,128,95" href="index.php"><area shape="poly" coords="496,42,503,62,580,43,573,30" href="index.php?LINK=indexQuartiers&ID_TOPIC=0"><area shape="poly" coords="596,34,593,51,726,66,724,50" href="/index.php?LINK=indexTravailler&ID_TOPIC=0"><area shape="poly" coords="407,70,425,81,493,28,469,23" href="index.php?LINK=index&ID_TOPIC=0"></map>';
		}
		if ( name == "leftFlash" ) {
			domaine = XMLURL;
			filedomaine=  domaine.substring(0,domaine.indexOf("%2E",0)) ;
			domaine=filedomaine.substring(filedomaine.indexOf("%2Fxml%2F",0)+9) 	;
			strHTML += '<script language="javascript" src="/gonesse/scripts/'+domaine+'.js"></script>';
		}
	}
	strHTML +=	 '</OBJECT>'											;
	document.write ( strHTML )										;
	SetCookie( "AnimeFlash"+animName+name, 1)					;
//	SetCookie( "AnimeFlash"+domaine+"_"+animName, 1)					;
}


function insertSWF( movieURL, strParams, width, height, name, embedParms ) {
	var strHTML	;
	var transparency = ""	;

	strParams += "&strNavigator="+navigator.appName		;
	strParams += "&strPlatform="+navigator.platform		;
	strHTML = '<OBJECT name='+name+' id='+name+' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
			+ ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" '
			+ ' WIDTH="'+width+'" HEIGHT="'+height+'">'
			+ '<PARAM name=movie VALUE="'+movieURL+'?'+strParams+'">'
			+ '<PARAM NAME=FlashVars VALUE="'+strParams+'" />'	;
	strHTML+= '<PARAM name=quality VALUE=high />';

	if (FlashMode == 1) {
		strHTML += '<embed  src="'+movieURL+'?'+strParams+'" quality=high '
				+ '    pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" '
				+ '    type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">';
				if ( navigator.appName.substr(0,2)=="Mi") strHTML += embedParms;
				strHTML += '</embed>' 
				+ '<noembed>'
				+  embedParms 
				+ '</noembed>';
	} else {
		strHTML += embedParms;
	}
	strHTML += '</OBJECT>'		;
	document.write ( strHTML )	;
}

function getCookie( sc ) { 
var cn									;
var cv = ""								;
var ch = ""								;
var ac = document.cookie.split(";")		;

	for(var i=0;i<ac.length;i++){
		ch = ac[i].split("=")[0]		;
		ch = ch.replace( " ","" );
		if ( ch == sc )  {
			cv=ac[i].split("=")[1];
			break;
		}
	}
	return unescape(cv.replace(/tspSpace/g," "));
}



function SetCookie (name, value) {
	var argv=SetCookie.arguments;
	var argc=SetCookie.arguments.length;
	var expires=(argc > 2) ? argv[2] : null;
	var path=(argc > 3) ? argv[3] : null;
	var domain=(argc > 4) ? argv[4] : null;
	var secure=(argc > 5) ? argv[5] : false;
	document.cookie=name+"="+escape(value)+
		((expires==null) ? "" : ("; expires="+expires.toGMTString()))+
		((path==null) ? "" : ("; path="+path))+
		((domain==null) ? "" : ("; domain="+domain))+
		((secure==true) ? "; secure" : "");
}
