function include( script_filename )
	{
	document.write( '<' + 'script' );
	document.write( ' language="javascript"' );
	document.write( ' type="text/javascript"' );
	document.write( ' src="' + script_filename + '">' );
	document.write( '</' + 'script' + '>' );
	}

include( "http://www.hollywoodprize.com/Scripts/xmlhttp.js" );

var http = "";

/*
	Code that the end website should implement
	------------------------------------------
<SCRIPT LANGUAGE="JavaScript" SRC="http://www.hollywoodprize.com/ Scripts/OPGWebLists.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">OPGOptInNews( 13 )</SCRIPT>
*/
function OPGOptInNews( IDClient, ColorBack, ColorFore )
	{
	var strHTMLCode, FormFontName, FormFontSize;


	// Set the font information.
	FormFontName = "Verdana, Arial, Helvetica, sans-serif";
	FormFontSize = "7.0pt";
 
	// Write out the class style.
	strHTMLCode  = "<style type=\"text/css\">\r\n";
	strHTMLCode += "<!--\r\n";
	strHTMLCode += "\t.styleOPGLists\r\n";
	strHTMLCode += "\t\t{\r\n";
	strHTMLCode += "\tFONT-SIZE: " + FormFontSize + ";\r\n";
	strHTMLCode += "\tFONT-FAMILY: " + FormFontName + ";\r\n";
	strHTMLCode += "\t\t}\r\n";
	strHTMLCode += "-->\r\n\r\n";
	strHTMLCode += "SELECT\r\n";
	strHTMLCode += "\t{\r\n";
	strHTMLCode += "\tfont-size:" + FormFontSize + ";\r\n";
	strHTMLCode += "\t}\r\n\r\n";
	strHTMLCode += "INPUT\r\n";
	strHTMLCode += "\t{\r\n";
	strHTMLCode += "\tfont-size:" + FormFontSize + ";\r\n";
	strHTMLCode += "\t}\r\n";
	strHTMLCode += "</style>\r\n\r\n";

	// Create the code that the user will see.
	strHTMLCode += "<div align=\"center\">";
	strHTMLCode += "\t<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\" bgcolor=\"" + ColorBack + "\" style=\"border:1px solid #000000; margin-left:20; margin-right:20;\">";
	strHTMLCode += "\t\t<tr>";
	strHTMLCode += "\t\t\t<td align=\"center\" style=\"font-weight: bold; color:" + ColorFore + ";\"><p class=\"styleOPGLists\">Subscribe to our<br />eNewsletter</p></td>";
	strHTMLCode += "\t\t</tr>";
	strHTMLCode += "\t\t<tr>";
	strHTMLCode += "\t\t\t<td align=\"center\" style=\"border-top:1px solid #000000\">";
	strHTMLCode += "\t\t\t\t<form name=\"opgoptin\" action=\"http://www.hollywoodprize.com/OPGListNews.php\" target=\"_blank\" method=\"post\" style=\"margin-bottom:2;\">";
	strHTMLCode += "\t\t\t\t\t<input type=\"hidden\" id=\"ci\" name=\"ci\" value=\"" + IDClient + "\">";
	strHTMLCode += "\t\t\t\t\t<input type=\"hidden\" id=\"lt\" name=\"lt\" value=\"news\">";
	strHTMLCode += "\t\t\t\t\t<p class=\"styleOPGLists\">Email: </p><input type=\"text\" name=\"ea\" size=\"20\" value=\"\" style=\"font-size:" + FormFontSize + "; border:1px solid #999999;\"><br /><input type=\"submit\" name=\"go\" value=\"Go\" class=\"submit\" style=\"font-family:Verdana, Arial, Helvetica, sans-serif; font-size:7pt;\"><br />";
	strHTMLCode += "\t\t\t\t</form>";
	strHTMLCode += "\t\t\t</td>";
	strHTMLCode += "\t\t</tr>";
	strHTMLCode += "\t</table>";
	strHTMLCode += "</div>";

	return strHTMLCode;
	}

/*
	Code that the end website should implement
	------------------------------------------
<SCRIPT LANGUAGE="JavaScript" SRC="http://www.hollywoodprize.com/Script/OPGWebLists.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript">OPGOptInSMS( 13 )</SCRIPT>
*/
function OPGOptInSMS( IDClient, ColorBack, ColorFore )
	{
	var strURLAjax, strURLOpen;


	// We create the HTTP Object
	http = new XMLHTTP(); // getHTTPObject();
	http.onerror = function( description )
		{
		alert( 'Error: ' + description );
		}

	// Remove the '#' from the color settings. Can't pass '#' on the command line.
	ColorBack = ColorBack.replace( "#", "" );
	ColorFore = ColorFore.replace( "#", "" );

	// Compute the Ajax URL.
	strURLAjax = "http://www.hollywoodprize.com/Scripts/AJaxCellList.php";
	strURLOpen = strURLAjax + "?IDClient=" + IDClient + "&ColorBack=" + ColorBack + "&ColorFore=" + ColorFore;

	// Call AJax.
	http.open("GET", strURLOpen, true);
	http.onreadystatechange = handleHttpResponse;
	http.send( null );
	}


// The server-side script
function handleHttpResponse()
	{
	var strHTMLCode;


	if (4 == http.readyState)
		{
		// Get the carrier list from the server.
		strHTMLCode = http.responseText;

		// Write out the list.
		document.getElementById('OPGOptInSMS').innerHTML = strHTMLCode;
		}
	else
		document.getElementById('OPGOptInSMS').innerHTML = "Sarah says: Error in AJax";
	}

function getHTTPObject()
	{
	var xmlhttp;

	/*@cc_on

	@if (@_jscript_version >= 5)
		try
			{
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}

		catch (e)
			{
				try
					{
					xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
					}

				catch (E)
					{
					xmlhttp = false;
					}
			}
	@else
		xmlhttp = false;
	@end @*/

	if (!xmlhttp && typeof XMLHttpRequest != 'undefined')
		{
		try
			{
			xmlhttp = new XMLHttpRequest();
			}
		
		catch (e)
			{
			xmlhttp = false;
			}
		}

	return xmlhttp;
	}
