/* ------------------- */
/* Code by Mootdesign */
/* ----------------- */

$(document).ready(function () {

/*$("#linia").css({'width': '0px'});*/
$(".message_head:eq(0)").css({'width': '0px'});
$(".message_head:eq(1)").css({'width': '0px'});
$(".message_head:eq(2)").css({'width': '0px'});
$(".message_head:eq(3)").css({'width': '0px'});
$(".message_head:eq(4)").css({'width': '0px'});
$(".message_head:eq(5)").css({'width': '0px'});
$(".message_head:eq(6)").css({'width': '0px'});
$(".message_head:eq(7)").css({'width': '0px'});
	
/*$("#linia").animate({ width: 980 }, 1500 );*/
setTimeout(function () { $(".message_head:eq(0)").animate({ width: 980 }, 1500 ); }, 50);
setTimeout(function () { $(".message_head:eq(1)").animate({ width: 980 }, 1500 ); }, 100);
setTimeout(function () { $(".message_head:eq(2)").animate({ width: 980 }, 1500 ); }, 150);
setTimeout(function () { $(".message_head:eq(3)").animate({ width: 980 }, 1500 ); }, 200);
setTimeout(function () { $(".message_head:eq(4)").animate({ width: 980 }, 1500 ); }, 250);
setTimeout(function () { $(".message_head:eq(5)").animate({ width: 980 }, 1500 ); }, 350);
setTimeout(function () { $(".message_head:eq(6)").animate({ width: 980 }, 1500 ); }, 400);
setTimeout(function () { $(".message_head:eq(7)").animate({ width: 980 }, 1500 ); }, 500);
	
	
setTimeout(function () { $(".message_list .message_body:eq(1)").slideToggle(500); }, 1700);	
	
/*$(".option0").ScrollTo(800);*/

$('.bigimage').cycle({
fx: 'scrollLeft', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
speed: 600,
timeout: 8000
});

  // Reset Font Size
  var originalFontSize = $('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size');
  $(".reset").click(function(){
  $('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size', originalFontSize);
  });

  // Increase Font Size
  $(".increase").click(function(){
  	var currentFontSize = $('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*1.2;
	$('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size', newFontSize);
	return false;
  });

  // Decrease Font Size
  $(".decrease").click(function(){
  	var currentFontSize = $('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size');
 	var currentFontSizeNum = parseFloat(currentFontSize, 10);
    var newFontSize = currentFontSizeNum*0.8;
	$('.message_head a, #contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').css('font-size', newFontSize);
	return false;
  });

//$("a.playvideo").fancybox({
//'opacity'		 : true,
//'overlayShow'	 : true,
//'transitionIn'	 : 'elastic',
//'transitionOut'	 : 'elastic',
//'titleShow'	 : false,
//'overlayColor'	 : '#000',
//'overlayOpacity' : 0.6
//});

$(".openmap1").click(function () {
$('.map2').slideUp();	
$('.map1').delay(200).slideToggle('slow');
});

$(".openmap2").click(function () {
$('.map1').slideUp();	
$('.map2').delay(200).slideToggle('slow');
});

//$('a.playvideo').hover(function(){
//$(this).stop().fadeTo("slow", 1.0)
//},function(){
//$(this).stop().fadeTo("slow", 0.6)
//});	

$('.loaderone').click(function(){
$('#contentone').load($(this).attr('href'));
return false;
});

$('.about1').click(function(){
$('.about1, .about2, .about3, .about4').removeClass('me');	
$('.about1').addClass('me');
$('#contentone').load($(this).attr('href'));
return false;
});

$('.about2').click(function(){
$('.about1, .about2, .about3, .about4').removeClass('me');	
$('.about2').addClass('me');	
$('#contentone').load($(this).attr('href'));
return false;
});

$('.about3').click(function(){
$('.about1, .about2, .about3, .about4').removeClass('me');	
$('.about3').addClass('me');	
$('#contentone').load($(this).attr('href'));
return false;
});

$('.about4').click(function(){
$('.about1, .about2, .about3, .about4').removeClass('me');	
$('.about4').addClass('me');	
$('#contentone').load($(this).attr('href'));
return false;
});

$('.loadertwo').click(function(){
$('#contenttwo').load($(this).attr('href'));
return false;
});

$('.loaderthree').click(function(){
$('#contentthree').load($(this).attr('href'));
return false;
});

$('.loaderfour').click(function(){
$('#contentfour').load($(this).attr('href'));
return false;
});

$('.loaderfive').click(function(){
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd1').click(function(){
    $('.rd2, .rd3, .rd4, .rd5, .rd6, .rd7, .rd8').removeClass('me');	
$('.rd1').addClass('me');
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd2').click(function(){
    $('.rd1, .rd3, .rd4, .rd5, .rd6, .rd7, .rd8').removeClass('me');	
$('.rd2').addClass('me');
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd3').click(function(){
    $('.rd1, .rd2, .rd4, .rd5, .rd6, .rd7, .rd8').removeClass('me');	
$('.rd3').addClass('me');
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd4').click(function(){
    $('.rd1, .rd2, .rd3, .rd5, .rd6, .rd7, .rd8').removeClass('me');	
$('.rd4').addClass('me');
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd5').click(function(){
    $('.rd1, .rd2, .rd3, .rd4, .rd6, .rd7, .rd8').removeClass('me');	
$('.rd5').addClass('me');
$('#contentfive').load($(this).attr('href'));
return false;
});

$('.rd6').click(function () {
    $('.rd1, .rd2, .rd3, .rd4, .rd5, .rd7, .rd8').removeClass('me');
    $('.rd6').addClass('me');
    $('#contentfive').load($(this).attr('href'));
    return false;
});

$('.rd7').click(function () {
    $('.rd1, .rd2, .rd3, .rd4, .rd5, .rd6, .rd8').removeClass('me');
    $('.rd7').addClass('me');
    $('#contentfive').load($(this).attr('href'));
    return false;
});

$('.rd8').click(function () {
    $('.rd1, .rd2, .rd3, .rd4, .rd5, .rd6, .rd7').removeClass('me');
    $('.rd8').addClass('me');
    $('#contentfive').load($(this).attr('href'));
    return false;
});

$('.loadersix').click(function(){
$('#contentsix').load($(this).attr('href'));
return false;
});
	
$(".itemone").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');	
$('#contentone').ScrollTo(800);
$('.item5options').slideUp('slow');	
$('#contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').slideUp('slow');	
$('#contentone, .item1options').delay(200).slideToggle('slow');
$('.arrow2, .arrow3, .arrow4, .arrow5, .arrow6').removeClass('on')
$('.arrow1').toggleClass('on');
$('.about1, .about2, .about3, .about4').removeClass('me');	
$('.about1').addClass('me');
});

$(".itemtwo").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');	
$('#contenttwo').ScrollTo(800);
$('.item1options, .item5options').slideUp('slow');	
$('#contentone, #contentthree, #contentfour, #contentfive, #contentsix').slideUp('slow');	
$('#contenttwo').delay(200).slideToggle('slow');
$('.arrow1, .arrow3, .arrow4, .arrow5, .arrow6').removeClass('on')
$('.arrow2').toggleClass('on');
});

