<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com  2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";
include "includes/arrays.inc.php";

$adminCurrency	= GetAdminCurrency();

$currencySymbol	=$adminCurrency['currency_symbol'];

if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE); 
} 

if(isset( $_SESSION["sess_userid"]) and $_SESSION["sess_userid"]!= ""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php");
	exit;
}
$orderid=$_GET['orderid'];
$orderid=intval($orderid)!='0'?$orderid:'0';

$qry="select * from ".$tableprefix."settings ";
$rs_q=mysql_query($qry) or die(mysql_error());
$row=mysql_fetch_array($rs_q);

if(!empty($orderid))
{
		 $sql = "SELECT od.*,o.user_id
					  FROM ".$tableprefix."order_details od
				INNER JOIN ".$tableprefix."orders o 
						ON o.order_id =od.order_id 
					 WHERE od.order_id=".$orderid."  
					   AND od.item_status=4  
						   AND DATE_ADD(od.item_delivery_date,INTERVAL 48 HOUR) >= now()
				  ORDER BY od.order_detail_id  DESC";
	//$sql="select od.* from ".$tableprefix."order_details od where od.order_id=".$orderid." ";
	$rs=mysql_query($sql) or die(mysql_error());
	$numrows=mysql_num_rows($rs);
		
}
		 
$result = mysql_query($sql);

$totalrows = mysql_num_rows($result);

$limit=getPaginationLimit();

if($limit==0)
{
	$limit=10;
}	
if(empty($page))
	{
		$page = 1;
	}

$limitvalue = ($page - 1) * $limit;

$query_string = " LIMIT $limitvalue, $limit";

$sql = $sql.$query_string;

$result=mysql_query($sql) or die(mysql_error());

