// brendandawes.com code library// hacked from various sources including k10k, newstoday and others// CHECK CLIENT BROWSER & PLATFORM// original code from http://developer.apple.com/internet/_javascript///// USAGE:	browserNaming();// NOTES:	call it from within an external JS document// RESULT:	browserNew = true/false//			browserName = IE/NS/Opera//			browserNameLong = IE5/etc//			Macintosh = true/false// WORKS:	everything	var its;	var browserName;	var browserNameLong;	var browserNew;	var preloadFlag = false;	var Macintosh = navigator.userAgent.indexOf('Mac')>0;	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;		}	// POPUP CENTERED WINDOW (FIXES THE IE4/MAC PROBLEM WHICH MAKES WINDOWS TOO SMALL)// USAGE:	<a href="#" onclick="spawnWindow('newpage.html','windowname',400,384,'no');">// NOTES:	substitute 400 with the width, 384 with the height, windowname with the name of the new window, scroll with either 'yes', 'no' or 'auto'// WORKS:	ie4+, ns4+, opera5	function spawnWindow(desktopURL,windowName,width,height,scroll) { 		if (Macintosh) { 			if (browserNameLong == "IE4") {				newheight = parseInt(height + 17);			}			else if (browserNameLong == "IE4.5") {				newheight = parseInt(height + 17);			}			else {				newheight = height;			} 		} 		else { newheight = height; }	 		// WORK OUT CENTER 		var winl = (screen.width - width) / 2;		var wint = (screen.height - newheight) / 2; 		window.open(desktopURL, windowName, "top="+wint+",left="+winl+",toolbar=no,location=no,status=yes,menubar=no,scrollbars="+scroll+",width="+width+",height="+newheight+",resizable=no" );	}	// LAUNCH WINDOW TO VIEW HEADSHOP PROJECTS// APENDS THE PHP URL TO THE FRONT OF THE PASSED URL// THEN CALLS THE SPAWNWINDOW FUNCTION ABOVE	function viewHeadshop (desktopURL,windowName,width,height,scroll,localTest) {	if (localTest == "yes") {		newURL = "downloads/"+desktopURL;		spawnWindow(newURL,windowName,width,height,scroll);		} else {		newURL = "/php/headshopview.php?url=/headshop/downloads/" + desktopURL+"&width="+width+"&height="+height;		spawnWindow(newURL,windowName,width,height,scroll);		}	}			function viewPopup (desktopURL,windowName,width,height,scroll,localTest) {	if (localTest == "yes") {		newURL = "downloads/"+desktopURL;		spawnWindow(newURL,windowName,width,height,scroll);		} else {		newURL = "/php/headshopview.php?url=" + desktopURL+"&width="+width+"&height="+height;		spawnWindow(newURL,windowName,width,height,scroll);		}	}		// MACROMEDIA SCRIPTS	function MM_findObj(n, d) { //v3.0  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;}/* Functions that swaps images. */function MM_swapImage() { //v3.0  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}}function MM_swapImgRestore() { //v3.0  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;}/* Functions that handle preload. */function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}}function MM_openBrWindow(theURL,winName,features) { //v2.0  window.open(theURL,winName,features);}