
// Function for transparency
function transparency(element, percentage) {
	var i, count, objStyle;
	if(document.getElementById) {
		if(typeof(element) == "object" && element) {
			obj = element;
		}
		else if (document.getElementsByName(element) && document.getElementsByName(element)[0]) {
			obj = document.getElementsByName(element);
		}
  		else if (document.getElementById(element)) {
  			obj = document.getElementById(element);
  		}
  		else if (document.getElementsByTagName && document.getElementsByTagName(element) && document.getElementsByTagName(element)[0]) {
  			obj = document.getElementsByTagName(element);
  		}
  		else {
  			obj = false;
  		}
		if(obj) {
			percentage=(typeof(percentage)=="undefined") ? 50:100 - percentage;
			count=(obj.length) ? obj.length:1;
			for(i = 0; i < count; i++) {
				objStyle = (obj.length) ? obj[i].style:obj.style;
				objStyle.filter = "Alpha(opacity=" + percentage + ")";
				objStyle.KTHMLOpacity = "" + percentage/100;
				objStyle.MozOpacity = "" + percentage/100;
				objStyle.opacity = "" + percentage/100;
			}
		}
	}
}

// Function to prevent right click
function clickIE() {
	if (document.all) {
		return false;
	}
}

// Function to prevent right click
function clickIE() {
	if (document.all) {
		return false;
	}
}
function clickNS(e) {
	if (document.layers||(document.getElementById&&!document.all)) {
		if (e.which == 2||e.which == 3) {
			return false;
		}
	}
}
if (document.layers) {
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown = clickNS;
}
else{
	document.onmouseup = clickNS;
	document.oncontextmenu = clickIE;
}

// Status message
window.status = "Haardesign Pauli";

// Durin the XHMTL standard the "target" attribute is not supported anymore.
// Here we change all internal links marked by the attribute "rel" with the
// value "external" to the attribute "target" with the value "_blank".
function setupExternalLinks() {
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") {
			anchor.target = "_blank";
 		}
	}
}

// Function which call several other functions after loading the website.
function myOnLoad() {
	setupExternalLinks();
}

// On load
window.onload = myOnLoad;

// Pop-Up Window Photo
function myPhoto(strName) {
	var newwindow = window.open('./popups/' + strName + '.html', 'photo', 'width=640, height=528, location=0, menubar=0, toolbar=0, personalbar=0, status=0, scrollbars=0');
}
