/********************************************************************
Vricks Republic Publishing S&A
Beginning : 2009-08-19
Final : 2009-09-04
*********************************************************************/
var ran = Math.floor(Math.random()*100000000);

//main flash
function embedSwfMain(embedSwf, swfWidth, swfHeight, swfId, pageCode) {
	var flashPath = "/flash/00_main/";
	var swfPath = flashPath + "common/swf/";
	var xmlPath =  "/xml/";
	var sessionPath = "/xml/session.php";
	var newsUpdateXmlPath = "/xml/newsUpdate.php";
	var videoPlayListXmlPath = "/xml/videoPlayList.php";
	var characterXmlPath = "/xml/character.xml";
	var linkURL = '/test/hahaha/';
	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + flashPath + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="ran=' + ran + '&swfPath=' + swfPath + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&sessionPath=' + sessionPath + '&newsUpdateXmlPath=' + newsUpdateXmlPath + '&videoPlayListXmlPath=' + videoPlayListXmlPath + '&characterXmlPath=' + characterXmlPath + '" />\n';
	flashValue += '<embed src="' + flashPath + embedSwf + '" quality="high" wmode="opaque" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&swfPath=' + swfPath + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&sessionPath=' + sessionPath + '&newsUpdateXmlPath=' + newsUpdateXmlPath + '&videoPlayListXmlPath=' + videoPlayListXmlPath + '&characterXmlPath=' + characterXmlPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	document.write(flashValue);
}

//gnb flash
function goLogin(userID,userPW){
	//alert("goLogin1: "+userID+" & "+userPW);
	document.getElementById('frmLogin').email.value = userID;
	document.getElementById('frmLogin').pwd.value = userPW;
	//alert("goLogi2: "+userID+" & "+userPW);

	document.getElementById('frmLogin').submit();

	//alert("goLogin1: "+userID+" & "+userPW);
}
function goLogout(){
	window.location.href = "/utility/logout_process.php";
}

function embedSwfGNB(embedSwf, swfWidth, swfHeight, swfId, xmlPath, sessionPath, pageCode) {
	var flashValue = makeSwfGNB(embedSwf, swfWidth, swfHeight, swfId, xmlPath, sessionPath, pageCode);
	document.write(flashValue);
}
function embedSwfGNBTo(embedSwf, swfWidth, swfHeight, swfId, xmlPath, sessionPath, pageCode, targetId) {
	var flashValue = makeSwfGNB(embedSwf, swfWidth, swfHeight, swfId, xmlPath, sessionPath, pageCode);
	var oTarget = document.getElementById(targetId);
	oTarget.innerHTML = flashValue;
}
function makeSwfGNB(embedSwf, swfWidth, swfHeight, swfId, xmlPath, sessionPath, pageCode) {
	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="ran=' + ran + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&sessionPath=' + sessionPath + '" />\n';
	flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&sessionPath=' + sessionPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	return flashValue;
}

//lnb flash
//if pagecode == "02000000"
function sendLetter(email){
	alert(email);
}

function embedSwfLNB(embedSwf, swfWidth, swfHeight, swfId, xmlPath, fansiteKitURL, pageCode) {
	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="ran=' + ran + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&fansiteKitURL=' + fansiteKitURL + '" />\n';
	flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&xmlPath=' + xmlPath + '&pageCode=' + pageCode + '&fansiteKitURL=' + fansiteKitURL + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	document.write(flashValue);
}

//videosimpleplayer flash
function embedSwfVideoSimplePlayer(embedSwf, swfWidth, swfHeight, swfId, flvPath) {
	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="ran=' + ran + '&flvPath=' + flvPath + '" />\n';
	flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&flvPath=' + flvPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	document.write(flashValue);
}

