<?

/*
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
*/



	// ========================================================================================
	
	$PageTitle = '<img src="'.$ImagesURL.'/admin/admincp_ecom.gif" width="20" height="21" align="middle"> '.$MsgText[9][129];
	$BrowserTitle = $MsgText[9][129];
	$LocationBar = '<a href="'.$IndexURL.'">'.$MsgText[0][1].'</a> > <a href="' . $MainURL . '/options.html">'.$MsgText[0][4].'</a> > '.$MsgText[9][129];
	
	if ($LoggedIn == 'y') {
		
		ReadPermissions();
		Global $Permissions;
		
		if ($Permissions[902] == 'y') {
		
			$query = "select * from `".$Settings['DBPrefix']."ec-Settings`";
			$result = mysql_query($query) or die (mysql_error());
			while ($row = mysql_fetch_array($result)) {
				$ecSettings[$row['Name']] = $row['Value'];
			}
			
			
			
			$TitleAlignmentSelected[$ecSettings['TitleAlignment']] = ' selected';
			
			$CategoryPictureLocationSelected[$ecSettings['CategoryPictureLocation']] = ' selected';
			$DetailsPictureLocationSelected[$ecSettings['DetailsPictureLocation']] = ' selected';
			
			
			$RequireShipToBillingSelected[$ecSettings['RequireShipToBilling']] = ' selected';
			
			$DisplayActualStockSelected[$ecSettings['DisplayActualStock']] = ' selected';
			
			
			if ($ecSettings['ShowInStock'] != 'n' && $ecSettings['ShowInStockOther'] != '') {
				$ShowInStockOther = $ecSettings['ShowInStockOther'];
				$ShowInStock[2] = ' checked';
			}
			else if ($ecSettings['ShowInStock'] != 'n') {
				$ShowInStock[1] = ' checked';
			}
			else {
				$ShowInStock[3] = ' checked';
			}
			
			
			if ($ecSettings['ShowSoldOut'] != 'n' && $ecSettings['ShowSoldOutOther'] != '') {
				$ShowSoldOutOther = $ecSettings['ShowSoldOutOther'];
				$ShowSoldOut[2] = ' checked';
			}
			else if ($ecSettings['ShowSoldOut'] != 'n') {
				$ShowSoldOut[1] = ' checked';
			}
			else {
				$ShowSoldOut[3] = ' checked';
			}
			
			
			$CurrencyLocationSelected[$ecSettings['CurrencyLocation']] = ' selected';
			
			$WeightUnitsSelected[$ecSettings['WeightUnits']] = ' selected';
			
			
			
			$ShowNoPricingChecked[$ecSettings['ShowNoPricing']] = ' checked';
			
			
			
			
			
			$PageContents = '<form name="PostForm" action="'.$MainURL.'/admin/store-prefs-save" method="post">
			
			<br><b>'.$MsgText[0][255].':</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;('.$MsgText[1][26].': <select name="TitleAlignment" style="'.$FormStyle.'">
			<option value="L"'.$TitleAlignmentSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="C"'.$TitleAlignmentSelected['C'].'> '.$MsgText[0][16].'</option>
			<option value="R"'.$TitleAlignmentSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>)<br>
			<input type="text" name="PageTitle" size="45" value="'.str_replace('"','&#34;',$ecSettings['PageTitle']).'" style="'.$FormStyle.'">
			<br>
			
			<script>
var ImageDestination = "";

var ExistingImagesWindowCode = "";

function SelectImage(ImageDestinationSent) {
	var WindowProperties = "width=420,height=300,left=" + (screen.width-420)/2 + ",top=" + (screen.height-300)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

	ImageDestination = ImageDestinationSent;

	if (ImageDestination == "Photo") {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["PhotoURL"].value,"existingimages",WindowProperties);
	}
	else {
		ExistingImagesWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-existingimages.php?"+document.forms["PostForm"].elements["TitleImage"].value,"existingimages",WindowProperties);
	}
}
function ExistingImageSelected(ImageName,ImageWidth,ImageHeight) {

	ExistingImagesWindowCode.close();
	
	if (ImageDestination == "Photo") {
		document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
	}
	else {
		document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
	}

}
function UploadToServer(ImageDestinationSent) {

		ImageDestination = ImageDestinationSent;

		var WindowProperties = "width=580,height=380,left=" + (screen.width-580)/2 + ",top=" + (screen.height-380)/2 + ",location=no,menubar=no,directories=no,toolbar=no,status=no,scrollbars=no,resizable=yes";

		UploadWindowCode = window.open("'.$BaseURL.'/inc-core-admin-editor-imageupload.php","imageupload",WindowProperties);

	  }

	  function UploadedImageSelected(ImageName,ImageWidth,ImageHeight) {

		UploadWindowCode.close();
		
		
		if (ImageDestination == "Photo") {
			document.forms["PostForm"].elements["PhotoURL"].value = "/images/uploaded/"+ImageName;
		}
		else {
			document.forms["PostForm"].elements["TitleImage"].value = "/images/uploaded/"+ImageName;
		}
		
	  }
</script>
			
			
			'.$MsgText[0][519].':<br>
			<input type="text" name="TitleImage" size="50" value="'.str_replace('"', '&#34;', $ecSettings['TitleImage']).'" style="'.$FormStyle.'">
			<br>
			<input type="button" value="'.$MsgText[0][521].'" onClick="SelectImage();" style="'.$FormStyle.'">&nbsp;<input type="button" value="'.$MsgText[0][563].'" onClick="UploadToServer();" style="'.$FormStyle.'">
			<br><br>
			
			
			<b>'.$MsgText[9][130].':</b><br><input type="text" name="TopText" size="60" value="'.str_replace('"','&#34;',$ecSettings['TopText']).'" style="'.$FormStyle.'">
			<br><br>
			<b>'.$MsgText[9][131].':</b><br><input type="text" name="BottomText" size="60" value="'.str_replace('"','&#34;',$ecSettings['BottomText']).'" style="'.$FormStyle.'">
			
			<br>
			<br><br><b>'.$MsgText[9][132].':</b><br>
			<select name="CategoryPictureLocation" style="'.$FormStyle.'">
			<option value="L"'.$CategoryPictureLocationSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="R"'.$CategoryPictureLocationSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>
			
			<br><br><b>'.$MsgText[9][133].':</b><br>
			<select name="DetailsPictureLocation" style="'.$FormStyle.'">
			<option value="L"'.$DetailsPictureLocationSelected['L'].'> '.$MsgText[0][15].'</option>
			<option value="R"'.$DetailsPictureLocationSelected['R'].'> '.$MsgText[0][17].'</option>
			</select>
			
			
			<br><br><br>	
			<b>'.$MsgText[9][134].':</b><br>'.$MsgText[9][137].': <input type="text" name="MaxWidth" size="3" value="'.$ecSettings['MaxWidth'].'" style="'.$FormStyle.'"> px, '.$MsgText[9][138].': <input type="text" name="MaxHeight" size="3" value="'.$ecSettings['MaxHeight'].'" style="'.$FormStyle.'"> px

			<br><br>	
			<b>'.$MsgText[9][135].':</b><br>'.$MsgText[9][137].': <input type="text" name="LargeImageMaxWidth" size="3" value="'.$ecSettings['LargeImageMaxWidth'].'" style="'.$FormStyle.'"> px, '.$MsgText[9][138].': <input type="text" name="LargeImageMaxHeight" size="3" value="'.$ecSettings['LargeImageMaxHeight'].'" style="'.$FormStyle.'"> px

			<br><br>	
			<b>'.$MsgText[9][136].':</b><br>'.$MsgText[9][137].': <input type="text" name="ThumbMaxWidth" size="3" value="'.$ecSettings['ThumbMaxWidth'].'" style="'.$FormStyle.'"> px, '.$MsgText[9][138].': <input type="text" name="ThumbMaxHeight" size="3" value="'.$ecSettings['ThumbMaxHeight'].'" style="'.$FormStyle.'"> px
			
			<br><br>	
			<b>'.$MsgText[9][139].':</b><br><input type="text" name="MaxImageFileSize" size="4" value="'.$ecSettings['MaxImageFileSize'].'" style="'.$FormStyle.'"> KB

			<br><br><br>
			
			<b>'.$MsgText[9][140].':</b><br>'.$MsgText[9][141].'<br><input type="text" name="OriginZipCode" size="5" value="'.$ecSettings['OriginZipCode'].'" style="'.$FormStyle.'">

			<br><br><br>
			
			<b>'.$MsgText[9][142].':</b> ('.$MsgText[0][418].')<br>'.$MsgText[9][143].'<br><input type="text" name="OrdersEmail" size="30" value="'.$ecSettings['OrdersEmail'].'" style="'.$FormStyle.'">
			
			
			<br><br><br>
			
			<b>'.$MsgText[9][144].':</b><br>'.$MsgText[9][145].'<br><input type="text" name="PaypalEmail" size="30" value="'.$ecSettings['PaypalEmail'].'" style="'.$FormStyle.'">
			
			<br><br><br>
			
			<b>'.$MsgText[9][365].':</b><br>'.$MsgText[9][368].'<br><input type="text" name="GoogleCheckoutMerchantID" size="30" value="'.$ecSettings['GoogleCheckoutMerchantID'].'" style="'.$FormStyle.'">

			<br><br><br>
			
			<b>'.$MsgText[9][146].':</b><br>'.$MsgText[9][147].'<br><input type="text" name="OfflinePayableTo" size="30" value="'.$ecSettings['OfflinePayableTo'].'" style="'.$FormStyle.'">
			<br><br>
			
			<b>'.$MsgText[9][148].':</b><br><textarea name="OfflinePaymentDetails" cols="40" rows="4" style="'.$FormStyle.'">'.$ecSettings['OfflinePaymentDetails'].'</textarea>


			<br><br><br>
			
			<b>'.$MsgText[9][149].':</b><br>'.$MsgText[9][150].'<br><select name="RequireShipToBilling" style="'.$FormStyle.'">
			<option value="n"'.$RequireShipToBillingSelected['n'].'> '.$MsgText[9][151].'</option>
			<option value="y"'.$RequireShipToBillingSelected['y'].'> '.$MsgText[9][152].'</option>			
			</select>

			<br><br><br>
			
			<b>'.$MsgText[9][153].':</b><br>'.$MsgText[9][154].'
			<br>
			<select name="DisplayActualStock" style="'.$FormStyle.'">
			<option value="n"'.$DisplayActualStockSelected['n'].'> '.$MsgText[0][119].'</option>
			<option value="y"'.$DisplayActualStockSelected['y'].'> '.$MsgText[0][118].'</option>			
			</select>
			
			<br><br>
			
			<b>'.$MsgText[9][155].':</b><br>'.$MsgText[9][156].'<br><input type="text" name="DisplayActualStockMax" size="3" value="'.$ecSettings['DisplayActualStockMax'].'" style="'.$FormStyle.'">

			<br><br>
			
			<b>'.$MsgText[9][157].':</b><br>
				<input type="radio" name="ShowInStock" value="1"'.$ShowInStock[1].'> "'.$MsgText[9][158].'"<br>
	<input type="radio" name="ShowInStock" value="2"'.$ShowInStock[2].'> '.$MsgText[9][159].': <input type="text" name="ShowInStockOther" size="25" style="'.$FormStyle.'" value="'.$ShowInStockOther.'"><br>
	<input type="radio" name="ShowInStock" value="3"'.$ShowInStock[3].'> '.$MsgText[9][160].'<br>
	
			<br>
			
			<b>'.$MsgText[9][161].':</b><br>
				<input type="radio" name="ShowSoldOut" value="1"'.$ShowSoldOut[1].'> "'.$MsgText[9][162].'"<br>
	<input type="radio" name="ShowSoldOut" value="2"'.$ShowSoldOut[2].'> '.$MsgText[9][159].': <input type="text" name="ShowSoldOutOther" size="25" style="'.$FormStyle.'" value="'.$ShowSoldOutOther.'"><br>
	<input type="radio" name="ShowSoldOut" value="3"'.$ShowSoldOut[3].'> '.$MsgText[9][160].'<br>
	
			<br>
			
			<b>'.$MsgText[9][361].':</b><br>
			<select name="ShowNoPricing" style="'.$FormStyle.'">
			<option value="n"'.$ShowNoPricingChecked['n'].'> '.$MsgText[0][119].'</option>
			<option value="y"'.$ShowNoPricingChecked['y'].'> '.$MsgText[0][118].'</option>			
			</select>
			
			<br><br>
			
			<b>'.$MsgText[9][163].':</b><br>'.$MsgText[9][164].'<br>
			<input type="text" name="HighlightColor" size="6" style="'.$FormStyle.'" value="'.$ecSettings['HighlightColor'].'">
			
			<br><br><br>
			
			<b>'.$MsgText[9][165].':</b><br>
			<input type="text" name="Currency" size="6" style="'.$FormStyle.'" value="'.$ecSettings['Currency'].'"> - <select name="CurrencyLocation" style="'.$FormStyle.'">
			<option value="b"'.$CurrencyLocationSelected['b'].'> '.$MsgText[9][166].'</option>
			<option value="a"'.$CurrencyLocationSelected['a'].'> '.$MsgText[9][167].'</option>			
			</select>
			<br><br>
			<b>'.$MsgText[9][168].':</b><br>'.$MsgText[9][169].'<br>
			<input type="text" name="CurrencyCode" size="3" style="'.$FormStyle.'" value="'.$ecSettings['CurrencyCode'].'">
			
			<br><br>
			
			<b>'.$MsgText[9][170].':</b><br>
			<input type="text" name="PriceDecimals" size="3" style="'.$FormStyle.'" value="'.$ecSettings['PriceDecimals'].'">
			
			<br><br>
			
			<b>'.$MsgText[9][171].':</b><br>
			<input type="text" name="DecimalSymbol" size="3" style="'.$FormStyle.'" value="'.$ecSettings['DecimalSymbol'].'">
			
			<br><br>
			
			<b>'.$MsgText[9][172].':</b><br>
			<input type="text" name="ThousandsSep" size="3" style="'.$FormStyle.'" value="'.$ecSettings['ThousandsSep'].'">
			
			
			<br><br><br>
			
			<b>'.$MsgText[9][173].':</b><br>
			<select name="WeightUnits" style="'.$FormStyle.'">
			<option value="lbs"'.$WeightUnitsSelected['lbs'].'> Lbs</option>
			<option value="kg"'.$WeightUnitsSelected['kg'].'> Kg</option>			
			</select>
			
			
								
			<br><br><br><br><br>
			<input type="submit" value="'.$MsgText[0][123].'" style="'.$FormStyle.'">
			</form>';
			
			
	
	
		}
		else {
		
			$PageContents = $MsgText[0][97];
		
		}

	}
	else {
	
		RedirectToLogin();
	
	}
	

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




?>
