__PaymentMethod = function(){
	this.container = $_('#OSCPaymentMethods')
	this.details = $_('#PaymentMethodDetails')
	this.URLGetContent = SmartCheckout.APIURL+'?ax=1&function=get_payment_method_html&methodId=';
	var self = this;
	$_('@paymentid').attach('click', function(){
		$_('#OSCPaymentIndicator'+this.value).style.visibility = 'visible';
		self.getContent()
	})
	
}

__PaymentMethod.prototype.getContent = function(){
	var self = this;
	var val = this.container.$_('@paymentid').VAL();
	if(!val)
		this.details.innerHTML = XCart.txt_select_payment_method
	else{
		$_('@paymentid').apply(function(el){el.disabled = true;})
		$_(this.URLGetContent+val).GET(function(data){
			$_('.OSCPaymentIndicator').CSS({visibility:'hidden'})
			$_('@paymentid').apply(function(el){el.disabled = false;})
			$_('@checkout_form').setAttribute('action',XCart.paymentMethods[val]);
			$_('@payment_method').VAL(XCart.paymentMethodTitles[val]);
			self.details.innerHTML = data.stdout
		})
	}
			
}

__PaymentMethod.prototype.$TEST = function(cbf){
	if(this.container.$_('@paymentid').VAL()){
		// If there is selected payment method
		return cbf();
	}else{
		var self = this;
		self.container.mutate({backgroundColor:'red'}, {backgroundColor:'#fffddf'},60, function(){setTimeout(function(){self.container.CSS({backgroundColor:''})}, 100)});
		return false;
	}
}


