			
			
			
			function next() {
			// make the imagerotator jump to the next image.
			document.getElementById('rotator').sendEvent('next');
			};
			function prev() {
			// make the imagerotator jump to the next image.
			document.getElementById('rotator').sendEvent('prev');
			};
			/*function getlink() {
			document.getElementById('rotator').sendEvent('getlink');
			};*/
      
      
      
			$(document).ready(function() { 
			// on click event - creation of games pop ups and loading xml files.	
				bodyWidth = $("body").width();
				bodyHeight = $(window).height();
				position = {}

        position.top = Math.max(100,bodyHeight/2 - 228);
				position.left = bodyWidth/2 - 279;
				
				$('.gameBut').click(function() { 
				$.blockUI ({
				 message: $('#rotatorContainer'), css : {  border: '0px', width: '559px',height: '456px', left: position.left+"px", top: position.top+"px", cursor: 'pointer'}, 
				 overlayCSS: { cursor: 'picker', opacity:   0.7 },  fadeIn:  500, fadeOut:  500 } ); 
				 
				 file = $(this).attr("file");
				 createRotator(file);
				}); 
				
				$('#closeUI').click(function() { 
					$.unblockUI(); 
					return false; 
				});
               
        $(function(){
          $('.backbtn img').toggle(
            function(){
              $(this).attr('src' , '/images/index/newindex/preview-page/gallery-frame/bw.png');
            },
            function(){
              $(this).attr('src' , '/images/index/newindex/preview-page/gallery-frame/bw-over.png');
            }
          );
        });
        
        $(function(){
          $('.nextbtn img').toggle(
            function(){
              $(this).attr('src' , '/images/index/newindex/preview-page/gallery-frame/fw.png');
            },
            function(){
              $(this).attr('src' , '/images/index/newindex/preview-page/gallery-frame/fw-over.png');
            }
          );
        });
        
        
			});
			
			
			function createRotator(file){
			var flashvars = {
			  'file':               file,
			  'transition':			'fade',
			  'shownavigation':		'false',
			  'shuffle':			'false',
			  'controlbar' : 'none',
			  'rotatetime' : '999',
			  'enablejs' : 'true',
			  'rotatetime': '1',
			  'repeat':   'false',
			  'showicons':   'false',
			  'width':  '502',
			  'height':  '376'
		   };

		   var params = {
			  'allowfullscreen':    'true',
			  'allowscriptaccess':  'always',
			  'bgcolor':            '#000000'
		   };

		   var attributes = {
			  'id':                 'rotator',
			  'name':               'rotator',
        'wmode' :             'transparent'
		   };
			
		   swfobject.embedSWF('/flash/imagerotator.swf', 'rotator', '502', '376', '9.0.124', 'false', flashvars, params, attributes);
		}
		
		
		
