//	basic javascript functions

			var isMac, isWin, isNS, isIE
			var canPrint = 1
			
			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(isMac && isNS) canPrint = 0
			
			var imageWindow
			
			
			function doWhat() {
				args=location.search.substr(1).split('&')
				eval(args[0])
			}			
			
			
			function unhideEmail(email) {
				
				//	array of things to find
				find = new Array()
				replace = new Array()
				
				find[0] 	= "dot"
				replace[0] 	= '.'
				find[1] 	= 'at'
				replace[1] 	= '@'

				find[2]		=	"\\s*\\]+\\s*"
				replace[2]	=	""
				find[3]		=	"\\s*\\[+\\s*"
				replace[3]	=	""
								
								
				for ( i = 0; i < find.length; i++ ) {
					eval("regexp = /" + find[i] + "/ig")
					email = email.replace(regexp, replace[i])
				}
				if ( email.indexOf("mailto:") < 0)
					email = "mailto:" + email
				location.href = email
				
			}
			
			
			function print_me() {
			//	alert('printing')
			//	alert(text)
				args=location.search.substr(1).split('&')
				text = args[1]
				self.document.open()
				self.document.write(text)
				self.document.write("<br><br>")
	//			self.document.write(location.search)
				self.document.close()
			}
			


			var win, copy, which_layer, triedIt,Delay
			
			function imgErr(that) {
				window.status = that.src + ' does not exist'
					
				
				if (document.images) {
					old = that.src
					path = old.substring(0,old.length-4)
					
					if(!that.triedIt)
						that.triedIt = -1

					if(that.triedIt) {
						that.src = '/media/blank.gif'
						window.status = that.src
						return true
					}

					if(that.src.indexOf('.gif') > -1) {
						that.src = path + '.jpg'
						that.triedIt++
						window.status = that.src
						return false
					}
					
					if(that.src.indexOf('.jpg') > -1) {
						that.src = path + '.gif'
						that.triedIt++
						window.status = that.src
						return false
					}			
				}
				return false
			}



function imageWindow(Url, width, height,scroll) {
	if(!win || win.closed == true) 
		openWindow(Url, width, height,scroll)
	else {
		win.close()
		openWindow(Url, width, height,scroll)
	}
	openWindow(Url, width, height,scroll)
}


function openWindow(Url, width, height, scroll) {

	content =""
			
	if(!scroll) scroll = "yes"
	
	if(Url.indexOf(".html") < 0) {			//	its not html
		content = "<html><head><title>Mandeno House</title></head><body bgcolor=black marginwidth=0 marginheight=0 leftmargin=0 rightmargin=0 topmargin=0 bottommargin=0>"
		content += "<img src=" + Url + " width=" + width + " height=" + height + ">"
		content += "</body></html>"
		scroll = "no"
		Url = ""
	}
	
	if(!win || win.closed == true )
		eval ("win = open('" + Url + "', 'win', 'width=" + width + ",height=" + height + ",toolbar=no,status=no,resizable=yes,location=no,menubar=no,scrollbars=" + scroll + ",titlebar=no,status=yes')")
	else 
		win.location.href = Url
		
	if(content != "") {
		win.document.open()
		win.document.writeln(content)
	}
	
	win.resizeTo(width,height)
	
	win.focus()
	
}
	
		
function oldOpenWindow(Url, width, height,scroll) {
	if(!scroll) scroll = "yes"
	if(!win || win.closed == true ) {
		eval ("win = open('" + Url + "', 'win', 'width=" + width + ",height=" + height + ",toolbar=no,status=no,resizable=yes,location=no,menubar=no,scrollbars=" + scroll + ",titlebar=no,status=yes')")
	}
	else 
		win.location.href = Url
	win.focus()
}

//	swap between included style sheets

function printable() {
	if(!canPrint) {
		alert("This button has no function in " + navigator.appName + " for " + navigator.platform)
		return
	}
	selectStyle(1)
	if(window.print)
		window.print()
		
	return
}



function gifSwap(which, suffix, which_layer) {
	if(document.images) {
		if(which_layer && document.layers) {
			that = document.layers[which_layer].document.images[which]
		}
		else
			that = document.images[which]
		temp = that.src
		parts = temp.split('/')
		parts[parts.length-1] = which + suffix + '.gif'
		path = parts.join('/')
		that.src = path
	}
}

function imgSwap(which, file, which_layer) {
	if(document.images) {
		if(which_layer && document.layers) {
			that = document.layers[which_layer].document.images[which]
		}
		else
			that = document.images[which]
		if((!that.src) || (!that)) {
			return false
		}
		else {
			temp = that.src
			parts = temp.split('/')
			parts[parts.length-1] = file
			path = parts.join('/')
			that.src = path
		}
	}
}


function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


/*
//old version of mm_showhidelayers

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;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

*/
