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