//	default.js
//	window resizer from various sources
//	customised by mr.snow@laudanum.net

			var isMac, isWin, isNS, isIE, isSafari
			var canPrint = 1
			var default_title = " // House of Laudanum"
						
			if(navigator.platform)
				if(navigator.platform.toLowerCase().indexOf("mac") > -1) isMac = 1
				
			if(navigator.platform)
				if(navigator.platform.toLowerCase().indexOf("wind") > -1) isWin = 1
				
			if(navigator.appName)
				if(navigator.appName.toLowerCase().indexOf("netscape") > -1) isNS = 1
				
			if(navigator.appName)
				if(navigator.appName.toLowerCase().indexOf("explorer") > -1) isIE = 1
				
			if(navigator.appVersion)
				if(navigator.appVersion.toLowerCase().indexOf("safari") > -1)
					isSafari = 1
				
				
			if(isMac && isNS) canPrint = 0
			
			var win, win_w, win_h

			default_title  = 'impermanent.audio'
			
			
			
			function openWindow(Url, width, height, scrolling, title) {
				content = ''
				if(scrolling == '' || scrolling) scrolling = 'yes'
				else	scrolling = 'no'
					
				if(Url.indexOf(".html") < 0) {			//	its not html
					content = "<html><head><title>"
					content += title + default_title
					content += "</title>"
					
					if(!isIE)
						content += "<script>modw =(parseInt(self.outerWidth) - parseInt(self.innerWidth)); modh =(parseInt(self.outerHeight) - parseInt(self.innerHeight)); function resize(that) { mw = parseInt(that.width) + modw; mh = parseInt(that.height) + modh; window.status = mw + ', ' + mh; window.resizeTo(mw,mh); }</script>"
					else
						content += "<script>function resize(that) { window.resizeTo(" + width + "," + height + ");  modw=" + width + "-(document.body.clientWidth-that.width); modh=" + height + "-(document.body.clientHeight-that.height); window.resizeTo(modw,modh) }</script>"
			//			content += "<script>function resize(that) { window.resizeTo(parseInt(that.width),parseInt(that.height)); }</script>"
			
					content += "</head><body bgcolor=white marginwidth=0 marginheight=0 leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>"
					content += "<img onLoad='window.resize(this);window.focus()' src=" + Url + ">"
			//		content += "<img onLoad='resizeImageWindow(this)' src=" + Url + " width=" + width + " height=" + height + ">"
					content += "</body></html>"
					scrolling = "no"
					Url = ""
				}
			
				if(!win || win.closed) {
					eval ("win = open('" + Url + "', 'win', 'width=" + width + ",height=" + height + ",toolbar=no,status=no,resizable=yes,location=no,menubar=no,scrollbars=" + scrolling + ",titlebar=no,status=yes')")
					win.moveTo(0,0)
				}
				if(content != "") {
					win.document.open()
					win.document.writeln(content)
					win.document.close()
				}
				win.document.title = title
				win.focus()
				
				win_w = width
				win_h = height
				
			}


			curX = curY = 0
			byX = byY = s = t = 0
			steps = 100
			delay = 10
			var target = self
			var isScrollTo,isScroll

			var steps = 20
			if (isNS && !isSafari) steps = steps * 5		//	if ns slow down scrolling			

			function scroller(x,y,which) {
				target = which
				if(document.body) {
					curX = which.document.body.scrollLeft
					curY = which.document.body.scrollTop
				}
				else {
					curX = which.pageXOffset
					curY = which.pageYOffset
				}
				
				s = 0
				isScrollTo = true
				
				byX = parseInt((x - curX) / steps)
				byY = parseInt((y - curY) / steps)
				stepper(curX,curY)
			}
			
			
			function stepper() {
					clearTimeout(t)
					if( s < steps ) {
						curX += byX
						curY += byY
						
						scroll_me(curX,curY)
						window.status = 'x ' + curX + ' y ' + curY
						s++
						t = setTimeout('stepper()',delay)
					}
			}
			
			
			function scroll_me(curX,curY) {
						if(isScrollTo)
							target.scrollTo(curX, curY)
						
						else
							if(isScroll)
								target.scroll(curX, curY)						
					
			}			


			function unhideEmail(email, inline) {
				//	v0.3
				
				//	array of things to find
				find = new Array()
				replace = new Array()
				
				find[0] 	= "\\s*\\[\\s*dot\\s*\\]\\s*"
				replace[0] 	= '.'
				find[1] 	= "\\s*\\[\\s*at\\s*\\]\\s*"
				replace[1] 	= '@'
			
				for ( i = 0; i < find.length; i++ ) {
					eval("regexp = /" + find[i] + "/ig")
					email = email.replace(regexp, replace[i])
				}
				
				if(inline)
					return email
				else {
					if ( email.indexOf('mailto') < 0 ) 
						email = 'mailto:'  + email
					location.href = email
				}
			}
			
			
			

