


$(document).ready(function () {
	
	//*
	//Funkcija nodrošina plūstošu, automātisku iekšējo pārvietošanos no vienas iezīmes uz otru
	//*	

	$.localScroll({
	offset:-5,
	duration: 600});





	//*
	//Funkcija nodrošina Atsauksmes formas parādīšanos un pazušanu
	//*

	
	
	$(".show-hide-button-text").stop().click(function () {
		$("#feedback-form").toggle(180);
		$("#show-hide-button").toggleClass("plus");
    });

	$("#show-hide-button").stop().click(function(){
		$("#feedback-form").toggle(180);
		$("#show-hide-button").toggleClass("plus");
	});










});



//*
//Funkcijas, lai darbinātu attēlu galerijas
//*
function slideSwitch_pocket() {
    var $active = $('#slideshow_pocket img.active');

    if ( $active.length == 0 ) $active = $('#slideshow_pocket IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow_pocket img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1200, function() {
            $active.removeClass('active last-active');
        });
}

function slideSwitch_turning() {
    var $active = $('#slideshow_turning img.active');

    if ( $active.length == 0 ) $active = $('#slideshow_turning IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow_turning img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1200, function() {
            $active.removeClass('active last-active');
        });
}

function slideSwitch_garage() {
    var $active = $('#slideshow_garage img.active');

    if ( $active.length == 0 ) $active = $('#slideshow_garage IMG:last');

    // use this to pull the images in the order they appear in the markup
    var $next =  $active.next().length ? $active.next()
        : $('#slideshow_garage img:first');

    // uncomment the 3 lines below to pull the images in random order
    
    // var $sibs  = $active.siblings();
    // var rndNum = Math.floor(Math.random() * $sibs.length );
    // var $next  = $( $sibs[ rndNum ] );


    $active.addClass('last-active');

    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 1200, function() {
            $active.removeClass('active last-active');
        });
}


$(function() {
    setInterval( "slideSwitch_turning()", 4500 );
	setInterval( "slideSwitch_pocket()", 4500 );
	setInterval( "slideSwitch_garage()", 4500 );
});
