window.addEvent('domready',function(){
	if ($('paypalSubmit'))
	//if ($type($('paypalSubmit'))=='element')
	{
		$('paypalSubmit').addEvent('click',function(e){
			e.stop();
			var allform = $('paypalSubmit').getParent('form');
			var com_id = $('com_id').value;
			new Request({
				url: "/ajax-maj-sys-payement.php?com_id="+com_id+"&com_type_paiement=PAYPAL",
				onSuccess: function()
				{
					parent.window.location.href= allform.get('action')+'?'+allform.toQueryString();
				},
	            onRequest: function(){}
	        }).send();
		});
	}
	if ($('formulairesipsatos'))
	if ($('formulairesipsatos').getElement('form'))
	//if ($type($('formulairesipsatos'))=='element')
	{
		var allform = $('formulairesipsatos').getElement('form');
		allform.getElement('div').getElements('input').each(function(el,i){
			el.addEvent('click',function(e){
				//e.stop();
				new Request({
					url: "/ajax-maj-sys-payement.php?com_id="+$('formulairesipsatos').get('title')+"&com_type_paiement=SIPSATOS",
					onSuccess: function()
					{
						//parent.window.location.href= allform.get('action')+'?'+allform.toQueryString();
					},
		            onRequest: function(){}
		        }).send();
			});
		});
	}
	
	if ($('chequesubmit'))
	{
		$('chequesubmit').addEvent('click',function(e){
			e.stop();
			var com_id = $('chequesubmitcom_id').value;
			new Request({
				url: "/ajax-maj-sys-payement.php?com_id="+com_id+"&com_type_paiement=CHEQUE",
				onSuccess: function()
				{
					parent.window.location.href= "/mon-panier/post-commande.html?typepaiement=CHEQUE";
				},
	            onRequest: function(){}
	        }).send();
		});
	}
	if ($('versementsubmit'))
	//if ($type($('versementsubmit'))=='element')
	{
		$('versementsubmit').addEvent('click',function(e){
			e.stop();
			var allform = $('versementsubmit').getParent('form');
			var com_id = $('versementsubmitcom_id').value;
			new Request({
				url: "/ajax-maj-sys-payement.php?com_id="+com_id+"&com_type_paiement=VERSEMENT",
				onSuccess: function()
				{
					parent.window.location.href= "/mon-panier/post-commande.html?typepaiement=VERSEMENT";
				},
	            onRequest: function(){}
	        }).send();
		});
	}
});