


$(document).ready(function(){
	
	// zoom

	if(typeof hs != "undefined") {

		hs.graphicsDir = BASE_URL + 'js/highslide/highslide/graphics/';
		hs.align = 'center';
		hs.transitions = ['expand', 'crossfade'];
		hs.outlineType = 'rounded-white';
		hs.fadeInOut = true;
		hs.showCredits = false;
		hs.preserveContent = true;

		// Add the controlbar
		hs.addSlideshow({
			//slideshowGroup: 'group1',
			interval: 5000,
			repeat: false,
			useControls: true,
			fixedControls: 'fit',
			overlayOptions: {
				opacity: .75,
				position: 'bottom center',
				hideOnMouseOut: true
			}
		});


	}
	
	
    $('a.zoom').each(function() {
    	
		this.onclick = function() {
			
			return hs.expand(this);
	    };
    });	
    
    
    
	tops = new Tops( $('div#banner') );
	
 
    
});








var Tops = function(el) {
	
	var _self 	= this;
	var t 		= null;
	
	
	this.sw = function(n) {
		
		var nr = 0;
		
		// active top

		var buttons = $('ul.navi li', el);		
		var nr = buttons.index(n);		
		
		var tops = $('a.image', el);

		if ($('#div1').not(':animated')) {
		
			tops.fadeOut('slow', function(){
			
				// active button
				
				buttons.removeClass('active');			
				$(buttons.get(nr)).addClass('active');					
				
			});
			
			$(tops.get(nr)).fadeIn('slow');

		}

	}
	
	
	
	
	this.timer = function() {
		
		var buttons = $('ul.navi li', el);
		var idx = buttons.index( $('ul.navi li.active', el) )
		
		idx += 1;
		
		if(idx >= buttons.length)
			idx = 0;
		
		_self.sw( buttons.get(idx) )
	}
	
	
	
	
	
	
	// init
	
	this.sw( $('ul.navi li', el)[0] );
	
	
	// hover
	
	if($('ul.navi li', el).length > 1) {
	
		$('ul.navi li', el).hover(function(){
	
			clearInterval(_self.t);
	
			_self.sw(this);
			
		}, function(){
					
			// _self.t = setInterval(_self.timer, 4000);
	
		});
	
		
		// timer
		
		_self.t = setInterval(_self.timer, 4000);

	}
	
	$(window).blur(function() {
		
		clearInterval(_self.t);
	});
	
	
}




function anketa() {
	
	var sid = $('input#sid');
	
	sid.val( sid.val().substr(0, 5) );
	
	sid.parents('form').submit();
}






