function createDDMenus() {

	$('body').click( function() {
		 $('.drop-down-menu').each(function() { $(this).removeClass('active').children('ul').hide(); });
	}); 
	
	 $('.drop-down-menu > a').click(function() {
		var curActive = $(this).parent('li').hasClass('active');
		
		$('.drop-down-menu ul').each(function() {
			if(curActive == false){ $(this).hide().parent('li').removeClass('active'); }
		});
		
		if(curActive == false){
			$(this).parent('li').addClass('active');
			$(this).next('ul').slideDown();
		} else {
			$(this).next('ul').hide().parent('li').removeClass('active');
		}
		return false;
	});
	
	$('#cart_small').click( function() {
		$('#cart_large').animate({
	    		width: 'toggle'
	  	}, 500);
	  	$('#cart_small').animate({
	    		width: 'toggle'
	  	}, 500);
	});
	$('#cart_large').click( function() {
		$('#cart_large').animate({
	    		width: 'toggle'
	  	}, 500);
	  	$('#cart_small').animate({
	    		width: 'toggle'
	  	}, 500);
	});
		
}

function loadFeature(f) {
	//alert(feature);
	//param = f;
	$('#homepage-features').html('<p class="loading"><img src="/images/layout/loading.gif" alt="Loading..." /></p>');
	var jqxhr = $.ajax({ url: "includes/features.php?feature="+f })
    	.error(function() { alert("error"); })
    	.complete(function(data) {
    			$('#homepage-features').html(jqxhr.responseText);
    			$('#feature-image').fadeIn('slow');
			
		});
}

function featureToggle(obj) {
	if(typeof(featureUpdate) !== "undefined") {
		featureUpdate=window.clearInterval(featureUpdate);
	
		var exdate=new Date();
		exdate.setDate(exdate.getDate() + 60);
		var c_value=escape('true') + ((60==null) ? "" : "; expires="+exdate.toUTCString());
		document.cookie="feature_stop" + "=" + c_value;
		obj.style.backgroundPosition = "-70px 0";
		obj.blur();
	} else {
		document.cookie = "feature_stop" + '=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
		loadFeature(currentFeature)
	}
}

function show_course_details(obj) {
	if(obj.parentNode.nextSibling.style.display != "block") {
		obj.parentNode.nextSibling.style.display="block";
		obj.parentNode.parentNode.style.border="solid 1px #D7DBA2";
		obj.parentNode.parentNode.style.background="#D7DBA2";
	} else {
		obj.parentNode.nextSibling.style.display="none";
		obj.parentNode.parentNode.style.border="none";
		obj.parentNode.parentNode.style.background="#EFEFEF";
	}
}
function show_faculty_details(area,obj) {
	var items =obj.parentNode.getElementsByTagName("LI");
	for(var i = 0; i < items.length; i++){
		items[i].className = "shut";
	}
	obj.className = "here";
	
	document.getElementById('faculty_about').style.display='none';
	document.getElementById('faculty_publications').style.display='none';
	document.getElementById('faculty_grants').style.display='none';
	document.getElementById('faculty_courses').style.display='none';
	
	document.getElementById('faculty_'+area).style.display='block';
}
