function AlertMe( oid, pid, mid )
{
    u = 'op/index.php?fuseAction=alertMe&op_id=' + oid + '&product_id=' + pid + '&producttype_id='+ mid;

    alertWin =  window.open( u ,'alertWin','directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=380,height=400');  
    alertWin.focus();
    return false;
}

function updateQuantity( prod_id, maxQuantity )
{
	frm = document.forms[ 'product_' + prod_id ];
	if( maxQuantity == 0 ) maxQuantity = 10;
    
	available_count = frm.productsize.options[ frm.productsize.options.selectedIndex ].available;
	frm.quantity.options.length = 0;
	
	for( n = 1; n <= maxQuantity; n++ )
	{
		frm.quantity.options.length = frm.quantity.options.length + 1;
		frm.quantity.options[frm.quantity.options.length-1].text = n;
		frm.quantity.options[frm.quantity.options.length-1].value = n;		
		if( n == available_count ) break;
	}
	
	
}
function checkProductForm( prod_id )
{
    var frm = $( 'product_' + prod_id );
	p	= frm.product_id.value;
	s	= frm.productsize.value;
	q	= frm.quantity.value;
    c  = frm.current_price.value; 
// alert("id:"+p+' size:'+s+' qty:'+q+' price:'+c+'"')
	if(!q)
		alert("Veuillez choisir une quantité.")
	else
		basket_add_prod( p, s, q, c );
	return false;
}

function strToFloat(val)
{
	var newVal;
	
	if(val == 0)
	{
		newVal = "";
	}else{
		val = val + "";
		arr = val.split(".");
		
		if(arr.length == 2){
			if(arr[1].length == 1)
			{
				newVal = val + "0";
			}else{
				newVal = arr[0]+"."+arr[1].substring(0,2);
			}
		}else{
			
			newVal = val + ".00";
		}
	}
	if(newVal == '') newVal = '0.00';
	return newVal * 1.00;
}


function popup( url )
{
	popupWin =  window.open( url ,'popupWin','directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=350,height=450');  
    popupWin.focus();
}

function trailer( i,w,h )
{
    u = 'op/index.php?fuseAction=trailer&op_id=' + i;
        
	trailerWin =  window.open( u ,'trailerWin','directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width='+w+',height='+h);  
    trailerWin.focus();
}


function _help( i, w, h )
{
    //w = 450;
    //h = 550;
     u = 'support/index.php?popup=1&fuseAction='+i;
        
	trailerWin =  window.open( u ,'trailerWin','directories=no,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width='+w+',height='+h);  
    trailerWin.focus();
}