﻿/*Adapted from: http://jdstiles.com/java/snippets.html*/

if (document.all) { 
	document.oncontextmenu = function () { 
		return false; 
	} 
} 
else { 
	document.captureEvents(Event.KEYDOWN); 
} 

if (document.layers) { 
	try { document.captureEvents(Event.MOUSEDOWN); } catch(e) { ; }
	document.onmousedown=mousedownAction; 
} 
else { 
	try { document.captureEvents(Event.MOUSEUP); } catch(e) { ; }
	document.onmouseup=mousedownAction; 
} 

document.onkeydown=nobutton; 

function mousedownAction(e) {
	if (!e) e = window.event;
	var el = (typeof e.target != "undefined") ? e.target : e.srcElement;
	try { renewCookie(); } catch(e) { ; }
	if (document.layers) { 
		if (e.which>1) { 
			return false; 
		} 
		else {
			runIfProductNavigator(el);
		}
	} 
	else if (document.getElementById) { 
		if (e.button>1) { 
			e.preventDefault(); 
			return false; 
		} 
		else {
			runIfProductNavigator(el);
		}
	} 
	return true; 
}
/*
function right(e) { 
	try { renewCookie(); } catch(e) { ; }
	if (document.layers) { if (e.which>1) { return false; } } 
	else if (document.getElementById) { if (e.button>1) { e.preventDefault(); return false; } } 
	return true; 
} 
*/
function runIfProductNavigator(node) {
	var thisNode=node;
	var array=['Menu'];
	for (var a in array) {
		if (hasParentWithClassName(node,array[a])) {
			var hierarchy=[];
			while (node.className.indexOf(array[a])==-1) {
				hierarchy.push(node.title);
				try { node=node.parentNode.parentNode; }
				catch(e) { break; }
			}
			GoToPage(hierarchy.reverse(), thisNode);
		}
	}
}
function nobutton(e) { 
	try { renewCookie(); } catch(e) { ; }
	if (!e) e = window.event;
	(document.all) ? kCode=event.keyCode : kCode=e.which; 
	if (kCode==93) { return false; } 
	return true; 
} 

document.oncontextmenu = function() { return false }
