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

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_artistid"]) and $_SESSION["sess_artistid"]!= ""){
	$artistid = $_SESSION["sess_artistid"];
}else{
	if(!isset($_SESSION['SESS_insertQry']))
	{
		header("Location:login.php");
		exit;
	}	
}
$memberShipType=$_POST['subOption'];
//--------------------------------payment options----------------------------------------//
$sql = "SELECT *  FROM ".$tableprefix."settings ";
$res = mysql_query($sql);

if(mysql_num_rows($res)>0)
{
$row = mysql_fetch_array($res);

$chkPaypal = $row["enablepaypal"];
$siteurl=$row["site_url"];
//========================================Check Tax Settings for  Products
$enable_tax=$row["enable_tax"];
$default_tax_rate=$row['defaulttax_rate'];
//==============================================End Tax Check 
//worldpay account Details
$chkworldpay = $row["enableworldpay"];
$worldpaytestmode = $row["worldpay_testmode"];
$Instid = $row["worldpay_inst_Id"];
$worldpayEmail = $row["worldpay_email"];
$worldauthmode = $row["worldpay_transact_method"];
}
switch($worldpaytestmode)
{
case "100":
$worldpayserver="https://select-test.worldpay.com/wcc/purchase";
break;

case "0":
$worldpayserver="https://select.worldpay.com/wcc/purchase";
break;

default:
$worldpayserver="https://select.worldpay.com/wcc/purchase";
break;
}
//---------------------------------------------------------------------------------------//

$myPlanID= $_SESSION['SESS_insertQry'][1]; 



/*function call to fetch details from site settings*/

$google_payment_array = array('vgoogle_check_enable','vyourpay_enable','vauthorize_enable','venable_gift_payment');
$google_payment_settings = getSiteGeneralSettings($google_payment_array);

if($google_payment_settings[0] == "Y")
{
	$google_block = "";
}
else
{
	$google_block = "none";
}

if($google_payment_settings[1] == "Y")
{
	$yourpay_block = "";
}
else
{
	$yourpay_block = "none";
}



include "../includes/htmltop.php";
?>
<script>


var xmlhttp;

function showDesc(str)
{
xmlhttp=GetXmlHttpObject();

var subOption=document.getElementById("subOption").value;
if(subOption!=""){
if (xmlhttp==null)
  {
  alert ("<?php echo ALERT_HTTP;?>");
  return;
  }
var url="getPlanDetails.php";
url=url+"?planID="+subOption;
url=url+"&sid="+Math.random();
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}else{
document.getElementById('showDisc').style.display = "none";
document.getElementById('payMethod').style.display = "none";
document.getElementById('palnID').value="";
}
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
var resText=xmlhttp.responseText;
var resText=resText.split("~IscriptsIamamcdelimiterIscripts~");
document.getElementById('planCharge').innerHTML="<strong>"+resText[3]+"&nbsp;&nbsp;(<?php echo $adminCurrency['currency_symbol'];?>"+resText[1]+")</strong>";
document.getElementById('palnID').value=resText[0];
document.getElementById('planDescription').innerHTML=resText[2];
document.getElementById('showDisc').style.display = "block";
document.getElementById('payMethod').style.display = "block";


}
}

function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}
</script>

		<body>
		<center>
		
		<div id="layout">
				
				<!--header area start -->
				
<?php

	include_once("../includes/topheader_seller.php")

?>						
				
				<!--header area end -->
				
				
				<div align="left" class="main_body" >
				<!--main body start -->
<?php	
			
include "../includes/artisttopmenu.php";
	
?>
																
				
					
								
				<div align="right" class="content_area">
					<!--content area start -->
									<br>									
									<div class="username_chooseplan"><strong><?php echo TEXT_WELCOME;?>&nbsp;<?php echo getArtistName($artistid); ?>&nbsp;&nbsp;</strong></div>
									<br><br>						
					<!--content area ends -->
					
					<div align="center">
					<table width="200" border="0" align="center" cellspacing="0" bordercolor="#000000">
  <tr>
    <td>
	<table width="600" border="0" align="center">
                      <tr align="center">
                        <td align="center"><?php echo MSG_PLAN;?></td>
                      </tr>
                      <tr>
                        <td align="center"><form name="subMembership" method="post" action="chooseYourPlan.php">
													<?php
