// JavaScript Document

// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;
// -----------------------------------------------------------------------------
var FORM_ADDRESS = 0x01;
var FORM_MESSAGE = 0x02;
var FORM_NEWSLETTER = 0x04;

function formDisplay(spotsDir,height,width,siteCode,form_blocks,topic,ret_url,swfStyleFile,bgColor) {
	<!--
	var resa_url;
	if (siteCode.indexOf('_DEBUG') != -1) {
		siteCode = siteCode.substr(0,siteCode.indexOf('_DEBUG'));
		resa_url = 'http://localhost/'+siteCode+'/';
	} else {
		resa_url = 'http://'+siteCode+'.resabase.com';
	}
	// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
	var hasProductInstall = DetectFlashVer(6, 0, 65);

	// Version check based upon the values defined in globals
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	if ( hasProductInstall && !hasRequestedVersion ) {
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;

		AC_FL_RunContent(
		"src", spotsDir+"/forms/playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "100%",
		"height", "480px",
		"align", "middle",
		"id", "Formulaire",
		"quality", "high",
		"bgcolor", "#869ca7",
		"name", "Formulaire",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else if (hasRequestedVersion) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
		AC_FL_RunContent(
		"src", spotsDir+"/forms/Formulaire",
		"flashVars", "RESA_URL="+resa_url+"&RESA_FORM_BLOCKS="+form_blocks+"&TOPIC="+topic+"&RESA_RETURN_URL="+ret_url+"&RESA_FORM_STYLE="+swfStyleFile,
		"width", width,
		"height", height,
		"align", "middle",
		"id", "Formulaire",
		"quality", "high",
		"bgcolor", bgColor,
		"name", "Formulaire",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else {  // flash is too old or we can't detect the plugin
		var alternateContent = 'Alternate HTML content should be placed here. '
		+ 'This content requires the Adobe Flash Player. '
		+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
		document.write(alternateContent);  // insert non-flash content
	}
	// -->
}

function AC_FL_GetContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  return AC_GET_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GET_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		str += '>';
  		for (var i in params)
  			str += '<param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '</object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }
    return(str);
}

function addForm(tag,resa_url,formBlocks,topic,retUrl,style,bgColor) {
	// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
	var hasProductInstall = DetectFlashVer(6, 0, 65);
	var spotsDir = "http://www.resabase.com/common";
	var width = "600px";
//	var height = getInnerHeight()-20;
	var height = document.viewport.getHeight() - 20;

	// Version check based upon the values defined in globals
	var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

	if ( hasProductInstall && !hasRequestedVersion ) {
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;

		AC_FL_RunContent(
		"src", spotsDir+"/forms/playerProductInstall",
		"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
		"width", "100%",
		"height", "480px",
		"align", "middle",
		"id", "Formulaire",
		"quality", "high",
		"bgcolor", "#869ca7",
		"name", "Formulaire",
		"allowScriptAccess","sameDomain",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
	} else if (hasRequestedVersion) {
		// if we've detected an acceptable version
		// embed the Flash Content SWF when all tests are passed
		tag.update(AC_FL_GetContent(
		"src", spotsDir+"/forms/Formulaire",
		"flashVars", "RESA_URL="+resa_url+"&RESA_FORM_BLOCKS="+formBlocks+"&TOPIC="+topic+"&RESA_RETURN_URL="+retUrl+"&RESA_FORM_STYLE="+style,
		"width", width,
		"height", height,
		"align", "middle",
		"id", "form_"+tag.id,
		"quality", "high",
		"bgcolor", bgColor,
		"name", "form_"+tag.id,
		"allowScriptAccess","always",
		"type", "application/x-shockwave-flash",
		"pluginspage", "http://www.adobe.com/go/getflashplayer"
		));
	} else {  // flash is too old or we can't detect the plugin
		var alternateContent = 'Alternate HTML content should be placed here. '
		+ 'This content requires the Adobe Flash Player. '
		+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
		document.write(alternateContent);  // insert non-flash content
	}
	// -->
}

