function add_a_piece_on_the_line_of_cart(index){alert(index);};function change_the_line_of_cart(datas,checked){var x=datas.split('!:');var strike="";var nostrike="";var z=GetId('price'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var price=parseFloat(z);z=GetId('quantity'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var quantity=parseInt(z);z=GetId('stock'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var y=z.split('/');y[0]=parseInt(y[0]);var total=0;var totalbuild=parseFloat(GetId('totalbuild').innerHTML);var totalquantity=parseInt(GetId('totalquantity').innerHTML);alert(totalquantity+' - '+totalbuild);switch(x[0]){case'1':total=format(price*(quantity+1),2,'');GetId('quantity'+x[1]).innerHTML=quantity+1;GetId('total'+x[1]).innerHTML=total;GetId('stock'+x[1]).innerHTML=(y[0]-1)+'/'+y[1];GetId('totalbuild').innerHTML=format(totalbuild+price,2,'');GetId('totalquantity').innerHTML=totalquantity+1;break;case'2':total=format(price*(quantity-1),2,'');GetId('quantity'+x[1]).innerHTML=quantity-1;GetId('total'+x[1]).innerHTML=total;GetId('stock'+x[1]).innerHTML=(y[0]+1)+'/'+y[1];GetId('totalbuild').innerHTML=format(totalbuild-price,2,'');GetId('totalquantity').innerHTML=totalquantity-1;break;case'3':total=parseFloat(price*quantity);if(!checked){GetId('updatecartcontent'+x[1]).style.width='0px';GetId('line'+x[1]).innerHTML=strike+GetId('line'+x[1]).innerHTML+nostrike;GetId('ref'+x[1]).innerHTML=strike+GetId('ref'+x[1]).innerHTML+nostrike;GetId('name'+x[1]).innerHTML=strike+GetId('name'+x[1]).innerHTML+nostrike;GetId('price'+x[1]).innerHTML=strike+GetId('price'+x[1]).innerHTML+nostrike;GetId('quantity'+x[1]).innerHTML=strike+GetId('quantity'+x[1]).innerHTML+nostrike;GetId('total'+x[1]).innerHTML=strike+GetId('total'+x[1]).innerHTML+nostrike;GetId('stock'+x[1]).innerHTML=strike+GetId('stock'+x[1]).innerHTML+nostrike;GetId('totalbuild').innerHTML=format(totalbuild-total,2,'');GetId('totalquantity').innerHTML=totalquantity-quantity;};if(checked){GetId('updatecartcontent'+x[1]).style.width='32px';z=GetId('line'+x[1]).innerHTML.replace(strike,"");GetId('line'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('ref'+x[1]).innerHTML.replace(strike,"");GetId('ref'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('name'+x[1]).innerHTML.replace(strike,"");GetId('name'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('price'+x[1]).innerHTML.replace(strike,"");GetId('price'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('quantity'+x[1]).innerHTML.replace(strike,"");GetId('quantity'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('total'+x[1]).innerHTML.replace(strike,"");GetId('total'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('stock'+x[1]).innerHTML.replace(strike,"");GetId('stock'+x[1]).innerHTML=z.replace(nostrike,"");GetId('totalbuild').innerHTML=format(totalbuild+total,2,'');GetId('totalquantity').innerHTML=totalquantity+quantity;};break;case'4':total=parseFloat(price*quantity);GetId('line'+x[1]).innerHTML=strike+GetId('line'+x[1]).innerHTML+nostrike;GetId('ref'+x[1]).innerHTML=strike+GetId('ref'+x[1]).innerHTML+nostrike;GetId('name'+x[1]).innerHTML=strike+GetId('name'+x[1]).innerHTML+nostrike;GetId('price'+x[1]).innerHTML=strike+GetId('price'+x[1]).innerHTML+nostrike;GetId('quantity'+x[1]).innerHTML=strike+GetId('quantity'+x[1]).innerHTML+nostrike;GetId('total'+x[1]).innerHTML=strike+GetId('total'+x[1]).innerHTML+nostrike;GetId('stock'+x[1]).innerHTML=strike+GetId('stock'+x[1]).innerHTML+nostrike;GetId('totalbuild').innerHTML=format(totalbuild-total,2,'');GetId('totalquantity').innerHTML=totalquantity-quantity;break;}};function get_array_of_calculs_for_price_photos(what,number){var x=myApp.announceexchangeconditions.split('/');var priceweek=parseFloat(x[0]);var base=parseFloat(x[1]);var offered=parseInt(x[2]);var percentsubscription=parseFloat(x[3]);var priceperday=parseFloat(x[4]);var priceperhour=parseFloat(x[5]);var priceperphoto=parseFloat(x[6]);var nbrofferedimg=parseInt(x[7]);var nbrofferedimgforsubscription=parseInt(x[8]);var y=myApp.announceexchangemystatus.split('/');var subscription=parseInt(y[2]);var o=GetId('id_registrationstep2');var choosesubscription=(o?o.checked:false);var y=GetId('idx_nbr_'+'upload');number=(y?parseInt(y.innerHTML):0);if(number<=nbrofferedimg)return(new Array(0,0,0,0,0));var nbroffered=(choosesubscription?number-nbrofferedimgforsubscription:number-nbrofferedimg);var price=priceperphoto*(1-Math.pow(base,nbroffered))/(1-base);if(price<0)return(new Array(0,0,0,0,0));var realprice=number*priceperphoto;var economy=realprice-price;var economypercent=(realprice>0?economy/realprice*100:0);return(new Array(price,realprice,economypercent,economy,number));};function get_array_of_calculs_for_price_backup(what,period){var x=myApp.announceexchangeconditions.split('/');var priceweek=parseFloat(x[0]);var base=parseFloat(x[1]);var offered=parseInt(x[2]);var percentsubscription=parseFloat(x[3]);var priceperday=parseFloat(x[4]);var priceperhour=parseFloat(x[5]);var y=myApp.announceexchangemystatus.split('/');var subscription=parseInt(y[2]);var priceperperiod=priceperday;if(what=='day'){base=Math.pow(base,2);}else{priceperperiod=priceperhour;};var price=priceperperiod*(1-Math.pow(base,period))/(1-base);if(price<0)return(new Array(0,0,0,0,0));var realprice=period*priceperperiod;var economy=realprice-price;var economypercent=(realprice>0?economy/realprice*100:0);return(new Array(price,realprice,economypercent,economy,period));};function get_array_of_calculs_for_price(totalweeks,pack){var x=myApp.announceexchangeconditions.split('/');var priceweek=parseInt(x[0]);var base=parseFloat(x[1]);var offered=parseInt(x[2]);var percentsubscription=parseInt(x[3]);var y=myApp.announceexchangemystatus.split('/');var used=parseInt(y[0]);var maxweeks=(used0?economy/realprice*100:0);return(new Array(price,realprice,economypercent,economy,totalweeks));};function update_comments_of_price(what,xarray){if(what=='duration'&&GetId('pricefor'+what)){GetId('pricefor'+what).innerHTML=format(xarray[0],2,'.');GetId('realpricefor'+what).innerHTML=format(xarray[1],2,'.');GetId('economyfor'+what).innerHTML=format(xarray[2],2,'.')+'% / '+format(xarray[3],2,'.');GetId('id_registrationstep2nbr').innerHTML=xarray[4];};if(what=='backup'&&GetId('pricefor'+what)){GetId('pricefor'+what).innerHTML=format(xarray[0],2,'.');GetId('realpricefor'+what).innerHTML=format(xarray[1],2,'.');GetId('economyfor'+what).innerHTML=format(xarray[2],2,'.')+'% / '+format(xarray[3],2,'.');};if(what=='photos'&&GetId('pricefor'+what)){GetId('pricefor'+what).innerHTML=format(xarray[0],2,'.');GetId('realpricefor'+what).innerHTML=format(xarray[1],2,'.');GetId('economyfor'+what).innerHTML=format(xarray[2],2,'.')+'% / '+format(xarray[3],2,'.');}};function update_price_for_photos(number){number=(number?number:0);update_comments_of_price('photos',get_array_of_calculs_for_price_photos('classic',number));};function update_price_for_duration(){var x=fg_osjs_get_infos_of_select(GetId('id_monthsduration'));var months=x[1];var x=fg_osjs_get_infos_of_select(GetId('id_weeksduration'));var weeks=x[1];update_comments_of_price('duration',get_array_of_calculs_for_price(parseInt(months)*4+parseInt(weeks),false));};function update_price_for_backupday(){var x=fg_osjs_get_infos_of_select(GetId('id_backupdayperiod'));var period=x[1];update_comments_of_price('backup',get_array_of_calculs_for_price(period,false));};function update_price_for_backup(){var selectdayperiod=GetId('id_backupdayperiod');if(selectdayperiod){var x=fg_osjs_get_infos_of_select(selectdayperiod);var period=x[1];update_comments_of_price('backup',get_array_of_calculs_for_price_backup('day',period));}else{var x=fg_osjs_get_infos_of_select(GetId('id_backuphourperiod'));var period=x[1];update_comments_of_price('backup',get_array_of_calculs_for_price_backup('hour',period));}};function update_price_for_registration(){var x=fg_osjs_get_infos_of_select(GetId('id_periodsubscription'));var period=x[1];alert('update_price_for_registration(): '+period+' - '+x[0]);var calc4weeks=get_array_of_calculs_for_price(4,true);var calc5weeks=get_array_of_calculs_for_price(5,true);var price=(calc5weeks[0]+calc4weeks[0])/2;var realprice=calc5weeks[1];var economy=0;var economypercent=0;var xarray=new Array(0,0,0,0,0);var nbrweeksprice=4*1;var nbrweeksperiod=5*1;var nbrannounces=4;var periodannounces='month';var base=0.95;switch(period){case'monthly':break;case'bimonthly':nbrannounces=9;periodannounces='2 months';base=0.93;nbrweeksprice=4*2;var nbrweeksperiod=5*2;break;case'quarterly':nbrannounces=13;periodannounces='quarter';base=0.91;nbrweeksprice=4*3;var nbrweeksperiod=5*3;break;case'biannual':nbrannounces=29;periodannounces='semester';base=0.87;nbrweeksprice=4*6;var nbrweeksperiod=5*6;break;case'yearly':nbrannounces=57;periodannounces='year';base=0.83;nbrweeksprice=4*12;var nbrweeksperiod=52;break;};GetId('number_of_announces').innerHTML=nbrannounces;GetId('period_of_announces').innerHTML=periodannounces;price=price*nbrannounces*base;realprice=realprice*nbrannounces;economy=(realprice-price);economypercent=economy/realprice*100;xarray=new Array(price,realprice,economypercent,economy,nbrannounces);update_comments_of_price('duration',xarray);};function update_checked_for_registration(me,id_name,inph_registration,inph_monthsweeks){var div=GetId(id_name);update_comments_of_price('duration',new Array(0,0,0,0,0));if(div)if(me.checked){div.innerHTML=GetId(inph_registration).value;update_price_for_registration();}else {div.innerHTML=GetId(inph_monthsweeks).value;update_price_for_duration();};update_price_for_photos();};function update_checked_for_backup(me,id_name,inph_backuphour,inph_backuphidden){var div=GetId(id_name);update_comments_of_price('backup',new Array(0,0,0,0,0));if(div)if(me.checked){div.innerHTML=GetId(inph_backuphour).value;update_price_for_backuphour();}else {div.innerHTML=GetId(inph_backuphidden).value;update_price_for_backupday();}};function change_the_line_of_cart(datas,checked){var x=datas.split('!:');var strike="";var nostrike="";var z=GetId('price'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var price=parseFloat(z);z=GetId('quantity'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var quantity=parseInt(z);z=GetId('stock'+x[1]).innerHTML.replace(strike,"");z=z.replace(nostrike,"");var y=z.split('/');y[0]=parseInt(y[0]);var total=0;var totalbuild=parseFloat(GetId('totalbuild').innerHTML);var totalquantity=parseInt(GetId('totalquantity').innerHTML);alert(totalquantity+' - '+totalbuild);switch(x[0]){case'1':total=format(price*(quantity+1),2,'');GetId('quantity'+x[1]).innerHTML=quantity+1;GetId('total'+x[1]).innerHTML=total;GetId('stock'+x[1]).innerHTML=(y[0]-1)+'/'+y[1];GetId('totalbuild').innerHTML=format(totalbuild+price,2,'');GetId('totalquantity').innerHTML=totalquantity+1;break;case'2':total=format(price*(quantity-1),2,'');GetId('quantity'+x[1]).innerHTML=quantity-1;GetId('total'+x[1]).innerHTML=total;GetId('stock'+x[1]).innerHTML=(y[0]+1)+'/'+y[1];GetId('totalbuild').innerHTML=format(totalbuild-price,2,'');GetId('totalquantity').innerHTML=totalquantity-1;break;case'3':total=parseFloat(price*quantity);if(!checked){GetId('updatecartcontent'+x[1]).style.width='0px';GetId('line'+x[1]).innerHTML=strike+GetId('line'+x[1]).innerHTML+nostrike;GetId('ref'+x[1]).innerHTML=strike+GetId('ref'+x[1]).innerHTML+nostrike;GetId('name'+x[1]).innerHTML=strike+GetId('name'+x[1]).innerHTML+nostrike;GetId('price'+x[1]).innerHTML=strike+GetId('price'+x[1]).innerHTML+nostrike;GetId('quantity'+x[1]).innerHTML=strike+GetId('quantity'+x[1]).innerHTML+nostrike;GetId('total'+x[1]).innerHTML=strike+GetId('total'+x[1]).innerHTML+nostrike;GetId('stock'+x[1]).innerHTML=strike+GetId('stock'+x[1]).innerHTML+nostrike;GetId('totalbuild').innerHTML=format(totalbuild-total,2,'');GetId('totalquantity').innerHTML=totalquantity-quantity;};if(checked){GetId('updatecartcontent'+x[1]).style.width='32px';z=GetId('line'+x[1]).innerHTML.replace(strike,"");GetId('line'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('ref'+x[1]).innerHTML.replace(strike,"");GetId('ref'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('name'+x[1]).innerHTML.replace(strike,"");GetId('name'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('price'+x[1]).innerHTML.replace(strike,"");GetId('price'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('quantity'+x[1]).innerHTML.replace(strike,"");GetId('quantity'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('total'+x[1]).innerHTML.replace(strike,"");GetId('total'+x[1]).innerHTML=z.replace(nostrike,"");z=GetId('stock'+x[1]).innerHTML.replace(strike,"");GetId('stock'+x[1]).innerHTML=z.replace(nostrike,"");GetId('totalbuild').innerHTML=format(totalbuild+total,2,'');GetId('totalquantity').innerHTML=totalquantity+quantity;};break;case'4':total=parseFloat(price*quantity);GetId('line'+x[1]).innerHTML=strike+GetId('line'+x[1]).innerHTML+nostrike;GetId('ref'+x[1]).innerHTML=strike+GetId('ref'+x[1]).innerHTML+nostrike;GetId('name'+x[1]).innerHTML=strike+GetId('name'+x[1]).innerHTML+nostrike;GetId('price'+x[1]).innerHTML=strike+GetId('price'+x[1]).innerHTML+nostrike;GetId('quantity'+x[1]).innerHTML=strike+GetId('quantity'+x[1]).innerHTML+nostrike;GetId('total'+x[1]).innerHTML=strike+GetId('total'+x[1]).innerHTML+nostrike;GetId('stock'+x[1]).innerHTML=strike+GetId('stock'+x[1]).innerHTML+nostrike;GetId('totalbuild').innerHTML=format(totalbuild-total,2,'');GetId('totalquantity').innerHTML=totalquantity-quantity;break;}};