$sql_Plans = "SELECT plan_Id, plan_Title,plan_Description,plan_Status,plan_SubscriptionCharge
		FROM ".$tableprefix."sellerPlans WHERE plan_Status='Y' AND plan_Period !='F'";
$res_Plans =	mysql_query($sql_Plans);
if(mysql_num_rows($res_Plans)>0){
							?>
							<select name="subOption" id="subOption" onchange="showDesc(this.value)" style="width: 250px; font-size:12px; font-weight:bold;">							
							<option value="">Choose your plan here</option>
							<?php
								
					while($data_plan=mysql_fetch_array($res_Plans))
					{
						echo '<option value="'.$data_plan['plan_Id'].'"';
						if($data_plan['plan_Id']==$myPlanID)
						echo "selected";
						
						echo	'>'.$data_plan['plan_Title'].'</option>';
					}

							?>
							</select>
<?php  }?>							
							<div id="showDisc" style="display:none;"><br><br><br>
							<div style="border:1px solid #A8A8A8; margin-bottom:10px; padding: 10px 5px 10px 5px; ">
<table width="85%" border="0" cellspacing="0" >
  <tr>
    <td style=" border-bottom-width:2px; border-bottom-style:dotted; border-bottom-color:#333333; ">&nbsp;&nbsp;<div align="justify" id="planCharge"></div><br></td>
  </tr>
  <tr>
    <td><br><div align="justify" id="planDescription"></div></td>
  </tr>
</table>


</div></div>
<input type="hidden" name="palnID"  id="palnID" value="">
							</form></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                      </tr>
          </table>
	</td>
  </tr>
</table>		

<br><br>

<div id="payMethod" style="display:none">
<table cellpadding="0" border="0" cellspacing="0" width="100%">
		
<?php

$txtEnableAuthorize 	= getSettingsValue('vauthorize_enable');
$txtEnableBluepay       = getSettingsValue('vbluepay_enable');
$txtEnableFirstData	= getSettingsValue('vyourpay_enable');
$enable_buyerToseller	= getSettingsValue('enable_buyerToseller');
																										
	if($chkPaypal == "Y")
	{
 ?>		
		<tr>
		  <td align="center"><?php echo MSG_PAYPL_ORDER;?></td>
		  </tr>
		<tr>
			<td align="center">

		<a href="pay.php?paymentMethod=PP"><img src="../images/pp.jpg" alt="Click here to complete Paypal order payment" border="0" title="Make payments with PayPal - it's fast, free and secure! " ></a>



<br>
<?php echo MSG_MAKE_SURE;?></td>
	</tr>
	<?php
	 } 
?>

	<tr>
	<td align="center">
            <br>
<?php


	if(($txtEnableAuthorize == "Y" || $txtEnableBluepay == "Y" || $txtEnableFirstData == "Y") && $enable_buyerToseller == 'N' && $adminCurrency['currency_code']=='USD')
	{
		$secureurl = SECURE_SITE_URL."/sellers/payment.php";
?>
		<a href="<?=$secureurl?>"><img src="../images/cc.gif" valign="top" title="Pay with Credit Card" border="0" ></a>
<?php
	}

?>		
				
		  </td>
		</tr>
		
		<?php
/*
                if($chkworldpay=="Y" && $enable_buyerToseller == 'N')
		{?>
		<tr>
		<td> <div id="worldpayBlock">
		<table width="100%">
		<tr><td align="center">
		  <a href="worldpaypayment.php?payment=WP"><img src="images/worldpay.gif" width="139" height="33" border="0"  title="Make payments with WorldPay - it's fast, free and secure"></a></td>
		</tr>
		<tr>
		  <td align="center">&nbsp;		    </td>
		  </tr>
		</table>
		</form>
		
		</div></td>
		</tr>
		<?
		}
		?>
				<tr>
			<td align="center">
				<div id="yourPayBlock" style="display:<?php echo $yourpay_block?>">
					<table cellpadding="0" cellspacing="0" border="0" width="30%">
						<tr>
							<td align="center"><a href="<?php echo SECURE_SITE_URL."/"?>yourpay_payment.php"><img src="images/yourpay.jpg" valign="top" title="Pay with YourPay Payment Gateway" border="0" ></a></td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		
				<tr>
			<td align="center">
				<div id="googleCheckBlock" style="display:<?php echo $google_block?>">
					<table cellpadding="0" cellspacing="0" border="0" width="30%">
						<tr>
							<td>
								<a href="google_checkout_payment.php"><img src="images/google_checkout.gif"  border="0" title="Google Checkout Payment Gateway"></a>
							</td>	
						</tr>	
					</table>
				</div>
			</td>
		</tr>
		
		

*/	
                
