<?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";

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_adminname"]) and $_SESSION["sess_adminname"] != "") {
    $adminname = $_SESSION["sess_adminname"];
} else {
    header("Location:login.php");
    exit;
}
$sql = "SELECT * FROM " . $tableprefix . "settings ";
$result = mysql_query($sql);
if (mysql_num_rows($result) != 0) {
    $row = mysql_fetch_array($result);
    $upsps_shipping = $row['enable_uspsshipping'];
} // end result check 
//selecting settings for fedex shipping

$sql = "select * from " . $tableprefix . "usps_settings ";
$rs = mysql_query($sql) or die(mysql_error());

if (mysql_num_rows($rs) > 0) {
    $row = mysql_fetch_array($rs);
    $uspsid = $row['username'];
    $server = $row['server'];
}

if (isset($_POST['submit'])) {
    (isset($_POST['enable_australiapost'])) ? $txtaustraliapost = $_POST['enable_australiapost'] : $txtaustraliapost = 'N';

    mysql_query("UPDATE " . $tableprefix . "settings 
	                SET enable_australiapost = '" . $txtaustraliapost . "' ");

    if (mysql_affected_rows() > 0) {
        $message =  SHIPPING_SETTINGS_UPDATED_SUCC."!!";
    }
}
include "../includes/htmltop.php";

$sql = "SELECT enable_australiapost FROM " . $tableprefix . "settings ";
$result = mysql_query($sql);
if (mysql_num_rows($result) != 0) {
    $row = mysql_fetch_array($result);
    $chkaustraliapost = $row["enable_australiapost"];
}

if ($chkaustraliapost == "Y") {
    $australiapost_checked = "checked";
} else {
    $australiapost_checked = '';
}
?>
<style type="text/css">
    <!--
    .style1 {color: #FF0000}
    -->
</style>
<script language="javascript">
    function checkUspsshipping()
    {
        if(document.uspsshipping.enable_uspsshipping.checked == true)
        {
            document.getElementById("uspsBlock").style.display = "";
        }
        else
        {
            document.getElementById("uspsBlock").style.display = "none";
        }
    }
</script>
<body>
<center>

    <div align="left" id="layout">




        <!--header area start -->
<?php
include_once("../includes/topheader_admin.php")
?>

        <!--header area end -->




        <div align="left" class="main_body">
            <!--main body start -->



        <?php
        include_once("../includes/admintopmenu.php")
        ?>

            <form action="" method="post" name="uspsshipping" >

                <div align="left" class="content_area">
                    <!--content area start -->
                    <table cellpadding="0" cellspacing="0" border="0" width="100%">
                        <tr><td height="35"><?php include_once("../includes/shippingmenu.php") ?></td>
                        </tr>
                        <tr>
                            <td>
                                <div align="left" class="page_title"><?php echo EDIT_AUSTRALIA_SETTINGS;?></div>
                                <div align="center" class="text_information grey_tr"><?php echo $message ?></div>
                                <br>
                                <div align="left">

                                    <table width="100%" border="0" cellpadding="5" cellspacing="5" class="manage_table">
                                        <tr>
                                            <td  height="40"><?php echo SHIPPING_METHOD;?> </td>
                                            <td  align="left">&nbsp;<b><?php echo AUS_POST_SHIPPING;?> </b></td>
                                        </tr>
                                        <tr>
                                            <td  height="40"><?php echo ENABLE;?>  </td>
                                            <td  align="left">&nbsp;<input name="enable_australiapost" type="checkbox" id="enable_australiapost" value="Y" <?php echo $australiapost_checked; ?>>
                                                <?php echo SEL_CHKBX_AUS_SHIPPING;?>. </td>
                                        </tr>
                                    </table>

                                </div>
                                <div align="center"><input type="submit" name="submit" value="<?php echo BTN_UPDATE; ?>" class="button"></div>



                                <!--content area end-->
                            </td></tr>

                    </table>	

                </div>

            </form>

            <div align="left" class="clear_float"><img src="../images/clear.gif" alt="" width="1" height="1" /></div>
            <!--main body end -->
        </div>


<?php
include "../includes/footer.php";
?>

        <script language="javascript">
            function validateFedex()
            {
                if(document.uspsshipping.uspsId.value=="")
                {
                    alert("<?php echo ENTER_USPS_USERID;?>");
                    document.uspsshipping.uspsId.focus();
                    return false;
                }
	
	
                return true;
	
            }	


        </script>
