var menu = {
init: function() {
	$('#navigation ul.level-0 li').mouseover(function() {
											 $('ul.level-1').css({'z-index':'1'});
											 $(this).addClass('selected');
											 $(this).children('ul.level-1').css({'z-index':'6', 'background-color': '#90CE2A'});
											 
											 }).mouseout(function() {
														 $(this).removeClass('selected');
														 $(this).children('ul.level-1').css({'z-index':'1'});
														 });
/*
	$('#navigation ul.level-0 li').click(function() {
										 $('ul.level-0').removeClass('selected');
										 $(this).addClass('selected');
										 $('ul.level-1').css({'z-index':'1'});
										 $(this).children('ul.level-1').css({'z-index':'6'});
										 });
*/ 
	}
};

function addTrusteSeal() {
	var page = document.getElementById("page");
	var container = document.createElement("div");
	var link = document.createElement("a");
	var img = document.createElement("img");
	var link1 = document.createElement("a");
	var img1 = document.createElement("img");
	var protocol = window.location.protocol;
	
	container.setAttribute("id", "truste_seals");
	
	link.setAttribute("href", protocol + "//privacy-policy.truste.com/click-with-confidence/ctv/en/www.ditechnetworks.com");
	link.setAttribute("target", "_blank");
	link.setAttribute("style", "float:right;");
	if(typeof link.style.setAttribute != "undefined")
		link.style.setAttribute("cssText", "float:right", 0);
	
	img.setAttribute("style", "border: none");
	img.setAttribute("src", protocol + "//privacy-policy.truste.com/certified-seal/ctv/en/www.ditechnetworks.com/seal.png");
	img.setAttribute("alt", "Truste Logo");
	
	link.appendChild(img);
	container.appendChild(link);
	
	link1.setAttribute("href", protocol + "//privacy-policy.truste.com/click-with-confidence/eusafe/en/www.ditechnetworks.com");
	link1.setAttribute("target", "_blank");
	link1.setAttribute("style", "float:left;");
	if(typeof link.style.setAttribute != "undefined")
		link1.style.setAttribute("cssText", "float:left", 0);	
	
	img1.setAttribute("style", "border: none");
	img1.setAttribute("src", protocol + "//privacy-policy.truste.com/certified-seal/eusafe/en/www.ditechnetworks.com/seal.png");
	img1.setAttribute("alt", "EUSafe Logo");
	
	link1.appendChild(img1);
	container.appendChild(link1);
	
	page.appendChild(container);
	return true;
}


function changeCopyRightDate() {
	var text = document.getElementById("footer").innerHTML;
	var searchString = /\d\d\d\d-\d\d\d\d/;
	var date = new Date();
	var year = date.getFullYear();
	// var replaceText = (year.toString() + "-" + (year+1).toString());
	var newText = text.replace(searchString, year.toString());
	document.getElementById("footer").innerHTML = newText;
	return true;
}

function changePrivacyPolicyLink() {
	var text = document.getElementById("footer").innerHTML;
	var searchString = "http://www.ditechnetworks.com/aboutDitech/copyright.html";
	var replaceText = "http://www.ditechnetworks.com/privacy.html";
	var newText = text.replace(searchString, replaceText);
	document.getElementById("footer").innerHTML = newText;
	return true;
}

$('document').ready(function() {
					menu.init();
					addTrusteSeal();
					changeCopyRightDate();
					changePrivacyPolicyLink();
});