function companies(b) {
	ajaxSend('/scripts/companies/?boolCompanies='+b);	
	showLayer('browse_brands_on',b?1:0);
	showLayer('browse_brands_off',b?0:1);
}

function formatNumber(v,d) {
	v = v.replace(/,/,'.');
	v = parseFloat(v);
	if (isNaN(v)||v=='') v = 0;
	return v.toFixed(d);
}

function formSubmit(f,a) {
	 document.getElementById(f).action=a;
	 document.getElementById(f).submit();
}

function productViews(p,o) {
	ajaxUpdate('product_photo','/scripts/zoom/?intProduct='+p+'&intOrder='+o,null);
	arrImages = document.getElementById('product_views').getElementsByTagName("a");
	for (i = 0; i < arrImages.length; i++) {
		arrImages[i].className = arrImages[i].id == 'product_views_'+o ? 'btn active' : 'btn';
	}
}

function productZoom(p,o) {
	window.open('/scripts/zoom/'+p+'/'+o+'/', '_blank', 'width=650,height=530,top='+((screen.height-530)/2)+',left='+((screen.width-650)/2)+',scrollbars=no,resizable');
}

function showLayer(d,b) {
	if (document.getElementById && document.getElementById(d)) { objLayer = document.getElementById(d); } else if (document.all && document.all[d]) { objLayer = document.all[d]; } else if (document.layers && document.layers[d]) { objLayer = document.layers[d]; } else { objLayer = null; }
	if (objLayer !== null) { objLayer.style.display = (b == 1) ? 'block' : 'none'; }
}

function updateShipping(a) {
	showLayer('totals_load',1);
	document.getElementById('totals').className = 'disabled';
	ajaxUpdate('totals','/scripts/cart/'+(a ? '?a=refresh&intShippingOption='+document.getElementById('intShippingOption').value+'&boolCOD='+document.getElementById('boolCOD').value+'&strPromoCode='+document.getElementById('strPromoCode').value+'&strGiftCertificate='+document.getElementById('strGiftCertificate').value : ''),'showLayer(\'totals_load\',0);document.getElementById(\'totals\').className=\'\';')	
}

function userInfos() {
	ajaxEval('/scripts/user/?intCountry='+document.getElementById('intUserCountry').value+'&intCurrency='+document.getElementById('intUserCurrency').value);	
}


