function initAccordion() {
  $('#accordion div').hide();
  $('#accordion h2:first').addClass('selected');
  $('#accordion div:first').show();
  $('#accordion h2').click(
	function() {
	// for the h3 in #accordian that has been clicked do this:
	  var checkElement = $(this).next(); //create a new variable called checkElement which is equal to the element after this h3
	  
	  if((checkElement.is('div')) && (checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is visible then do:
		return false; 
		}
	  if((checkElement.is('div')) && (!checkElement.is(':visible'))) { // if checkElement is a div AND checkElement is not visible then do:
		$('#accordion h2').removeClass('selected'); //find all h2s in #accordian and remove the class 'selected'
		$('#accordion div:visible').slideUp('normal'); //find all visible divs in accordian and slide up
		$(this).addClass('selected'); //add the class 'selected' to this h2
		checkElement.slideDown('normal'); // slidedown checkElement
		return false;
		}
	  }
	);
  }




function initMenu() {
  	$('div.dropdown').hide();
  	$('#nav li').hover(
		function() {
			var checkElement = $(this).children('div.dropdown'); 
	  
			if((checkElement.is('div')) && (checkElement.is(':visible'))) {
				return false; 
			}
			if((checkElement.is('div')) && (!checkElement.is(':visible'))) { 
				$('#nav li').removeClass('selected'); 
				$('#nav ul div.dropdown:visible').hide();
				$(this).addClass('selected');
				checkElement.fadeIn(200); 
			}
		},
		function() {
			var checkElement = $(this).children('div.dropdown'); 
	  		$('#nav li').removeClass('selected');
			if((checkElement.is('div')) && (checkElement.is(':visible'))) { 
				checkElement.fadeOut(0);
			}
		}
	);
}

function initHover() {
  	$('div.hover').hide();
  	$('#home-hover li a').hover(
		function() {
			var checkElement = $(this).next('div.hover'); 
	  
			if((checkElement.is('div')) && (checkElement.is(':visible'))) {
				return false; 
			}
			if((checkElement.is('div')) && (!checkElement.is(':visible'))) { 
				$('#home-hover li a').removeClass('selected'); 
				$('#home-hover li div.hover:visible').hide();
				$(this).addClass('selected');
				checkElement.fadeIn(500); 
			}
		},
		function() {
			var checkElement = $(this).next('div.hover'); 
	  		$('#home-hover li a').removeClass('selected');
			if((checkElement.is('div')) && (checkElement.is(':visible'))) { 
				checkElement.fadeOut(500);
			}
		}
	);
}





	
	$(document).ready(function () {
		var version = swfobject.getFlashPlayerVersion();
		if (Number(version.major) > 8) {
			$("#featureHome12345").addClass("featureHome12345");
		}
		$("#wrapper").prepend('<div id="flashCurlPusher"></div><div id="flashCurlWrap"><div id="flashCurl"></div></div>');
		swfobject.embedSWF("/css/swfs/pagecurl.swf", "flashCurl", "360", "350", "8.0.0", "", {}, {"scale": "noscale", salign: "right", wmode: "transparent"});
		
		$("#flashCurlWrap").hover(function () {
	
			$("#flashCurlWrap").css({"overflow": "visible"});
			
		  }, 
		  function() {
			$("#flashCurlWrap").delay(800).animate({"overflow": "hidden"}, 0, resetOverflow);
		
		  }
		);
		
		function resetOverflow() {
			//alert('reset');
			$("#flashCurlWrap").css({"overflow": "hidden"});
		}
		
		$("#socialIcons").append('<li><a href="#" class="print">Print</a></li>');
		$(".print").click(function(e) {
			window.print(); 
			e.preventDefault();
		});		
	});
	
	




$(document).ready(function() {
initAccordion();
initMenu();
initHover();
$('#prompt .box').hide().fadeIn(1000);
});