$(".itemthree").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');	
$('#contentthree').ScrollTo(800);
$('.item1options, .item5options').slideUp('slow');	
$('#contentone, #contenttwo, #contentfour, #contentfive, #contentsix').slideUp('slow');		
$('#contentthree').delay(200).slideToggle('slow');
$('.arrow1, .arrow2, .arrow4, .arrow5, .arrow6').removeClass('on')
$('.arrow3').toggleClass('on');
});

$(".itemfour").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');	
$('#contentfour').ScrollTo(800);
$('.item1options, .item5options').slideUp('slow');		
$('#contentone, #contenttwo, #contentthree, #contentfive, #contentsix').slideUp('slow');	
$('#contentfour').delay(200).slideToggle('slow');
$('.arrow1, .arrow2, .arrow3, .arrow5, .arrow6').removeClass('on')
$('.arrow4').toggleClass('on');
});

$(".itemfive").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');	
$('#contentfive').ScrollTo(800);
$('.item1options').slideUp('slow');		
$('#contentone, #contenttwo, #contentthree, #contentfour, #contentsix').slideUp('slow');
$('#contentfive, .item5options').delay(200).slideToggle('slow');
$('.arrow1, .arrow2, .arrow3, .arrow4, .arrow6').removeClass('on')
$('.arrow5').toggleClass('on');
$('.rd1').addClass('me');
});