//mediaplayer flash
function makeSwfMediaPlayer(embedSwf, swfWidth, swfHeight, swfId, xmlPath) {
	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="ran=' + ran + '&xmlPath=' + xmlPath + '" />\n';
	flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&xmlPath=' + xmlPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	return flashValue;
}
function embedSwfMediaPlayerTo(embedSwf, swfWidth, swfHeight, swfId, xmlPath, targetId) {
	var flashValue = makeSwfMediaPlayer(embedSwf, swfWidth, swfHeight, swfId, xmlPath, targetId);
	var oTarget = document.getElementById(targetId);
	oTarget.innerHTML = flashValue;
}
function embedSwfMediaPlayer(embedSwf, swfWidth, swfHeight, swfId, xmlPath) {
	var flashValue = makeSwfMediaPlayer(embedSwf, swfWidth, swfHeight, swfId, xmlPath, targetId);
	document.write(flashValue);
}

function embedSwfVideoPlayerLarge(embedSwf, swfWidth, swfHeight, swfId, xmlPath) {
	var flashValue = makeSwfVideoPlayerLarge(embedSwf, swfWidth, swfHeight, swfId, xmlPath);
	document.write(flashValue);
}
function embedSwfVideoPlayerLargeTo(embedSwf, swfWidth, swfHeight, swfId, xmlPath, targetId) {
	var flashValue = makeSwfVideoPlayerLarge(embedSwf, swfWidth, swfHeight, swfId, xmlPath);
	var oTarget = document.getElementById(targetId);
	oTarget.innerHTML = flashValue;	
}
function makeSwfVideoPlayerLarge(embedSwf, swfWidth, swfHeight, swfId, xmlPath) {
	var flashValue = "";
	if(document.all){
		flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="videoPlayerLarge" name="videoPlayerLarge">\n';
		flashValue += '<param name="allowScriptAccess" value="always" />\n';
		flashValue += '<param name="allowFullScreen" value="true" />\n';
		flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
		flashValue += '<param name="quality" value="high" />\n';
		flashValue += '<param name="wmode" value="transparent" />\n';
		flashValue += '<param name="FlashVars" value="ran=' + ran + '&xmlPath=' + xmlPath + '" />\n';
		
		flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="videoPlayerLarge" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&xmlPath=' + xmlPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
		flashValue += '</object>\n';
	}else{
		//alert("firefox")
		flashValue += '<embed src="' + embedSwf + '" wmode="transparent" bgcolor="#000000" quality="high" width="' + swfWidth + '" height="' + swfHeight + '" name="videoPlayerLarge" allowScriptAccess="always" allowFullScreen="true" FlashVars="ran=' + ran + '&xmlPath=' + xmlPath + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" id="videoPlayerLarge" name="videoPlayerLarge" />\n';
		flashValue += '</object>\n';
	}
	return flashValue;
}

//musicplayer flash
function embedSwfMusicPlayer(embedSwf, swfWidth, swfHeight, swfId, midx) {

	var musicXmlPath = "/xml/music.xml.php";
	if(typeof(midx)!='undefined')
		var currentPlayIndex = midx;
	else
		var currentPlayIndex = Math.floor(Math.random() * 4)+6;

	var flashValue = "";
	flashValue += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="' + swfWidth + '" height="' + swfHeight + '" id="' + swfId + '">\n';
	flashValue += '<param name="allowScriptAccess" value="always" />\n';
	flashValue += '<param name="allowFullScreen" value="true" />\n';
	flashValue += '<param name="movie" value="' + embedSwf + '" />\n';
	flashValue += '<param name="quality" value="high" />\n';
	flashValue += '<param name="wmode" value="transparent" />\n';
	flashValue += '<param name="FlashVars" value="musicXmlPath='+musicXmlPath+'&currentPlayIndex='+currentPlayIndex+'" />\n';
	flashValue += '<embed src="' + embedSwf + '" quality="high" wmode="transparent" width="' + swfWidth + '" height="' + swfHeight + '" name="'+ swfId +'" allowScriptAccess="always" allowFullScreen="true" FlashVars="musicXmlPath='+musicXmlPath+'&currentPlayIndex='+currentPlayIndex+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />\n';
	flashValue += '</object>\n';
	document.write(flashValue);
}


function thisMovie(movieName) {
	if(window[movieName])
		return window[movieName];
	if(document[movieName])
		return document[movieName];
	return document.getElementById(movieName);
	
}
