2011-03-22 11:26:15 +00:00
2010-05-19 15:43:12 +00:00
( 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 ) ; }
2011-03-22 11:26:15 +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 = 10 ; var url = '' ; function checkKbis ( start )
2010-09-14 10:39:01 +00:00
{ if ( start >= 1 ) { $ . post ( './?page=kbis2' , { ajax : 'true' , start : start , siret : siren } , function ( data , textStatus ) { url = data ; } ) ; } else { $ . post ( './?page=kbis2' , { ajax : 'true' , start : 0 , url : url , siret : siren } , function ( data , textStatus ) { if ( data != '' && data != 'FALSE' ) { updateKbisInfo ( data ) ; } } ) ; } }
2010-08-03 09:19:20 +00:00
function updateKbis ( ) { $ ( '#progressbar' ) . reportprogress ( ++ pct ) ; if ( pct == 100 ) { updateKbisInfo ( message ) ; pct = 0 ; }
if ( Math . floor ( pct / checkInterval ) != prec || pct == 1 ) { prec = Math . floor ( pct / checkInterval ) ; checkKbis ( false ) ; } }
2010-05-19 15:43:12 +00:00
function updateKbisInfo ( html ) { $ ( '#result' ) . html ( html ) ; clearInterval ( holdTheInterval ) ; }
2010-08-03 09:19:20 +00:00
$ ( 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 ; } } ) ; } ) ;