//K-Stone 20070719

function BuildEmailServicesForm()
{
	var str = "";
	str += '<form id="EmailServices_Form" name="EmailServices_Form" action="emailservices.asp" method="post">';
	str += '<div id="emailServices" class="txt_cE" style="margin:22px 0px 0px 19px;">';
	str += '<div style="clear:both; margin:0px;"><img src="images/SideTitle_EmailService.gif" alt="Email Services" title="Email Services" width="110" height="13"></div>';
	str += '<div style="clear:both; margin:10px 18px 0px 0px;">Receive free publication alerts when you want, or our Business Newsletter.</div>';
	str += '<div style="clear:both; margin:12px 10px 0px 0px;">Email <input name="Customer_Email" type="text" maxlength="255" style="background:url(images/SideEmail_Bg.gif) no-repeat; width:116px; height:18px; font-family:Verdana; font-size:9px; color:#000; border:none; padding:2px 0px 0px 2px; font-weight:normal; margin-left:3px;"></div>';
	str += '<div style="clear:both; margin:6px 16px 0px 0px;"><input name="EmailServices_Button" type="button" style="background:url(images/Button_SendEmail.jpg) no-repeat; width:53px; height:18px; border:none; float:right;" value="" onclick="javascript:__doApply();"></div>';
	str += '</div>';
	str += '</form>';

	document.write(str);
}

function __doApply()
{
	var ajax = new AJAXRequest();
	ajax.postf(document.getElementById("EmailServices_Form"), __completeApply);
}

function __completeApply(obj)
{
	var callBackString = obj.responseText;
	callBackString = parseInt(callBackString);

	if(callBackString == -1)
	{
		window.alert("Your email address had been recorded in the system!");
		document.getElementById("Customer_Email").value = "";
		return;
	}
	else if(callBackString == -2)
	{
		window.alert("Some errors about your email length!");
		document.getElementById("Customer_Email").value = "";
		return;
	}
	else if(callBackString == 1)
	{
		window.alert("Thanks!");
		document.getElementById("Customer_Email").value = "";
		return;
	}
}

function __timeoutApply(e)
{
	window.alert("The request is timeout!");
}

function __exceptionApply(e)
{
	window.alert("The request is error!");
}

function __enterKeyDown()
{
	if(event.keyCode == 13)
	{
		__doApply();
	}
}
