//indexPage FlashMovie
//for Root Directory
//player version : v4 (flvplayer_v4.swf)

/* Function List...

	SFCS_GreateFlashMove(swfUrl, width, height, movUrl, imageUrl)
	getFlashMoveTag(TagID, width, height, movUrl, imageUrl)
	getFlashMoveTag_FromRootPath(playerUrl, TagID, width, height, movUrl, imageUrl)
	getRootDirectory()
	getCurrentDirectory()
*/

//Need [AC_RunActiveContent.js]
function SFCS_GreateFlashMove(swfUrl, width, height, movUrl, imageUrl)
{
	if(typeof(AC_FL_RunContent) != "function")
	{
		alert(" FlashMoviePlayer\n need include [AC_RunActiveContent.js]\n please check html tag!");
		return false;
	}

 AC_FL_RunContent(
    'id','indexPage_FlashMovie',
    'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0',
    'src',swfUrl,
    'width',width,
    'height',height,
    'quality','high',
    'allowfullscreen','true',
    'pluginspage','http://www.macromedia.com/go/getflashplayer',
    'movie',swfUrl,
    'flashvars','type=video&controlbar=over'
		+ '&width=' + width 
		+ '&height='+ height 
		+ '&backcolor=0xFFCCFF'
		+ '&usefullscreen=true'
		+ '&file=' + movUrl 
		+ '&image=' + imageUrl
 ); //end AC code
}

////Need [swfobject.js]
function getFlashMoveTag(TagID, width, height, movUrl, imageUrl)
{
	getFlashMoveTag_Detail(TagID, width, height, "_Flash/flvplayer_V4.swf", movUrl, imageUrl);
}

function getFlashMoveTag_Detail(TagID, width, height, playerUrl, movUrl, imageUrl)
{
	//movUrl's Path is Depend on playerUrl
	// "Movie Path" base on playerUrl
	// playerUrl is root for "Movie Path"
	// imagePath is base on HTML Page

	if(typeof(SWFObject) != "function")
	{
		alert(" FlashMoviePlayer\n need include [swfobject.js]\n please check html tag!");
		return false;
	}

	var so = new SWFObject(playerUrl, "indexPage_FlashMove", width, height, "9", "#FFFFFF");
	//so.addParam("allowfullscreen", "true");

	myFlashVars = 'type=video&controlbar=over'
		+ '&width=' + width 
		+ '&height='+ height 
		+ '&backcolor=0xFFCCFF'
		+ '&fullscreen=true'
		+ '&file=' + movUrl 
		+ '&image=' + imageUrl;

	so.addParam("flashvars", myFlashVars);
	so.addParam("allowfullscreen","true");
	so.addParam("wmode","opaque");

	if(document.getElementById(TagID))
		so.write(TagID);
	else
		alert("TagID not in page!!:[" + TagID + "]");
}

function getFlashMoveTag_FromRootPath(playerUrl, TagID, width, height, movUrl, imageUrl)
{
	var CurrentPath = getCurrentDirectory();

	var so = new SWFObject(CurrentPath + playerUrl, "indexPage_FlashMove", width, height, "9", "#FFFFFF");
	myFlashVars = 'type=video&controlbar=over'
		+ '&width=' + width
		+ '&height='+ height
		+ '&backcolor=0xFFCCFF'
		+ '&fullscreen=true'
		+ '&file=' + CurrentPath + movUrl
		+ '&image=' + CurrentPath + imageUrl;

	so.addParam("flashvars", myFlashVars);
	so.addParam("allowfullscreen","true");
	so.addParam("wmode","opaque");

	if(document.getElementById(TagID))
		so.write(TagID);
	else
		alert("TagID not in page!!:[" + TagID + "]");
}


function getRootDirectory()
{
	var locHref = location.href;
	var locArray = locHref.split("/");

    var dirTxt = locArray[0] + "//" + locArray[2] + "/";
    return dirTxt;
}

function getCurrentDirectory()
{
	var locHref = location.href;
	var locArray = locHref.split("/");

	/**´ú¸ÕlocArrayªº¤º®e**
	for(x in locArray)
	{
		document.write("locArray[");
		document.write(x+"]: ");
		document.write(locArray[x]+"<br />");
	}

	//locArray[0]: http:
	//locArray[1]: 
	//locArray[2]: localhost
	//locArray[3]: dir1
	//locArray[4]: dir2
	//locArray[5]: dir3
	//locArray[6]: xxx.html
    **/



    //delete locArray[locArray.length-1]; //remove filename(only path)
    locArray.pop(); //remove filename(only path)

    var dirTxt = locArray.join("/") + "/";
    return dirTxt;
}

