/*
if (screen.width<600) 
 window.location = "./mobile/web/"; 
 */
 
$(document).ready(function() {
						   

			
			//preload images
(function($) {
  var cache = [];
  // Arguments are image paths relative to the current page.
  $.preLoadImages = function() {
    var args_len = arguments.length;
    for (var i = args_len; i--;) {
      var cacheImage = document.createElement('img');
      cacheImage.src = arguments[i];
      cache.push(cacheImage);
    }
  }
})(jQuery)
	
	$("#soon").hide();
	/* thumbnail */
	shapes = $('.thumbnail_wrapper');  
	$('.thumbnail_wrapper, nav').show();
	$('.thumbnail_wrapper').animate({top:'20px', opacity:0});
	$('.thumbnail_wrapper').fadeIn(500);
	var z = 0;  
	var refreshId = setInterval(function() {  
	    
	    shapes.eq(z).animate({top:'0px', opacity:100},{duration:300, easing: 'easeOutQuint'});
	     
	     z++;  
	     if (z > shapes.length) {  
	        clearInterval(refreshId);  
	     }  
	}, 100);
	
	
		/* menü rollover */
		$("#sort_home").mouseover(function() {
			if (!$("#homeRollover").hasClass ('selected')) {
				$("#sort_home").hover(function() {
						$("#homeRollover").addClass("over");
				},function() {
				 		$("#homeRollover").removeClass("over");
			 	});
			}
		});
		
		$("#sort_news").mouseover(function() {
			if (!$("#newsRollover").hasClass ('selected')) {
				$("#sort_news").hover(function() {
						$("#newsRollover").addClass("over");
				},function() {
				 		$("#newsRollover").removeClass("over");
				 		
			 		
			 	});
			}
		});
		$("#sort_musor").mouseover(function() {
			if (!$("musorRollover").hasClass ('selected')) {
				$("#sort_musor").hover(function() {
						$("#musorRollover").addClass("over");
				},function() {
				 		$("#musorRollover").removeClass("over");

			 	});
			}
		});
		$("#sort_live").mouseover(function() {
			if (!$("#liveRollover").hasClass ('selected')) {
				$("#sort_live").hover(function() {
						$("#liveRollover").addClass("over");
				},function() {
				 		$("#liveRollover").removeClass("over");
				 		
			 		
			 	});
			}
		});
		
		/*FB rollover*/
		$("#fb_ikon").mouseover(function() {
			if (!$("#fbRollover").hasClass ('selected')) {
				$("#fb_ikon").hover(function() {
						$("#fbRollover").addClass("over");
						$("#fbRollover").stop().fadeIn({queue:false,duration:100, easing: 'easeOutQuint'});
				},function() {
				 		$("#fbRollover").removeClass("over");
				 		
			 		
			 	});
			}
		});
		
		

	//To switch directions up/down and left/right just place a "-" in front of the top/left attribute
	//Vertical Sliding
	$('.thumbnail_wrapper').mouseover(function(){
		// $(".cover", this).stop().fadeOut({queue:false,duration:100,easing: 'easeOutQuint'});
		$(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300});
	});
	$('.thumbnail_wrapper').mouseout(function(){
		//$(".cover", this).stop().fadeIn({queue:false,duration:100, easing: 'easeOutQuint'});
		$(".cover", this).stop().animate({top:'160px'},{queue:false,duration:300});
	});
	


		
		/* ends */
		$('div[id^=slideImg]').each(function(index) {
		
			$('#slideImg'+ (index+1)).cycle({
				fx:     'fade', 
				speed:  'fast', 
				timeout: 0, 
				next:   '.next,#slideImg'+ (index+1),
				prev:   '.prev'
			});
		});
	
});
	
function myMouseOut(id){
     	if ($(id).hasClass("over")){
     		$(id).mouseleave(function(){
     			$(id).slideUp({duration:300 , easing: 'easeInOutQuint'});
     		});
     	} else{
     		$(id).slideUp({duration:300 , easing: 'easeInOutQuint'});
     	}
}	
	
 /* scroll */

function goToByScroll(id){
	if( $.browser.opera ){
		$('html').animate({scrollTop: $("#"+id).offset().top},'slow');

	}else {
 		$('html,body').animate({scrollTop: $("#"+id).offset().top},'slow'); 
  }
}


