<html>
<head>
<title>Email Report</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--base href="$$BASE_URL$$"-->
<link href="css/trend-style-new.css" rel="stylesheet" type="text/css">
<script language="JavaScript" src="javascripts/localization.js"></script>
<script language="JavaScript" src="javascripts/trend-ui-new.js"></script>
<script language="javascript">
function jsInitPage()
{
	document.fmMain.txtRecipients.focus();
}

function jsSubmit()
{	
	if(document.getElementById("txtRecipients").value.length == 0 || document.getElementById("txtRecipients").value.length > INT_LMAX_EM_ADDR_LONG){
	    alert(STR_WARN_EM_ADDR_EMPTY);
	    jsFocus(document.getElementById("txtRecipients"));
	    return false;
	}
	
    if(!checkMultiEmailPatternFormat(document.getElementById("txtRecipients").value,STR_ERR_INVALID_EMAIL)){
        jsFocus(document.getElementById("txtRecipients"));
        return false; 
    }
	
	jsAddCSRFToken(document.fmMain);
    document.fmMain.submit();
}

function jsCancel()
{
	window.close();
}


function verifyMultiAddress(obj)
{
	var emails = document.getElementById(obj).value;
        emails = emails.replace(",",";");
	var vItem = emails.split(";");
	for (var i=0;i<vItem.length;i++) 
	{
		if (checkEmailFormat(vItem[i], STR_ERR_INVALID_EMAIL))
        {
			jsSubmit();
            return true;
		}
        else
        {
			return false;
		}
	}
}

</script>
</head>

<body onload="jsInitPage();">
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">

<!--Page Title -->    
	<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<tr> 
       <td width="507"> 
         <table width="224" border="0" cellpadding="0" cellspacing="0">
         <tr> 
           <td width="224" class="content-title">Email Report</td>
         </tr>
         </table>
       </td>
           
       <td width="33" valign="bottom">
       </td>
    </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0">
   <tr><td height="4"></td></tr>
    <tr><td height="1" background="images/dot.gif"></td></tr>        
    <tr> 
      <td height="10"><img src="images/1space_cui.gif" width="1" height="1"></td>
    </tr>
    </table>

    <table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
    <tr> 
      <td colspan="2">
      	<form name="fmMain" method="post" action="$$FORM_ACTION$$">
      	<input type="hidden" name="template_id" value="$$REPORT_TEMPLATE_ID$$">
      	<input type="hidden" name="report_id" value="$$REPORT_ID$$">
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
					<tr>
						<td height="22" colspan="8" class="data2">Send the report to the following address: </td></tr>
					<tr>
          	<td colspan="5" class="data1">Address: </td>
						<td width="88%" class="data1"><input id="txtRecipients" name="txtRecipients" type="text" class="text" size="60"/></td></tr>
					<tr>
						<td colspan="5" class="data1">&nbsp;</td>
						<td class="data1">use semicolon&quot;;&quot; to separate multiple addresses<br/>
							For example: user1@domain.com;user2@domain.com</td></tr></table></form>
			</td></tr></table>
	</td></tr></table> 
	<table>
	  <tr>
	    <td><input type="button" value="Send" class="button" onclick="verifyMultiAddress('txtRecipients');" style="width:60px" /></td>
	    <td>&nbsp;</td>
	    <td><input type="button" value="Cancel" class="button" onclick="window.close();" style="width:50px" /></td></tr></table>
</body>
</html>
