﻿/***************************/
//@Author: Adrian "yEnS" Mato Gondelle
//@website: www.yensdesign.com
//@email: yensamg@gmail.com
//@license: Feel free to use it, but keep this credits please!					
/***************************/

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;
var currentTab = 1;
//loading popup with jQuery magic!
function loadPopup(call) {
    if (popupStatus == 0) {
        $("#backgroundPopup").css({
            "opacity": "0.7"
        });
        $("#backgroundPopup").fadeIn("slow");
        if (call == 0)
            $("#popupdiv").fadeIn("slow");
        popupStatus = 1;
    }
}



//centering popup
function centerPopup(call) {
    //request data for centering
    var windowWidth = document.documentElement.clientWidth;
    var windowHeight = document.documentElement.clientHeight;
    var popupHeight = null;
    var popupWidth = null;
    if (call == 0) {
        popupWidth = $("#popupdiv").width();
        //centering
        $("#popupdiv").css({
        'position': 'absolute',
        'left': (windowWidth / 2 - popupWidth / 2)
        });
    }
    //only need force for IE6
    $("#backgroundPopup").css({
        "height": windowHeight
    });

}

//disabling popup with jQuery magic!
function disablePopup(call) {
    if (popupStatus == 1) {
        $("#backgroundPopup").fadeOut("slow");
        if (call == 0)
            $("#popupdiv").fadeOut("slow");
       
        popupStatus = 0;
    }
}
//CONTROLLING EVENTS IN jQuery
try {
    $(document).ready(function() {
        //LOADING POPUP
        //Click the button event!
    $("#addTestimonial").click(function() { centerPopup(0); loadPopup(0); });
        //CLOSING POPUP
        //Click the x event!
    $("#popupTestimonialClose").click(function() {
            disablePopup(0);
        });

    jQuery('#menuTrackerList').accordion({
        autoheight: true,
        animated: 'easeslide'
    });
    
    $(document).keypress(function(e) {
        if (e.keyCode == 27 && popupStatus == 1) {
            disablePopup(0);
        }
    });


        $(".newsticker-jcarousellite").jCarouselLite({
            vertical: true,
            hoverPause: true,
            visible: 5,
            auto: 500,
            speed: 2000
        });
   


					$('#news').innerfade({
					animationtype: 'fade',
						speed: 100,
						timeout: 5000,
						type: 'random',
						containerheight: '1em'
					});
					
					$('ul#portfolio').innerfade({
						speed: 1000,
						timeout: 300,
						type: 'sequence',
						containerheight: '220px'
					});
					
					$('.fade').innerfade({
						speed: 600,
						timeout: 300,
						type: 'random_start',
						containerheight: '1.5em'
					});
					
					$('.adi').innerfade({
						speed: 'fast',
						timeout: 300,
						type: 'random',
						containerheight: '150px'
					});

	 
});     
}
catch (err) {
}


