function open_insc(){
Shadowbox.init();
Shadowbox.open({
        player:     'iframe',
        title:      '',
        content:    '/popin_inscription.php',
        height:     400,
        width:      650
    });
} 
function killshadow(){
Shadowbox.close()
}

function open_first_login(){
	var my_modal = new Custom.Confirm('<img align="left" src="/images/panier_alert.gif" alt=""/><b>Votre première connexion</b>','<span>Vous pouvez modifier vos paramètres de connexion dans l&quot;espace "Mon compte".<br> Voulez-vous modifier ces paramètres maintenant ? </span>', {
			content: 'html',
			width: '378px',
			text: {
				confirmButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>oui',
				closeButtonText: '',
				cancelButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>non'
			},
			opacify:false,
			draggable:false,
			zones: {
				box: 'box_alert',
				head: 'head_alert',
				body: 'body_alert',
				buttonBox: 'button_box'
			},
			buttons: {
				//closeButton: 'close_button',
				confirmButton: 'confirm_button',
				cancelButton: 'cancel_button'
			},
			overlay: 'lighten',
			onConfirm: function() {
				//$('confirm3').set('html', '<b>You typed OK with the third confirm</b>');
				window.location="/mon-compte.html";
			},
			onCancel: function() {
				//$('confirm3').set('html', '<b>You typed Cancel with the third confirm</b>');	
			},
			initialize: function() {
				this.theclose = new Element('div', { 'styles': {'clear': 'both'} });
				this.theclose.injectInside(this.closebox);
			}
	});
	my_modal.create();
}

function open_pop_cart_add(){
	var my_modal = new Custom.Confirm('<img align="left" src="/images/panier_alert.gif" alt=""/><b>Produit ajouté</b>','<span>Voulez-vous passer à la commande dès maintenant ? </span>', {
			content: 'html',
			width: '378px',
			text: {
				confirmButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>oui',
				closeButtonText: '',
				cancelButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>non'
			},
			opacify:false,
			draggable:false,
			zones: {
				box: 'box_alert',
				head: 'head_alert',
				body: 'body_alert',
				buttonBox: 'button_box'
			},
			buttons: {
				//closeButton: 'close_button',
				confirmButton: 'confirm_button',
				cancelButton: 'cancel_button'
			},
			overlay: 'lighten',
			onConfirm: function() {
				//$('confirm3').set('html', '<b>You typed OK with the third confirm</b>');
				window.location="/boutique/panier.html";
			},
			onCancel: function() {
				//$('confirm3').set('html', '<b>You typed Cancel with the third confirm</b>');	
			},
			initialize: function() {
				this.theclose = new Element('div', { 'styles': {'clear': 'both'} });
				this.theclose.injectInside(this.closebox);
			}
	});
	my_modal.create();
}

function open_pop_cart_delete(cdt_id){
	var my_modal = new Custom.Confirm('<img align="left" src="/images/panier_alert_suppr.gif" alt=""/><b>Produit supprimé</b>','<span>Confirmez-vous la suppression de cet article ? </span>', {
			content: 'html',
			width: '378px',
			text: {
				confirmButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>oui',
				closeButtonText: '',
				cancelButtonText: '<img style="margin-right: 5px; margin-top: 5px;" alt="" src="/images/sup_b&bf.gif"/>non'
			},
			opacify:false,
			draggable:false,
			zones: {
				box: 'box_alert',
				head: 'head_alert',
				body: 'body_alert',
				buttonBox: 'button_box'
			},
			buttons: {
				//closeButton: 'close_button',
				confirmButton: 'confirm_button',
				cancelButton: 'cancel_button'
			},
			overlay: 'lighten',
			onConfirm: function() {
				//$('confirm3').set('html', '<b>You typed OK with the third confirm</b>');
				window.location="/boutique/panier.html?delete=1&panier_id="+cdt_id;
			},
			onCancel: function() {
				$(cdt_id).checked=false;	
			},
			initialize: function() {
				this.theclose = new Element('div', { 'styles': {'clear': 'both'} });
				this.theclose.injectInside(this.closebox);
			}
	});
	my_modal.create();
}

function open_pop_validation_panier(magique,mini){
	var texte="";

	if(magique==0){
		texte="Minimum de commande "+mini+" &euro; TTC remises déduites";
	}
	if($('cgv').checked==false){
		texte="Vous devez accepter les conditions générales de vente";
	}	

	if(magique==0 || $('cgv').checked==false){

		var my_modal = new Custom.Confirm('<img align="left" src="/images/panier_alert_red.gif" alt=""/><b>Attention</b>','<span>'+texte+'</span>', {
					content: 'html',
					width: '378px',
					text: {
						confirmButtonText: '&nbsp;',
						closeButtonText: 'x Fermer',
						cancelButtonText: '&nbsp;'
					},
					opacify:false,
					draggable:false,
					zones: {
						box: 'box_alert_red',
						head: 'head_alert_red',
						body: 'body_alert_red',
						buttonBox: 'button_box_red'
					},
					buttons: {
						closeButton: 'close_button_red',
						confirmButton: 'confirm_button_red',
						cancelButton: 'cancel_button_red'
					},
					overlay: 'lighten',
					onConfirm: function() {
						window.location="/boutique/panier.html?delete=1&cdt_id="+cdt_id;
					},
					onCancel: function() {
					},
					initialize: function() {
						this.theclose = new Element('div', { 'styles': {'clear': 'both'} });
						this.theclose.injectInside(this.closebox);
					}
			});
			my_modal.create();
	}else{
		window.location="/boutique/commande.html";
	}
}

function enregistrement_commande_cheque(){
	//new Request.HTML({
	//url: '/ajax_commande.php',
	//method: 'post',
	//onSuccess:function(){
		window.location='merci.html';
	//}
	//}).send("is_cheque=1");
}
function enregistrement_commande_paybox(){
	//var enreg=new Request.HTML({
	//url: '/ajax_commande.php',
	//method: 'post',
	//onComplete: function(responseTree, responseElements, responseHTML, responseJavaScript) { 
	//	$('PBX_CMD').value=responseHTML; 
		$('paybox').submit();
	//}}).send("is_paybox=1");
	
	
}


Request.HTML.implement({
  
         processHTML: function(text){
             var match = text.match(/<body[^>]*>([\s\S]*?)<\/body>/i);
             text = (match) ? match[1] : text;
            
             var container = new Element('div');
            
             return $try(function(){
                 var root = '<root>' + text + '</root>', doc;
                 if (Browser.Engine.trident){
                     doc = new ActiveXObject('Microsoft.XMLDOM');
                     doc.async = false;
                     doc.loadXML(root);
                 } else {
                     doc = new DOMParser().parseFromString(root, 'text/html');
                 }
                 root = doc.getElementsByTagName('root')[0];
                 for (var i = 0, k = root.childNodes.length; i < k; i++){
                    var child = Element.clone(root.childNodes[i], true, true);
                     if (child) container.grab(child);
                 }
                 return container;
             }) || container.set('html', text);
         }
    
     });

  