// Code by AshzFall. 
// www.ashzfall.com/flash/fscomlib/index.html

var agt=navigator.userAgent.toLowerCase();
var InternetExplorer = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

var returnVar=null;
var returnPlayStatus=null;
var returnPercentLoaded=null;
var returnCurrentFrameNumber=null;
var returnCurrentFrameLabel=null;
var returnPropString=null;
var returnPropNumber=null;

flashObj=new Array();
a=new Array(10);
w=new Array();
w[0]=window.opener;

function playMovie(objNum) {
	flashObj[objNum].Play();
}

function rewindMovie(objNum) {
	flashObj[objNum].Rewind();
}

function stopMovie(objNum) {
	flashObj[objNum].StopPlay();
}

function playTargetMovie(curTarget,objNum) {
	flashObj[objNum].TPlay(curTarget);
}

function stopTargetMovie(curTarget,objNum) {
	flashObj[objNum].TStopPlay(curTarget);
}

function loadedPercent(objNum) {
	returnPercentLoaded=flashObj[objNum].PercentLoaded();
	return returnPercentLoaded;
}

function currentFrameNumber(curTarget,objNum) {
	returnCurrentFrameNumber=flashObj[objNum].TCurrentFrame(curTarget)+1;
	return returnCurrentFrameNumber;
}

function currentFrameLabel(curTarget,objNum) {
	returnCurrentFrameLabel=flashObj[objNum].TCurrentLabel(curTarget);
	return returnCurrentFrameLabel;
}

function playStatus(objNum) {
	returnPlayStatus=flashObj[objNum].IsPlaying();
	return returnPlayStatus;
}

function movieLoad(layerNum,movieURL,objNum) {
	flashObj[objNum].LoadMovie(layerNum,movieURL);
}

function goToFrameNumber(curFrame,objNum) {
	curFrame--;
	flashObj[objNum].GotoFrame(curFrame);
}

function goToTFrameNumber(curTarget,curFrame,objNum) {
	curFrame--;
	flashObj[objNum].TGotoFrame(curTarget,curFrame);
}

function goToFrameLabel(curTarget,curFrame,objNum) {
	flashObj[objNum].TGotoLabel(curTarget,curFrame);
}

function callFrameNumber(curTarget,curFrame,objNum) {
	curFrame--;
	flashObj[objNum].TCallFrame(curTarget,curFrame);
}

function callFrameLabel(curTarget,curFrame,objNum) {
	flashObj[objNum].TCallLabel(curTarget,curFrame);
}

function zoomIt(curPercent,objNum) {
	flashObj[objNum].Zoom(parseInt(curPercent));
}

function panIt(curX,curY,zoomMode,objNum) {
	flashObj[objNum].Pan(curX,curY,zoomMode);
}

function setZoom(curLeft,curTop,curRight,curBottom,objNum) {
	toTwips=20;
	curLeft*=toTwips;
	curTop*=toTwips;
	curRight*=toTwips;
	curBottom*=toTwips;
	flashObj[objNum].SetZoomRect(curLeft,curTop,curRight,curBottom);
}

function getVar(curVar,objNum) {
	returnVar=flashObj[objNum].GetVariable(curVar);
	return returnVar;
}

function setVar(curVar,curVal,objNum) {
	flashObj[objNum].SetVariable(curVar,curVal);
}

function getProperty(curTarget,curProperty,objNum) {
	returnPropString=flashObj[objNum].TGetProperty(curTarget,curProperty);
	return returnPropString;
}

function setProperty(curTarget,curProperty,curValue,objNum) {
	flashObj[objNum].TSetProperty(curTarget,curProperty,curValue);
}

function popupMaker(curURL,curName,iWidth,iHeight,iTop,iLeft,bToolbar,bLocation,bStatus,bMenubar,bScrollbars,bResizable,bFullscreen,wC) {
	curFeatures='width='+iWidth+',height='+iHeight+',top='+iTop+',left='+iLeft;
	curFeatures+=',toolbar='+bToolbar+',location='+bLocation+',status='+bStatus;
	curFeatures+=',menubar='+bMenubar+',scrollbars='+bScrollbars+',resizable='+bResizable+',fullscreen='+bFullscreen;
	w[wC]=window.open(curURL,curName,curFeatures);
}

function closePopup(wC) {
	if (w[wC]) {
		w[wC].close();
	}
}

function alertIt(curMessage) {
	alert(curMessage);
}

