/* 
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 resizeFlashObject(divid, newW, newH){

try

{

if(newW > 1000)

{

parent.hideAll();

newW = parent.frameW;

newH = parent.frameH;

}

else

parent.showAll();

}catch(e){

//alert("Maximize is not available with this view.");

}

document.getElementById(divid).style.width = newW;

document.getElementById(divid).style.height = newH;

}

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;
}

// Write the Flash Object (HTML)-------------------------------------------
function renderFlashObj(myMovie, myMovieID, myDivID, myFocus, myBGColor, myWidth, myHeight, myScale, myAlign, mySAlign, myWMode, myVars, myAccess, myMenu, myDisplay) {
	var openWrapper = "<p><textarea rows=\"20\" name=\"uiOutput\" cols=\"150\">";
	myMovie += "?" + location.search.substring(1,location.search.length); // Adds querystring to flash movie

	var flashString = "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0\" width=\"" + myWidth + "\" height=\"" + myHeight + "\" id=\"" + myMovieID + "\" align=\"" + myAlign + "\">\n";
	flashString += "<param name=\"allowScriptAccess\" value=\"" + myAccess + "\" />\n";
	flashString += "<param name=\"movie\" value=\"" + myMovie + "\" />\n";
	flashString += "<param name=\"quality\" value=\"high\" />\n";
	flashString += "<param name=\"wmode\" value=\"" + myWMode + "\" />\n";
	flashString += "<param name=\"bgcolor\" value=\"" + myBGColor + "\" />\n";
	flashString += "<param name=\"scale\" value=\"" + myScale + "\" />\n";
	flashString += "<param name=\"salign\" value=\"" + mySAlign + "\" />\n";
	flashString += "<param name=\"menu\" value=\"" + myMenu + "\" />\n";
	flashString += "<param name=\"FlashVars\" value=\"" + myVars + "\" />\n";
	flashString += "<embed src=\"" + myMovie + "\" quality=\"high\" scale=\""+ myScale + "\" wmode=\"" + myWMode + "\" bgcolor=\""+ myBGColor + "\" width=\"" + myWidth + "\" height=\"" + myHeight + "\" name=\"" + myMovieID + "\" align=\"" + myAlign + "\" salign=\"" + mySAlign + "\" menu=\"" + myMenu + "\" FlashVars=\"" + myVars + "\" allowScriptAccess=\"" + myAccess + "\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />\n";
	flashString += "</object>\n";

	var closeWrapper = "</textarea></p>";

	var flashObj = (typeof myDivID=="string")?document.getElementById(myDivID):myDivID;
	// Write it!
	if(myDisplay) {
		flashObj.innerHTML  = (openWrapper+flashString+closeWrapper); // Use this to view code
	} else {
		flashObj.innerHTML  = (flashString);  // Use this to display movie
		if(myFocus) {
		    flashObj.focus(); // Use this to bring focus to the movie
		}
	}
}
function getSWFObj(myMovieID) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	return (isIE) ? window[myMovieID] : document[myMovieID];
}
// Done
