var cookieUsergroup = $.cookie('HM_USERGROUP');

if(currentPage == hmhomepage) {
	if(cookieUsergroup == "student"){
		document.location.href = studenthp;
	} else if(cookieUsergroup == "interested" ){
		document.location.href = interestedhp;
	}
}

$(document).ready(function () {
	if(allg) {
		$.cookie('HM_USERGROUP', '', { expires: -1, path:'/', domain:'hm.edu'});
		$("#options ul li input").removeAttr("checked");
		// binds click-events to the user-group options in the main-navigation
		$("#options ul li[class*=student] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','student',{expires: 1500, path:'/', domain:'hm.edu'});
				document.location.href = studenthp;
			});
		$("#options ul li[class*=interested-person] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','interested',{expires: 1500, path:'/', domain:'hm.edu'});
				document.location.href = interestedhp;
			});

		// binds click-events to the user-group options on the sitemap (location is specified in onclick-Event in tag)
		$("div.options-sm ul li[class*=student-sm] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','student',{expires: 1500, path:'/', domain:'hm.edu'});
			});
		$("div.options-sm ul li[class*=interested-person-sm] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','interested',{expires: 1500, path:'/', domain:'hm.edu'});
			});
	} else {
		$("#options ul li input")
			.bind("click", function() {
				$.cookie('HM_USERGROUP', '', { expires: -1, path:'/', domain:'hm.edu'});
				document.location.href = hmhomepage;
			})
			.attr("checked", "checked");
		$("#content-nav-reset ul li a").bind("click", function() {
				$.cookie('HM_USERGROUP', '', { expires: -1, path:'/', domain:'hm.edu'});
				document.location.href = hmhomepage;		  
			});

		// binds click-events to the user-group options on the sitemap (location is specified in onclick-Event in tag)
		$("div.options-sm ul li[class*=default-sm] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP', '', { expires: -1, path:'/', domain:'hm.edu'});
			});
		$("div.options-sm ul li[class*=student-sm] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','student',{expires: 1500, path:'/', domain:'hm.edu'});
			});
		$("div.options-sm ul li[class*=interested-person-sm] *")
			.bind("click", function() {
				$.cookie('HM_USERGROUP','interested',{expires: 1500, path:'/', domain:'hm.edu'});
			});
	}
});
	
