/*
 *    @author     Blufish Design (www.blufishdesign.com)
 *    @version    1.0
 *    @date       Thursday, December 16, 2010
 */

$(document).ready(function() {
	
	var allIds = Array();
	
	/*
	 *    Grab all possible options and push 
	 *    it into an array.
	 */
	$(".LImenu_opt").each(function(){
		if($(this).attr('id')) {
			var classes = $(this).attr('id');
			var classArray = classes.split('menu');
			allIds.push(classArray[1]);
		}
	});
	
	/*
	 *    Add hover to options stated in 
	 *    array above. 
	 */
	$(".LImenu_opt").hover(
		function() {
			if($(this).attr('id')) {
				var x = $(this).attr('id');
				var y = x.split('menu');
				$(".DIVsubMenu_wrapper").show();
				for(i=0;i<allIds.length;i++) {					
					if(allIds[i] == y[1]) {
						//$('#holder_'+allIds[i]).stop(true, true).fadeIn({queue:false, duration:150});
						$('#holder_'+allIds[i]).show();
						$('#'+allIds[i]).show();
					} else {
						$('#'+allIds[i]).hide();
					}
				}
			}
		}, 
		function() {
			$(".DIVsubMenu_holder").hide();
			$(".DIVsubMenu_wrapper").hide();
		}
	);
	
	/*
	 *    Add hover to sub menu wrappers
	 */
	$(".DIVsubMenu_holder").each(function() {
		$(this).hover (
			function() {
				var x = $(this).attr('id');
				var y = x.split('holder_');
				$(".DIVsubMenu_wrapper").show();
				$(this).show();
				$("#holder_"+y[1]).show();
			}, 
			function() {
				//$(this).stop(true, true).fadeOut({queue:false, duration:200});
				//$(".DIVsubMenu_wrapper").stop(true, true).fadeOut({queue:false, duration:200});
				$(this).hide();
				$(".DIVsubMenu_wrapper").hide();
			}
		);
	});
	
	/*
	 *    Functions for read more buttons.
	 */
	$(".rm_btn").each(function() {
		var x = $(this).attr('id');
		var y = x.split('rm_btn_');
		var z = y[1];
		
		$(this).click(function() {
			$('#rm_content_'+z).fadeIn();
			$(this).fadeOut();
		});
		
	 });
	
	if ( $.browser.msie ) {
		if($.browser.version < 7) {
			alert('This website does not support Internet Explorer 6. Please update your browser.');
		}
	}
	
		
});