function promptToVar(curVar,curMessage,defaultValue,objNum) {
	curInput=prompt(curMessage,defaultValue);
	if (!curInput) {
		curInput='CANCEL';
	}
	setVar(curVar,curInput,objNum);
	return curInput;
}

function confirmToVar(curVar,curMessage,objNum) {
	curInput=confirm(curMessage);
	setVar(curVar,curInput,objNum);
	return curInput;
}

function quickDate(objNum) {
	curDate=new Date();
	curMonth=curDate.getMonth()+1;
	curDay=curDate.getDate();
	curYear=curDate.getFullYear();
	setVar('jsMonth',curMonth,objNum);
	setVar('jsDay',curDay,objNum);
	setVar('jsYear',curYear,objNum);
}

function quickTime(objNum) {
	curDate=new Date();
	curHour=curDate.getHours();
	curMinutes=curDate.getMinutes();
	curSeconds=curDate.getSeconds();
	curMilliseconds=curDate.getMilliseconds();
	setVar('jsHour',curHour,objNum);
	setVar('jsMinutes',curMinutes,objNum);
	setVar('jsSeconds',curSeconds,objNum);
	setVar('jsMilliseconds',curMilliseconds,objNum);
}

function quickTimeDate(objNum) {
	quickDate(objNum);
	quickTime(objNum);
}

function theYear(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getFullYear();
	setVar(curVar,curDateInfo,objNum);
}

function theMonth(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getMonth()+1;
	setVar(curVar,curDateInfo,objNum);
}

function theDay(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getDate();
	setVar(curVar,curDateInfo,objNum);
}

function theHour(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getHours();
	setVar(curVar,curDateInfo,objNum);
}

function theMinutes(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getMinutes();
	setVar(curVar,curDateInfo,objNum);
}

function theSeconds(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getSeconds();
	setVar(curVar,curDateInfo,objNum);
}

function theMilliseconds(curVar,objNum) {
	curDate=new Date();
	curDateInfo=curDate.getMilliseconds();
	setVar(curVar,curDateInfo,objNum);
}

function setCookie(theName,thePath,curDays,theValue) {
	theName+="=";
	theValue=escape(theValue)+";";
	thePath=" path="+thePath+";"
	toExpire=getExpire(curDays);
	toExpire=" expires="+toExpire.toGMTString();
	cookieValue=theName + theValue + thePath + toExpire
	document.cookie=cookieValue;
}

function getCookie(theName,curVar,objNum) {
	theName = theName + "=";
	theCookie = document.cookie;
	if (theCookie.length > 0) {
		startString = theCookie.indexOf(theName);
		if (startString != -1) {
			startString += theName.length;
			endString = theCookie.indexOf(";", startString);
			if (endString == -1) endString = theCookie.length;
			theValue=theCookie.substring(startString,endString);
			theValue=unescape(theValue);
			setVar(curVar,theValue,objNum)
			return theValue;
		}
	}
	return null;
}

function deleteCookie(theName,thePath) {
	document.cookie = theName + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" +  "; path=" + thePath;
}

function getExpire(curDays) {
	var toExpire = new Date();                                   
	toExpire.setTime(toExpire.getTime() + (1000 * 60 * 60 * 24 * curDays));
	return toExpire;
}

function loadPercentToVar(curVar,objNum1,objNum2) {
	curPercent=flashObj[objNum1].PercentLoaded();
	setVar(curVar,curPercent,objNum2);
}

function currentFrameToVar(curTarget,curVar,objNum1,objNum2) {
	curLabel=flashObj[objNum1].TCurrentFrame(curTarget)+1;
	setVar(curVar,curLabel,objNum2);
}

function varToVar(var1,var2,objNum1,objNum2) {
	curVar=getVar(var1,objNum1);
	setVar(var2,curVar,objNum2);
}

function propToProp(target1,target2,prop1,prop2,objNum1,objNum2) {
	curProp=getProperty(target1,prop1,objNum1);
	setProperty(target2,prop2,curProp,objNum2);
}

function propToVar(curTarget,curProp,curVar,objNum1,objNum2) {
	curProp=getProperty(curTarget,curProp,objNum1);
	setVar(curVar,curProp,objNum2);
}

function setMovieRef(curMovie,objNum) {
	flashObj[objNum] = InternetExplorer ? eval(curMovie) : eval('document.'+curMovie);
}

