$(document).ready(function(){
	
	var shrUrl = document.getElementById('baseCSS').href.replace('common/css/import.css', '');
	var filename = location.href.split("#")[0].split("?")[0].split("/").reverse()[0];
	var filepass = location.href.replace(filename, '');
	var filerootpass = filepass.replace(shrUrl, '');
	
	$.ajaxSetup({
		cache: false
	});
	$("#header").load(shrUrl + "menu/main.html #menuwrap",function(){
		$(this).find("a").each(function(){
			var pass = $(this).attr('href').replace(filepass,'');
			pass.replace(filepass,'');
			$(this).attr('href',shrUrl + pass);
		});
		$(this).find("img").each(function(){
			var pass = $(this).attr('src').replace(filepass,'');
			pass.replace(filepass,'');
			$(this).attr('src',shrUrl + pass);
		});	
		$("body[class]").each(function(){
			var test = $(this).attr("class");
			$(this).find("#headermenu").show().load(shrUrl + 'menu/' + test + '.html table',function(){
				$(this).find("a").each(function(){
					var pass = $(this).attr('href').replace(filepass,'');
					pass.replace(filepass,'');
					$(this).attr('href',shrUrl + pass);
				});
				$(this).find('td:last-child').addClass('lastChild');
				tablepulldown();
				$.yuga.selflink();
			});
		});
		$(this).find(":last-child").addClass('lastChild');
	});
	
	var toDoubleDigits = function(num) {
		num += "";
		if (num.length === 1) {
			num = "0" + num;
		}
		return num;     
	};

	var myD       = new Date();
	var myYear    = myD.getYear().toString();
	var myYear4   = (myYear < 2000) ? myYear+1900 : myYear;
	var myyear2   = (new Date).getFullYear()%100;
	var myMonth   = toDoubleDigits(myD.getMonth() + 1);
	
	var anchor = document.getElementById("calenderlink");
	anchor.href = "c7/c" + myyear2 + "/cal" + myyear2 + myMonth + ".html";
	
});

function rootpass(){
};

function tablepulldown(){
	$("#headermenu td").mouseover(function () {
		$(this).addClass("hover");
		$(this).find("ul").show();
	});
	$("#headermenu td").mouseout(function () {
			$(this).removeClass("hover");
			$(this).find("ul").hide()
		}
	)
};

