// CHECK CLIENT BROWSER & PLATFORM
// Works: IE4+, NS4+, Opera

	var its;
	var browserName = '';
	var browserNameLong = '';
	var browserNew = '';
	var preloadFlag = false;
	var Macintosh = navigator.userAgent.indexOf('Mac')>0;
	
	function showStatus(statustext) {
		window.status = statustext;
	}

	function its() {
		var n = navigator;
		var ua = ' ' + n.userAgent.toLowerCase();
		var pl = n.platform.toLowerCase();
		var an = n.appName.toLowerCase();

		// browser version
		this.version = n.appVersion;
		this.nn = ua.indexOf('mozilla') > 0;

		// 'compatible' versions of mozilla aren't navigator
		if(ua.indexOf('compatible') > 0) {
			this.nn = false;
		}
		
		this.opera = ua.indexOf('opera') > 0;
		this.ie = ua.indexOf('msie') > 0;
		this.major = parseInt( this.version );
		this.minor = parseFloat( this.version );

		// platform
		this.mac = ua.indexOf('mac') > 0;
		this.win = ua.indexOf('win') > 0;

		// workaround for IE5 which reports itself as version 4.0
		if(this.ie) {
			if(ua.indexOf("msie 5") > 1) {
			var msieIndex = navigator.appVersion.indexOf("MSIE") + 5;
			this.major = parseFloat(navigator.appVersion.substr(msieIndex,3));
			}
		}

		return this;
	}

	function browserNaming() {
		its = new its();
		
		// is it a DOM-enabled browser?
		if (!document.getElementById) {
			browserNew = false;
		}
		else {
			browserNew = true;
		}

		// need the name, too
		if (its.opera) {
			browserName = "Opera";
		}
		else if (its.ie) {
			browserName = "IE";
		}
		else {
			browserName = "NS";
		}

		// and the number
		browserNameLong = browserName + its.major;
	}
	

// PRELOADING THE MOUSEOVER IMAGES
// Works: IE4+, NS4+, Opera

	function createObj(imgName,imgSrc) {
		if (loadingFlag) {
			eval(imgName + ' = new Image()');
			eval(imgName + '.src = "' + imgSrc + '"');
			return imgName;
		}
	}
	

// MOUSEOVER IMAGE SWITCHING
// Works: IE4+, NS4+, Opera
// Notes: NS4 needs the DIV-name in there if image is in a DIV

	function chImg(layer,imgName,imgObj) {
		if (preloadFlag) {
			if (browserNew) {
				document.getElementById(imgName).src = eval(imgObj+'.src');
			}
			if ((!browserNew) && (browserName == "NS") && (layer!=null)) {
				eval('document.'+layer+'.document.images["'+imgName+'"].src = '+imgObj+'.src');
			}
			else {
				document.images[imgName].src = eval(imgObj+'.src');
			}
		}
	}


// POPUP WINDOW
// Works: IE4+, NS4+, Opera
// Notes: IE4/IE4.5 for the mac spawns windows 17px too short

	function winOpen(desktopURL,windowName,width,height) {
		if ((Macintosh) && ((browserNameLong == "IE4") || (browserNameLong == "IE4.5"))) {
 			var newheight = parseInt(height + 17);
		}
		else {
			var newheight = height;
		}
		window.open(desktopURL,windowName,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=1,width='+width+',height='+newheight+',resizable=0');
	}


	function winOpen2(desktopURL,windowName,width,height) {
 		window.open(desktopURL,windowName,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,width='+width+',height='+height+',resizable=0');
	}
	

	
// REMOVES THE LINK BORDER IN IE4+, NS6
// Works: IE4+, NS6+
// Notes: In NS6 the select tags are not blurred

	function unblur() {
		this.blur();
	}

	function getLinksToBlur() {
		if ((browserNew) || (browserName == "IE")) {
			if (browserNew) {
				links = document.getElementsByTagName("a");
			}
			else {
				links = document.all.tags("a");
			}
			for(i=0; i<links.length; i++) {
				links[i].onfocus = unblur
			}
		}
		if (browserName == "IE") {
			if (browserNew) {
				drops = document.getElementsByTagName("select");
			}
			else {
				drops = document.all.tags("select");
			}
			for(i=0; i<drops.length; i++) {
				drops[i].onfocus = unblur
			}
		}
	}


// DOM / GET PROPERTY
// Works: IE5+, NS6+, Opera

	function getIdProperty(id,property) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
				if (styleObject[property]) {
					return styleObject[ property ];
				}
			}
		return (styleObject != null) ?
		styleObject[property] :
		null;
	}


// DOM / SET PROPERTY
// Works: IE5+, NS6+, Opera

	function setIdProperty(id,property,value) {
		var styleObject = document.getElementById( id );
		if (styleObject != null) {
			styleObject = styleObject.style;
			styleObject[ property ] = value;
		}
	}



// FIXES THE OS X IFRAME DISPLAY PROBLEMS
// Notes: Only needed for IE5/mac under OS X

	function fix_OSX_IE_DisplayBug() {
		if ((Macintosh) && (browserName == 'IE') && (browserNew)) {
			try {
				objBody = document.getElementsByTagName("body");
				for (i=0; i < objBody.length; i++) {
					objBody[i].style.visibility = "hidden";
					objBody[i].style.visibility = "visible";
				}
			}
			catch(error) {
				// ignore error
			}
		}
	}

// ANTI-SPAM

	function antispam(name,domain) {
    	document.location = "mailto:" + name + "@" + domain;
	}

// POPUP IMAGE
function popImage(imageURL,imageTitle){
	var PositionX = 0;
	var PositionY = 0;
	var defaultWidth  = 500;
	var defaultHeight = 500;
	var AutoClose = true;
	if (parseInt(navigator.appVersion.charAt(0))>=4){
	var isNN=(navigator.appName=="Netscape")?1:0;
	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='location=no,scrollbars=no,width=150,height=200,left='+PositionX+',top='+PositionY;
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(240,240);');
	writeln('width=240-(document.body.clientWidth-document.images[0].width);');
	writeln('height=240-(document.body.clientHeight-document.images[0].height);');
	/*writeln('width=document.images[0].width;');
	writeln('if (parseInt(navigator.appVersion.charAt(22)) < 7) {');
	writeln('  height=document.images[0].height;}');
	writeln('else {height=document.images[0].height + 60;}');*/
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["myFoto"].width;');writeln('window.innerHeight=document.images["myFoto"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');
	writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
	else writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
	writeln('<img name="myFoto" src="'+imageURL+'" alt="'+imageTitle+'" style="display:block"></body></html>');
	close();
	}
}