function setFrameRef(curFrame,curMovie,objNum) {
	frameRef=parent.frames[eval("'"+curFrame+"'")];
	flashObj[objNum] = InternetExplorer ? frameRef.eval(curMovie) : eval('frameRef.document.'+curMovie);
}

function setWindowRef(winNum,curMovie,objNum) {
	flashObj[objNum] = InternetExplorer ? w[winNum].eval(curMovie) : eval('w['+winNum+'].document.'+curMovie);
}

function setWindowFrameRef(winNum,curFrame,curMovie,objNum) {
	frameRef=w[winNum].frames[eval("'"+curFrame+"'")];
	flashObj[objNum] = InternetExplorer ? frameRef.eval(curMovie) : eval('frameRef.document.'+curMovie);
}

function setLayerRef(curLayer,curMovie,objNum) {
	flashObj[objNum] = InternetExplorer ? document.all[eval("'"+curMovie+"'")] : document.embeds[curMovie];
}

function setLayerFrameRef(curFrame,curLayer,curMovie,objNum) {
	frameRef=parent.frames[eval("'"+curFrame+"'")];
	flashObj[objNum] = InternetExplorer ? frameRef.document.all[eval("'"+curMovie+"'")] : frameRef.document.embeds[curMovie];
}

function setLayerWindowRef(winNum,curLayer,curMovie,objNum) {
	flashObj[objNum] = InternetExplorer ? w[winNum].document.all[eval("'"+curMovie+"'")] : w[winNum].document.embeds[curMovie];
}

function setLayerWindowFrameRef(winNum,curFrame,curLayer,curMovie,objNum) {
	frameRef=w[winNum].frames[eval("'"+curFrame+"'")];
	flashObj[objNum] = InternetExplorer ? frameRef.document.all[eval("'"+curMovie+"'")] : frameRef.document.embeds[curMovie];
}

function parseArgs(args) {
	pS="";
	pS+=args;
	pC=pS.indexOf(',');
	pN=0;
	while(pC !=-1) {
		pL=pS.length;
		a[pN]=pS.substring(0,pC);
		pS=pS.substring(pC+1,pL);
		pN++;
		pC=pS.indexOf(',');
	}
	
	a[pN]=pS;
	for (pD=0;pD<=pN;pD++) {
		if (a[pN]=='returnVar') {a[pN]=returnVar;}
		else if (a[pN]=='returnPlayStatus') {a[pN]=returnPlayStatus;}
		else if (a[pN]=='returnPercentLoaded') {a[pN]=returnPercentLoaded;}
		else if (a[pN]=='returnCurrentFrameNumber') {a[pN]=returnCurrentFrameNumber;}
		else if (a[pN]=='returnCurrentFrameLabel') {a[pN]=returnCurrentFrameLabel;}
		else if (a[pN]=='returnPropString') {a[pN]=returnPropString;}
		else if (a[pN]=='returnPropNumber') {a[pN]=returnPropNumber;}
	}
}

