/****************************************************************/
/*							                                    */
/*					FONCTIONS javascript						*/
/*			Detection des parametres necessaires                */
/****************************************************************/


/* Présence du flash >=6 */
function detectFlash()
{
	FlashMode = 0;
	if (navigator.plugins && navigator.plugins.length > 0)
	{
		if (navigator.plugins["Shockwave Flash"])
		{
			var plugin_version = "";
			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;
					}
				}
			}
		}
	}
	if (window.ActiveXObject)
	{
	    try
	    {
	       for (j = 6; oQTime=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.'+j); j++)
		   {
				FlashMode = 1;
				plugin_version=j
			}
	    }
		
	    catch(e) {}
		}
	do_dw_var = FlashMode;
	browser_flash_version = plugin_version;
	//alert(browser_flash_version);
	
	return {mode:do_dw_var, version:browser_flash_version}
}

/* cookies */
function setCookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );
  
  if ( secure )
        cookie_string += "; secure";
  
  document.cookie = cookie_string;
}

function getCookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}

function isCookiesOK()
{
	// TEST
	var testCookieName   = 'testCookies';
	var testCookieValue  = 'cookieOK';
	setCookie(testCookieName, testCookieValue);
	
	val = getCookie(testCookieName);
	
	return testCookieValue == getCookie(testCookieName);
}


// cookie pour empecher le test 
function setCookBypass() {
	var name = 'm6_replay_test';
	var value = 'bypasstest';
	var days = 7;
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";	
}

/* Navigateur */

function cherche_navigateur() {
var nav = false;
if ((navigator.userAgent.indexOf("MSIE 6") != -1) || (navigator.userAgent.indexOf("MSIE 7") != -1) || (navigator.userAgent.indexOf("Firefox") != -1) || (navigator.userAgent.indexOf("Safari") != -1))
{
nav =  true;
}
}
/* Résolution */


/* plugins xls / pdf */
