/*------------------------------------------------------------------------------
    JS Document (https://developer.mozilla.org/en/JavaScript)

    project:    CLEVERSYS
    created:    2010-11-25
    author:     johdoe

    summary:    MAJX_CORE
                CONSTANTES
                UTILITIES
                WINDOW.ONLOAD
                CAROUSEL
                ANIMATE_HEADER
                CUSTOM
                

----------------------------------------------------------------------------- */

/* =MAJX_CORE (http://code.google.com/p/majx-js/)
----------------------------------------------------------------------------- */
(function(){if(typeof majx=="undefined"){majx={};majx.init=function(){if(!majx.config){majx.config={};}}();}}());majx.set=function(){var e=arguments[0]||{};var b=null;var d=arguments.length;var c=1;if(d==c){e=majx.config;--c;}for(;c<d;c++){if((b=arguments[c])!=null){for(var a in b){var f=e[a];var g=b[a];if(e===g){continue;}else{if(g!==undefined){e[a]=g;}}}}}majx.config=e;};


/*  =CONSTANTES
----------------------------------------------------------------------------- */
jQuery.noConflict();
var d = document;
var w = window;
pm = {};
majx.set({
    
});


/*  =UTILITIES
----------------------------------------------------------------------------- */
var log = function(x) {
    if (typeof console != 'undefined') {
        console.log(x);
    }
};



/*  =WINDOW.ONLOAD
----------------------------------------------------------------------------- */
jQuery(document).ready(function(){

    // Call Functions
    carousel01();                 // Carousel
    carousel02();
    animateHeader();
    animateHeaderPage();
    custom();
    validateContact();

    if (jQuery.browser.msie && jQuery.browser.version == 6) {
        // IE 6 FUNCTIONS ONLY
        
    }

});


/*  =CAROUSEL
----------------------------------------------------------------------------- */

carousel01 = function(){
    jQuery('#block-carousel').carousel({
        loop: true,
    //    animSpeed: "slow",
    //   effect: 'fade'     
     autoSlide: true, 
     autoSlideInterval: 5000,
	});
 
}

carousel02 = function(){
    jQuery('#block-services .carousel').carousel({
        autoSlide: true, 
        autoSlideInterval: 5000,
        loop: true,
        dispItems: 3
    });
 
}



/*  =ANIMATE_HEADER
----------------------------------------------------------------------------- */

var value = 1;
var items = 7;

//var rand_items =Math.floor(Math.random()*6)
    
animateHeader = function(){
    	
	if(jQuery('.page-type-01 #background').length < 1 ){
		jQuery('.page-type-01 #banner').append('<a href="#" id="background"></a>');
	}
	jQuery('.page-type-01 #background').fadeOut('slow', function(){
		if(value > items)
			value = 1;
		
		jQuery('#header #background').removeClass();
		jQuery('#header #background').addClass('banner-'+value+'');
		jQuery('#header #background').fadeIn('slow');
		
		value++;
	});
	setTimeout("animateHeader()",20000);

}

animateHeaderPage = function(){
    var num = Math.floor(Math.random() * 7)+1;
    
    jQuery('.page-type-02 #banner').addClass('banner-'+num+'');
}

/*  =CUSTOM
----------------------------------------------------------------------------- */

custom = function(){
    jQuery("#menu-footer-menu li:last").addClass("last");
    jQuery("#qtranslate-4-chooser li:last").addClass("last");
}