$message="";
if(isset($_POST['btnSave']))
{
	$recordsper=0;
	$comments=$_POST['comments'];
	$ids		= $_POST['ids'];
	$ids		= isset($_POST['ids'])	?	$_POST['ids']	:	array();
		if (empty($ids) or count($ids)==0)
		{
			$message	.= RR_SELECT_PRODUCT_TEXT."<br>";
		}	
 if($message=='')
 { // check if message is empty
	if(!empty($ids))
	{
	foreach($_POST['ids'] as $key=>$value)
	{
		$pid=mysql_real_escape_string($value);
		$reasonid="reason".$pid;
		
		$qty="qty".$pid;
		$seller="sellerid".$pid;
		$product="pname".$pid;
		$sellerid=addslashes($_POST[$seller]);
		$userid=addslashes($_POST['userid']);
		$reason=addslashes($_POST[$reasonid]);
		$quantity=addslashes($_POST[$qty]);
		$productname=$_POST[$product];
		$comments=addslashes($_POST['comments']);
		$orderid=addslashes($_POST['orderid']);
		
		$sql_insert="insert into  ".$tableprefix."refunds(seller_id,buyer_id,product_id,order_id,quantity,return_reason,Additional_info,date)
					VALUES('".$sellerid."','".$userid."','".$pid."','".$orderid."','".$quantity."','".$reason."','".$comments."',now()) ";
		$rs_insert=mysql_query($sql_insert) or die(mysql_error());
		if($rs_insert)
		{ // updating order details table with refund id 
			$recordsper++;
			$refund_id=mysql_insert_id();
			$sql_update="UPDATE ".$tableprefix."order_details  set user_refund_id=".$refund_id." where order_id=".$orderid." and product_id=".$pid." ";
			 $rs_update=mysql_query($sql_update);
			 $sql="select o.billing_first_name,o.billing_last_name,o.billing_email,o.order_id,DATE_FORMAT(o.order_date,'%m-%d-%Y') orderdate,a.artist_name,a.first_name,a.last_name,a.email as selleremail,od.product_name,r.status,r.*
	 		from ".$tableprefix."orders o ,".$tableprefix."artists a , ".$tableprefix."order_details od ,".$tableprefix."refunds r 
	 		where o.order_id=r.order_id  AND od.order_id=r.order_id and od.product_id=r.product_id AND  a.artist_id=r.seller_id  and r.buyer_id=".$userid." and r.refund_id=".$refund_id." ";
		 $result=mysql_query($sql) or die(mysql_error());
		
		$numresults=mysql_num_rows($result);
		
		if($numresults>0)
		{
			$rm=mysql_fetch_array($result);
			//$username=$rm['user_name'];
			$sellername=$rm['artist_name'];
			
			$buyerfname=$rm['billing_first_name'];
			
			$buyerlname=$rm['billing_last_name'];
						
			$productname=$rm['product_name'];
			$quanity=$rm['quantity'];
			$reason=stripslashes($rm['return_reason']);
			$buyer_comments=stripslashes($rm['Additional_info']);
			//$to_buyer= $rm['email'];
			$date=date("m-d-Y");
			$to_seller=$rm['selleremail'];
			//$orderid=$rm['order_id'];
			//$refundid=$rm['refund_id'];
			$sellerfname=$rm['first_name'];
			
			$sellerlname=$rm['last_name'];
			$date_new = date("m-d-Y");
			
	}	
	        $date_new = dateFormat($date_new,"Y-m-d","m/d/Y");
			$date_new_format = $date_new;
		
	// Send Mails to Seller 
	    $refundid=$refund_id;
		$subject="Request for return payment with ".SITE_NAME;
/*-------Email Template Reading Fuction Call--------*/				
		$mailcontent = readEmailTemplate('refund_registration_seller');
		$mailcontent = htmlentities(stripslashes($mailcontent));
		
		$mailcontent = str_replace('[p_name]',stripslashes($productname),$mailcontent);		
		$mailcontent = str_replace('[return_reason]',stripslashes($reason),$mailcontent);	
		$mailcontent = str_replace('[quantity]',$quanity,$mailcontent);	
		$mailcontent = str_replace('[date]',date('m-d-Y'),$mailcontent);	
		if($buyer_comments!='')
		{
                    $mailcontent = str_replace('[comments]',$buyer_comments,$mailcontent);
		}
		$mailcontent = str_replace('[order_id]',$orderid,$mailcontent);	
		$mailcontent = str_replace('[refund_id]',$refundid,$mailcontent);	
		$mailcontent = str_replace('[seller_first_name]',$sellerfname,$mailcontent);	
		$mailcontent = str_replace('[seller_last_name]',$sellerlname,$mailcontent);			
		$mailcontent = str_replace('[first_name]',$buyerfname,$mailcontent);
		$mailcontent = str_replace('[last_name]',$buyerlname,$mailcontent);
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$mailcontent = nl2br($mailcontent);
		$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Online reservation</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';

$mailsent = mail($to_seller, $subject, $mail_send_details, $headers);
	
	//////////////////////////////////////////////////////////////////// 
	
	// send mail to Administrator 
	
	$u_sql    = "select first_name,last_name,email from ".$tableprefix."users where user_id = ".$_SESSION["sess_userid"];
	$u_rs     = mysql_query($u_sql);
	$u_rw     = mysql_fetch_array($u_rs);
	$username = $u_rw["first_name"]." ".$u_rw["last_name"];
	$to_buyer = $u_rw["email"];
	
	$subject="Return Payment Request Registration with ".SITE_NAME;

		$to_admin=SITE_EMAIL;
/*-------Email Template Reading Fuction Call--------*/				
		$mailcontent = readEmailTemplate('refund_request_reg_admin');
		$mailcontent = str_replace('[user_name]',$username,$mailcontent);	
		$mailcontent = str_replace('[p_name]',stripslashes($productname),$mailcontent);		
		$mailcontent = str_replace('[seller_name]',$sellername,$mailcontent);	
		$mailcontent = str_replace('[reason]',stripslashes($reason),$mailcontent);	
		$mailcontent = str_replace('[quantity]',$quanity,$mailcontent);	
		$mailcontent = str_replace('[date]',date('m-d-Y'),$mailcontent);	
		
		$mailcontent = str_replace('[first_name]',$buyerfname,$mailcontent);
		$mailcontent = str_replace('[last_name]',$buyerlname,$mailcontent);
		
		if($buyer_comments!='')
		{
		$mailcontent = str_replace('[comments]',$buyer_comments,$mailcontent);	
		}
		$mailcontent = str_replace('[order_id]',$orderid,$mailcontent);	
		$mailcontent = str_replace('[refund_id]',$refundid,$mailcontent);	
		
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$mailcontent = nl2br($mailcontent);
		$mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Online reservation</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';


$mailsent = mail($to_admin, $subject, $mail_send_details, $headers);
	// End Send Mail Message To Administrator
			
	if($row['rma_confirm_message']=='Y')
		{ //  check send mail confirmation 
		$subject="Your return payment information with ".SITE_NAME;
/*-------Email Template Reading Fuction Call--------*/				
		$mailcontent = readEmailTemplate('refund_registration');
		$mailcontent = str_replace('[p_name]',stripslashes($productname),$mailcontent);		
		$mailcontent = str_replace('[return_reason]',$reason,$mailcontent);	
		$mailcontent = str_replace('[quantity]',$quanity,$mailcontent);	
		$mailcontent = str_replace('[date]',date('m-d-Y'),$mailcontent);	
		if($buyer_comments!='')
		{
		
		$mailcontent = str_replace('[comments]',$buyer_comments,$mailcontent);	
		}
		$mailcontent = str_replace('[order_id]',$orderid,$mailcontent);	
		$mailcontent = str_replace('[refund_id]',$refundid,$mailcontent);	
		$mailcontent = str_replace('[seller_first_name]',$sellerfname,$mailcontent);	
		$mailcontent = str_replace('[seller_last_name]',$sellerlname,$mailcontent);			
		$mailcontent = str_replace('[first_name]',$buyerfname,$mailcontent);
		$mailcontent = str_replace('[last_name]',$buyerlname,$mailcontent);
		
		$headers  = "MIME-Version: 1.0" . "\r\n";
		$headers .= "Content-type: text/html; charset=iso-8859-1" . "\r\n";
		$headers .= "From: ".SITE_EMAIL."<".SITE_EMAIL.">" . "\r\n";
		$mailcontent = nl2br($mailcontent);
		 $mail_send_details = '<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   <title>Online reservation</title>
  <link href="./themes/'. $active_template[4].' rel="stylesheet" type="text/css">
</head>
<body>

<table width="103%" cellspacing="10" cellpadding="0" bgcolor="#EAEAEA">
   <tr>
     <td align="center" valign="top">
         
         <table width="600" border="0" cellpadding="0" cellspacing="0" bordercolor="#EAEAEA" bgcolor="#FFFFFF" class="manage_table">
            <tr>
               <td align="right" >
              </td>
            </tr>
            <tr>
               <td valign="middle" align="left"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 <tr>
                   <td  bgcolor="#EAEAEA" > <img src='.SITE_URL.'/banners/'.getSettingsValue('site_logo').' width="125" height="60"/></td>
                 </tr>
               </table></td>
            </tr>
            <tr>
              <td align="center" valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
                <tr>
                  <td align="left"><p>'.$mailcontent.'</p>
                  </td>
                </tr>
              </table></td>
            </tr>
            <tr>
               <td align="center" bgcolor="#EAEAEA" class="footer">
                  <p>&nbsp;</p>
              </td>
            </tr>
       </table>

     </td>
   </tr>
</table>


</body>
</html>';

                

		$mailsent = @mail($to_buyer, $subject, $mail_send_details, $headers);
		
	} // end if 
		} // end if update
	} // end for each 
	//echo $date_new_format;exit;

       // exit;
	header ("Location:myreturns.php");
	exit;
} // end if 
			
} // end message empty check 
	
} // end if button save check 


