<?php

/*

  osCommRes, Services Online
  http://www.oscommres.com

  Copyright (c) 2005 osCommRes

  Released under the GNU General Public License
  
  Freeway eCommerce from ZacWare
http://www.zac-ware.com/freeway

Copyright 2007 ZacWare Pty. Ltd
*/
// Set flag that this is a parent file
	define( '_FEXEC', 1 );

  require('includes/application_top.php');
  tep_get_last_access_file();require(DIR_WS_CLASSES . '/currencies.php');
  $currencies=new currencies;  
  // get input entries to find type of entry
  $flag = (isset($HTTP_GET_VARS['flag']) ? $HTTP_GET_VARS['flag'] : '');
  $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');
  $command=(isset($HTTP_GET_VARS['command']) ? $HTTP_GET_VARS['command'] : '');	
  $msg_id = (isset($HTTP_GET_VARS['msg_id']) ?$HTTP_GET_VARS['msg_id'] : 'AUT');

   $message=array();
	$message=array(
				array('id'=>'AUT','text'=>TEXT_TYPE_AUT,'mode'=>1),
				array('id'=>'AUR','text'=>TEXT_TYPE_AUR,'mode'=>1),
				array('id'=>'CUS','text'=>TEXT_TYPE_CUS,'mode'=>1),
				array('id'=>'CUR','text'=>TEXT_TYPE_CUR,'mode'=>1),
				array('id'=>'AFT','text'=>TEXT_TYPE_AFT,'mode'=>1),
				array('id'=>'AFR','text'=>TEXT_TYPE_AFR,'mode'=>1),
				array('id'=>'AFP','text'=>TEXT_TYPE_AFP,'mode'=>1),
				array('id'=>'ACU','text'=>TEXT_TYPE_ACU,'mode'=>2),
				array('id'=>'MIV','text'=>TEXT_TYPE_MIV,'mode'=>5),
				array('id'=>'TEM','text'=>TEXT_TYPE_TEM,'mode'=>5),
				array('id'=>'PSP','text'=>TEXT_TYPE_PSP,'mode'=>5),
				array('id'=>'CON','text'=>TEXT_TYPE_CON,'mode'=>5)
				);
	
	$fields_type['AUT']='A';
	$fields_type['AUR']='A';
	$fields_type['CUS']='C';
	$fields_type['CUR']='C';
	$fields_type['AFT']='T';
	$fields_type['AFR']='T';
	$fields_type['AFP']='T_F';
	$fields_type['ACU']='U';
	$fields_type['MIV']='I';
	$fields_type['TEM']='U_D_B_O';
	$fields_type['PSP']='P_B_D';
	$fields_type['CON']='N';  
	$mes_array=array('message_id'=>'',
		'message_type'=>'',
		'message_send'=>'',
		'message_subject'=>'',
		'message_reply_to'=>STORE_OWNER_EMAIL_ADDRESS,
		'message_text'=>'',
		'message_format'=>'');
	$format_array=array(array('id'=>'T','text'=>TEXT_FORMAT_TEXT),
			array('id'=>'H','text'=>TEXT_FORMAT_HTML),
			array('id'=>'B','text'=>TEXT_FORMAT_BOTH));
	
	$fields_details['C']=array(
				array('id'=>'TITLE_C','text'=>TEXT_TITLE_C),
				array('id'=>'FN','text'=>'&nbsp;&nbsp;' . TEXT_FN),
				array('id'=>'LN','text'=>'&nbsp;&nbsp;' . TEXT_LN),
				array('id'=>'SN','text'=>'&nbsp;&nbsp;' . TEXT_SN),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_SE),
				array('id'=>'LE','text'=>'&nbsp;&nbsp;' . TEXT_LE),
				array('id'=>'LP','text'=>'&nbsp;&nbsp;' . TEXT_LP),
				array('id'=>'GR','text'=>'&nbsp;&nbsp;' . TEXT_GR),
				/*array('id'=>'CP','text'=>'&nbsp;&nbsp;' . CUST_CP),
				array('id'=>'CC','text'=>'&nbsp;&nbsp;' . CUST_CC),
				array('id'=>'CS','text'=>'&nbsp;&nbsp;' . CUST_CS),
				array('id'=>'CO','text'=>'&nbsp;&nbsp;' . CUST_CO),
				array('id'=>'CU','text'=>'&nbsp;&nbsp;' . CUST_CU),*/
				);
	$fields_details['A']=array(
				array('id'=>'TITLE_A','text'=>TEXT_TITLE_A),
				array('id'=>'FN','text'=>'&nbsp;&nbsp;' . TEXT_FN),
				array('id'=>'LN','text'=>'&nbsp;&nbsp;' . TEXT_LN),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'SN','text'=>'&nbsp;&nbsp;' . TEXT_SN),
				array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_SE),
				array('id'=>'LE','text'=>'&nbsp;&nbsp;' . TEXT_LE),
				array('id'=>'LP','text'=>'&nbsp;&nbsp;' . TEXT_LP),
				array('id'=>'AL','text'=>'&nbsp;&nbsp;' . TEXT_AL),
				/*array('id'=>'CC','text'=>'&nbsp;&nbsp;' . CUST_CC),
				array('id'=>'CS','text'=>'&nbsp;&nbsp;' . CUST_CS),
				array('id'=>'CO','text'=>'&nbsp;&nbsp;' . CUST_CO),
				array('id'=>'CU','text'=>'&nbsp;&nbsp;' . CUST_CU),*/
				);
	
	$fields_details['O']=array(
				array('id'=>'TITLE_O','text'=>TEXT_TITLE_O),
				array('id'=>'NO','text'=>'&nbsp;&nbsp;' . ORDR_NO),
				array('id'=>'OP','text'=>'&nbsp;&nbsp;' . ORDR_OP),
				array('id'=>'OL','text'=>'&nbsp;&nbsp;' . ORDR_OL),
				array('id'=>'PO','text'=>'&nbsp;&nbsp;' . ORDR_PO),
				array('id'=>'OM','text'=>'&nbsp;&nbsp;' . ORDR_OM),
				array('id'=>'OT','text'=>'&nbsp;&nbsp;' . ORDR_OT),
				array('id'=>'PM','text'=>'&nbsp;&nbsp;' . ORDR_PM),
				array('id'=>'DD','text'=>'&nbsp;&nbsp;' . ORDR_DD),
				array('id'=>'PF','text'=>'&nbsp;&nbsp;' . ORDR_PF),
				);
	$fields_details['U']=array(
				array('id'=>'TITLE_U','text'=>TEXT_TITLE_U),
				array('id'=>'CF','text'=>'&nbsp;&nbsp;' . CUST_CF),
				array('id'=>'CL','text'=>'&nbsp;&nbsp;' . CUST_CL),
				array('id'=>'CM','text'=>'&nbsp;&nbsp;' . CUST_CM),
				array('id'=>'SN','text'=>'&nbsp;&nbsp;' . TEXT_SN),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_SE),
				array('id'=>'AL','text'=>'&nbsp;&nbsp;' . TEXT_AL),
				array('id'=>'CT','text'=>'&nbsp;&nbsp;' . CUST_CT),
				array('id'=>'CP','text'=>'&nbsp;&nbsp;' . CUST_CP),
				array('id'=>'CC','text'=>'&nbsp;&nbsp;' . CUST_CC),
				array('id'=>'CS','text'=>'&nbsp;&nbsp;' . CUST_CS),
				array('id'=>'CE','text'=>'&nbsp;&nbsp;' . CUST_CE),
				array('id'=>'CU','text'=>'&nbsp;&nbsp;' . CUST_CU),
				array('id'=>'CO','text'=>'&nbsp;&nbsp;' . CUST_CO),
				array('id'=>'CA','text'=>'&nbsp;&nbsp;' . CUST_CA),
				);
	$fields_details['B']=array(
				array('id'=>'TITLE_B','text'=>TEXT_TITLE_B),
				array('id'=>'NA','text'=>'&nbsp;&nbsp;' . BILL_NA),
				array('id'=>'CM','text'=>'&nbsp;&nbsp;' . BILL_CM),
				array('id'=>'CT','text'=>'&nbsp;&nbsp;' . BILL_CT),
				array('id'=>'CP','text'=>'&nbsp;&nbsp;' . BILL_CP),
				array('id'=>'CC','text'=>'&nbsp;&nbsp;' . BILL_CC),
				array('id'=>'CS','text'=>'&nbsp;&nbsp;' . BILL_CS),
				array('id'=>'CE','text'=>'&nbsp;&nbsp;' . BILL_CE),
				array('id'=>'CU','text'=>'&nbsp;&nbsp;' . BILL_CU),
				);
	$fields_details['D']=array(
				array('id'=>'TITLE_D','text'=>TEXT_TITLE_D),
				array('id'=>'NA','text'=>'&nbsp;&nbsp;' . DELI_NA),
				array('id'=>'CM','text'=>'&nbsp;&nbsp;' . DELI_CM),
				array('id'=>'CT','text'=>'&nbsp;&nbsp;' . DELI_CT),
				array('id'=>'CP','text'=>'&nbsp;&nbsp;' . DELI_CP),
				array('id'=>'CC','text'=>'&nbsp;&nbsp;' . DELI_CC),
				array('id'=>'CS','text'=>'&nbsp;&nbsp;' . DELI_CS),
				array('id'=>'CE','text'=>'&nbsp;&nbsp;' . DELI_CE),
				array('id'=>'CU','text'=>'&nbsp;&nbsp;' . DELI_CU),
				);
	
	$fields_details['T']=array(
				array('id'=>'TITLE_T','text'=>TEXT_TITLE_T),
				array('id'=>'FN','text'=>'&nbsp;&nbsp;' . TEXT_FN),
				array('id'=>'LN','text'=>'&nbsp;&nbsp;' . TEXT_LN),
				array('id'=>'AD','text'=>'&nbsp;&nbsp;' . TEXT_AD),
				array('id'=>'AU','text'=>'&nbsp;&nbsp;' . TEXT_AU),
				array('id'=>'AP','text'=>'&nbsp;&nbsp;' . TEXT_AP),
				array('id'=>'FL','text'=>'&nbsp;&nbsp;' . TEXT_FL),
				array('id'=>'SN','text'=>'&nbsp;&nbsp;' . TEXT_SN),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_SE),
				array('id'=>'AL','text'=>'&nbsp;&nbsp;' . TEXT_AL),
				);
	$fields_details['F']=array(
				array('id'=>'TITLE_F','text'=>TEXT_TITLE_F),
				array('id'=>'FD','text'=>'&nbsp;&nbsp;' . TEXT_FD),
				array('id'=>'FB','text'=>'&nbsp;&nbsp;' . TEXT_FB),
				array('id'=>'FI','text'=>'&nbsp;&nbsp;' . TEXT_FI),
				array('id'=>'PO','text'=>'&nbsp;&nbsp;' . ORDR_PO),
				array('id'=>'OM','text'=>'&nbsp;&nbsp;' . ORDR_OM),
				array('id'=>'OT','text'=>'&nbsp;&nbsp;' . ORDR_OT),
				array('id'=>'PM','text'=>'&nbsp;&nbsp;' . ORDR_PM),
				);
	
	$fields_details['I']=array(array('id'=>'TITLE_I','text'=>TEXT_TITLE_I),
				array('id'=>'FN','text'=>'&nbsp;&nbsp;' . TEXT_FN),
				array('id'=>'LN','text'=>'&nbsp;&nbsp;' . TEXT_LN),
				array('id'=>'NO','text'=>'&nbsp;&nbsp;' . TEXT_NO),
				array('id'=>'OP','text'=>'&nbsp;&nbsp;' . TEXT_OP),
				array('id'=>'OL','text'=>'&nbsp;&nbsp;' . TEXT_OL),
				array('id'=>'OL','text'=>'&nbsp;&nbsp;' . TEXT_OM),
				array('id'=>'PO','text'=>'&nbsp;&nbsp;' . TEXT_PO),
				array('id'=>'PM','text'=>'&nbsp;&nbsp;' . TEXT_PM),
				array('id'=>'DT','text'=>'&nbsp;&nbsp;' . PAYMT_DT),
				array('id'=>'BA','text'=>'&nbsp;&nbsp;' . ORDR_BA),
				array('id'=>'SA','text'=>'&nbsp;&nbsp;' . ORDR_SA),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'AD','text'=>'&nbsp;&nbsp;' . STORE_AD),
				array('id'=>'IP','text'=>'&nbsp;&nbsp;' . LOG_IP)
				);
				
				//print_r($fields_details);
				
	$fields_details['P']=array(array('id'=>'TITLE_P','text'=>TEXT_TITLE_C),
				array('id'=>'FN','text'=>'&nbsp;&nbsp;' . TEXT_FN),
				array('id'=>'LN','text'=>'&nbsp;&nbsp;' . TEXT_LN),
				array('id'=>'SA','text'=>'&nbsp;&nbsp;' . TEXT_SA),  
				array('id'=>'TN','text'=>'&nbsp;&nbsp;' . CUST_CO),
				array('id'=>'EM','text'=>'&nbsp;&nbsp;' . TEXT_EA),
				array('id'=>'SU','text'=>'&nbsp;&nbsp;' . TEXT_PC),																					
				array('id'=>'SU','text'=>'&nbsp;&nbsp;' . CUST_CE),
				array('id'=>'SU','text'=>'&nbsp;&nbsp;' . TEXT_CT),
				array('id'=>'SU','text'=>'&nbsp;&nbsp;' . TEXT_CY),									
				/*array('id'=>'PN','text'=>'&nbsp;&nbsp;' . TEXT_PN),
				array('id'=>'PP','text'=>'&nbsp;&nbsp;' . TEXT_PP),
				array('id'=>'PQ','text'=>'&nbsp;&nbsp;' . TEXT_P_Q),
				array('id'=>'PS','text'=>'&nbsp;&nbsp;' . TEXT_P_STATUS),
				array('id'=>'PM','text'=>'&nbsp;&nbsp;' . TEXT_P_M),*/
				array('id'=>'TITLE_O','text'=>TEXT_TITLE_O),
				array('id'=>'PF','text'=>'&nbsp;&nbsp;' . TEXT_PF),
				array('id'=>'NO','text'=>'&nbsp;&nbsp;' . TEXT_NO), 
				array('id'=>'OP','text'=>'&nbsp;&nbsp;' . TEXT_OP),
				array('id'=>'OL','text'=>'&nbsp;&nbsp;' . TEXT_OM),
				array('id'=>'PO','text'=>'&nbsp;&nbsp;' . TEXT_PO),
				array('id'=>'PM','text'=>'&nbsp;&nbsp;' . TEXT_PM),
				array('id'=>'TITLE_O','text'=>TEXT_STORE_DETAILS),
				array('id'=>'SN','text'=>'&nbsp;&nbsp;' . TEXT_SN),
				array('id'=>'SM','text'=>'&nbsp;&nbsp;' . TEXT_SM),
				array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_SE),
				array('id'=>'CM','text'=>'&nbsp;&nbsp;' . CUST_CM),
				array('id'=>'AD','text'=>'&nbsp;&nbsp;' . STORE_AD) 
				//array('id'=>'AL','text'=>'&nbsp;&nbsp;' . TEXT_AL),
				//array('id'=>'BA','text'=>'&nbsp;&nbsp;' . ORDR_BA),
				//array('id'=>'SA','text'=>'&nbsp;&nbsp;' . ORDR_SA),
				//array('id'=>'SE','text'=>'&nbsp;&nbsp;' . TEXT_DD)
				); 
	$fields_details['N']=array(array('id'=>'TITLE_N','text'=>TEXT_TITLE_N),
					   array('id'=>'T1','text'=>'&nbsp;&nbsp;' . TEXT_TN1),
					   array('id'=>'T2','text'=>'&nbsp;&nbsp;' . TEXT_TN2),
					   array('id'=>'T3','text'=>'&nbsp;&nbsp;' . TEXT_TN3),
					   array('id'=>'B1','text'=>'&nbsp;&nbsp;' . TEXT_BT1),
					   array('id'=>'B2','text'=>'&nbsp;&nbsp;' . TEXT_BT2)
				);
	if ($action=='insert_message' || $action=='update_message'){ 
			$message_text=($HTTP_POST_VARS['message_format']!='T'?$HTTP_POST_VARS['message_text']:strip_tags($HTTP_POST_VARS['message_text'],'<br>'));
			$sql_array=array(	'message_type'=>tep_db_prepare_input($HTTP_POST_VARS['message_type']),
								'message_subject'=>tep_db_prepare_input($HTTP_POST_VARS['message_subject']),
								'message_reply_to'=>tep_db_prepare_input($HTTP_POST_VARS['message_reply_to']),
								'message_text'=>tep_db_prepare_input($message_text),
								'message_format'=>tep_db_prepare_input($HTTP_POST_VARS['message_format']));
								
								
			if ($action=='insert_message'){
				tep_db_perform(TABLE_EMAIL_MESSAGES,$sql_array);
			} else {
				$update_id=(int)$HTTP_GET_VARS['id'];
				tep_db_perform(TABLE_EMAIL_MESSAGES,$sql_array,'update',"message_id='" . (int)$update_id . "'");
			}
			$msg_id=$HTTP_POST_VARS['message_type'];
			$command='fetch_message_details';
	} else if ($action=='delete_message'){
		$delete_id=(int)$HTTP_GET_VARS['id'];
		tep_db_query("delete from " . TABLE_EMAIL_MESSAGES . " where message_id='" . (int)$delete_id . "'");
		$msg_id=$HTTP_GET_VARS['msg_type'];
		$command='fetch_delete_message';
	} else if ($action=='test_send'){ 
		tep_send_default_test_email($HTTP_GET_VARS['msg_type']);
		$msg_id=$HTTP_GET_VARS['msg_type'];
		$command='fetch_message_details';
		$alert_message=TEST_EMAIL_SENT_TO;
	} else if ($action=='change_send'){
		$new_type=$HTTP_POST_VARS['message_send'];
		if ($new_type!='')
			tep_db_query("UPDATE " . TABLE_EMAIL_MESSAGES . " set message_send='" . $new_type . "' where message_id='" . (int)$HTTP_POST_VARS['id'] . "'");
		$command='fetch_message_details';
		$msg_id=$HTTP_POST_VARS['msg_type'];
	}
