function formatCurrency(price,currencyFormat,currencySign){if(currencyFormat==1)return currencySign+formatNumber(price,priceDisplayPrecision,',','.');if(currencyFormat==2)return(formatNumber(price,priceDisplayPrecision,' ',',')+' '+currencySign);if(currencyFormat==3)return(currencySign+' '+formatNumber(price,priceDisplayPrecision,' ',','));if(currencyFormat==4)return(formatNumber(price,priceDisplayPrecision,',','.')+currencySign);return price}function formatNumber(value,numberOfDecimal,thousenSeparator,virgule){value=value.toFixed(numberOfDecimal);if(parseInt(numberOfDecimal)==0)return(value);var val_string=value+'';var tmp=val_string.split('.');var abs_val_string=(tmp.length==2)?tmp[0]:val_string;var deci_string=('0.'+(tmp.length==2?tmp[1]:0)).substr(2);var nb=abs_val_string.length;for(var i=1;i<4;i++)if(value>=Math.pow(10,(3*i)))abs_val_string=abs_val_string.substring(0,nb-(3*i))+thousenSeparator+abs_val_string.substring(nb-(3*i));return abs_val_string+virgule+(deci_string>0?deci_string:'00')}function updateTextWithEffect(jQueryElement,text,velocity,effect1,effect2,newClass){if(jQueryElement.text()!=text)if(effect1=='fade')jQueryElement.fadeOut(velocity,function(){$(this).addClass(newClass);if(effect2=='fade')$(this).text(text).fadeIn(velocity);else if(effect2=='slide')$(this).text(text).slideDown(velocity);else if(effect2=='show')$(this).text(text).show(velocity,function(){})});else if(effect1=='slide')jQueryElement.slideUp(velocity,function(){$(this).addClass(newClass);if(effect2=='fade')$(this).text(text).fadeIn(velocity);else if(effect2=='slide')$(this).text(text).slideDown(velocity);else if(effect2=='show')$(this).text(text).show(velocity)});else if(effect1=='hide')jQueryElement.hide(velocity,function(){$(this).addClass(newClass);if(effect2=='fade')$(this).text(text).fadeIn(velocity);else if(effect2=='slide')$(this).text(text).slideDown(velocity);else if(effect2=='show')$(this).text(text).show(velocity)})}function dbg(value){var active=false;var firefox=true;if(active)if(firefox)console.log(value);else alert(value)}function print_r(arr,level){var dumped_text="";if(!level)level=0;var level_padding="";for(var j=0;j<level+1;j++)level_padding+="    ";if(typeof(arr)=='object'){for(var item in arr){var value=arr[item];if(typeof(value)=='object'){dumped_text+=level_padding+"'"+item+"' ...\n";dumped_text+=dump(value,level+1)}else{dumped_text+=level_padding+"'"+item+"' => \""+value+"\"\n"}}}else{dumped_text="===>"+arr+"<===("+typeof(arr)+")"}return dumped_text}function in_array(value,array){for(var i in array)if(array[i]==value)return true;return false}function disableSelection(target){if(typeof target.onselectstart!="undefined")target.onselectstart=function(){return false}else if(typeof target.style.MozUserSelect!="undefined")target.style.MozUserSelect="none"else target.onmousedown=function(){return false}target.style.cursor="default"}
