/*
	Autor: Grzegorz Jaworek
	E-mail: grzegorz.jaworek@gmail.com
	www: http://gjaworek.pl 
	Tel.: +48 519 133 159
*/

jQuery(document).ready(function(){
	var myWidth = 0, myHeight = 0;
	function getWindowSize() {
	  if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	  }
	  // window.alert( 'Width = ' + myWidth );
	  // window.alert( 'Height = ' + myHeight );
	}
	jQuery('body').append('<div id="loader"><div></div></div>');
	getWindowSize();
	jQuery('#loader').children('div').css('margin-top', (myHeight-55)/2);
	var imagesToLoad = [
	 'menu-1-hover.png', 
	 'menu-2-hover.png', 
	 'menu-3-hover.png', 
	 'menu-4-hover.png', 
	 'menu-5-hover.png'
	];
	jQuery.preloadCssImages();
	jQuery('#menu li ul li:first-child').each(function() {
		jQuery(this).children('a').css('border-top', 0);
	});
	// jQuery('#menu li ul').hide();
	jQuery('#menu li').hover(function() {
		jQuery(this).children('a').addClass('hover');
		// jQuery(this).children('ul').slideToggle('fast');
		// return false;
	}, function() {
		jQuery(this).children('a').removeClass('hover');
		// jQuery(this).children('ul').slideToggle('fast');
		// return false;
	});
	jQuery('#flash-player').flash({
		src: 'http://www.youtube.com/cp/vjVQa1PpcFMFhe9N81X9s00jXzYZgCCaA8qir7Y8V0U=',
		width: 746,
		height: 413,				wmode: 'transparent',
		expressInstall: true
	});
	jQuery('#mp3-player').flash({
		src: 'http://singledread.com/wp-content/themes/singledread/mp3player/xspf_player_slim.swf',
		width: 340,
		height: 74,				wmode: 'transparent',		
		expressInstall: true
	});	jQuery('#head-flash').flash({		src: 'http://singledread.com/wp-content/themes/singledread/content/head.swf',		width: 480,		height: 169,				wmode: 'transparent',		expressInstall: true	});
	jQuery(window).load(function(){
		jQuery('#loader').remove()
	}); 
	
	jQuery.fn.fadeToggle = function(speed, easing, callback) {
		return this.animate({opacity: "toggle"}, speed, easing, callback); 
	}; 	
	jQuery("a.gigpress-links-toggle").click(function() {
		var target = jQuery(this).attr("href");
		jQuery(target).fadeToggle("fast");
		jQuery(this).toggleClass("gigpress-link-active");
		return false;
	});
});