/**
 * Open a pop up window
 **/
function popUp(url,id,w,h,r,s)
	{
	if(!id) id = 'popup';
	if(!w) w = 400;
	if(!h) h = 300;
	if(!r) r = '0';
	if(!s) s = '0';
    r = window.open(url,id,'width='+w+',height='+h+',menubar=0,statusbar=0,status=0,location=0,scrollbars='+s+',resizable='+r);
	}
/**
 * delete alert
 * @param string url of the page
 */
function del(pg) {
	// todo : lang replacement !!
	msg = "Etes-vous sûr de vouloir effacer cet élément ?";
	if(confirm(msg))
		location.href = pg;
	}
/**
 * submit the product top the wishlist
 * @param object form object
 **/
function submit_wishlist(f) {
	frm = eval('document.'+f);
	frm.mod.value='wishlist_add';
	frm.submit();	
	}
/**
 * use to update image for all product
 **/
function toupdate(t)
	{
	if(t.checked)
		{
		document.toupdateform.toupdate.value += '|'+t.value;
		}
	else {
		var v = document.toupdateform.toupdate.value;
		document.toupdateform.toupdate.value = v.replace(eval('/\\|'+t.value+'/g'),'');
		}
	}
/**
 *
 **/
function validateshippingForm(lang)
	{
	/*
	alert("on passe bien par validateshippingForm !!!!");
	alert(document.shippingform.ship_mode.checked);
	alert(document.getElementById("ship_mode_id").value);
	alert(document.shippingform.ship_same_billing.checked);
	alert(document.getElementById("ship_same_billing_id").value);
	*/
	/*if (document.shippingform.ship_mode.checked == false )
		{
		if(lang=='fr'){
			alert('Veuillez choisir un mode de livraison.');
			}
		else{
			alert('Please check a shipping mode.');
			}
		return false;
  }else{ 
   
		if(document.getElementById("ship_mode_id").value == 'normal' || document.getElementById("ship_mode_id").value == 'express'){
			//alert("same as billing");
			//return true;
			
		}
	
		if(document.shippingform.ship_same_billing.checked == false ){
			if(lang=='fr'){
			alert('Veuillez choisir une adresse de livraison.');
			}
			else{
			alert('Please check a shipping address choice.');
			}
			return false;
		}
			*/ 
		if(document.getElementById("ship_same_billing_id").value == 'no'){
			return validateForm(document.shippingform);
		}
		else{
			//alert("different as billing validate form !!!!");
			return true;
			}
		//}		
	}
	
		function validateCheckout(){
		if(document.validate_order.check_conditions.checked){
		//if(document.getElementById("check_conditions_id").checked == true && document.getElementById("check_conditions_id").value == 'yes'){
			return validateForm(document.validate_order);
		}else{
			//alert('<?=$trs->get("check_condition")?>');
			alert('Veuillez accepter les conditions générales');
			//alert(pas bon);
			return false;
		}
	}

	