ÿþv a r   I E   =   d o c u m e n t . a l l ? t r u e : f a l s e ;  
 i f   ( ! I E )   d o c u m e n t . c a p t u r e E v e n t s ( E v e n t . M O U S E M O V E )  
 d o c u m e n t . o n m o u s e m o v e   =   g e t M o u s e X Y ;  
  
 v a r   t e m p X   =   0 ;  
 v a r   t e m p Y   =   0 ;  
  
 f u n c t i o n   g e t M o u s e X Y ( e )   {  
 i f   ( I E )   {   / /   g r a b   t h e   x - y   p o s . s   i f   b r o w s e r   i s   I E  
 	 t e m p X   =   M o u s e X ( ) ;  
 	 t e m p Y   =   M o u s e Y ( ) ;  
 } 	  
 e l s e   {     / /   g r a b   t h e   x - y   p o s . s   i f   b r o w s e r   i s   N S  
     t e m p X   =   e . p a g e X ;  
     t e m p Y   =   e . p a g e Y ;  
 }      
 i f   ( t e m p X   <   0 ) { t e m p X   =   0 ; }  
 i f   ( t e m p Y   <   0 ) { t e m p Y   =   0 ; }      
 r e t u r n   t r u e ;  
 }  
  
 f u n c t i o n   M o u s e Y ( e )   {  
 	 v a r   p o s x   =   0 ;  
 	 v a r   p o s y   =   0 ;  
 	 i f   ( ! e )   v a r   e   =   w i n d o w . e v e n t ;  
 	 i f   ( e . p a g e X   | |   e . p a g e Y )   	 {  
 	 	 p o s y   =   e . p a g e Y ;  
 	 	 / / a l e r t ( p o s y ) ;  
 	 }  
 	 e l s e   i f   ( e . c l i e n t X   | |   e . c l i e n t Y )   	 {  
 	 	 p o s y   =   e . c l i e n t Y ;  
 	 	 i f   ( d o c u m e n t . b o d y )  
 	 	 	 p o s y   + =   d o c u m e n t . b o d y . s c r o l l T o p ;  
 	 	 i f   ( d o c u m e n t . d o c u m e n t E l e m e n t )  
 	 	 	 p o s y   + =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l T o p ;  
 	 }  
 	 r e t u r n   p o s y ;  
 }  
  
 f u n c t i o n   M o u s e X ( e )   {  
 	 v a r   p o s x   =   0 ;  
 	 v a r   p o s y   =   0 ;  
 	 i f   ( ! e )   v a r   e   =   w i n d o w . e v e n t ;  
 	 i f   ( e . p a g e X   | |   e . p a g e Y )   	 {  
 	 	 p o s x   =   e . p a g e X ;  
 	 }  
 	 e l s e   i f   ( e . c l i e n t X   | |   e . c l i e n t Y )   	 {  
 	 	 p o s x   =   e . c l i e n t X ;  
 	 	 i f   ( d o c u m e n t . b o d y )  
 	 	 	 p o s x   + =   d o c u m e n t . b o d y . s c r o l l L e f t ;  
 	 	 i f   ( d o c u m e n t . d o c u m e n t E l e m e n t )  
 	 	 	 p o s x   + =   d o c u m e n t . d o c u m e n t E l e m e n t . s c r o l l L e f t ;  
 	 }  
 	 r e t u r n   p o s x ;  
 }  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 *  
 * 	 	 	 	 	 	 	 	 	 F u n z i o n i   d i   U t i l i t à   G e n e r a l e  
 *  
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 f u n c t i o n   L e f t ( s t r ,   n ) {  
 	 i f   ( n   < =   0 )  
 	         r e t u r n   " " ;  
 	 e l s e   i f   ( n   >   S t r i n g ( s t r ) . l e n g t h )  
 	         r e t u r n   s t r ;  
 	 e l s e  
 	         r e t u r n   S t r i n g ( s t r ) . s u b s t r i n g ( 0 , n ) ;  
 }  
 f u n c t i o n   R i g h t ( s t r ,   n ) {  
         i f   ( n   < =   0 )  
               r e t u r n   " " ;  
         e l s e   i f   ( n   >   S t r i n g ( s t r ) . l e n g t h )  
               r e t u r n   s t r ;  
         e l s e   {  
               v a r   i L e n   =   S t r i n g ( s t r ) . l e n g t h ;  
               r e t u r n   S t r i n g ( s t r ) . s u b s t r i n g ( i L e n ,   i L e n   -   n ) ;  
         }  
 }  
  
 f u n c t i o n   r o u n d T o ( v a l u e ,   d e c i m a l p o s i t i o n s ) {  
         v a r   i   =   v a l u e   *   M a t h . p o w ( 1 0 , d e c i m a l p o s i t i o n s ) ;  
         i   =   M a t h . r o u n d ( i ) ;  
         r e t u r n   i   /   M a t h . p o w ( 1 0 , d e c i m a l p o s i t i o n s ) ;  
 }    
  
 f u n c t i o n   I s M u l t i p l o ( n , d )   {  
 	 r e t u r n   ( ( n   %   d )   = =   0 ) ;  
 }  
  
 f u n c t i o n   p u l s e G r e e n ( f i e l d ) {  
 	 f i e l d . s t y l e . b a c k g r o u n d C o l o r = ' # c c f f 3 3 ' ;  
 	 f = f i e l d ;  
 	 c = ' # f f f ' ;  
 	 s e t T i m e o u t ( ' f . s t y l e . b a c k g r o u n d C o l o r = c ' , 1 0 0 0 ) ;  
 }  
  
 f u n c t i o n   N o H T M L ( W o r d )   {  
 	 a   =   W o r d . i n d e x O f ( " < " ) ;  
 	 b   =   W o r d . i n d e x O f ( " > " ) ;  
 	 l e n   =   W o r d . l e n g t h ;  
 	 c   =   W o r d . s u b s t r i n g ( 0 ,   a ) ;  
 	 i f ( b   = =   - 1 )  
 	 b   =   a ;  
 	 d   =   W o r d . s u b s t r i n g ( ( b   +   1 ) ,   l e n ) ;  
 	 W o r d   =   c   +   d ;  
 	 t a g C h e c k   =   W o r d . i n d e x O f ( " < " ) ;  
 	 i f ( t a g C h e c k   ! =   - 1 )  
 	 W o r d   =   N o H T M L ( W o r d ) ;  
 	 r e t u r n   W o r d ;  
 }  
  
  
 f u n c t i o n   I s N u l l ( v a l ) { r e t u r n ( v a l = = n u l l ) ; }  
  
 f u n c t i o n   e m a i l C h e c k 2 ( e )   {  
 	 r e g e x   =   / ^ ( [ a - z A - Z 0 - 9 _ \ . \ - ] ) + \ @ ( ( [ a - z A - Z 0 - 9 \ - ] { 2 , } ) + \ . ) + ( [ a - z A - Z 0 - 9 ] { 2 , } ) + $ / ;  
 	 r e t u r n   r e g e x . t e s t ( e ) ;  
 }  
  
 f u n c t i o n   T r i m ( s t r i n g a )  
       {  
       r e T r i m = / \ s + $ | ^ \ s + / g ;  
       r e t u r n   s t r i n g a . r e p l a c e ( r e T r i m , " " ) ;  
       }  
  
 f u n c t i o n   C h e c k _ C F ( c f )  
       {  
       v a r   r e   =   / ^ [ A - Z ] { 6 } \ d { 2 } [ A - Z ] \ d { 2 } [ A - Z ] \ d { 3 } [ A - Z ] $ / ;  
       C o d i c e = T r i m ( c f . t o U p p e r C a s e ( ) ) ;  
       r e t u r n   r e . t e s t ( C o d i c e )  
       }  
  
 f u n c t i o n   C h e c k _ I n t e g e r ( f v a l u e )   {  
 	 v a r   c h e c k O K   =   " 0 1 2 3 4 5 6 7 8 9 " ;  
 	 v a r   c h e c k S t r   =   f v a l u e ;  
 	 v a r   a l l V a l i d   =   t r u e ;  
 	 v a r   d e c P o i n t s   =   0 ;  
 	 v a r   a l l N u m   =   " " ;  
 	 f o r   ( i   =   0 ;     i   <   c h e c k S t r . l e n g t h ;     i + + )  
 	 {  
 	 c h   =   c h e c k S t r . c h a r A t ( i ) ;  
 	 f o r   ( j   =   0 ;     j   <   c h e c k O K . l e n g t h ;     j + + )  
 	     i f   ( c h   = =   c h e c k O K . c h a r A t ( j ) )  
 	         b r e a k ;  
 	 i f   ( j   = =   c h e c k O K . l e n g t h )  
 	 {  
 	 	 a l l V a l i d   =   f a l s e ;  
 	 	 b r e a k ;  
 	 }  
 	 a l l N u m   + =   c h ;  
 	 }  
 	 r e t u r n   a l l V a l i d ;  
 }  
  
 f u n c t i o n   C h e c k _ P r i c e ( f v a l u e )   {  
 	 v a r   c h e c k O K   =   " 0 1 2 3 4 5 6 7 8 9 , . " ;  
 	 v a r   c h e c k S t r   =   f v a l u e ;  
 	 v a r   a l l V a l i d   =   t r u e ;  
 	 v a r   d e c P o i n t s   =   0 ;  
 	 v a r   a l l N u m   =   " " ;  
 	 f o r   ( i   =   0 ;     i   <   c h e c k S t r . l e n g t h ;     i + + )  
 	 {  
 	 c h   =   c h e c k S t r . c h a r A t ( i ) ;  
 	 f o r   ( j   =   0 ;     j   <   c h e c k O K . l e n g t h ;     j + + )  
 	     i f   ( c h   = =   c h e c k O K . c h a r A t ( j ) )  
 	         b r e a k ;  
 	 i f   ( j   = =   c h e c k O K . l e n g t h )  
 	 {  
 	 	 a l l V a l i d   =   f a l s e ;  
 	 	 b r e a k ;  
 	 }  
 	 a l l N u m   + =   c h ;  
 	 }  
 	 r e t u r n   a l l V a l i d ;  
 }  
  
  
 f u n c t i o n   C h e c k _ S t r ( f v a l u e )   {  
 	 v a r   c h e c k O K   =   " A B C D E F G H I L M N O P Q R S T U V Z J W Y 0 1 2 3 4 5 6 7 8 9 - _   " ;  
 	 v a r   c h e c k S t r   =   f v a l u e ;  
 	 v a r   a l l V a l i d   =   t r u e ;  
 	 v a r   d e c P o i n t s   =   0 ;  
 	 v a r   a l l N u m   =   " " ;  
 	 f o r   ( i   =   0 ;     i   <   c h e c k S t r . l e n g t h ;     i + + )  
 	 {  
 	 c h   =   c h e c k S t r . c h a r A t ( i ) ;  
 	 f o r   ( j   =   0 ;     j   <   c h e c k O K . l e n g t h ;     j + + )  
 	     i f   ( c h   = =   c h e c k O K . c h a r A t ( j ) )  
 	         b r e a k ;  
 	 i f   ( j   = =   c h e c k O K . l e n g t h )  
 	 {  
 	 	 a l l V a l i d   =   f a l s e ;  
 	 	 b r e a k ;  
 	 }  
 	 a l l N u m   + =   c h ;  
 	 }  
 	 r e t u r n   a l l V a l i d ;  
 }  
  
  
 f u n c t i o n   p a u s e c o m p ( m i l l i s )  
 {  
 	 v a r   d a t e   =   n e w   D a t e ( ) ;  
 	 v a r   c u r D a t e   =   n u l l ;  
 	  
 	 d o   {   c u r D a t e   =   n e w   D a t e ( ) ;   }  
 	 w h i l e ( c u r D a t e - d a t e   <   m i l l i s ) ;  
 }    
 v a r     P r o m p t _ f i e l d   =   " " ;  
 f u n c t i o n   a l e r t 2 ( m s g , f i e l d )   {  
 	 P r o m p t _ f i e l d   =   f i e l d ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' P r o m p t ' ) . s t y l e . d i s p l a y = ' i n l i n e ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' P r o m p t _ O K ' ) . f o c u s ( ) ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' P r o m p t _ M s g ' ) . i n n e r H T M L = m s g ;  
 }  
  
 f u n c t i o n   e m a i l C h e c k ( e m a i l S t r )   {  
 	 v a r   e m a i l P a t   =   / ^ ( . + ) @ ( . + ) $ / ;  
 	 v a r   s p e c i a l C h a r s   =   " \ \ ( \ \ ) < > @ , ; : \ \ \ \ \ \ \ " \ \ . \ \ [ \ \ ] " ;  
 	 v a r   v a l i d C h a r s   =   " [ ^ \ \ s "   +   s p e c i a l C h a r s   +   " ] " ;  
 	 v a r   q u o t e d U s e r   =   " ( \ " [ ^ \ " ] * \ " ) " ;  
 	 v a r   i p D o m a i n P a t   =   / ^ \ [ ( \ d { 1 , 3 } ) \ . ( \ d { 1 , 3 } ) \ . ( \ d { 1 , 3 } ) \ . ( \ d { 1 , 3 } ) \ ] $ / ;  
 	 v a r   a t o m   =   v a l i d C h a r s   +   " + " ;  
 	 v a r   w o r d   =   " ( "   +   a t o m   +   " | "   +   q u o t e d U s e r   +   " ) " ;  
 	 v a r   u s e r P a t   =   n e w   R e g E x p ( " ^ "   +   w o r d   +   " ( \ \ . "   +   w o r d   +   " ) * $ " ) ;  
 	 v a r   d o m a i n P a t   =   n e w   R e g E x p ( " ^ "   +   a t o m   +   " ( \ \ . "   +   a t o m   +   " ) * $ " ) ;  
 	 v a r   m a t c h A r r a y   =   e m a i l S t r . m a t c h ( e m a i l P a t ) ;  
 	 i f   ( m a t c h A r r a y   = =   n u l l )   {  
 	 	 a l e r t ( " L ' e m a i l   s e m b r a   e s s e r e   s b a g l i a t a :   ( c o n t r o l l a   @   e   . ) " ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	 v a r   u s e r   =   m a t c h A r r a y [ 1 ] ;  
 	 v a r   d o m a i n   =   m a t c h A r r a y [ 2 ] ;  
 	 i f   ( u s e r . m a t c h ( u s e r P a t )   = =   n u l l )   {  
 	 	 a l e r t ( " L a   p a r t e   d e l l ' e m a i l   p r i m a   d i   ' @ '   n o n   s e m b r a   e s s e r e   v a l i d a ! " ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	 v a r   I P A r r a y   =   d o m a i n . m a t c h ( i p D o m a i n P a t ) ;  
 	 i f   ( I P A r r a y   ! =   n u l l )   {  
 	 	 f o r   ( v a r   i   =   1 ;   i   < =   4 ;   i + + )   {  
 	 	 	 i f   ( I P A r r a y [ i ]   >   2 5 5 )   {  
 	 	 	 	 a l e r t ( " L ' I P   d i   d e s t i n a z i o n e   n o n   è   v a l i d o ! " ) ;  
 	 	 	 	 r e t u r n   f a l s e ;  
 	 	 	 }  
 	 	 }  
 	 	 r e t u r n   t r u e ;  
 	 }  
 	 v a r   d o m a i n A r r a y   =   d o m a i n . m a t c h ( d o m a i n P a t ) ;  
 	 i f   ( d o m a i n A r r a y   = =   n u l l )   {  
 	 	 a l e r t ( " L a   p a r t e   d e l l ' e m a i l   d o p o   ' @ '   n o n   s e m b r a   e s s e r e   v a l i d a ! " ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	 v a r   a t o m P a t   =   n e w   R e g E x p ( a t o m ,   " g " ) ;  
 	 v a r   d o m A r r   =   d o m a i n . m a t c h ( a t o m P a t ) ;  
 	 v a r   l e n   =   d o m A r r . l e n g t h ;  
 	 i f   ( d o m A r r [ d o m A r r . l e n g t h   -   1 ] . l e n g t h   <   2   | |  
 	 	 d o m A r r [ d o m A r r . l e n g t h   -   1 ] . l e n g t h   >   6 )   {  
 	 	 a l e r t ( " I l   d o m i n i o   d i   p r i m o   l i v e l l o   ( e s :   . c o m   e   . i t )   n o n   s e m b r a   e s s e r e   v a l i d o ! " ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	 i f   ( l e n   <   2 )   {  
 	 	 v a r   e r r S t r   =   " L ' i n d i r i z z o   m a n c a   d e l   d o m i n i o ! " ;  
 	 	 a l e r t ( e r r S t r ) ;  
 	 	 r e t u r n   f a l s e ;  
 	 }  
 	 r e t u r n   t r u e ;  
 }  
  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 *  
 * 	 	 	 	 	 	 	 	 	 G   E   S   T   I   O   N E             D A T E    
 *  
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 v a r   d t C h =   " / " ;  
 v a r   m i n Y e a r = 1 9 0 0 ;  
 v a r   m a x Y e a r = 2 1 0 0 ;  
  
 f u n c t i o n   i s I n t e g e r ( s ) {  
 	 v a r   i ;  
         f o r   ( i   =   0 ;   i   <   s . l e n g t h ;   i + + ) {        
                 / /   C h e c k   t h a t   c u r r e n t   c h a r a c t e r   i s   n u m b e r .  
                 v a r   c   =   s . c h a r A t ( i ) ;  
                 i f   ( ( ( c   <   " 0 " )   | |   ( c   >   " 9 " ) ) )   r e t u r n   f a l s e ;  
         }  
         / /   A l l   c h a r a c t e r s   a r e   n u m b e r s .  
         r e t u r n   t r u e ;  
 }  
  
 f u n c t i o n   s t r i p C h a r s I n B a g ( s ,   b a g ) {  
 	 v a r   i ;  
         v a r   r e t u r n S t r i n g   =   " " ;  
         / /   S e a r c h   t h r o u g h   s t r i n g ' s   c h a r a c t e r s   o n e   b y   o n e .  
         / /   I f   c h a r a c t e r   i s   n o t   i n   b a g ,   a p p e n d   t o   r e t u r n S t r i n g .  
         f o r   ( i   =   0 ;   i   <   s . l e n g t h ;   i + + ) {        
                 v a r   c   =   s . c h a r A t ( i ) ;  
                 i f   ( b a g . i n d e x O f ( c )   = =   - 1 )   r e t u r n S t r i n g   + =   c ;  
         }  
         r e t u r n   r e t u r n S t r i n g ;  
 }  
  
 f u n c t i o n   d a y s I n F e b r u a r y   ( y e a r ) {  
 	 / /   F e b r u a r y   h a s   2 9   d a y s   i n   a n y   y e a r   e v e n l y   d i v i s i b l e   b y   f o u r ,  
         / /   E X C E P T   f o r   c e n t u r i a l   y e a r s   w h i c h   a r e   n o t   a l s o   d i v i s i b l e   b y   4 0 0 .  
         r e t u r n   ( ( ( y e a r   %   4   = =   0 )   & &   (   ( ! ( y e a r   %   1 0 0   = =   0 ) )   | |   ( y e a r   %   4 0 0   = =   0 ) ) )   ?   2 9   :   2 8   ) ;  
 }  
 f u n c t i o n   D a y s A r r a y ( n )   {  
 	 f o r   ( v a r   i   =   1 ;   i   < =   n ;   i + + )   {  
 	 	 t h i s [ i ]   =   3 1  
 	 	 i f   ( i = = 4   | |   i = = 6   | |   i = = 9   | |   i = = 1 1 )   { t h i s [ i ]   =   3 0 }  
 	 	 i f   ( i = = 2 )   { t h i s [ i ]   =   2 9 }  
       }    
       r e t u r n   t h i s  
 }  
  
 f u n c t i o n   i s D a t e ( d t S t r ) {  
 	 v a r   d a y s I n M o n t h   =   D a y s A r r a y ( 1 2 )  
 	 v a r   p o s 1 = d t S t r . i n d e x O f ( d t C h )  
 	 v a r   p o s 2 = d t S t r . i n d e x O f ( d t C h , p o s 1 + 1 )  
 	 v a r   s t r D a y = d t S t r . s u b s t r i n g ( 0 , p o s 1 )  
 	 v a r   s t r M o n t h = d t S t r . s u b s t r i n g ( p o s 1 + 1 , p o s 2 )  
 	 v a r   s t r Y e a r = d t S t r . s u b s t r i n g ( p o s 2 + 1 )  
 	 s t r Y r = s t r Y e a r  
 	 i f   ( s t r D a y . c h a r A t ( 0 ) = = " 0 "   & &   s t r D a y . l e n g t h > 1 )   s t r D a y = s t r D a y . s u b s t r i n g ( 1 )  
 	 i f   ( s t r M o n t h . c h a r A t ( 0 ) = = " 0 "   & &   s t r M o n t h . l e n g t h > 1 )   s t r M o n t h = s t r M o n t h . s u b s t r i n g ( 1 )  
 	 f o r   ( v a r   i   =   1 ;   i   < =   3 ;   i + + )   {  
 	 	 i f   ( s t r Y r . c h a r A t ( 0 ) = = " 0 "   & &   s t r Y r . l e n g t h > 1 )   s t r Y r = s t r Y r . s u b s t r i n g ( 1 )  
 	 }  
 	 m o n t h = p a r s e I n t ( s t r M o n t h )  
 	 d a y = p a r s e I n t ( s t r D a y )  
 	 y e a r = p a r s e I n t ( s t r Y r )  
 	 i f   ( p o s 1 = = - 1   | |   p o s 2 = = - 1 ) {  
 	 	 a l e r t ( " I l   f o r m a t o   d e l l a   d a t a   d e v e   e s s e r e   :   m m / d d / y y y y " )  
 	 	 r e t u r n   f a l s e  
 	 }  
 	 i f   ( s t r M o n t h . l e n g t h < 1   | |   m o n t h < 1   | |   m o n t h > 1 2 ) {  
 	 	 a l e r t ( " I n s e r i r e   u n   m e s e   v a l i d o " )  
 	 	 r e t u r n   f a l s e  
 	 }  
 	 i f   ( s t r D a y . l e n g t h < 1   | |   d a y < 1   | |   d a y > 3 1   | |   ( m o n t h = = 2   & &   d a y > d a y s I n F e b r u a r y ( y e a r ) )   | |   d a y   >   d a y s I n M o n t h [ m o n t h ] ) {  
 	 	 a l e r t ( " I n s e r i r e   u n   g i o r n o   v a l i d o " )  
 	 	 r e t u r n   f a l s e  
 	 }  
 	 i f   ( s t r Y e a r . l e n g t h   ! =   4   | |   y e a r = = 0   | |   y e a r < m i n Y e a r   | |   y e a r > m a x Y e a r ) {  
 	 	 a l e r t ( " I n s e r i r e   u n   a n n o   c o m p r e s o   t r a   " + m i n Y e a r + "   e   " + m a x Y e a r )  
 	 	 r e t u r n   f a l s e  
 	 }  
 	 i f   ( d t S t r . i n d e x O f ( d t C h , p o s 2 + 1 ) ! = - 1   | |   i s I n t e g e r ( s t r i p C h a r s I n B a g ( d t S t r ,   d t C h ) ) = = f a l s e ) {  
 	 	 a l e r t ( " I n s e r i r e   u n a   d a t a   v a l i d a " )  
 	 	 r e t u r n   f a l s e  
 	 }  
 r e t u r n   t r u e  
 }  
  
  
 D a t e . p r o t o t y p e . a d d   =   f u n c t i o n   ( s I n t e r v a l ,   i N u m ) {  
     v a r   d T e m p   =   t h i s ;  
     i f   ( ! s I n t e r v a l   | |   i N u m   = =   0 )   r e t u r n   d T e m p ;  
     s w i t c h   ( s I n t e r v a l . t o L o w e r C a s e ( ) ) {  
         c a s e   " m s " :  
             d T e m p . s e t M i l l i s e c o n d s ( d T e m p . g e t M i l l i s e c o n d s ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " s " :  
             d T e m p . s e t S e c o n d s ( d T e m p . g e t S e c o n d s ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " m i " :  
             d T e m p . s e t M i n u t e s ( d T e m p . g e t M i n u t e s ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " h " :  
             d T e m p . s e t H o u r s ( d T e m p . g e t H o u r s ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " d " :  
             d T e m p . s e t D a t e ( d T e m p . g e t D a t e ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " m o " :  
             d T e m p . s e t M o n t h ( d T e m p . g e t M o n t h ( )   +   i N u m ) ;  
             b r e a k ;  
         c a s e   " y " :  
             d T e m p . s e t F u l l Y e a r ( d T e m p . g e t F u l l Y e a r ( )   +   i N u m ) ;  
             b r e a k ;  
     }  
     r e t u r n   d T e m p ;  
 }  
  
 f u n c t i o n   a d d D a y ( d t S t r , d a y a d d ) {  
 	 v a r   m i l l i s e c o n d = 1 ;  
 	 v a r   s e c o n d = m i l l i s e c o n d * 1 0 0 0 ;  
 	 v a r   m i n u t e = s e c o n d * 6 0 ;  
 	 v a r   h o u r = m i n u t e * 6 0 ;  
 	 v a r   d a y = h o u r * 2 4 ;  
 	 v a r   y e a r = d a y * 3 6 5 ;  
  
  
 	 v a r   d a y s I n M o n t h   =   D a y s A r r a y ( 1 2 )  
 	 v a r   p o s 1 = d t S t r . i n d e x O f ( d t C h )  
 	 v a r   p o s 2 = d t S t r . i n d e x O f ( d t C h , p o s 1 + 1 )  
 	 v a r   s t r D a y = d t S t r . s u b s t r i n g ( 0 , p o s 1 )  
 	 v a r   s t r M o n t h = d t S t r . s u b s t r i n g ( p o s 1 + 1 , p o s 2 )  
 	 v a r   s t r Y e a r = d t S t r . s u b s t r i n g ( p o s 2 + 1 )  
 	 s t r Y r = s t r Y e a r  
 	 i f   ( s t r D a y . c h a r A t ( 0 ) = = " 0 "   & &   s t r D a y . l e n g t h > 1 )   s t r D a y = s t r D a y . s u b s t r i n g ( 1 )  
 	 i f   ( s t r M o n t h . c h a r A t ( 0 ) = = " 0 "   & &   s t r M o n t h . l e n g t h > 1 )   s t r M o n t h = s t r M o n t h . s u b s t r i n g ( 1 )  
 	 f o r   ( v a r   i   =   1 ;   i   < =   3 ;   i + + )   {  
 	 	 i f   ( s t r Y r . c h a r A t ( 0 ) = = " 0 "   & &   s t r Y r . l e n g t h > 1 )   s t r Y r = s t r Y r . s u b s t r i n g ( 1 )  
 	 }  
 	 m o n t h = p a r s e I n t ( s t r Y r )  
 	 d a y = p a r s e I n t ( s t r D a y )  
 	 y e a r = p a r s e I n t ( s t r Y r )  
  
 	 v a r   m y D a t e = n e w   D a t e ( ) ;  
 	 m y D a t e . s e t F u l l Y e a r ( s t r Y r , s t r M o n t h - 1 , s t r D a y ) ;  
 	  
 	 m y D a t e . a d d ( " d " , d a y a d d ) ;  
  
 	 r e s D a y   =   m y D a t e . g e t D a t e ( ) ;  
 	 i f   ( r e s D a y   <   1 0 )   r e s D a y = ' 0 ' + r e s D a y ;  
 	  
 	 r e s M o n t h   =   m y D a t e . g e t M o n t h ( ) + 1  
 	 i f   ( r e s M o n t h   <   1 0 )   r e s M o n t h   = ' 0 ' + r e s M o n t h ;  
 	  
 	 r e t u r n   r e s D a y   +   ' / '   +   r e s M o n t h   +   ' / '   +   m y D a t e . g e t Y e a r ( ) ;  
 }    
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 *  
 * 	 	 	 	 	 	 	 	 	 G   E   S   T   I   O   N E             L a y e r   e   T a b e l l e  
 *  
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
  
 f u n c t i o n   w i n d o w _ o p e n _ b a r ( f i l e n a m e ,   x ,   y ,   t a r g e t )  
 {  
 	 w i n d o w o p s   =   e v a l ( " ' t o o l b a r = n o , l o c a t i o n = n o , d i r e c t o r i e s = n o , s t a t u s = n o , m e n u b a r = n o , s c r o l l b a r s = y e s , r e s i z a b l e = n o , c o p y h i s t o r y = n o , w i d t h = "   +   x   +   " , h e i g h t = "   +   y   +   " ' " ) ;  
 	 n e w w i n d o w = w i n d o w . o p e n ( f i l e n a m e ,   t a r g e t ,   w i n d o w o p s ) ;  
 	 r e t u r n ;  
 }  
  
 f u n c t i o n   t o g g l e t a b l e ( p o s t i d , m e n u i d )   {  
       v a r   w h i c h p o s t   =   d o c u m e n t . g e t E l e m e n t B y I d ( p o s t i d ) ;  
  
       i f   ( w h i c h p o s t . c l a s s N a m e = = " t a b l e s h o w n " )   {  
             w h i c h p o s t . c l a s s N a m e = " t a b l e h i d d e n " ;  
             i f   ( m e n u i d   ! =   u n d e f i n e d )   {  
             	 d o c u m e n t . g e t E l e m e n t B y I d ( m e n u i d ) . i n n e r H T M L = ' [ + ] ' ;  
             }  
       }  
       e l s e   {  
             w h i c h p o s t . c l a s s N a m e = " t a b l e s h o w n " ;  
             i f   ( m e n u i d   ! =   u n d e f i n e d )   {  
             	 d o c u m e n t . g e t E l e m e n t B y I d ( m e n u i d ) . i n n e r H T M L = ' [ "] ' ;  
             }  
              
       }  
 }  
  
 f u n c t i o n   s h o w t a b l e ( )   {  
 	 v a r   d i v s = d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " d i v " ) ;  
 	 f o r ( i = 0 ; i < d i v s . l e n g t h ; i + + ) {  
 	       i f ( d i v s [ i ] . c l a s s N a m e = = " t a b l e h i d d e n " ) {  
 	               d i v s [ i ] . c l a s s N a m e   = " t a b l e s h o w n " ;  
 	               d o c u m e n t . g e t E l e m e n t B y I d ( " s h o w _ a l l " ) . i n n e r H T M L = ' [ "] ' ;  
 	               }  
 	             e l s e   {  
 	     i f ( d i v s [ i ] . c l a s s N a m e = = " t a b l e s h o w n " ) {  
 	       	 	 d i v s [ i ] . c l a s s N a m e   = " t a b l e h i d d e n " ;  
 	       	 	 d o c u m e n t . g e t E l e m e n t B y I d ( " s h o w _ a l l " ) . i n n e r H T M L = ' [ + ] ' ;  
 	       	 }  
 	       }  
       }  
 }  
  
 f u n c t i o n   h i d e a l l ( )   {  
 	 v a r   d i v s = d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " d i v " ) ;  
 	 f o r ( i = 0 ; i < d i v s . l e n g t h ; i + + ) {  
 	 	 i f ( d i v s [ i ] . c l a s s N a m e = = " t a b l e s h o w n " ) {  
 	 	 	 d i v s [ i ] . c l a s s N a m e   = " t a b l e h i d d e n " ;  
 	 	 }  
       }  
 }  
  
 f u n c t i o n   s p u r s ( )   {  
 	 v a r   d i v s = d o c u m e n t . g e t E l e m e n t s B y N a m e ( " c a l " )  
 	 f o r ( i = 0 ; i < d i v s . l e n g t h ; i + + ) {  
 	 	 d i v s [ i ] . s t y l e . b o r d e r = ' 1 p x   # A 3 B A E 9   s o l i d ' ;  
       }  
 }  
  
  
 f u n c t i o n   h i d e T R ( i d )   {  
 	 v a r   d i v s = d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " t a b l e " ) ;  
 	 f o r ( i = 0 ; i < d i v s . l e n g t h ; i + + ) {  
 	 	 i f ( d i v s [ i ] . c l a s s N a m e = = " T R s h o w n " ) {  
 	 	 	 d i v s [ i ] . c l a s s N a m e   = " T R h i d d e n " ;  
 	 	 }  
       }  
 	 v a r   t t   =   d o c u m e n t . g e t E l e m e n t s B y N a m e ( i d ) ;  
 	 f o r ( i = 0 ; i < t t . l e n g t h ; i + + ) {  
 	 	 t t [ i ] . c l a s s N a m e   = " T R s h o w n "  
 	 }  
 }  
  
 f u n c t i o n   s h o w T R ( )   {  
 	 v a r   d i v s = d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " t a b l e " ) ;  
 	 f o r ( i = 0 ; i < d i v s . l e n g t h ; i + + ) {  
 	 	 	 d i v s [ i ] . c l a s s N a m e   = " T R s h o w n " ;  
 	 }  
 }  
  
 f u n c t i o n   L a y e r D i s p l a y ( l a y e r , d i s p )   {  
 	 d d d   =   ' n o n e ' ;  
 	 i f   ( d i s p   = =   1 )   d d d   =   ' i n l i n e ' ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . s t y l e . d i s p l a y = d d d ;  
 }  
  
 f u n c t i o n   I s L a y e r D i s p l a y ( l a y e r , n o d i s p )   {  
 	 i f   ( d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . s t y l e . d i s p l a y   = =   ' i n l i n e ' )   {  
 	 	 i f   ( n o d i s p   ! =   1 )   {  
 	 	 	 L a y e r D i s p l a y ( l a y e r , 0 ) ;  
 	 	 	 r e t u r n   f a l s e ;  
 	 	 }  
 	 	 e l s e   r e t u r n   t r u e ;  
 	 }  
 	 e l s e   {  
 	 	 i f   ( n o d i s p   ! =   1 )   {  
 	 	 	 L a y e r D i s p l a y ( l a y e r , 1 ) ;  
 	 	 	 r e t u r n   t r u e ; 	  
 	 	 }  
 	 	 e l s e   r e t u r n   f a l s e ;  
 	 }  
 }  
  
 / * P O S I Z I O N A   U N   L A Y E R   C L A U D I A   * /  
 f u n c t i o n   L a y e r P o s i t i o n ( l a y e r , y , x )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . s t y l e . t o p = y + ' p x ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . s t y l e . l e f t = x + ' p x ' ;  
 }  
  
 / * T R O V A   P O S I Z I O N E   L A Y E R   C L A U D I A   * /  
 f u n c t i o n   g e t P o s X ( o b j )   {  
 v a r   c u r l e f t   =   0 ;  
 i f   ( o b j . o f f s e t P a r e n t )   {  
 w h i l e   ( o b j . o f f s e t P a r e n t )   {  
 c u r l e f t   + =   o b j . o f f s e t L e f t  
 o b j   =   o b j . o f f s e t P a r e n t ;  
 }  
 }  
 e l s e   i f   ( o b j . x )  
 c u r l e f t   + =   o b j . x ;  
 / / a l e r t ( c u r l e f t ) ;  
 r e t u r n   c u r l e f t ;  
 }  
  
 f u n c t i o n   g e t P o s Y ( o b j )   {  
 v a r   c u r t o p   =   0 ;  
 i f   ( o b j . o f f s e t P a r e n t )   {  
 w h i l e   ( o b j . o f f s e t P a r e n t )   {  
 c u r t o p   + =   o b j . o f f s e t T o p  
 o b j   =   o b j . o f f s e t P a r e n t ;  
 }  
 }  
 e l s e   i f   ( o b j . y )  
 c u r t o p   + =   o b j . y ;  
 / / a l e r t ( c u r t o p ) ;  
 r e t u r n   c u r t o p ;  
 }  
 / * T R O V A   P O S I Z I O N E   L A Y E R   C L A U D I A   * /  
  
 / * A n t e p r i m a   i m m a g i n e * /  
 f u n c t i o n   t h u m b ( a c t , d i v , i m g ) {  
         / / a c t   =   a z i o n e   v i s u a l i z z a   ( V I E W )   /   n o n   v i s u a l i z z a   ( N O V I E W )  
         i f ( a c t = = ' V I E W ' ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . d i s p l a y   =   ' b l o c k ' ;  
                 v a r   p o s i z i o n e Y = M o u s e Y ( ) ;  
                 v a r   p o s i z i o n e X = M o u s e X ( ) ;  
                 / / a l e r t ( p o s i z i o n e ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . p o s i t i o n   =   ' a b s o l u t e ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . t o p   =   p o s i z i o n e Y ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . l e f t   =   p o s i z i o n e X ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L   =   ' < i m g   s r c = \ ' ' + i m g + ' \ '   b o r d e r = \ ' 0 \ '   / > ' ;  
         } e l s e {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L   = ' < i m g   s r c = \ ' i m a g e s / s p i n n e r . g i f \ '   b o r d e r = \ ' 0 \ '   / > ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
         }  
 }  
  
 f u n c t i o n   t h u m b 2 ( a c t , d i v , x , y , i m g ) {  
         / / a c t   =   a z i o n e   v i s u a l i z z a   ( V I E W )   /   n o n   v i s u a l i z z a   ( N O V I E W )  
         i f ( a c t = = ' V I E W ' ) {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . d i s p l a y   =   ' b l o c k ' ;  
                 v a r   p o s i z i o n e Y = y ;  
                 v a r   p o s i z i o n e X = x ;  
                 / / a l e r t ( p o s i z i o n e ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . p o s i t i o n   =   ' a b s o l u t e ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . t o p   =   p o s i z i o n e Y + ' p x ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . l e f t   =   p o s i z i o n e X + ' p x ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L   =   ' < i m g   s r c = \ ' ' + i m g + ' \ '   b o r d e r = \ ' 0 \ '   / > ' ;  
         } e l s e {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L   = ' < i m g   s r c = \ ' i m a g e s / s p i n n e r . g i f \ '   b o r d e r = \ ' 0 \ '   / > ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
         }  
 }  
  
 / * A n t e p r i m a   i m m a g i n e * /  
  
  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 *  
 * 	 	 	 	 	 	 	 	 	 G   E   S   T   I   O   N E             A   J   A   X    
 *  
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
  
 f u n c t i o n   a s s e g n a X M L H t t p R e q u e s t ( )   {  
 v a r  
   X H R   =   n u l l ,  
   b r o w s e r U t e n t e   =   n a v i g a t o r . u s e r A g e n t . t o U p p e r C a s e ( ) ;  
  
   i f ( t y p e o f ( X M L H t t p R e q u e s t )   = = =   " f u n c t i o n "   | |   t y p e o f ( X M L H t t p R e q u e s t )   = = =   " o b j e c t " )  
     X H R   =   n e w   X M L H t t p R e q u e s t ( ) ;  
  
   e l s e   i f (  
     w i n d o w . A c t i v e X O b j e c t   & &  
     b r o w s e r U t e n t e . i n d e x O f ( " M S I E   4 " )   <   0  
   )   {  
  
     i f ( b r o w s e r U t e n t e . i n d e x O f ( " M S I E   5 " )   <   0 )  
       X H R   =   n e w   A c t i v e X O b j e c t ( " M s x m l 2 . X M L H T T P " ) ;  
     e l s e  
       X H R   =   n e w   A c t i v e X O b j e c t ( " M i c r o s o f t . X M L H T T P " ) ;  
   }  
   r e t u r n   X H R ;  
 }  
  
 f u n c t i o n   A j a x G e t W a i t ( u r l ,   l a y e r )   {  
 	 u   =   u r l ;  
 	 l   =   l a y e r ;  
  
 	 s e t T i m e o u t ( " A j a x G e t ( u , l ) ; " , 0 ) ;  
 	 d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . i n n e r H T M L = ' < d i v   i d = " a t t e n d e r e "   s t y l e = " t e x t - a l i g n : c e n t e r ; w i d t h : 9 0 p x ; m a r g i n - t o p : ' + ( ( d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . o f f s e t H e i g h t / 2 ) - 1 0 ) + ' p x ; m a r g i n - l e f t : ' + ( ( d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . o f f s e t W i d t h / 2 ) - 4 5 ) + ' p x ; f o n t - s i z e : 1 1 p x ; " > A t t e n d e r e   p r e g o < / d i v > ' ;  
 }  
  
 f u n c t i o n   A j a x G e t A s y n c ( u r l , l a y e r , s o r t , j s , w a i t ) {  
 	 v a r   a j a x   =   a s s e g n a X M L H t t p R e q u e s t ( ) ;  
 	 v a r   r = M a t h . f l o o r ( M a t h . r a n d o m ( ) * 1 0 0 0 0 )  
 	 i f ( a j a x )   {  
 	  
 	 	 i f ( w a i t   ! =   0 ) {  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' b o d y ' ) . s t y l e . c u r s o r = ' w a i t ' ;  
 	  
 	 	 	 l a y e r Y   =   ( M a t h . c e i l ( d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . o f f s e t H e i g h t / 2 ) ) - 9 ;  
 	 	 	 w a i t T e x t   =   ' < d i v   i d = " a t t e n d e r e "   s t y l e = " t e x t - a l i g n : c e n t e r ; m a r g i n - t o p : ' + l a y e r Y + ' p x ; f o n t - s i z e : 1 1 p x ; " > A t t e n d e r e   p r e g o < / d i v > '  
 	 	 	 i f ( d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . o f f s e t H e i g h t   >   5 0 )   {  
 	 	 	 	 l a y e r Y - = 2 0 ;  
 	 	 	 	 w a i t T e x t = ' < d i v   i d = " a t t e n d e r e "   s t y l e = " t e x t - a l i g n : c e n t e r ; m a r g i n - t o p : ' + l a y e r Y + ' p x ; f o n t - s i z e : 1 1 p x ; " > < i m g   a l t = " S p i n n e r "   s r c = " i m a g e s / s p i n n e r . g i f "   w i d t h = " 3 7 "   h e i g h t = " 3 9 "   / > < / d i v > '  
 	 	 	 }  
 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . i n n e r H T M L = w a i t T e x t ;  
 	 	 }  
 	 	 a j a x . o n r e a d y s t a t e c h a n g e = f u n c t i o n ( ) {  
 	 	 	 i f ( a j a x . r e a d y S t a t e = = 4 ) {  
 	 	 	 	 i f   ( j s   = =   1 )   {  
 	 	 	 	 	 s e t A n d E x e c u t e ( l a y e r , a j a x . r e s p o n s e T e x t ) ;  
 	 	 	 	 }  
 	 	 	 	 e l s e   {  
 	 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . i n n e r H T M L = a j a x . r e s p o n s e T e x t ;  
 	 	 	 	 }  
 	 	 	 	 i f   ( s o r t   = =   1 )   $ ( " # S o r t T a b l e " ) . t a b l e s o r t e r ( ) ;  
 	 	 	 	 d o c u m e n t . g e t E l e m e n t B y I d ( ' b o d y ' ) . s t y l e . c u r s o r = ' d e f a u l t ' ;  
 	 	 	 }  
 	 	 }  
 	 	 a j a x . o p e n ( " g e t " ,   u r l   +   " & r = " + r ,   t r u e ) ;  
   	 	 a j a x . s e n d ( n u l l ) ;  
   	 }  
   	 e l s e {  
   	 	 a l e r t ( ' A t t e n z i o n e !   A j a x   n o n   i n i z i a l i z z a t o ' ) ;  
   	 }  
 }  
  
 f u n c t i o n   A j a x G e t ( u r l , l a y e r ) {  
 	 v a r   a j a x   =   a s s e g n a X M L H t t p R e q u e s t ( ) ;  
 	 v a r   r = M a t h . f l o o r ( M a t h . r a n d o m ( ) * 1 0 0 0 0 )  
 	 i f ( a j a x )   {  
 	 	 a j a x . o p e n ( " g e t " ,   u r l   +   " & r = " + r ,   f a l s e ) ;  
   	 	 a j a x . s e n d ( n u l l ) ;  
   	 	 d o c u m e n t . g e t E l e m e n t B y I d ( l a y e r ) . i n n e r H T M L = a j a x . r e s p o n s e T e x t ;  
   	 }  
   	 e l s e {  
   	 	 a l e r t ( ' A t t e n z i o n e !   A j a x   n o n   i n i z i a l i z z a t o ' ) ;  
   	 }  
 }  
  
 f u n c t i o n   A j a x G e t V a l u e ( u r l , f i e l d ) {  
 	 v a r   a j a x   =   a s s e g n a X M L H t t p R e q u e s t ( ) ;  
 	 v a r   r = M a t h . f l o o r ( M a t h . r a n d o m ( ) * 1 0 0 0 0 )  
 	 i f ( a j a x )   {  
 	 	 a j a x . o p e n ( " g e t " ,   u r l   +   " & r = " + r ,   f a l s e ) ;  
   	 	 a j a x . s e n d ( n u l l ) ;  
   	 	 d o c u m e n t . g e t E l e m e n t B y I d ( f i e l d ) . v a l u e = a j a x . r e s p o n s e T e x t ;  
   	 }  
   	 e l s e {  
   	 	 a l e r t ( ' A t t e n z i o n e !   A j a x   n o n   i n i z i a l i z z a t o ' ) ;  
   	 }  
 }  
  
 f u n c t i o n   A j a x G e t R e t u r n ( u r l ) {  
 	 v a r   a j a x   =   a s s e g n a X M L H t t p R e q u e s t ( ) ;  
 	 v a r   r = M a t h . f l o o r ( M a t h . r a n d o m ( ) * 1 0 0 0 0 )  
 	 i f ( a j a x )   {  
 	 	 a j a x . o p e n ( " g e t " ,   u r l   +   " & r = " + r ,   f a l s e ) ;  
   	 	 a j a x . s e n d ( n u l l ) ;  
   	 	 r e t u r n   a j a x . r e s p o n s e T e x t ;  
   	 }  
   	 e l s e {  
   	 	 a l e r t ( ' A t t e n z i o n e !   A j a x   n o n   i n i z i a l i z z a t o ' ) ;  
   	 	 r e t u r n   f a l s e ;  
   	 }  
 }  
  
 f u n c t i o n   A j a x G e t R e t u r n A s y n c ( u r l ) {  
 	 v a r   a j a x   =   a s s e g n a X M L H t t p R e q u e s t ( ) ;  
 	 v a r   r = M a t h . f l o o r ( M a t h . r a n d o m ( ) * 1 0 0 0 0 )  
 	 i f ( a j a x )   {  
 	 	 a j a x . o n r e a d y s t a t e c h a n g e = f u n c t i o n ( ) {  
 	 	 	 i f ( a j a x . r e a d y S t a t e = = 4 ) {  
 	 	 	 	 r e t u r n   a j a x . r e s p o n s e T e x t ;  
 	 	 	 }  
 	 	 }  
 	 	 a j a x . o p e n ( " g e t " ,   u r l   +   " & r = " + r ,   t r u e ) ;  
   	 	 a j a x . s e n d ( n u l l ) ;  
   	 }  
   	 e l s e {  
   	 	 a l e r t ( ' A t t e n z i o n e !   A j a x   n o n   i n i z i a l i z z a t o ' ) ;  
   	 }  
 }  
  
  
 f u n c t i o n   s e t h t m l ( d i v , c o n t e n t )  
 {  
         v a r   s e a r c h   =   c o n t e n t ;  
         v a r   s c r i p t ;  
                    
         w h i l e (   s c r i p t   =   s e a r c h . m a t c h ( / ( < s c r i p t [ ^ > ] + j a v a s c r i p t [ ^ > ] + > \ s * ( < ! - - ) ? ) / i ) )  
         {  
             s e a r c h   =   s e a r c h . s u b s t r ( s e a r c h . i n d e x O f ( R e g E x p . $ 1 )   +   R e g E x p . $ 1 . l e n g t h ) ;  
              
             i f   ( ! ( e n d s c r i p t   =   s e a r c h . m a t c h ( / ( ( - - > ) ? \ s * < \ / s c r i p t > ) / ) ) )   b r e a k ;  
              
             b l o c k   =   s e a r c h . s u b s t r ( 0 ,   s e a r c h . i n d e x O f ( R e g E x p . $ 1 ) ) ;  
             s e a r c h   =   s e a r c h . s u b s t r i n g ( b l o c k . l e n g t h   +   R e g E x p . $ 1 . l e n g t h ) ;  
              
             v a r   o S c r i p t   =   d o c u m e n t . c r e a t e E l e m e n t ( ' s c r i p t ' ) ;  
             o S c r i p t . t e x t   =   b l o c k ;  
             d o c u m e n t . g e t E l e m e n t s B y T a g N a m e ( " h e a d " ) . i t e m ( 0 ) . a p p e n d C h i l d ( o S c r i p t ) ;  
         }  
        
         d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L = c o n t e n t ;  
 }  
  
 f u n c t i o n   s e t A n d E x e c u t e ( d i v I d ,   i n n e r H T M L )  
 {  
       v a r   d i v   =   d o c u m e n t . g e t E l e m e n t B y I d ( d i v I d ) ;  
       d i v . i n n e r H T M L   =   i n n e r H T M L ;  
       v a r   x   =   d i v . g e t E l e m e n t s B y T a g N a m e ( " s c r i p t " ) ;    
       f o r ( v a r   i = 0 ; i < x . l e n g t h ; i + + )  
       {  
               e v a l ( x [ i ] . t e x t ) ;  
       }  
 }  
  
 f u n c t i o n   g e t C o o k i e ( p o s t i d )   {  
       p o s t i d   + =   " = " ;  
       s t a r t p o s   =   d o c u m e n t . c o o k i e . i n d e x O f ( p o s t i d ) ;  
       i f ( s t a r t p o s   = =   - 1 )  
             r e t u r n   ' ' ;  
        
       s t a r t p o s   =   s t a r t p o s   +   p o s t i d . l e n g t h ;  
       i f ( d o c u m e n t . c o o k i e . i n d e x O f ( " | " ,   s t a r t p o s )   ! =   - 1 )  
             e n d p o s   =   d o c u m e n t . c o o k i e . i n d e x O f ( " | " ,   s t a r t p o s ) ;  
       e l s e  
             e n d p o s   =   d o c u m e n t . c o o k i e . l e n g t h ;  
  
       r e t u r n   u n e s c a p e ( d o c u m e n t . c o o k i e . s u b s t r i n g ( s t a r t p o s ,   e n d p o s ) ) ;  
 }  
  
 / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 *  
 * 	 	 	 	 	 	 	 	 	 G   E   S   T   I   O   N E             S   H   O   P  
 *  
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /  
 f u n c t i o n   H o m e ( ) {  
 	 A j a x G e t A s y n c ( ' H O M E . a s p ? a = 1 ' , ' w o r k s p a c e ' ) ;  
 	 A j a x G e t A s y n c ( ' W E L C O M E . a s p ? a = 1 ' , ' L o g i n _ T D ' ) ;  
 }  
  
 f u n c t i o n   C h e c k S e s s i o n ( )   {  
 	 i f   ( A j a x G e t R e t u r n ( ' C H E C K _ S E S S I O N . a s p ? a = 2 ' )   ! =   ' O K ' )   {  
 	 	 c o n f i r m ( ' S e s s i o n e   s c a d u t a ' ) ;  
 	 	 w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 	 }  
 }  
  
 f u n c t i o n   C h e c k S e s s i o n C l i e n t e ( )   {  
 	 i f   ( A j a x G e t R e t u r n ( ' C H E C K _ S E S S I O N _ C L I E N T E . a s p ? a = 2 ' )   ! =   ' O K ' )   {  
 	 	 c o n f i r m ( ' S e s s i o n e   C l i e n t e   s c a d u t a ' ) ;  
 	 	 w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 	 }  
 }  
 v a r   i n t C l i = 0 ;  
 f u n c t i o n   L o g i n ( u t , p w ) {  
 	 / / l = d o c u m e n t . g e t E l e m e n t B y I d ( ' l o g i n ' ) . v a l u e ;  
 	 / / p = d o c u m e n t . g e t E l e m e n t B y I d ( ' p w d ' ) . v a l u e ;  
 	 l = u t ;  
 	 p = p w ;  
 	 i f ( l = = ' '   | |   p = = ' ' ) { a l e r t ( ' I n s e r i r e   l o g i n   e   p a s s w o r d ' ) ; r e t u r n   f a l s e ; }  
 	 r e t = A j a x G e t R e t u r n ( ' L O G I N . a s p ? p = ' + p + ' & l = ' + l )  
 	 i f ( r e t ! = ' O K ' ) { a l e r t ( ' L o g i n   o   P a s s w o r d   e r r a t i ' ) ; A j a x G e t R e t u r n ( ' L O G O U T . a s p ? a = 1 ' ) ; }  
 	 e l s e { i n t C l i = s e t I n t e r v a l ( ' C h e c k S e s s i o n C l i e n t e ( ) ' , 1 0 0 0 0 ) ; w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ; }  
 }  
  
 f u n c t i o n   L o g o u t ( ) {  
 	 c l e a r I n t e r v a l ( i n t C l i ) ;  
 	 A j a x G e t R e t u r n ( ' L O G O U T . a s p ? a = 1 ' ) ;  
 	 / / A j a x G e t A s y n c ( ' W E L C O M E . a s p ? a = 1 ' , ' L o g i n _ T D ' ) ;  
 	 / / w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 	 w i n d o w . l o c a t i o n . h r e f = ' d e f a u l t . a s p '  
 }  
  
 f u n c t i o n   C e r c a ( ) {  
 	 s e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s S e a r c h ' ) . v a l u e ;  
 	 i f ( s e = = ' ' ) r e t u r n   f a l s e ;  
 	 A j a x G e t A s y n c ( ' S E A R C H . a s p ? s e a r c h = ' + s e , ' w o r k s p a c e ' ) ;  
 	 w i n d o w . l o c a t i o n . h r e f = ' d e f a u l t . a s p ? '  
 }  
  
 f u n c t i o n   C a r r e l l o A d d ( i d a r t , a l , q t a , d i v ) {  
 	 r e t = A j a x G e t R e t u r n ( ' C A R R E L L O . a s p ? a c t = a d d & i d a r t = ' + i d a r t + ' & a l = ' + a l + ' & q t a = ' + q t a ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e { A j a x G e t A s y n c ( ' C a r r e l l o . a s p ? a c t = s e l ' , ' c a r r e l l o ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( d i v ) . i n n e r H T M L = ' < i m g   s r c = \ " i m a g e s / c h e c k _ c o n f i r m . j p g \ "   b o r d e r = \ " 0 \ "   a l t = \ " A r t .   I n s e r i t o \ "   t i t l e = \ " A r t i c o l o   i n s e r i t o \ "   / > ' ; }  
 }  
  
 f u n c t i o n   C a r r e l l o U p d ( i d , q t a ) {  
 	 r e t = A j a x G e t R e t u r n ( ' C A R R E L L O . a s p ? a c t = u p d & i d = ' + i d + ' & q t a = ' + q t a ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e   w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 }  
  
 f u n c t i o n   C a r r e l l o E r a s e ( ) {  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
 	 r e t = A j a x G e t R e t u r n ( ' C A R R E L L O . a s p ? a c t = e r a s e ' ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e   w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 }  
  
 / * R i c e r c a   l ' a r t i c o l o   i n   b a s e   a l   c o d i c e   i m m e s s o   e   n e   r e s t i t u i s c e   l ' i d   * /  
 f u n c t i o n   C a r r e l l o C a t a l o g o S e a r c h ( c o d i c e , n ) {  
 v a r   c o d = c o d i c e ;  
 v a r   n u = n ;  
         / / A j a x G e t V a l u e ( ' s e a r c h A r t . a s p ? t i p o = c o d i c e & s S e a r c h = ' + c o d , ' i d A r t ' + n u )  
                                          
         / / m e t t o   i l   v e l i n o   s o p r a  
         / / P o p V i e w ( ' V E R I F I C A   A R T I C O L O ' , ' s e a r c h A r t . a s p ? t i p o = c o d i c e & s S e a r c h = ' + c o d + ' & k e e p T h i s = t r u e & T B _ i f r a m e = t r u e & h e i g h t = 5 5 0 & w i d t h = 8 0 0 ' , ' p a g i n a v u o t a ' ) ; r e t u r n   f a l s e ;  
         P o p V i e w ( ' V E R I F I C A   A R T I C O L O ' , ' p a g i n a v u o t a . a s p ? k e e p T h i s = t r u e & T B _ i f r a m e = t r u e & h e i g h t = 5 5 0 & w i d t h = 8 0 0 ' , ' p a g i n a v u o t a ' ) ;  
          
         r e t = A j a x G e t R e t u r n ( ' s e a r c h A r t . a s p ? t i p o = c o d i c e & s S e a r c h = ' + c o d )  
         i f   ( r e t ! = ' ' ) {  
         v a r   i d a r t = r e t . s u b s t r ( 0 , r e t . i n d e x O f ( ' ; ' ) ) ;  
         v a r   p r e z z o = r e t . s l i c e ( r e t . i n d e x O f ( ' ; ' ) + 1 ) ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' q t a ' + n u ) . d i s a b l e d = f a l s e ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' q t a ' + n u ) . v a l u e = " 1 " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' i d A r t ' + n u ) . v a l u e = i d a r t ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' p r e z z o ' + n u ) . v a l u e = p r e z z o ;  
                 P o p C l o s e ( ) ;  
         } e l s e {  
         P o p C l o s e ( ) ;  
         a l e r t ( ' I l   c o d i c e   è   e r r a t o   o p p u r e   l \ ' a r t i c o l o   n o n   r i s u l t a   p i ù   a   c a t a l o g o . ' ) ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' q t a ' + n u ) . d i s a b l e d = t r u e ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' q t a ' + n u ) . v a l u e = " " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' i d A r t ' + n u ) . v a l u e = " " ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' p r e z z o ' + n u ) . v a l u e = " " ;  
         }  
          
 }  
  
 f u n c t i o n   d i s a b i l i t a I n v i o E C e r c a ( e ,   c o d i c e ,   n )  
 {  
           v a r   k e y ;  
           i f ( w i n d o w . e v e n t )  
                     k e y   =   w i n d o w . e v e n t . k e y C o d e ;           / / I E  
           e l s e  
                     k e y   =   e . w h i c h ;           / / f i r e f o x  
           i f ( k e y   = =   1 3 )  
           {                    
                     C a r r e l l o C a t a l o g o S e a r c h ( c o d i c e , n ) ;  
                     r e t u r n   f a l s e ;  
           }  
           e l s e  
           {          
                     r e t u r n   t r u e ;  
           }  
            
 }  
  
 / * i n s e r i m e n t o   p i ù   a r t i c o l i   i n   c a r r e l l o   * /  
 f u n c t i o n   C a r r e l l o A d d M u c h ( d a t i ) {  
 	 / / r e t = A j a x G e t R e t u r n ( ' C A R R E L L O . a s p ? a c t = a d d & i d a r t = ' + i d a r t + ' & a l = ' + a l + ' & q t a = ' + q t a ) ;  
 	 v a r   i n f o   =   d a t i ;  
 	 / / a l e r t ( i n f o ) ;  
 	 r e t = A j a x G e t R e t u r n ( ' C A R R E L L O . a s p ? ' + i n f o ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 / / e l s e { A j a x G e t A s y n c ( ' C a r r e l l o . a s p ? a c t = s e l ' , ' c a r r e l l o _ h o m e ' ) ; }  
 	 e l s e { a l e r t ( ' A r t i c o l i   i n s e r i t i   n e l   c a r r e l l o . ' ) ; w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ; }  
 }  
 / *  
 F I N E   - - -   i n s e r i m e n t o   p i ù   a r t i c o l i   i n   c a r r e l l o  
 * /  
  
 f u n c t i o n   O r d i n e D e s t i n a z i o n e ( b ) {  
         r e t = A j a x G e t R e t u r n ( ' O R D I N E . a s p ? a c t = d e s t i n a z i o n e & I D C l i S e d D e s t = ' + b ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e   w i n d o w . l o c a t i o n . r e l o a d ( t r u e ) ;  
 }  
  
 f u n c t i o n   O r d i n e I n v i a ( a , b , a u t o ) {  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
 	 b   =   b . r e p l a c e ( ' \ r \ n ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ r \ n   ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ n ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ n   ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( / ( \ r \ n ) | ( \ n ) / g , ' [ B R ] ' ) ;    
  
 	 r e t = A j a x G e t R e t u r n ( ' O R D I N E . a s p ? a c t = i n v i a & i d c l i e n t e s e d e d e s t = ' + a + ' & n o t e = ' + b ) ;  
 	 i f ( r e t ! = ' O K ' ) {  
 	 	 a l e r t ( r e t ) ;  
 	 } e l s e {  
 	 	 i f ( a u t o = = 1 )   {  
 	 	 	 E s p o r t a O r d i n e ( ) ;  
 	 	 }  
 	 	 i f ( t o p ) {  
 	 	 	 t o p . l o c a t i o n . h r e f = ' d e f a u l t . a s p ? a c t = o r d i n e o k ' ;  
 	 	 } e l s e {  
 	 	 	 w i n d o w . l o c a t i o n . h r e f = ' d e f a u l t . a s p ? a c t = o r d i n e o k ' ;  
 	 	 }  
 	 } ;  
  
 }  
  
 f u n c t i o n   O r d i n e I n v i a _ D i r e c t ( a , b , a u t o ,   s e s s i o n _ n e g o z i o ) {  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
 	 b   =   b . r e p l a c e ( ' \ r \ n ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ r \ n   ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ n ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( ' \ n   ' , ' [ B R ] ' ) ;  
 	 b   =   b . r e p l a c e ( / ( \ r \ n ) | ( \ n ) / g , ' [ B R ] ' ) ;    
  
 	 r e t = A j a x G e t R e t u r n ( ' O R D I N E . a s p ? a c t = i n v i a _ d i r e c t & i d c l i e n t e s e d e d e s t = ' + a + ' & n o t e = ' + b + ' & s e s s i o n _ n e g o z i o = ' + s e s s i o n _ n e g o z i o ) ;  
 	 i f ( r e t ! = ' O K ' ) {  
 	 	 a l e r t ( r e t ) ;  
 	 } e l s e {  
 	 	 i f ( a u t o = = 1 )   {  
 	 	 	 E s p o r t a O r d i n e ( ) ;  
 	 	 }  
 	 	 i f ( t o p ) {  
 	 	 	 t o p . l o c a t i o n . h r e f = ' d e f a u l t . a s p ? a c t = o r d i n e o k ' ;  
 	 	 } e l s e {  
 	 	 	 w i n d o w . l o c a t i o n . h r e f = ' d e f a u l t . a s p ? a c t = o r d i n e o k ' ;  
 	 	 }  
 	 } ;  
  
 }  
  
 f u n c t i o n   E s p o r t a O r d i n e ( )  
 {        
     r e t = A j a x G e t R e t u r n ( ' O R D I N E . a s p ? a c t = e s p o r t a ' ) ;  
     i f ( r e t ! = ' O K ' ) { a l e r t ( r e t ) ; r e t u r n ; }  
 }  
  
 f u n c t i o n   C l i e n t e R e g i s t r a ( )   {  
  
         v a r   p i v a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p i v a ' ) . v a l u e ;  
         v a r   c o d f i s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d f i s c ' ) . v a l u e ;  
         v a r   c l a s s m e r c e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c l a s s i f i c a z i o n e m e r c e o l o g i c a ' ) . v a l u e ;   / /   n o n   o b b l i g a t o r i o  
         v a r   c o g n o m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o g n o m e ' ) . v a l u e ;  
         v a r   n o m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e ' ) . v a l u e ;  
         v a r   i n d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d ' ) . v a l u e ;  
         v a r   c i t t a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a ' ) . v a l u e ;  
         v a r   c o m u n e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o m u n e ' ) . v a l u e ;  
         v a r   c a p   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p ' ) . v a l u e   ;  
         v a r   p r o v   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v ' ) . v a l u e   ;  
         v a r   s t a t o   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s t a t o ' ) . v a l u e   ;  
         v a r   n a z i o n a l i t a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' n a z i o n a l i t a ' ) . v a l u e   ;  
         v a r   t e l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l ' ) . v a l u e   ;  
         v a r   t e l 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l 2 ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   t e l p o r t a t i l e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l p o r t a t i l e ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   f a x   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' f a x ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   e m a i l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l 1 ' ) . v a l u e   ;  
         v a r   e m a i l 2   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l 2 ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   e m a i l 3   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l 3 ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   c o n t a t t a r e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o n t a t t a r e ' ) . v a l u e   ;  
         v a r   p a g i n a w e b   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p a g i n a w e b ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   i n f o r m a z i o n i   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n f o r m a z i o n i ' ) . v a l u e   ;   / /   n o n   o b b l i g a t o r i o  
         v a r   l o g i n   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' l o g ' ) . v a l u e   ;  
         v a r   p a s s w d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s w d ' ) . v a l u e   ;  
         v a r   c o n f e r m a p a s s w d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o n f e r m a p a s s w d ' ) . v a l u e   ;  
 	  
         / / v a r   e s p r e s s i o n e   =   / ^ [ _ a - z A - Z 0 - 9 + - ] + ( \ . [ _ a - z A - Z 0 - 9 + - ] + ) * @ [ a - z 0 - 9 - ] + ( \ . [ a - z 0 - 9 - ] + ) + $ / ;  
 	  
         i f ( c o g n o m e = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   c o g n o m e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o g n o m e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( n o m e = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   n o m e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( i n d = = ' ' ) { a l e r t ( ' I n s e r i r e   i n d i r i z z o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( c i t t a = = ' ' ) { a l e r t ( ' I n s e r i r e   c i t t à   ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
         i f ( c o m u n e = = ' ' ) { a l e r t ( ' I n s e r i r e   c o m u n e   ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o m u n e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( c a p = = ' ' ) { a l e r t ( ' I n s e r i r e   C A P ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( p r o v = = ' ' ) { a l e r t ( ' I n s e r i r e   p r o v i n c i a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( s t a t o = = ' ' ) { a l e r t ( ' I n s e r i r e   s t a t o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' s t a t o ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( n a z i o n a l i t a = = ' ' ) { a l e r t ( ' I n s e r i r e   n a z i o n a l i t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' n a z i o n a l i t a ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( t e l = = ' ' ) { a l e r t ( ' I n s e r i r e   t e l e f o n o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 / / i f ( ( e m a i l = = ' ' )   | |   ( ! e s p r e s s i o n e . t e s t ( e m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
       	 i f ( ( e m a i l = = ' ' )   | |   ( ! e m a i l C h e c k ( e m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l 1 ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( c o n t a t t a r e = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   n o m e   d e l l a   p e r s o n a   d a   c o n t a t t a r e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o n t a t t a r e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
         i f ( p i v a = = ' ' ) { a l e r t ( ' I n s e r i r e   l a   p a r t i t a   i v a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p i v a ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
         i f ( c l a s s m e r c e = = ' S c e g l i e r e S e g u e n t i ' ) { c l a s s m e r c e = = ' - 1 ' }  
         i f ( l o g i n = = ' ' ) { a l e r t ( ' I n s e r i r e   l o g i n ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' l o g ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( p a s s w d = = ' ' ) { a l e r t ( ' I n s e r i r e   p a s s w o r d ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s w d ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( p a s s w d ! = c o n f e r m a p a s s w d ) { a l e r t ( ' P a s s w o r d   n o n   c o n f e r m a t a   c o r r e t t a m e n t e .   R e i n s e r i r e   l a   p a s s w o r d . ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o n f e r m a p a s s w d ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
         i f ( c o d f i s = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   c o d i c e   f i s c a l e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d f i s ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
  
 	 r e t = A j a x G e t R e t u r n ( " R E G I S T R A Z I O N E . a s p ? c o d f i s c a l e = " + c o d f i s + " & p i v a = " + p i v a + " & c l a s s m e r c e = " + c l a s s m e r c e + " & c o g n o m e = " + c o g n o m e . r e p l a c e ( " ' " ,   " ' ' " ) + " & n o m e = " + n o m e . r e p l a c e ( " ' " ,   " ' ' " ) + " & i n d = " + i n d . r e p l a c e ( " ' " ,   " ' ' " ) + " & c i t t a = " + c i t t a . r e p l a c e ( " ' " ,   " ' ' " ) + " & c o m u n e = " + c o m u n e . r e p l a c e ( " ' " ,   " ' ' " ) + " & c a p = " + c a p + " & p r o v = " + p r o v + " & s t a t o = " + s t a t o . r e p l a c e ( " ' " ,   " ' ' " ) + " & n a z i o n a l i t a = " + n a z i o n a l i t a . r e p l a c e ( " ' " ,   " ' ' " ) + " & t e l = " + t e l + " & t e l 2 = " + t e l 2 + " & t e l p o r t a t i l e = " + t e l p o r t a t i l e + " & f a x = " + f a x + " & e m a i l = " + e m a i l + " & e m a i l 2 = " + e m a i l 2 + " & e m a i l 3 = " + e m a i l 3 + " & c o n t a t t a r e = " + c o n t a t t a r e . r e p l a c e ( " ' " ,   " ' ' " ) + " & p a g i n a w e b = " + p a g i n a w e b + " & i n f o r m a z i o n i = " + i n f o r m a z i o n i + " & l o g i n = " + l o g i n + " & p a s s w d = " + p a s s w d ) ;  
 	 / / a l e r t ( ' R E G I S T R A Z I O N E . a s p ? n o m e = ' + n o m e + ' & i n d = ' + i n d + ' & c i t t a = ' + c i t t a + ' & c a p = ' + c a p + ' & p r o v = ' + p r o v + ' & t e l = ' + t e l + ' & e m a i l = ' + e m a i l + ' & l o g i n = ' + l o g i n + ' & p a s s w d = ' + p a s s w d + ' & p i v a = ' + p i v a + ' & f a x = ' + f a x ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e {  
 	         a l e r t ( ' G r a z i e   p e r   e s s e r t i   r e g i s t r a t o ' ) ;  
 	         w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
 	         / / w i n d o w . l o c a t i o n . h r e f = ' R E D I R . a s p ' ;  
 	 } ;  
 }  
  
  
 f u n c t i o n   C l i e n t e D a t i A c c e s s o U P D ( l o g i n , p a s s w d , p a s s w d c o n f ) {  
 	  
 	 i f ( l o g i n = = ' ' ) { a l e r t ( ' I n s e r i r e   l o g i n ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' l o g i n ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( ( p a s s w d = = ' ' )   | |   ( p a s s w d c o n f = = ' ' )   | |   ( p a s s w d ! = p a s s w d c o n f ) ) { a l e r t ( ' I n s e r i r e   c o r r e t t a m e n t e   l a   p a s s w o r d ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s w d ' ) . f o c u s ( ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s w d 2 ' ) . v a l u e = ' ' ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
  
 	 r e t = A j a x G e t R e t u r n ( ' C L I E N T E _ E D I T _ A C T . a s p ? a c t = m o d l o g & l o g i n = ' + l o g i n + ' & p a s s w d = ' + p a s s w d ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e { a l e r t ( ' D a t i   d \ ' a c c e s s o   a g g i o r n a t i ' ) ; w i n d o w . l o c a t i o n . r e l o a d ( ) } ;  
 }  
  
 f u n c t i o n   C l i e n t e U P D ( n o m e , i n d , c i t t a , c a p , p r o v , t e l , f a x , e m a i l , l o g i n , p a s s w d , p i v a , c o d f i s c a l e ) {  
 	 i f ( n o m e = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   n o m e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( i n d = = ' ' ) { a l e r t ( ' I n s e r i r e   i n d i r i z z o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( c i t t a = = ' ' ) { a l e r t ( ' I n s e r i r e   c i t t à ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( c a p = = ' ' ) { a l e r t ( ' I n s e r i r e   C A P ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( p r o v = = ' ' ) { a l e r t ( ' I n s e r i r e   p r o v i n c i a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( t e l = = ' ' ) { a l e r t ( ' I n s e r i r e   t e l e f o n o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( f a x = = ' ' ) { a l e r t ( ' I n s e r i r e   f a x ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' f a x ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 v a r   e s p r e s s i o n e   =   / ^ [ _ a - z A - Z 0 - 9 + - ] + ( \ . [ _ a - z A - Z 0 - 9 + - ] + ) * @ [ a - z 0 - 9 - ] + ( \ . [ a - z 0 - 9 - ] + ) + $ / ;  
  
 	 v a r   m a i l   =   e m a i l ;  
 	 / / i f ( ( m a i l = = ' ' )   | |   ( ! e s p r e s s i o n e . t e s t ( m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( ( m a i l = = ' ' )   | |   ( ! e m a i l C h e c k ( m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l 1 ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
         i f ( c o d f i s c a l e = = ' ' ) { a l e r t ( ' I n s e r i r e   C o d i c e   F i s c a l e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d f i s c a l e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
          
 	 i f ( l o g i n = = ' ' ) { a l e r t ( ' I n s e r i r e   l o g i n ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' l o g i n ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( p a s s w d = = ' ' ) { a l e r t ( ' I n s e r i r e   p a s s w o r d ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p a s s w d ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
  
 	 r e t = A j a x G e t R e t u r n ( ' C L I E N T E _ E D I T _ A C T . a s p ? a c t = m o d & n o m e = ' + n o m e . r e p l a c e ( " ' " ,   " ' ' " ) + ' & i n d = ' + i n d . r e p l a c e ( " ' " ,   " ' ' " ) + ' & c i t t a = ' + c i t t a . r e p l a c e ( " ' " ,   " ' ' " ) + ' & c a p = ' + c a p + ' & p r o v = ' + p r o v + ' & t e l = ' + t e l + ' & e m a i l = ' + m a i l + ' & l o g i n = ' + l o g i n + ' & p a s s w d = ' + p a s s w d + ' & p i v a = ' + p i v a + ' & f a x = ' + f a x + ' & c o d f i s c a l e = ' + c o d f i s c a l e ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e { a l e r t ( ' P r o f i l o   a g g i o r n a t o ' ) ; w i n d o w . l o c a t i o n . r e l o a d ( ) } ;  
 }  
  
  
 f u n c t i o n   C l i e n t e D e s t U P D ( a z i o n e , i d d e s , n o m e , i n d , c i t t a , c a p , p r o v , t e l , f a x , e m a i l , p i v a , s e d e n e w , c o d f i s c a l e ) {  
 	 i f ( n o m e = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   n o m e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( i n d = = ' ' ) { a l e r t ( ' I n s e r i r e   i n d i r i z z o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( c i t t a = = ' ' ) { a l e r t ( ' I n s e r i r e   c i t t à ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( c a p = = ' ' ) { a l e r t ( ' I n s e r i r e   C A P ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( p r o v = = ' ' ) { a l e r t ( ' I n s e r i r e   p r o v i n c i a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 i f ( t e l = = ' ' ) { a l e r t ( ' I n s e r i r e   t e l e f o n o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( f a x = = ' ' ) { a l e r t ( ' I n s e r i r e   f a x ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' f a x _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( c o d f i s c a l e = = ' ' ) { a l e r t ( ' I n s e r i r e   c o d i c e   f i s c a l e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d f i s c a l e _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
 	 v a r   e s p r e s s i o n e   =   / ^ [ _ a - z A - Z 0 - 9 + - ] + ( \ . [ _ a - z A - Z 0 - 9 + - ] + ) * @ [ a - z 0 - 9 - ] + ( \ . [ a - z 0 - 9 - ] + ) + $ / ;  
  
 	 v a r   m a i l   =   e m a i l ;  
 	 / / i f ( ( m a i l = = ' ' )   | |   ( ! e s p r e s s i o n e . t e s t ( m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( ( m a i l = = ' ' )   | |   ( ! e m a i l C h e c k ( m a i l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;  
  
 	 r e t = A j a x G e t R e t u r n ( ' C L I E N T E _ E D I T _ A C T . a s p ? a c t = ' + a z i o n e + ' & i d = ' + i d d e s + ' & n o m e = ' + n o m e . r e p l a c e ( " ' " ,   " ' ' " ) + ' & i n d = ' + i n d . r e p l a c e ( " ' " ,   " ' ' " ) + ' & c i t t a = ' + c i t t a . r e p l a c e ( " ' " ,   " ' ' " ) + ' & c a p = ' + c a p + ' & p r o v = ' + p r o v + ' & t e l = ' + t e l + ' & e m a i l = ' + m a i l + ' & p i v a = ' + p i v a + ' & f a x = ' + f a x + ' & s e d e n e w = ' + s e d e n e w + ' & c o d f i s c a l e = ' + c o d f i s c a l e ) ;  
 	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
 	 e l s e {  
 	 i f ( a z i o n e = = ' i n s D e s ' ) {  
 	 a l e r t ( ' D e s t i n a z i o n e   a g g i u n t a ' ) ;  
 	 } e l s e {  
 	 a l e r t ( ' D e s t i n a z i o n e   m o d i f i c a t a ' ) ;  
 	 }  
 	  
 	 w i n d o w . l o c a t i o n . r e l o a d ( ) } ;  
 }  
  
 f u n c t i o n   E m a i l C o n s u l e n t e ( n o m e ,   i n d i r i z z o ,   c i t t a ,   c a p ,   p r o v i n c i a ,   c o d i c e ,   t e l e f o n o ,   f a x ,   e m a i l ,   m e s s a g g i o )   {  
         i f   ( n o m e   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   i l   n o m e ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( i n d i r i z z o   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   i n d i r i z z o ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d i r i z z o ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( c i t t a   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   c i t t à ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( c a p   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   C A P ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( p r o v i n c i a   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   p r o v i n c i a ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v i n c i a ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( c o d i c e   = =   ' ' )   {   a l e r t ( ' I n s e r i r e   c o d i c e   f i s c a l e   o   P . I V A ' ) ;   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d i c e ' ) . f o c u s ( ) ;   r e t u r n   f a l s e ;   }  
  
         i f   ( ! c o n f i r m ( ' I n v i o   r i c h i e s t a ? ' ) )   r e t u r n   f a l s e ;  
  
         r e t   =   A j a x G e t R e t u r n ( ' S O S _ I N V I O . a s p ? n o m e = '   +   n o m e   +   ' & i n d i r i z z o = '   +   i n d i r i z z o   +   ' & c i t t a = '   +   c i t t a   +   ' & c a p = '   +   c a p   +   ' & c o d i c e = '   +   c o d i c e   +   ' & p r o v i n c i a = '   +   p r o v i n c i a   +   ' & t e l e f o n o = '   +   t e l e f o n o   +   ' & e m a i l = '   +   e m a i l   +   ' & m e s s a g g i o = '   +   m e s s a g g i o ) ;  
          
         i f   ( r e t   ! =   ' O K ' )   a l e r t ( r e t ) ;  
         e l s e   {  
                 a l e r t ( ' G r a z i e   p e r   a v e r c i   c o n t a t t a t o ' ) ;  
                 w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
         } ;  
 }  
  
  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / P R E F E R I T I   * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 f u n c t i o n   P r e f e r i t i U p D t ( i d a r t , a r t a l i e n o , a c t , d i v )  
 {  
 v a r   i d   =   i d a r t ;  
 v a r   a c t i o n   =   a c t ;   / / c a n c   =   r i m u o v i ,   i n s   =   i n s e r i s c i  
 v a r   a l i e n o   =   a r t a l i e n o ;  
 v a r   d i v r i s p   =   d i v ;  
         i f   ( a c t i o n = = ' c a n c ' ) {  
                 i f ( ! c o n f i r m ( ' S e i   s i c u r o   d i   v o l e r l o   r i m u o v e r e   d a l l a   l i s t a   d e i   P r e f e r i t i ? ' ) ) {  
                         r e t u r n   f a l s e ;  
                 } e l s e {  
                         r e t = A j a x G e t R e t u r n ( ' P R E F E R I T I _ A C T . a s p ? a c t = ' + a c t i o n + ' & i d = ' + i d + ' & a l i e n o = ' + a l i e n o ) ;  
                                 i f ( r e t ! = ' O K ' ) {  
                                         a l e r t ( r e t ) ;  
 	                         } e l s e {  
                                         i f   ( d i v r i s p ! = ' r e l o a d ' ) {  
                                                 A j a x G e t ( " P R E F E R I T I _ L I N K . a s p ? i d a r t i c o l o = " + i d + " & a l i e n o = " + a l i e n o , d i v r i s p )  
                                         } e l s e {  
                                                 w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
                                         }  
                                          
                                 }  
                 }        
         }  
         / / * * * * * * * * * * * * * * * * * * * * *  
         i f   ( a c t i o n = = ' i n s ' ) {  
                 r e t = A j a x G e t R e t u r n ( ' P R E F E R I T I _ A C T . a s p ? a c t = ' + a c t i o n + ' & i d = ' + i d + ' & a l i e n o = ' + a l i e n o ) ;  
                         i f ( r e t ! = ' O K ' ) {  
                                 a l e r t ( r e t ) ;  
                         }   e l s e   {  
                                 i f   ( d i v r i s p   ! =   ' r e l o a d ' )   {  
                                         A j a x G e t ( " P R E F E R I T I _ L I N K . a s p ? i d a r t i c o l o = "   +   i d   +   " & a l i e n o = "   +   a l i e n o ,   d i v r i s p )  
                                 }   e l s e   {  
                                         w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
                                 }  
                         }        
         }  
  
 }  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / F I N E   P R E F E R I T I   * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
  
 / / * * * * *   O F F E R T E   O R D I N I   C L I E N T I   * * * * * * * * *  
 f u n c t i o n   V i s u a l i z z a D e t t a g l i o O f f e r t a C l i e n t e ( i d o f f e r t a )  
 {  
     A j a x G e t A s y n c ( ' O f f e r t e _ O r d i n i . a s p ? a = 1 & a c t O f f e r t a = d e t t a g l i o o f f e r t a & i d o f f e r t a = ' + i d o f f e r t a , ' w o r k s p a c e ' ) ;    
 }    
  
 f u n c t i o n   A c c e t t a O f f e r t a ( i d c l i e n t e ,   i d o f f e r t a ,   a u t o )  
 {        
 	 i f ( ! c o n f i r m ( ' S e i   s i c u r o ? ' ) ) r e t u r n   f a l s e ;     	    
     r e t = A j a x G e t R e t u r n ( ' o f f e r t e A C T . a s p ? a c t = a c c e t t a & i d c l i e n t e = ' + i d c l i e n t e + ' & i d o f f e r t a = ' + i d o f f e r t a ) ;      
     i f ( r e t ! = ' O K ' ) { a l e r t ( r e t ) ;   r e t u r n ; }      
     A j a x G e t A s y n c ( ' O f f e r t e _ O r d i n i . a s p ? a = 1 ' , ' w o r k s p a c e ' ) ;    
     a l e r t ( ' L \ ' o r d i n e   è   s t a t o   i n v i a t o ' ) ;  
     i f ( a u t o = = 1 )  
 	     E s p o r t a O r d i n e ( ) ;  
 	 w i n d o w . l o c a t i o n . h r e f = ' ? a c t = o r d i n e o k ' ;  
 }  
  
 f u n c t i o n   i s V a l i d a R i c C a t a l o g ( )   {  
 	  
 	 v a r   r e t   =   t r u e ;  
 	 v a r   s m s   =   ' C o n t r o l l a r e   i   v a l o r i   n e i   s e g u e n t i   c a m p i : \ n ' ;  
 	  
         v a r   n o m e   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e ' ) . v a l u e ;  
         v a r   i n d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d i r i z z o ' ) . v a l u e ;  
         v a r   c i t t a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a ' ) . v a l u e ;  
         v a r   c a p   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p ' ) . v a l u e   ;  
         v a r   p r o v   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v i n c i a ' ) . v a l u e   ;  
         v a r   p i v a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p i v a ' ) . v a l u e ;  
         v a r   t e l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l e f o n o ' ) . v a l u e   ;  
         v a r   e m a i l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l ' ) . v a l u e   ;  
 	 v a r   n a z   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' n a z i o n e ' ) . v a l u e   ;  
 	  
 	 i f ( n o m e = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   N o m e / R a g i o n e   s o c i a l e ' ; }  
 	 i f ( i n d = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   I n d i r i z z o ' ; }  
 	 i f ( c i t t a = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   C i t t à ' ; }  
 	 i f ( n a z = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   N a z i o n a l i t à ' ; }  
 	  
 	 v a r   e s p r e s s i o n e   =   / ^ [ 0 - 9 ] { 5 } $ / ;  
       	 i f ( ( c a p = = ' ' )   | |   ( ! e s p r e s s i o n e . t e s t ( c a p ) ) )   {  
       	 	 r e t   =   f a l s e ;    
 	 	 s m s + = ' \ n   "   I l   c a p   n o n   s e m b r a   e s s e r e   c o r r e t t o ' ;  
 	 }  
 	  
 	 i f ( p r o v = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   P r o v i n c i a ' ; }  
         i f ( p i v a = = ' ' ) { r e t   =   f a l s e ;   s m s + = ' \ n   "   P . I V A / C o d . F i s c a l e ' ; }  
 	  
         / / v a r   e s p r e s s i o n e   =   / ^ ( ? : ( ? : \ + ? 1 \ s * ( ? : [ . - ] \ s * ) ? ) ? ( ? : \ ( \ s * ( [ 2 - 9 ] 1 [ 0 2 - 9 ] | [ 2 - 9 ] [ 0 2 - 8 ] 1 | [ 2 - 9 ] [ 0 2 - 8 ] [ 0 2 - 9 ] ) \ s * \ ) | ( [ 2 - 9 ] 1 [ 0 2 - 9 ] | [ 2 - 9 ] [ 0 2 - 8 ] 1 | [ 2 - 9 ] [ 0 2 - 8 ] [ 0 2 - 9 ] ) ) \ s * ( ? : [ . - ] \ s * ) ? ) ? ( [ 2 - 9 ] 1 [ 0 2 - 9 ] | [ 2 - 9 ] [ 0 2 - 9 ] 1 | [ 2 - 9 ] [ 0 2 - 9 ] { 2 } ) \ s * ( ? : [ . - ] \ s * ) ? ( [ 0 - 9 ] { 4 } ) ( ? : \ s * ( ? : # | x \ . ? | e x t \ . ? | e x t e n s i o n ) \ s * ( \ d + ) ) ? $   / ;  
       	 i f ( t e l = = ' ' )   {   / / | |   ( ! e s p r e s s i o n e . t e s t ( t e l ) ) )   {  
       	 	 r e t   =   f a l s e ;    
 	 	 / / s m s + = ' \ n   "   I l   t e l e f o n o   n o n   s e m b r a   e s s e r e   c o r r e t t o ' ;  
 	 	 s m s + = ' \ n   "   I l   t e l e f o n o   n o n   p u ò   e s s e r e   v u o t o ' ;  
 	 }  
 	  
       	 i f ( ( e m a i l = = ' ' )   | |   ( ! e m a i l C h e c k ( e m a i l ) ) )   {  
 	 	 r e t   =   f a l s e ;    
 	 	 s m s + = " \ n   "   L ' e m a i l   n o n   s e m b r a   e s s e r e   c o r r e t t a " ;  
 	 }  
 	  
 	 i f ( r e t   = =   f a l s e ) {  
 	 	 a l e r t ( s m s ) ;  
 	 }  
 	  
 	 r e t u r n   r e t ;  
 }  
  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
 / / I N I Z I O   D E S T I N A Z I O N I   * * * * * * * * * * * * * * * * * * * * * * *  
 / / * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  
  
 f u n c t i o n   s e l e c t D e s t i n a z i o n e ( v a l o r e )   {  
         v a r   n e w S t r i n g   =   v a l o r e . s p l i t ( " | " ) ;        
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D C l i S e d D e s t ' ) . v a l u e = n e w S t r i n g [ 0 ] ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D S e d e ' ) . v a l u e = n e w S t r i n g [ 1 ] ;  
 }  
  
 f u n c t i o n   e l i m i n a D e s t i n a z i o n e ( )   {  
         v a r   d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D C l i S e d D e s t ' ) . v a l u e ;  
         v a r   s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D S e d e ' ) . v a l u e ;  
         i f ( d ! = ' '   & &   s ! = ' ' )   {  
                 i f ( ! c o n f i r m ( ' S e i   s i c u r o   d i   v o l e r   r i m u o v e r e   l a   d e s t i n a z i o n e   s e l e z i o n a t a ? ' ) ) {  
                         r e t u r n   f a l s e ;  
                 } e l s e {  
                         w i n d o w . l o c a t i o n . h r e f = ' ? a c t = e d i t D e s t i n a z i o n i & o p t = d e l & d = ' + d + ' & s = ' + s ;  
                 }  
         }   e l s e   {  
                 a l e r t ( ' S e l e z i o n a r e   u n a   d e s t i n a z i o n e . ' ) ;  
         }  
 }  
  
 f u n c t i o n   m o d i f i c a D e s t i n a z i o n e ( t , a )   {  
         v a r   d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D C l i S e d D e s t ' ) . v a l u e ;  
         i f ( d ! = ' ' )   {  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' m n u ' ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
                 d o c u m e n t . g e t E l e m e n t B y I d ( ' n e w S e d e ' ) . s t y l e . d i s p l a y   =   ' i n l i n e ' ;  
                 A j a x G e t A s y n c ( ' C L I E N T E D e s t _ E D I T _ A C T . a s p ? o p t = u p d & d = ' + d + ' & a n = ' + a , ' n e w S e d e ' ) ;  
         }   e l s e   {  
                 a l e r t ( ' S e l e z i o n a r e   u n a   d e s t i n a z i o n e . ' ) ;  
         }  
 }  
  
 f u n c t i o n   n u o v a D e s t i n a z i o n e ( t ,   a )   {  
         v a r   i d s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D S e d e ' ) . v a l u e ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' m n u ' ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' n e w S e d e ' ) . s t y l e . d i s p l a y   =   ' i n l i n e ' ;  
         A j a x G e t A s y n c ( ' C L I E N T E D e s t _ E D I T _ A C T . a s p ? o p t = a d d & a n = ' + a + ' & i d s = ' + i d s , ' n e w S e d e ' ) ;  
 }  
  
 f u n c t i o n   a n n u l l a D e s t i n a z i o n e ( a )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' n e w S e d e ' ) . s t y l e . d i s p l a y   =   ' n o n e ' ;  
         d o c u m e n t . g e t E l e m e n t B y I d ( a ) . s t y l e . d i s p l a y   =   ' i n l i n e ' ;  
 }  
  
 f u n c t i o n   s a l v a D e s t i n a z i o n e ( o p t ,   d )   {  
          
         v a r   i d s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d I D S e d e ' ) . v a l u e ;  
  
         v a r   c o d   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d _ d e s t ' ) . v a l u e ;  
         v a r   n o m   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e _ d e s t ' ) . v a l u e ;  
         v a r   i n f   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d _ d e s t ' ) . v a l u e ;  
         v a r   c i t   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a _ d e s t ' ) . v a l u e ;  
         v a r   c a p   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p _ d e s t ' ) . v a l u e ;  
         v a r   p r o   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v _ d e s t ' ) . v a l u e ;  
         v a r   t e l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l _ d e s t ' ) . v a l u e ;  
         v a r   f a x   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' f a x _ d e s t ' ) . v a l u e ;  
         v a r   m a l   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l _ d e s t ' ) . v a l u e ;  
         v a r   i v a   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' p i v a _ d e s t ' ) . v a l u e ;  
         v a r   f i s   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' c o d f i s c a l e _ d e s t ' ) . v a l u e ;  
          
 	 i f ( n o m = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   n o m e   o   l a   r a g i o n e   s o c i a l e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' n o m e _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( i n f = = ' ' ) { a l e r t ( ' I n s e r i r e   l \ ' i n d i r i z z o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' i n d _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( c i t = = ' ' ) { a l e r t ( ' I n s e r i r e   l a   c i t t à ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c i t t a _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( c a p = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   C A P ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' c a p _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( p r o = = ' ' ) { a l e r t ( ' I n s e r i r e   l a   p r o v i n c i a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p r o v _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( t e l = = ' ' ) { a l e r t ( ' I n s e r i r e   u n   r e c a p i t o   t e l e f o n i c o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t e l _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
  
       	 i f ( ( m a l = = ' ' )   | |   ( ! e m a i l C h e c k ( m a l ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' e m a i l _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	  
 	 i f ( ( i v a = = ' ' )   & &   ( f i s = = ' ' ) )   {  
                 a l e r t ( ' E \ '   n e c e s s a r i o   i n s e r i r e   u n   v a l o r e   t r a   p a r t i t a   i v a   o   c o d i c e   f i s c a l e ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' p i v a _ d e s t ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; 	  
         }  
          
         v a r   r e t   =   A j a x G e t R e t u r n ( ' C L I E N T E D e s t _ E D I T _ A C T . a s p ? o p t = ' + o p t + ' & d = ' + d + ' & p = s v & c o d = ' + c o d + ' & n o m = ' + n o m + ' & i n f = ' + i n f + ' & c i t = ' + c i t + ' & c a p = ' + c a p + ' & p r o = ' + p r o + ' & t e l = ' + t e l + ' & f a x = ' + f a x + ' & m a l = ' + m a l + ' & i v a = ' + i v a + ' & f i s = ' + f i s + ' & i d s = ' + i d s ) ;      
     	 i f ( r e t ! = ' O K ' ) a l e r t ( r e t ) ;  
         w i n d o w . l o c a t i o n . r e l o a d ( ) ;  
 }  
  
 f u n c t i o n   O r d i n e P a g a m e n t o ( p a g a m e n t o )   {  
         d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d P a g a m e n t o ' ) . v a l u e   =   p a g a m e n t o ;  
         v a r   r e t   =   A j a x G e t R e t u r n ( ' O R D I N E . a s p ? a c t = p a g a m e n t o & m o d a l i t a P a g a m e n t o = ' + p a g a m e n t o ) ;  
     	 i f ( r e t ! = ' O K ' )   {  
     	         a l e r t ( r e t ) ;  
     	         r e t u r n   f a l s e ;  
     	 }  
 	 p u l s e G r e e n ( d o c u m e n t . g e t E l e m e n t B y I d ( ' P a g a m e n t i ' ) ) ;  
 }  
  
 f u n c t i o n   O r d i n e G o T o M a p p a ( )   {  
         i f ( d o c u m e n t . g e t E l e m e n t B y I d ( ' I D C l i S e d D e s t ' ) . v a l u e = = 0 )   {  
                 a l e r t ( ' I m p o s t a r e   l a   d e s t i n a z i o n e   d e l l a   m e r c e . ' ) ;  
                 r e t u r n   f a l s e ;  
         }  
         i f ( d o c u m e n t . g e t E l e m e n t B y I d ( ' h i d P a g a m e n t o ' ) . v a l u e = = ' ' )   {  
                 a l e r t ( ' I m p o s t a r e   l a   m o d a l i t à   d i   p a g a m e n t o . ' ) ;  
                 r e t u r n   f a l s e ;  
         }  
         w i n d o w . l o c a t i o n . h r e f = ' ? a c t = m a p p a ' ;  
 }  
  
 f u n c t i o n   i n v i a R i c h i e s t a P r e v e n t i v o ( )   {  
  
         v a r   m i t   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t M i t t e n t e ' ) . v a l u e ;  
         v a r   o g g   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t O g g e t t o ' ) . v a l u e ;  
         v a r   c o r   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t C o r p o ' ) . v a l u e ;  
          
 	 i f ( ( m i t = = ' ' )   | |   ( ! e m a i l C h e c k ( m i t ) ) ) { a l e r t ( ' I n s e r i r e   e m a i l   c o r r e t t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t M i t t e n t e ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( o g g = = ' ' ) { a l e r t ( ' L \ ' o g g e t t o   d e l l a   r i c h i e s t a   n o n   p u ò   e s s e r e   v u o t o ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t O g g e t t o ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
 	 i f ( c o r = = ' ' ) { a l e r t ( ' L a   r i c h i e s t a   n o n   p u ò   e s s e r e   v u o t a ' ) ; d o c u m e n t . g e t E l e m e n t B y I d ( ' t x t C o r p o ' ) . f o c u s ( ) ; r e t u r n   f a l s e ; }  
                  
         v a r   r e t   =   A j a x G e t R e t u r n ( ' r i c h i e d i P r e v e n t i v o _ A C T . a s p ? m i t = ' + m i t + ' & o g g = ' + o g g + ' & c o r = ' + c o r ) ;  
     	 i f ( r e t ! = ' O K ' )   {  
     	         a l e r t ( r e t ) ;  
     	         r e t u r n   f a l s e ;  
     	 }   e l s e   {  
     	         a l e r t ( ' R i c h i e s t a   i n v i a t a ' ) ;  
                 w i n d o w . l o c a t i o n . h r e f = ' / ' ;  
     	 }  
 }  
  
 f u n c t i o n   s t a m p a C a r t o l i n a ( i m g , w , h )   {  
         v a r   m   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s m s ' ) . v a l u e ;  
         w i n d o w . o p e n ( ' c a r t o l i n a A C T . a s p ? a c t = s t a m p a & i m g = ' + i m g + ' & w = ' + w + ' & h = ' + h + ' & m = ' + e s c a p e ( m ) ,   ' s t a m p a ' ,   ' t o o l b a r = n o , l o c a t i o n = n o , d i r e c t o r i e s = n o , s t a t u s = n o , m e n u b a r = n o , s c r o l l b a r s = n o , r e s i z a b l e = n o , c o p y h i s t o r y = n o , w i d t h = 8 0 0 , h e i g h t = 6 0 0 ' ) ;  
 }  
  
 f u n c t i o n   f o r m I n v i a C a r t o l i n a ( i m g , w , h )   {  
         v a r   m   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' s m s ' ) . v a l u e ;  
         w i n d o w . o p e n ( ' c a r t o l i n a A C T . a s p ? a c t = m a i l & i m g = ' + i m g + ' & w = ' + w + ' & h = ' + h + ' & m = ' + e s c a p e ( m ) ,   ' i n v i a ' ,   ' t o o l b a r = n o , l o c a t i o n = n o , d i r e c t o r i e s = n o , s t a t u s = n o , m e n u b a r = n o , s c r o l l b a r s = n o , r e s i z a b l e = n o , c o p y h i s t o r y = n o , w i d t h = 8 0 0 , h e i g h t = 8 0 0 ' ) ;  
 }  
  
 f u n c t i o n   i n v i a C a r t o l i n a ( b a s e , f o t o , m l , m t , w , h )   {  
         v a r   m i t t   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' m i t t ' ) . v a l u e ;  
         v a r   d e s t   =   d o c u m e n t . g e t E l e m e n t B y I d ( ' d e s t ' ) . v a l u e ;  
          
 	 i f ( m i t t = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   m i t t e n t e   d e l l a   c a r t o l i n a ' ) ; r e t u r n   f a l s e ; }  
 	 i f ( d e s t = = ' ' ) { a l e r t ( ' I n s e r i r e   i l   d e s t i n a t a r i o   d e l l a   c a r t o l i n a ' ) ; r e t u r n   f a l s e ; }  
      
         v a r   r e t   =   A j a x G e t R e t u r n ( ' c a r t o l i n a A C T . a s p ? a c t = s e n d & m i t t = ' + e s c a p e ( m i t t ) + ' & d e s t = ' + e s c a p e ( d e s t ) ) ;  
 	 i f ( r e t ! = ' O K ' )   {  
     	         a l e r t ( r e t ) ;  
     	         r e t u r n   f a l s e ;  
     	 }   e l s e   {  
     	         a l e r t ( ' C a r t o l i n a   i n v i a t a ' ) ;  
     	         w i n d o w . c l o s e ( ) ;  
     	 }  
  
 } 
