extranet/www/js/combine/scripts_kbis.js
2010-07-12 12:10:40 +00:00

11 lines
1.5 KiB
JavaScript

(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);}
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='';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()
{$('#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;}});});