function popWin(where, height, width) {
	window.open(where, 'popWindow', 'height=' + height + ',width=' + width + ',locationbar=no,statusbar=no,menubar=no,scrollbars=yes')
}

var resizeIframe = false
onresize = resizeIt
onload = resizeIt

function resizeIt() {
	window.status = resizeIframe
	if (document.getElementById && resizeIframe) {
		
		var d = document.getElementById(resizeIframe)
		var w = window.iframeContent
		
		var b = document.body.clientHeight
		
		var dPos = getAbsolutePos(d)
		
		var offset = 5 // bottom offset between iframe and bottom
		
		//window.status = (b - dPos.y - offset) + "!"
		
		//window.status = d.style.height + "!"
		d.style.height = b - dPos.y - offset
		
		
	}
}

function browserObj() {
	this.platform = ''
	this.version = 0
	this.isNav4 = false
	this.isNav6 = false
	this.isIE4 = false
	this.isMajor = false
	this.isMinor = false
	
	if (navigator.appVersion.indexOf('Mac') != -1) {
		this.platform = "mac"
	} else {
		this.platform = "pc"
	}
	
	//var isNav4, isNav6, isIE4, isMajor, isMinor;
	if ((navigator.appName.indexOf('Netscape') != -1)) {
		if (navigator.appVersion.charAt(0) > "4") {
			this.version = 6
			this.isNav6 = true
			this.isMajor = true
		} else {
			this.version = 4
			this.isNav4 = true;
			this.isMinor = true
		}
	} else {
		uA = navigator.userAgent.toLowerCase()
		ind = uA.indexOf("msie")
		uA = uA.substr(ind, uA.length)
		ind = uA.indexOf(";")
		uA = parseFloat(uA.substr(0, ind).replace("msie", ""))
		if (uA >= 5) {
			this.version = uA
			this.isMajor = true
		} else {
			this.version = uA
			this.isIE4 = true;
			this.isMinor = true
		}
	}
}

var browserProps = new browserObj()

function getAbsolutePos (who) {
	x = 0, y = 0
	
	if (!browserProps.isNav4) {
		while (who.offsetParent != null) {
	
			x += who.offsetLeft
			y += who.offsetTop
			who = who.offsetParent
	
		}

		x += who.offsetLeft
		y += who.offsetTop
	} else {
		x = who.x
		y = who.y
	}
	
	point = new pointObj(x, y)
	return point
}

function pointObj(x, y) {
	this.x = x
	this.y = y
	this.toString = function() {
		'x:' + this.x + ',y:' + this.y
	}
}

var browserProps = new browserObj()

function buildSwf(name, height, width, bg) {
	//alert('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"\ WIDTH="' + width + '" HEIGHT="' + height + '" id="' + name.replace(/\.swf/gi, '') + '" ALIGN=""><PARAM NAME=movie VALUE="loader.swf?name=' + name + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#' + bg + '> <EMBED src="loader.swf?name=' + name + '" quality=high bgcolor=#' + bg + '  WIDTH="' + width + '" HEIGHT="' + height + '" NAME="' + name.replace(/\.swf/gi, '') + '" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>\n')

	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"\ WIDTH="' + width + '" HEIGHT="' + height + '" id="' + name.replace(/\.swf/gi, '') + '" ALIGN=""><PARAM NAME=movie VALUE="' + name + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#' + bg + '> <EMBED src="' + name + '" quality=high bgcolor=#' + bg + '  WIDTH="' + width + '" HEIGHT="' + height + '" NAME="' + name.replace(/\.swf/gi, '') + '" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>\n')
	document.write('</OBJECT>')
}