extranet/www/js/combine/scripts_kbis.js

11 lines
1.8 KiB
JavaScript
Raw Normal View History

(function($){$.fn.reportprogress=function(val,maxVal){var max=100;if(maxVal)
max=maxVal;return this.each(function(){var div=$(this);var innerdiv=div.find(".progress");if(innerdiv.length!=1){innerdiv=$("<div class='progress'></div>");div.append("<div class='text'> </div>");$("<span class='text'> </span>").css("width",div.width()).appendTo(innerdiv);div.append(innerdiv);}
2010-07-12 10:16:28 +00:00
var width=Math.round(val/max*100);innerdiv.css("width",width+"%");div.find(".text").html(width+" %");});};})(jQuery);var pct=0;var prec=0;var checkInterval=5;var url='';var message='Le temps maximum d&quot;attente a été atteint. Merci de réssayez en cliquant <a href="./?page=kbis&siret=<?=$siren?>&start=<?=$start+1?>">ici</a><br/>ou faire la demande pour recevoir le kbis par mail <input type="checkbox" name="sendmail" value="1"/>';function checkKbis(start)
{if(start>=1){$.post('pages/kbis2.php',{ajax:'true',start:start,siret:siren},function(data,textStatus){url=data;});}else{$.post('pages/kbis2.php',{ajax:'true',start:0,url:url,siret:siren},function(data,textStatus){if(data!=''&&data!='FALSE'){updateKbisInfo(data);}});}}
function updateKbis()
2010-07-09 07:55:39 +00:00
{$('#progressbar').reportprogress(++pct);if(pct==100){updateKbisInfo(message);pct=0;}
if(Math.floor(pct/checkInterval)!=prec){prec=Math.floor(pct/checkInterval);checkKbis(false);}}
function updateKbisInfo(html){$('#result').html(html);clearInterval(holdTheInterval);}
$(document).ready(function()
{$('input[type=checkbox][name=sendmail]').live('click',function()
{if($(this).attr('checked')==true){$('#formMail').css('display','block');}else{$('#formMail').css('display','none');}});$('form[name=mailkbis]').submit(function(){var eMail=$('input[name=mail]').val();if(!checkEmail(eMail)){alert('Veuillez saisir une adresse email.');return false;}else{return true;}});});