function Flash_Call(swf,widht,height){
quality = 'high';
scale = 'noscale';

document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" WIDTH="'+widht+'" HEIGHT="'+height+'" id="flash" ALIGN="middle"><PARAM NAME=movie VALUE="'+swf+'"><param name="salign" value="lt" /><PARAM NAME=quality VALUE='+quality+'><param name="scale" value="'+scale+'" /> <PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="'+swf+'" quality='+quality+' bgcolor=#FFFFFF scale='+scale+' salign="lt" WIDTH="'+widht+'" HEIGHT="'+height+'" NAME="flash" ALIGN="middle" TYPE="application/x-shockwave-flash"></EMBED></OBJECT>')
}

function redraw(id) {
	var obj = document.getElementById(id);
	setPos(id);
	fadeIn(obj.bgId, 70, 70);
	fadeIn(id, 100, 100);
}
function setPos(id) {
	var pObj = document.getElementById(id);

	var width = 0;
	var height = 0;
	var scroll = 0;
	if(document.documentElement.clientWidth) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} else if(document.body.clientWidth){
		width = document.body.clientWidth;
		width = document.body.clientHeight;
	} else {
		width = window.innerWidth;
		height = window.innerHeight;
	}
	scroll = (document.body.scrollTop || document.documentElement.scrollTop);

	var maxHeight = height;
	if (typeof document.documentElement.style.msInterpolationMode != "undefined") {
		//IE7
		if(document.documentElement.clientHeight && document.documentElement.clientHeight > maxHeight) {
			maxHeight = document.documentElement.clientHeight;
		}
		if(document.body.clientHeight && document.body.clientHeight > maxHeight) {
			maxHeight = document.body.clientHeight;
		}
		if(window.innerWidth && window.innerWidth > maxHeight) {
			maxHeight = window.innerWidth;
		}
		maxHeight -= scroll;
	}

	if(pObj.offsetWidth > width) {
		pObj.style.left = '0px';
	} else {
		pObj.style.left = ((width-pObj.offsetWidth)/2)+'px';
	}
	if(pObj.offsetHeight > height) {
		pObj.style.top = '0px';
	} else {
		pObj.style.top = ((height-pObj.offsetHeight)/2)+'px';
	}

	var baseObj = document.getElementById(pObj.baseId);
	baseObj.style.width=width+'px';
	baseObj.style.height=height+'px';
	baseObj.style.left = '0px';
	baseObj.style.top = scroll+'px';

	var bgObj = document.getElementById(pObj.bgId);
	bgObj.style.width=width+'px';
	bgObj.style.height=maxHeight+'px';
	bgObj.style.left = '0px';
	bgObj.style.top = scroll+'px';
}
function onPopup(base, bg, popup, url, text) {
	window.onscroll=function() {
		redraw(popup);
	};
	window.onresize=function() {
		redraw(popup);
	};

	document.getElementById(url).src = text;

	var pObj = document.getElementById(popup);
	if(!pObj.baseId) {
		pObj.baseId = base;
		pObj.bgId = bg;
	}

	var baseObj = document.getElementById(base);
	baseObj.style.zIndex = 100;
	baseObj.style.position="absolute";

	setPos(popup);

	fadeIn(bg, 70, 0);
	fadeIn(popup, 100, 0);
}
function closePopup(id) {
	window.onscroll=null;
	window.onresize=null;
	var obj = document.getElementById(id);
	fadeOut(id, 0, 100);
	fadeOut(obj.bgId, 0, 70);
	document.getElementById(obj.baseId).style.zIndex = -100;
}
function fadeIn(id, max, now) {
	var obj = document.getElementById(id);
	obj.style.visibility="visible";
	if(max > now) {
		var next = now + (max / 5);
		obj.style.filter = "alpha(opacity=" + next + ")";
		obj.style.opacity = next/100;
		setTimeout("fadeIn('"+id+"',"+max+","+next+")", 100);
	} else {
		obj.style.filter = "alpha(opacity=" + max + ")";
		obj.style.opacity = max/100;
	}
}
function fadeOut(id, min, now) {
	var obj = document.getElementById(id);
	if(min < now) {
		var next = now - ((100-min) / 5);
		obj.style.filter = "alpha(opacity=" + next + ")";
		obj.style.opacity = next/100;
		setTimeout("fadeOut('"+id+"',"+min+","+next+")", 100);
	} else {
		if(min <= 0) {
			obj.style.visibility="hidden";
		} else {
			obj.style.filter = "alpha(opacity=" + min + ")";
			obj.style.opacity = min/100;
		}
	}
}
