/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
function setFlashWidth(divid, newW){
	getElement(divid).style.width = newW + "px";
}
function setFlashHeight(divid, newH){
	//document.getElementById(divid).style.height = newH+"px";
	//alert("Hello");
	var currentH = parseInt(getElement('flashid').style.height);
	if(currentH < newH){
		nInterval = setInterval("increase("+newH+")", 1);
	}else{
		nInterval = setInterval("reduce("+newH+")", 1);
	}		
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
var nInterval = 0;
function increase(newH){
    var currentH = parseInt(getElement('flashid').style.height);
    if(currentH < newH){
		currentH += 40;
		getElement('flashid').style.height = currentH + "px";
		getElement('flashidswf').style.height = currentH + "px";
    } else {
        clearInterval(nInterval);
    }
}
function reduce(newH){
    var currentH = parseInt(getElement('flashid').style.height);
    if(currentH > newH){
		currentH -= 40;
	    getElement('flashid').style.height = currentH + "px";
		getElement('flashidswf').style.height = currentH + "px";
    } else {
        clearInterval(nInterval);
    }
}
function getElement(id){
	var ret = null;
	try {
		if(document.getElementById)
			if(document.getElementById(id))
				ret = document.getElementById(id);
		if(document.embeds)
			for(i = 0; i < document.embeds.length; i++)
				if(document.embeds[i].id == id || document.embeds[i].name == id)
					ret = document.embeds[i];
		if(document.applets)
			for(i = 0; i < document.applets.length; i++)
				if(document.applets[i].id == id || document.applets[i].name == id)
					ret = document.applets[i];
	} catch (e) {
		return ret;
	}
	return ret;
}

function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}