?>
 <?php if($chkPaypal != "Y" && $google_payment_settings[0] != "Y" && $google_payment_settings[1] != "Y" && $google_payment_settings[2] != "Y" && $google_payment_settings[3] != "Y")
	{
?>			
		

		<tr>
			<td class="text_information"><?php echo MSG_CONT_ADMIN;?></td>
		</tr>	
		<tr>
			<td align="center"><input type="button" class="button" name="back" value="Back" onClick="Javscript:history.go(-1);"></td>
		</tr>	
<?php

	}

?>		
		
	<!--
	<tr>
		<td>&nbsp;</td>
	</tr>
	<tr><td height="42" align="center">Click here to use a credit card for payment</td>
	</tr>
	<tr>
	<td align="center">
<?php
/*
	if($google_payment_settings[2] == "Y")
	{
		$secureurl = SECURE_SITE_URL."/payment.php";
?>
		<a href="<?=$secureurl?>"><img src="images/cc.gif" valign="top" title="Pay with Credit Card" border="0" ></a>
<?php
	}
*/
?>		
				
		  </td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		<?php 
		/*
		if($chkworldpay=="Y")
		*/
		{?>
		<tr>
		<td> <div id="worldpayBlock">
		<table width="100%">
		<tr><td align="center">
		  <a href="worldpaypayment.php?payment=WP"><img src="images/worldpay.gif" width="139" height="33" border="0"  title="Make payments with WorldPay - it's fast, free and secure"></a></td>
		</tr>
		<tr>
		  <td align="center">&nbsp;		    </td>
		  </tr>
		</table>
		</form>
		
		</div></td>
		</tr>
		<?php
		}
		?>
		<tr>
			<td align="center">
				<div id="yourPayBlock" style="display:<?php//echo $yourpay_block?>">
					<table cellpadding="0" cellspacing="0" border="0" width="30%">
						<tr>
							<td align="center"><a href="<?php // echo SECURE_SITE_URL."/"?>yourpay_payment.php"><img src="../images/yourpay.jpg" valign="top" title="Pay with YourPay Payment Gateway" border="0" ></a></td>
						</tr>
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
		
		<tr>
			<td align="center"><a href="2checkout_payment.php"><img src="images/2co.jpg"  border="0" title="2Checkout Payment Gateway"></a></td>
		</tr>
		
		<tr>
			<td align="center">
				<div id="googleCheckBlock" style="display:<?php // echo $google_block?>">
					<table cellpadding="0" cellspacing="0" border="0" width="30%">
						<tr>
							<td>
								<a href="google_checkout_payment.php"><img src="images/google_checkout.gif"  border="0" title="Google Checkout Payment Gateway"></a>
							</td>	
						</tr>	
					</table>
				</div>
			</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
		</tr>
<?php
/*

	if($google_payment_settings[3] == "Y" && $_SESSION['gift_certificate_flag'] == "N")
	{
*/
?>		
		
		
		<tr>
			<td align="center"><a href="giftcoupon_payment.php"><img src="../images/giftcoupon_payment.jpg" border="0" title="Pay with Gift Certificate"></a></td>
		</tr>
		
<?php
/*
	}
	
	if($chkPaypal != "Y" && $google_payment_settings[0] != "Y" && $google_payment_settings[1] != "Y" && $google_payment_settings[2] != "Y" && $google_payment_settings[3] != "Y")
	{
	*/
?>			
		

		<tr>
			<td class="text_information">All Payment options are disabled by the Administrator,<br>Please contact the Administrator !!</td>
		</tr>	
		<tr>
			<td align="center"><input type="button" class="button" name="back" value="Back" onClick="Javscript:history.go(-1);"></td>
		</tr>	
<?php

	// }

?>		
		
		<tr>
			<td>&nbsp;</td>
		</tr> -->

</table>
</div>

							  
							  
							
				  </div>
							


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

				</div>
<script>
showDesc("<?php echo $myPlanID; ?>");
</script>				

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

?>