
/*
$('.slides').cycle({
	fx: 'fade',
	speed: 500,
	timeout: 1000,
	next: '#next',
	prev: '#prev',
	
	
});
*/
/*
var openPopup = false;
function changePopupPosition(){
	
	var heihtSetto = Math.round($(window).height()/2 - $(".slidesBig").height()/2);
	var widthSetto = Math.round($(window).width()/2 - $(".slidesBig").width()/2);
	console.info($(".slidesBig").height()+"     "+$(".slidesBig").width()+" "+widthSetto)
	$(".slidesBig").css({"top":heihtSetto,"left":widthSetto,"position":"absolute"});
}



function popUp(){
	var a = $('#slideshowBig').html();
	if(!empty(a)){
		$('body').prepend(a);
		var openPopup = true;
		changePopupPosition();
		console.info(openPopup);
	}
}
*/
/* Tabs */
function intTabs(){
	var selectedTAbSet = 0;
	var full_url = window.location.href;
	var parts = full_url.split("#");
	if(!empty(parts)){
		var trgt = parts[1];
		if(!empty(trgt)){
			selectedTabs = trgt.split('tab');
			var selectedTAbSet = selectedTabs[1]; 
		}
	}
		
	//console.info(selectedTAbSet);

	$(".tabsHolder div.tabedData").each(function (i) {
		if(selectedTAbSet == i){
			$(this).show();
			SetTabNavigation(i);
		} else {
			$(this).hide();
		}
	});
}

function SetTabNavigation(selectedTab){
	$(".tabs a").each(function (i) {
		$(this).unbind('click');
		if(selectedTab == i){
			//console.info('Faund @'+selectedTab);
			$(this).addClass('selected');
		}
		$(this).click(function() {
			$(".tabs a").removeClass('selected');
			$(this).addClass('selected');
			loadTabData(i);
		});
	});
}

function loadTabData(TabID){
		$(".tabsHolder div.tabedData").each(function (i) {
			if(TabID == i){
				$(this).show();
				$(this,'div').show();
			} else {
				$(this).hide();
			}
		});
	}
	

function empty (mixed_var) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philippe Baumann
    // +      input by: Onno Marsman
    // +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +      input by: LH
    // +   improved by: Onno Marsman
    // +   improved by: Francesco
    // +   improved by: Marc Jansen
    // +   input by: Stoyan Kyosev (http://www.svest.org/)
    // *     example 1: empty(null);
    // *     returns 1: true
    // *     example 2: empty(undefined);
    // *     returns 2: true
    // *     example 3: empty([]);
    // *     returns 3: true
    // *     example 4: empty({});
    // *     returns 4: true
    // *     example 5: empty({'aFunc' : function () { alert('humpty'); } });
    // *     returns 5: false
    
    var key;
    
    if (mixed_var === "" ||
        mixed_var === 0 ||
        mixed_var === "0" ||
        mixed_var === null ||
        mixed_var === false ||
        typeof mixed_var === 'undefined'
    ){
        return true;
    }

    if (typeof mixed_var == 'object') {
        for (key in mixed_var) {
            return false;
        }
        return true;
    }

    return false;
}


//move to news item
$(document).ready(function(){
$('.slides').cycle({
	timeout: 10000,
	speed: 500,
	next: '#next, .slides',
	prev: '#prev',
	pause: 1,

});
$('#play').hide();
$('#pause').click(function(){
 	$('.slides').cycle('pause');
 	$(this).hide();
 	$('#play').show(); 
});
$('#play').click(function(){
 	$('.slides').cycle('resume'); 
 	$(this).hide();
 	$('#pause').show(); 
});
$('.controls').hide();
$('.slideshow').hover(function(){
	$('.controls').fadeIn('slow');
});
$('.slideshow').mouseleave(function(){
	$('.controls').fadeOut('slow');
});

$('.slidesBig').cycle({
	timeout: 10000,
	speed: 500,
	next: '#nextBig, .slidesBig',
	prev: '#prevBig',
	pause: 1
});
$('#playBig').hide();
$('#pauseBig').click(function(){
 	$('.slidesBig').cycle('pause');
 	$(this).hide();
 	$('#playBig').show(); 
});
$('#playBig').click(function(){
 	$('.slidesBig').cycle('resume'); 
 	$(this).hide();
 	$('#pauseBig').show(); 
});
$('.controlsBig').hide();
$('.slideshowBig').hover(function(){
	$('.controlsBig').fadeIn('slow');
});
$('.slideshowBig').mouseleave(function(){
	$('.controlsBig').fadeOut('slow');
});
$("a#openPopup").fancybox({
				'hideOnContentClick' :	false,
				'showCloseButton' : true,
				'overlayOpacity'	:	0.5,
				'overlayColor'		:	'#5F81CB'
});

	//submit search
		$('.srcBtn').click(function(){
			$('.serachForm').submit();
	});
	
	
	//move to catalog undersection
	$('.newsHolder div').click(function(){
		var id = $(this).find('.newsItemLink').val();
		document.location.href=id;
	});
	//mave to catalog sections
	$('.catalogListItem').click(function(){
		var id = $(this).find(':hidden').val();
		document.location.href=id;

	});
	//move to news item
	$('.smallNews div, .itemsForCycle div, .itemsForCycle2 div').click(function(){
		var id = $(this).find(':hidden').val();
		document.location.href=id;

	});
	
//move to catalog item
	$('.firstPageItemsHolder ul li').click(function(){
		var id = $(this).find('.section').val();
		document.location.href=id;
	});
	
	$('.section div').click(function(){
		var id = $(this).find('.catalogLink').val();
		document.location.href=id;
	});
	
	$("#link").fancybox({
				'hideOnOverlayClick' :	true,
				'hideOnContentClick' :	false,
				'showCloseButton' : true,
				'overlayOpacity'	:	0.5,
				'overlayColor'		:	'#5F81CB',
				'width'				: 500,
				'height'			: 1000

  });
  $("#btn").click(function(){
    $("#link").trigger('click');
  });
  $("#poga").click(function(){
  	$("#link").trigger('click');
  });

  $(".zoom2").fancybox({
			'hideOnContentClick' :	false,
			'overlayOpacity'	:	0.5,
			'overlayColor'		:	'#5F81CB'
  });
	
	intTabs();
 $('.smallNews').cycle({ 
 	fx:     'fade', 
    speed:   1000, 
    timeout: 5000, 
    pause:   1
    });
 $('#banner').cycle({ 
 	fx:     'scrollLeft', 
    sync:   0, 
    delay: -7000,
    pause: 1 
    });
    
    
   $('.itemsForCycle').cycle({ 
 	fx:     'fade', 
    speed:   1000, 
    timeout: 5000, 
    pause:   1
    });
   $('.itemsForCycle2').cycle({ 
 	fx:     'fade', 
    speed:   1000, 
    timeout: 5000, 
    pause:   1
    });
/*
    popUp();
    $(window).resize(function() {
  		if(openPopup == true){

  			changePopupPosition();
  		}
  	});
*/

});