//==========initial parameters to perform ajax actions====
$submit_pagename=FILENAME_EMAIL_MESSAGES;
$variable_name="id";
$form_name="select_event";
$init_editor=true;
require('marketing_functions_ajax.php');
//==========================================================

	if($command=='fetch_message_list')
	{
		echo "message_list{}";
		tep_get_message_list($message,$message_type_array,$fields_type,'EM',0);
		exit;
	}
	elseif($command=='fetch_delete_message')
	{
		echo "del_message{}";
		exit;
	}
	elseif($command=='fetch_message_details')
	{
		for($icnt=0;$icnt<sizeof($message);$icnt++)
		{
			if($message[$icnt]['id']==$msg_id)
			{
				tep_get_message_details($message[$icnt],$message_type_array[$msg_id],$fields_type[$msg_id],'EM',0);
				exit;
			}
		}
	}

?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
<script type="text/javascript" src="htmlarea/htmlarea.js"></script>
<script type="text/javascript" src="htmlarea/editor.js"></script>
<script language="javascript" src="includes/menu.js"></script>
<script language="javascript" src="includes/general.js"></script>
<script language="javascript" src="includes/http.js"></script>
<script language=javascript>
function validateForm(){
	var error_result="";
	var mes_format;
	if (document.insert_message.message_type.value!='MIV' && document.insert_message.message_type.value!='TEM' && document.insert_message.message_type.value!='PSP' && document.insert_message.message_type.value!='CON'){
		mes_format=document.insert_message.message_format.value;
    if (document.insert_message.message_subject.value=="" || str_trim(document.insert_message.message_subject.value)=="")
		error_result="<?php echo tep_db_input(ERR_EMPTY_SUBJECT); ?>";
	else if (document.insert_message.message_reply_to.value=="" || str_trim(document.insert_message.message_reply_to.value)=="")
		error_result="<?php echo tep_db_input(ERR_EMPTY_REPLY_TO); ?>";
	else if (document.insert_message.message_reply_to.value.indexOf("@")<1)
	    error_result="<?php echo tep_db_input(ERR_INVALID_REPLY_TO); ?>";
	}
	else if (document.insert_message.message_type.value=='MIV' || document.insert_message.message_type.value=='TEM' || document.insert_message.message_type.value=='PSP' || document.insert_message.message_type.value=='CON'){
	  if( (document.insert_message.message_subject.value=="") || (str_trim(document.insert_message.message_subject.value)=="") )
		 error_result="<?php echo tep_db_input(ERR_EMPTY_TITLE); ?>";
	}
	if (error_result!=""){
	  	alert(error_result);
	  	return false;
	  }
	return true;
}
function AddField(){
	var select_field;
	var select_id;
	
	if (document.insert_message.fields.selectedIndex<=-1) return;
 	select_id=document.insert_message.fields.options[document.insert_message.fields.selectedIndex].value;
	if (select_id.length>2) return;
	    select_field="%%" + document.insert_message.fields.options[document.insert_message.fields.selectedIndex].innerHTML + "%%";
	    select_field=select_field.replace("&nbsp;&nbsp;","");
	    editor.insertHTML(select_field);
}
function setAction(ptype){
	if (ptype==1)
	   document.insert_message.action_type.value="test";
	else
	   document.insert_message.action_type.value="create";
}
</script>