function doComs(command,args) {
	parseArgs(args);
	if(command=='setMovieRef') {setMovieRef(a[0],parseInt(a[1]));}
	else if(command=='setFrameRef') {setFrameRef(a[0],a[1],parseInt(a[2]));}
	else if(command=='setWindowRef') {setWindowRef(parseInt(a[0]),a[1],parseInt(a[2]));}
	else if(command=='setWindowFrameRef') {setWindowFrameRef(parseInt(a[0]),a[1],a[2],parseInt(a[3]));}
	else if(command=='setLayerRef') {setLayerRef(a[0],a[1],parseInt(a[2]));}
	else if(command=='setLayerFrameRef') {setLayerFrameRef(a[0],a[1],a[2],parseInt(a[3]));}
	else if(command=='setLayerWindowRef') {setLayerWindowRef(parseInt(a[0]),a[1],a[2],parseInt(a[3]));}
	else if(command=='setLayerWindowFrameRef') {setLayerWindowFrameRef(parseInt(a[0]),a[1],a[2],a[3],parseInt(a[4]));}
	else if(command=='playMovie') {playMovie(parseInt(a[0]));}
	else if(command=='rewindMovie') {rewindMovie(parseInt(a[0]));}
	else if(command=='stopMovie') {stopMovie(parseInt(a[0]));}
	else if(command=='playTargetMovie') {playTargetMovie(a[0],parseInt(a[1]));}
	else if(command=='stopTargetMovie') {stopTargetMovie(a[0],parseInt(a[1]));}
	else if(command=='loadedPercent') {loadedPercent(parseInt(a[0]));}
	else if(command=='currentFrameNumber') {currentFrameNumber(a[0],parseInt(a[1]));}
	else if(command=='currentFrameLabel') {currentFrameLabel(a[0],parseInt(a[1]));}
	else if(command=='playStatus') {playStatus(parseInt(a[0]));}
	else if(command=='movieLoad') {movieLoad(parseInt(a[0]),a[1],parseInt(a[2]));}
	else if(command=='goToFrameNumber') {goToFrameNumber(parseInt(a[0]),parseInt(a[1]));}
	else if(command=='goToTFrameNumber') {goToTFrameNumber(a[0],parseInt(a[1]),parseInt(a[2]));}
	else if(command=='goToFrameLabel') {goToFrameLabel(a[0],a[1],parseInt(a[2]));}
	else if(command=='callFrameNumber') {callFrameNumber(a[0],parseInt(a[1]),parseInt(a[2]));}
	else if(command=='callFrameLabel') {callFrameLabel(a[0],a[1],parseInt(a[2]));}
	else if(command=='zoomIt') {zoomIt(parseInt(a[0]),parseInt(a[1]));}
	else if(command=='panIt') {panIt(parseInt(a[0]),parseInt(a[1]),parseInt(a[2]),parseInt(a[3]));}
	else if(command=='setZoom') {setZoom(parseInt(a[0]),parseInt(a[1]),parseInt(a[2]),parseInt(a[3]),parseInt(a[4]));}
	else if(command=='getVar') {getVar(a[0],parseInt(a[1]));}
	else if(command=='setVar') {setVar(a[0],a[1],parseInt(a[2]));}
	else if(command=='getProperty') {getProperty(a[0],parseInt(a[1]),parseInt(a[2]));}
	else if(command=='setProperty') {setProperty(a[0],parseInt(a[1]),a[2],parseInt(a[3]));}
	else if(command=='popupMaker') {popupMaker(a[0],a[1],parseInt(a[2]),parseInt(a[3]),parseInt(a[4]),parseInt(a[5]),parseInt(a[6]),parseInt(a[7]),parseInt(a[8]),parseInt(a[9]),parseInt(a[10]),parseInt(a[11]),parseInt(a[12]),parseInt(a[13]));}
	else if(command=='closePopup') {closePopup(parseInt(a[0]));}
	else if(command=='alertIt') {alertIt(a[0]);}
	else if(command=='promptToVar') {promptToVar(a[0],a[1],parseInt(a[2]),parseInt(a[3]));}
	else if(command=='confirmToVar') {confirmToVar(a[0],a[1],parseInt(a[2]));}
	else if(command=='quickDate') {quickDate(parseInt(a[0]));}
	else if(command=='quickTime') {quickTime(parseInt(a[0]));}
	else if(command=='quickTimeDate') {quickTimeDate(parseInt(a[0]));}
	else if(command=='theYear') {theYear(a[0],parseInt(a[1]));}
	else if(command=='theMonth') {theMonth(a[0],parseInt(a[1]));}
	else if(command=='theDay') {theDay(a[0],parseInt(a[1]));}
	else if(command=='theHour') {theHour(a[0],parseInt(a[1]));}
	else if(command=='theMinutes') {theMinutes(a[0],parseInt(a[1]));}	
	else if(command=='theSeconds') {theSeconds(a[0],parseInt(a[1]));}
	else if(command=='theMilliseconds') {theMilliseconds(a[0],parseInt(a[1]));}
	else if(command=='setCookie') {setCookie(a[0],a[1],parseInt(a[2]),a[3]);}
	else if(command=='getCookie') {getCookie(a[0],a[1],parseInt(a[2]));}
	else if(command=='deleteCookie') {deleteCookie(a[0],a[1]);}
	else if(command=='loadPercentToVar') {loadPercentToVar(a[0],parseInt(a[1]),parseInt(a[2]));}
	else if(command=='currentFrameToVar') {currentFrameToVar(a[0],a[1],parseInt(a[2]),parseInt(a[3]));}
	else if(command=='varToVar') {varToVar(a[0],a[1],parseInt(a[2]),parseInt(a[3]));}
	else if(command=='propToProp') {propToProp(a[0],a[1],parseInt(a[2]),parseInt(a[3]),parseInt(a[4]),parseInt(a[5]));}
	else if(command=='propToVar') {propToVar(a[0],parseInt(a[1]),a[2],parseInt(a[3]),parseInt(a[4]));}
}

libLoad=1;