/*display the active template*/

$active_template = displayTemplate();

include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>
<script language="JavaScript" type="text/JavaScript">
function checkConfirm() {
  var total=0;
  frm = document.frmresponse;
  var chks = document.frmresponse.elements['ids[]'];
  for(var i=0; i<chks.length; i++){
    if(frm.ids[i].checked) 
	{
      total++;
    }
  }
  if( total == 0 )
   {
  alert('<?php echo SELECT_ONE_CHECKBOX_TEXT;?>');
    return false;
  } else {
    return true;
  }
}

function checkConfirm11()
{
var chks = document.frmresponse.elements['ids[]'];
var hasChecked = false;
for (var i=0;i<chks.length;i++){
if (chks[i].checked){
hasChecked = true;
break;
}
}
if (!hasChecked){
alert('<?php echo SELECT_CHECK_BOX_TEXT;?>');
chks[0].focus();
return false;
}

return true;

}


checked=false;
function checkedAll (frm1) {
	var aa= document.getElementById('frmresponse');
	 if (checked == false)
          {
           checked = true
          }

        else
          {
          checked = false
          }
	for (var i =0; i < aa.elements.length; i++) 
	{
	 aa.elements[i].checked = checked;
	}
      }
	
function toggleChecked(status) {
$(".checkbox").each( function() {
$(this).attr("checked",status);
})
} 
	  
	  function checkConfirmrefund()
{
var ids=document.getElementsByName('ids[]');
	  var hasChecked = false;
	  var hasChecked1=true;
        // Get the checkbox array length and iterate it to see if any of them is selected
    
		for (var i = 0; i < ids.length; i++)
        {
			var qty=ids[i].value;
			
			
			    if(ids[i].disabled==false)
			   {
					if (ids[i].checked==true)
					{
					hasChecked=true;
					if(document.getElementById("qty"+qty).value=="")
						 {
							hasChecked1=false;
						 }
						  
					}
				}
				
        }
		
		if (!hasChecked)
        {
                alert('<?php echo CHECKBOX_SELECT_TEXT;?>');
                ids[0].focus();
                return false;
        }
		else if (!hasChecked1)
        {
                alert('<?php echo QUANTITY_SELECT_TEXT;?>');
                ids[0].focus();
                return false;
        }
        // if ishasChecked is false then throw the error message
		
		if(document.getElementById("comments").value=="")
		{
			 alert('<?php echo COMMENT_BOX_TEXT;?>');
			 return false;
		}
     
	else {
	
		 return true;
	 }	   
		
		
		

}	
</script>
			<div align="left" class="main_body">
			
			<!--mainbody area start -->
			
		<!--center content area start-->		

		<form action="" method="post" name="frmresponse">
		
		<div align="left" id="item_details">
		<!--items display area start -->
		<div align="left" id="items_top_area">
				
				<div align="left" id="items_top_area_ttl"><?php echo RETURN_PAY_REQUEST_TEXT?></div>
		</div>

		
		<div class="order_listings">
			<fieldset>
			<table width="100%"  border="0" cellpadding="0" cellspacing="5" align="center">
				
				<tr>
					<td height="21"  align="left"><strong><?php echo REGISTER_RETURN_PAY_TEXT;?></strong></td>
				</tr>
				<tr>
				<td>
				<?php if($numrows>0)
					{
					
						if(!checkAllProductsRefunded($orderid))
						{
						
					?>
				<table border="0" width="100%" cellpadding="2" class="manage_table">
				<?php if(!empty($message)){ ?>
				<tr><td colspan="4" class="text_information" height="30"><?php echo $message;?></td>
				</tr> <?php } // end if ,essage check ?>
				
				<tr class="ordheads_heads" ><td width="13%"><input type="checkbox" name="checkAllBox" value="checkbox" onclick="toggleChecked(this.checked)"></td>
				  <td width="23%"><strong><?php echo PRODUCT_TEXT;?></strong></td>
				  <td width="17%"><strong><?php echo PRICE_TEXT;?></strong></td>
				  <td width="29%"><strong><?php echo QUANTITY_TEXT;?></strong></td>
				  <td width="18%"><strong><?php echo REASON_TEXT?></strong></td>
				</tr>
				<?php 
						$i=1;
						$totalrefund_qty=0;
						$totalqty= 0;
						
						while($rr=mysql_fetch_array($rs))
						{
						if($i%2==0)
						{
							$bgcolor="";
						}
						else
						{
							$bgcolor="";
						}	
						
						// Check this prodocts is requested refund  		
					  $checkRefundStats=checkRefundStatus($rr['order_id'],$rr['product_id'])	;
					
					// Check how much quantitity requested refund 			
					  $checkQuantity=checkSkuQuantity($rr['order_id'],$rr['product_id']);	
					  
					// Check Quatity Remaining for Refund then return value 1 else return value 0  
					if($checkRefundStats=="1")
						{
								if($checkQuantity!=$rr['product_quantity'])
								{
									$txtquantity=$rr['product_quantity']-$checkQuantity;
									$moreRequest=1;
								} // end if quuantity equal check 
								else
								{
										$moreRequest=0;
								
								}
					
						}  // en dif 
						
						else
						{
							$txtquantity =	$rr['product_quantity'];
							$moreRequest=1;
						}
						
						 $totalrefund_qty+=$checkQuantity;
					 
					 	 $totalqty+=$rr['product_quantity'];
					?>
					
		<?php 
		if($moreRequest==1)
		{
		?>			
				<tr bgcolor="<?php echo $bgcolor;?>">
				  <td><input type="checkbox" name="ids[]" value="<?php echo $rr['product_id']?>" class="checkbox"></td>
				  <td><?php echo $rr['product_name'];?> <input type="hidden" name="sellerid<?php echo $rr['product_id']?>" value="<?php echo $rr['artist_id']?>">
				  <input type="hidden" name="pname<?php echo $rr['product_id']?>" value="<?php echo $rr['product_name']?>">
                  <input type="hidden" name="username" value="<?php echo $rr['user_name'];?>" >
</td>
				  <td> <?php echo $currencySymbol ?> <?php echo $rr['product_price'];?></td>
				  <td>
				  <select name="qty<?php echo $rr['product_id']?>" id="qty<?php echo $rr['product_id'];?>">
				 <option value="">-<?php echo SELECT_TEXT;?>-</option>
						<?php for($j=1;$j<=$txtquantity;$j++)
						{
						?>
						<option value="<?php echo $j;?>"><?php echo $j;?></option>
						<?php } // end for each ?>
				  </select>				  </td>
				  <td align="center"><select name="reason<?php echo $rr['product_id']?>">
				 <?php foreach($reasonArray as $reason => $val)
				 {	
				 ?>
				 <option value="<?php echo stripslashes($reason);?>"><?php echo stripslashes($val);?></option>
				 <?php } ?>
			 </select></td>
				  </tr>
				  <?php 
				  $i++;
				  } // end while
				  	}
					 
					 
				   ?>
				<tr>
				  <td>&nbsp;</td>
				  <td>&nbsp;</td>
				  <td>&nbsp;</td>
				  <td>&nbsp;</td>
				  <td align="center">&nbsp;</td>
				  </tr>
				<tr>
				  <td colspan="2" align="left" valign="top"><?php echo COMMENT_TEXT;?></td>
				  <td colspan="3"><textarea name="comments" cols="40" rows="5" id="comments"></textarea>
			      <input type="hidden" name="orderid" value="<?php echo $orderid;?>">
			      <input type="hidden" name="userid" value="<?php echo $userid;?>"></td>
				  </tr>
								<tr>
									<td align="center" colspan="4"><input type="button" value="<?php echo ACCOUNT_BACK_BUTTON;?>" name="btnBack"  class="button" onClick="window.location.href='myaccount.php'">
									<input type="submit" value="<?php echo REQUEST_REFUND_TEXT;?>" name="btnSave"  class="button" onClick="return checkConfirmrefund();">
									</td>
								</tr>
			</table>
			<?php 
			 } 
			 
			 else{ 
			 	
				echo '<tr>
									<td align="center" colspan="4" class="text_information">'.RR_ALREADY_REQUESTED_TEXT.'</td>
								</tr>';
			 }
			
			} // end if 
			else
			{
				echo '<tr>
									<td align="center" colspan="4" class="text_information">'.RR_NO_RECORD_TEXT.'</td>
								</tr>';
			}//end else
			?>
			<?php  if($recordsper>0)
				   {
				?>
				<table width="100%">
				  <tr>
				  <td align="center" class="text_information"><?php echo RR_UPDATE_SUCCESS_TEXT;?></td>
				  <tr>
				    <td align="center">&nbsp;</td>
			      </tr>
				  <tr>
				    <td align="center">&nbsp;</td>
			      </tr>
				  <tr>
				<td align="center"><input type="button" value="<?php echo ACCOUNT_BACK_BUTTON;?>" name="btnBack"  class="button" onClick="window.location.href='myaccount.php'">
				</td>
				  </tr>
			</table>
				<?php } ?>
		</td></tr></table>		
		  </fieldset>
							
		</div>	
	
		<div align="left" class="float_clear1"></div>
		 <!--items display area end -->
		  </div>
			</form>
		<!--center content area end-->	

		<div align="left" class="clear"></div>		
		<!--mainbody area end -->
        </div>
		<div align="left" class="clear"></div>
<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>																										
																										
																										
																									