$(".itemsix").click(function () {
window.scrollTo(0, 0);
$('.bigimage').slideUp('slow');
$('#contentsix').ScrollTo(800);
$('.item1options, .item5options').slideUp('slow');		
$('#contentone, #contenttwo, #contentthree, #contentfour, #contentfive').slideUp('slow');
$('#contentsix, .item6options').delay(200).slideToggle('slow');
$('.arrow1, .arrow2, .arrow3, .arrow4, .arrow5').removeClass('on')
$('.arrow6').toggleClass('on');
});

$(".openall").click(function () {
$('.bigimage').slideUp('slow');
$('#contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').slideDown('slow');
});

$(".closeall").click(function () {
$('.bigimage').slideDown('slow');
$('#contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').slideUp('slow');
});

$(".hdimageno").click(function () {
$('.bigimage').slideUp('slow');
});

$(".hdimageyes").click(function () {
$('.arrow1, .arrow2, .arrow3, .arrow4, .arrow5, .arrow6').removeClass('on')
$('.item1options, .item5options').slideUp('slow');	
$('#contentone, #contenttwo, #contentthree, #contentfour, #contentfive, #contentsix').slideUp('slow');	
$('.bigimage').slideDown('slow');
});

$("#nav li a").click(function() { 
		$("link").attr("href",$(this).attr('rel'));
		return false;
	});

});

$(document).ready(function () {

    //SETTING UP OUR POPUP
    //0 means disabled; 1 means enabled;
    var popupStatus = 0;

    //loading popup with jQuery magic!
    function loadPopup(intPopupNumber) {

        //loads popup only if it is disabled
        if (popupStatus == 0) {
            $("#backgroundPopup").css({
                "opacity": "0.7"
            });
            $("#backgroundPopup").fadeIn("slow");

            var PopupNumber = '#popupContact' + intPopupNumber;

            $(PopupNumber).fadeIn("slow");
            popupStatus = 1;
            $('.speechMark').fadeOut("slow");
        }
    }

    //disabling popup with jQuery magic!
    function disablePopup() {
        //disables popup only if it is enabled
        if (popupStatus == 1) {
            $("#backgroundPopup").fadeOut("slow");
            $(".popupContact").fadeOut("slow");
            popupStatus = 0;
            $('.speechMark').fadeIn("slow");
        }
    }

    //centering popup
    function centerPopup(intPopupWidth) {
        //request data for centering
        var windowWidth = document.documentElement.clientWidth;
        var windowHeight = document.documentElement.clientHeight;
        var popupHeight = $(".popupContact").height();
        var popupWidth = intPopupWidth;

        // This will sort of centre the popups vertically
        // However, it also roughly ties them to the links that popped them up.
        var docViewTop = $(window).scrollTop();
        var windowScrollPosition = windowHeight + docViewTop + (popupHeight * 2);

        $(".popupContact").css({
            "position": "absolute",
            "top": windowScrollPosition / 2 - popupHeight / 2,
            "left": windowWidth / 2 - popupWidth / 2
        });

        // This calculates the height of the window for the IE6 background
        if ($.browser.msie && $.browser.version.substr(0, 1) < 7) {
            var $currentObjectHeight = null;
            $currentObjectHeight = $(document).height();
            $('div#backgroundPopup').css('height', $currentObjectHeight);
        }

    }



    //.popup-test1
    //.popup-test2
    //.popup-test3

    //LOADING POPUP
    //Click the button event!
    $(".popup-Click").click(function () {
        //centering with css
        centerPopup(540);
        //load popup
        loadPopup(1);
    });

    //Click the x event!  
    $(".popupContactClose").click(function () {
        disablePopup();
    });

    //Click the x event!  
    $(".popupContactCloseLink").click(function () {
        disablePopup();
    });

    //Click out event!  
    $("#backgroundPopup").click(function () {
        disablePopup();
    });

    //Press Escape event!  
    $(document).keypress(function (e) {
        if (e.keyCode == 27 & popupStatus == 1) {
            disablePopup();
        };
    });

});
