var Global = {

	init: function(){
		
        //this.initFonts();
		this.initSliders();
		this.initEqualWidths();
		this.initIE(); //must do this AFTER widths are set.	
    },
    initSliders:function(){

    	$carousel = $('#slider_home');
    	
    	if( $('#slider_home').length > 0 ) {
    		$('#slider_home').tinycarousel({pager:true, controls: false, interval: true, intervaltime: 6000});
            
        }
    },
    initEqualWidths: function(){
    	$nav_second = $('#nav_second .menu');
    	if( $nav_second.length > 0 ) {
    		$nav_second.equalWidths(); 
    	}
    	
    },
	initIE: function() {
		/*if ($.browser.msie) {
			$('#header #nav_first li a').textShadow(options_nav_first); 
			$('#header #nav_first li.active a, #header #nav_first li:hover a, #header #nav_first li.active-trail a').textShadow(options_nav_first);

			$('#nav_second li a ,#nav_second li a:hover').textShadow(options_nav_second);
			$('body.page-node #nav_second a.active-trail, #nav_second li.active-trail a.active,#nav_second li.active a.active,#nav_second li a:hover').textShadow(options_nav_second);
		
		}*/
		if(jQuery.browser.msie && jQuery.browser.version <= 8) {
			this.initIframeMaxWidths()
		} //end of if lte 8 and msie

	},
	initIframeMaxWidths: function (){
		//resizing the youtube embeds probaly only in ie8 and lower
		jQuery("#content .view-homepage iframe").each(function() {
		
			
			var oWidth = jQuery(this).width();
			var oHeight = jQuery(this).height();
			var nWidth = 220;
			//maybe also check if width is ok, but height is higher then 200px also resize?
			if (oWidth >= nWidth) {

				i_ratio = oWidth / nWidth;
				var nHeight = (oHeight / i_ratio)+30;

				/*jQuery(this).css("width", nWidth);
				jQuery(this).css("height", nHeight);
				jQuery(this).width(nWidth);
				jQuery(this).height(nHeight);*/
				jQuery(this).closest(".field-name-body").height(nHeight);
			}

		});
	}
    
}
//end of global


$(document).ready(function() { 
    Global.init();
});

//to window ready stuff on the window load (images etc.), ok its dirty, maybe an own Global?
$(window).load(function() {
          
});
