<?

/*
FlexCMS (http://www.flexcms.com)
Flexible, Powerful, Affordable.

Contents of this file are protected by the copyright
notice found at http://www.flexcms.com/flex/pages/copyright.html,
and its usage is subject to the terms of the licensing agreement 
available at http://www.flexcms.com/flex/pages/license.html
*/



	// ========================================================================================
	
	// ========================================================================================
		
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[901] == 'y') {
		
			$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_ecom.gif" width="20" height="21" align="middle"> '.$MsgText[9][56];
			$BrowserTitle = $MsgText[9][56];
			$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > <a href="'.$MainURL.'/admin/store-products.html">'.$MsgText[9][3].'</a> > <a href="'.$MainURL.'/admin/store-products_edit/'.$Arguments3.'.html">'.$MsgText[9][39].'</a> > '.$MsgText[9][56];
		
		
		
			$query5 = "select * from `".$Settings['DBPrefix']."ec-Items` WHERE Product='".intval($Arguments3)."' limit 1";
			$result5 = mysql_query($query5) or die (mysql_error());
			if (mysql_num_rows($result5) > 0) {
			
				$PageContents = $MsgText[9][57];			
			
			}
			else {
			
				$query = "select * from `".$Settings['DBPrefix']."ec-Items` WHERE Product='".intval($Arguments4)."' ORDER BY Option1 ASC, Option2 ASC, Option3 asc";
				$result = mysql_query($query) or die (mysql_error());
				while ($row = mysql_fetch_array($result)) {
				
					$x++;
				
					$BottomSection .= '<tr><td><input type="checkbox" name="ItemSelected_'.$x.'" value="y"></td><td><input type="text" name="ItemID_'.$x.'" size="20"></td><td><input type="text" name="ItemOption1_'.$x.'" size="40" value="'.$row['Option1'].'"></td><td><input type="text" name="ItemStock_'.$x.'" size="5"></td></tr>';
				
				
				}
				
				$NumItems = $x;
				
				
				for ($i = 1; $i <= 10; $i++) {
					if ($i == 1) {
						$QtyBox = '1';
					}
					else {
						$QtyBox = '<input type="text" name="PriceQty'.$i.'" size="4" style="'.$FormStyle.'">';
					}
					$PriceQtyBoxes .= '<tr><td>&nbsp;</td><td align="center"><font face="'.$FontFace.'" size="'.$FontSize.'">'.$QtyBox.'</td><td>&nbsp;</td><td align="center"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>$</b>&nbsp;<input type="text" name="Price'.$i.'" size="7" style="'.$FormStyle.'"></td></tr>';
				}
			
				$TopSection .= '<br><b>'.$MsgText[9][58].':</b> ('.$MsgText[9][59].')<br>
<table border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td width="20"><img src="'.$ImagesURL.'/admin/spacer.gif" width="20" height="1" alt="" border="0"></td>
      <td align="center"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[9][60].'</b></font></td>
      <td width="10"><img src="'.$ImagesURL.'/admin/spacer.gif" width="10" height="1" alt="" border="0"></td>
      <td align="center"><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[9][61].'</b></font></td>
    </tr>
    '.$PriceQtyBoxes.'
</table><font size="1"><b>'.$MsgText[9][62].':</b> '.$MsgText[9][63].'<br></font>';


	
				$TopSection .= '<br><br>
<b>'.$MsgText[9][64].':</b> ('.$MsgText[0][418].')<br><input type="text" name="ShippingWeight" size="10" style="'.$FormStyle.'">lbs <input type="text" name="ShippingWeightOz" size="2" style="'.$FormStyle.'">oz

<br><br>

<b>'.$MsgText[9][38].':</b> ('.$MsgText[0][418].')<br>$<input type="text" name="AdditionalShipping" size="5" style="'.$FormStyle.'">

<br><br><br>

<b>'.$MsgText[9][36].':</b> ('.$MsgText[0][418].')<br></font>'; 
							
				
				
				$PageContents .= '<form name="SubmitForm" action="'.$MainURL.'/admin/store-products_new_clone_save" method="post"><input type="hidden" name="ProductID" value="'.$Arguments3.'"><input type="hidden" name="NumItems" value="'.$NumItems.'">
<script>
		
	var NumItems = '.$NumItems.';
	
	function SelectAll() {
		for (x=1; x<=NumItems; x++) {
			document.forms["SubmitForm"].elements["ItemSelected_"+x].checked = true;
		}
	}
	function DeSelectAll() {
		for (x=1; x<=NumItems; x++) {
			document.forms["SubmitForm"].elements["ItemSelected_"+x].checked = false;
		}
	}
	</script>
'.$TopSection.'<br><br><br><table width="90%" cellpadding="2" cellspacing="0" border="0"><tr><td><font face="'.$FontFace.'" size="'.$FontSize.'"><a href="javascript:SelectAll();">'.$MsgText[9][65].'</a><br><a href="javascript:DeSelectAll();">'.$MsgText[9][66].'</a></td><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[9][42].'</b> ('.$MsgText[0][418].')</td><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[9][50].'</b></td><td><font face="'.$FontFace.'" size="'.$FontSize.'"><b>'.$MsgText[9][36].'</b> ('.$MsgText[0][418].')</td></tr>'.$BottomSection.'</table>

<br><br><br><br><input type="submit" value="'.$MsgText[9][55].'" style="'.$FormStyle.'"></form>';
				
				
				
			}
					
		
		
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}

	// ========================================================================================




?>