<?php
// WebMakers.com Added: Java Scripts
include(DIR_WS_INCLUDES . 'javascript/' . 'webmakers_added_js.php')
?>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onLoad="SetFocus();">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'marketing_functions_js.php'); ?>
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">
	<tr> 
    <!-- body_text //-->
	<td width="100%" valign="top">
	<table border="0" width="100%" cellspacing="0" cellpadding="2">
		<tr>
			<td>
			<table border="0" width="100%" cellspacing="0" cellpadding="2">
			<?php if ($action==''){ ?>
				<tr>
					<td class="pageHeading"><?php //echo TEXT_HEADING_TITLE; ?></td>
				</tr>
				<tr>
					<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td>
				</tr>
				<tr>
					<td id="message_list">
					<?php tep_get_message_list($message,$message_type_array,$fields_type,'EM',0);?>
					</td>
				</tr>
					<?php } ?>
					</table>
					</td>
				</tr>
			<!--	<tr class="openContent_top"><td><?php //echo tep_draw_separator('pixel_trans.gif', '1', '5'); ?></td></tr> !-->
				</table>
				</td>
<!-- body_text_eof //-->
			</tr>
			
			
			
			<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '2', '10'); ?></td></tr>	 
		 <!-- BOttom -->
			 <tr>
		 		<td>
					<table border="0" width="100%" cellspacing="0" cellpadding="0">
						<tr>
							<td>
								<table border="0" width="100%" cellpadding="5" cellspacing="0">
									<tr>
									 <td>
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tr class="product_title">
												<td colspan="2"><?php echo '<b>' . TEXT_INFO_GENERAL . '</b>'; ?></td>
											 </tr>
											 <tr height="7"></tr>	
											<tr>
											  	<td valign="top" width="7%">
													<table border="0" cellpadding="0" cellspacing="0">
													<tr> 
													<td height="79px"  width="59px" align="center" valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'categories/gen_marketing.png', General);?></td>
													</tr>
													</table>
												</td> 
														
												 <td width="93%" valign="top">
												 <table cellpadding="1" cellspacing="3" border="0" width="100%" class="info_content">
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_EMAIL_MESSAGES,'top=1') . '">' . TEXT_INFO_GENERAL . '</a>'; ?></td>
												 </tr>
												 </table>
											    </td>
										    </tr>	
										 </table>
										 </td>
									   </tr>
			
								 <tr>
									 <td>
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tr class="product_title">
												<td colspan="2"><?php echo '<b>' . TEXT_INFO_EMARKETING . '</b>'; ?></td>
											 </tr>
											 <tr height="7"></tr>	
											<tr>
											  	<td valign="top" width="7%">
													<table border="0" cellpadding="0" cellspacing="0">
													<tr> 
													<td height="79px"  width="59px" align="center" valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'categories/eMarketing.png', eMarketing);?></td>
													</tr>
													</table>
												</td> 
														
												 <td width="93%" valign="top">
												 <table cellpadding="1" cellspacing="3" border="0" width="100%" class="info_content">
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_MESSAGE,'top=1') . '">' . TEXT_INFO_PRODUCTS . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_EVENTS_MESSAGES,'top=1') . '">' . TEXT_INFO_EVENTS . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_SERVICES_MESSAGES,'top=1') . '">' . TEXT_INFO_SERVICES . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_SUBSCRIPTION_MESSAGES,'top=1') . '">' . TEXT_INFO_SUBSCRIPTIONS . '</a>'; ?></td>
												 </tr>
											<!--	 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION,'top=1&mPath=7_60_73') . '">' . TEXT_INFO_ADVANCED . '</a>'; ?></td>
												 </tr>
											-->	 </table>
											    </td>
										    </tr>	
										 </table>
										 </td>
								   </tr>
								   
								  <tr>
									 <td>
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tr class="product_title">
												<td colspan="2"><?php echo '<b>' . TEXT_INFO_AFFILIATES . '</b>'; ?></td>
											 </tr>
											 <tr height="7"></tr>	
											<tr>
											  	<td valign="top" width="7%">
													<table border="0" cellpadding="0" cellspacing="0">
													<tr> 
													<td height="79px"  width="59px" align="center" valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'categories/affiliates.png', Affiliates);?></td>
													</tr>
													</table>
												</td> 
														
												 <td width="93%" valign="top">
												 <table cellpadding="1" cellspacing="3" border="0" width="100%" class="info_content">
												 <tr>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_SUMMARY,'top=1') . '">' . TEXT_INFO_SUMMARY . '</a>'; ?></td>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_PAYMENT,'top=1') . '">' . TEXT_INFO_PAYMENT . '</a>'; ?></td>
													<td class="info_content" width="40%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_SALES,'top=1') . '">' . TEXT_INFO_SALES . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_CLICKS,'top=1') . '">' . TEXT_INFO_CLICKS . '</a>'; ?></td>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_BANNERS,'top=1') . '">' . TEXT_INFO_BANNERS . '</a>'; ?></td>
													<td class="info_content" width="40%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_CONTACT,'top=1') . '">' . TEXT_INFO_CONTACT . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_EMARKETING,'action=new_message&type=FAQ&top=1') . '">' . TEXT_INFO_FAQ . '</a>'; ?></td>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_EMARKETING,'action=new_message&type=TRM&top=1') . '">' . TEXT_INFO_TERMS . '</a>'; ?></td>
													<td class="info_content" width="40%"><?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_EMARKETING,'action=new_message&type=AIM&top=1') . '">' . TEXT_INFO_INFORMATION . '</a>'; ?></td>												
												 </tr>
												 <tr>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_MARKETING_AFFILIATE_COMMISSION,'top=1&mPath=7_62_237') . '">' . TEXT_INFO_COMMISSION_JUNCTION. '</a>'; ?></td>
													<td class="info_content" width="30%"><?php echo '<a href="' . tep_href_link(FILENAME_CONFIGURATION,'top=1&mPath=7_62_79') . '">' . TEXT_INFO_ADVANCED . '</a>'; ?></td>
													<td class="info_content" width="40%"><?php echo '<a href="' . tep_href_link(FILENAME_MARKETING_AFFILIATE_COMMISSION,'top=1&mPath=7_62_246') . '">' . TEXT_INFO_COMMISSION_JUNCTION . '</a>'; ?></td>												
												 </tr>
												 </table>
											    </td>
										    </tr>	
										 </table>
									    </td>
								  </tr>	
								  
								 <tr>
									 <td>
										<table cellpadding="0" cellspacing="0" border="0" width="100%">
											<tr class="product_title">
												<td colspan="2"><?php echo '<b>' . TEXT_INFO_SURVEYS . '</b>'; ?></td>
											 </tr>
											 <tr height="7"></tr>	
											<tr>
											  	<td valign="top" width="7%">
													<table border="0" cellpadding="0" cellspacing="0">
													<tr> 
													<td height="79px"  width="59px" align="center" valign="top"><?php echo tep_image(DIR_WS_IMAGES . 'categories/surveys.png', Surveys);?></td>
													</tr>
													</table>
												</td> 
														
												 <td width="93%" valign="top">
												 <table cellpadding="1" cellspacing="3" border="0" width="100%" class="info_content">
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_EVENTS_SURVEYS,'top=1') . '">' . TEXT_INFO_EVENTS . '</a>'; ?></td>
												 </tr>
										<!--	 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_SERVICES_SURVEYS,'top=1') . '">' . TEXT_INFO_SERVICES . '</a>'; ?></td>
												 </tr>
											-->	 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_REFERRALS,'top=1') . '">' . TEXT_INFO_CUSTOMER_REFERRAL . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMER_OPTIONS,'type=O&top=1') . '">' . TEXT_INFO_CUSTOMER_OCCUPATION . '</a>'; ?></td>
												 </tr>
												 <tr>
													<td class="info_content"><?php echo '<a href="' . tep_href_link(FILENAME_CUSTOMER_OPTIONS,'type=I&top=1') . '">' . TEXT_INFO_CUSTOMER_INTEREST . '</a>'; ?></td>
												 </tr>
												 </table>
											    </td>
										    </tr>	
										 </table>
										 </td>
								   </tr>
								  
								<!-- Bottom -->  
					</table>
				</td>
			</tr>
		</table>
	</td>
  </tr>
</table>
<!-- body_eof //-->
<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); 
if($flag=='open'){ ?>
<script language="javascript">
	fetch_details('','CON');
</script>
<?php } ?>