var isMSIE=(document.all)?true:false;
var isJS12=(window.screen)?true:false;
var isDOM = (document.getElementById ? true : false);
var isIE4 = ((document.all && !isDOM) ? true : false);
var isNS4 = (document.layers ? true : false);
var isNS = navigator.appName == "Netscape";
var strWWW = document.location.hostname.split(".")[0];
var strProtocol = document.location.protocol;
var strHost;
strProtocol == "http:" ? strHost = "" : strHost = "http://www.genienglish.com"

var strDiv;
var winX, winY
if (parseInt(navigator.appVersion) >= 4) {
	winX = (screen.availWidth - 500)*.5;
	winY = (screen.availHeight - 500)*.5;
}

function screenCenter(objX, objY){
	if (parseInt(navigator.appVersion) >= 4) {
		winX = ((screen.availWidth*.5)-(objX*.5));
		winY = ((screen.availHeight*.5)-(objY*.5));
	}
}

function popFirstEntrance(seq){
	popupwinX = "800";
	popupwinY = "670";
	screenCenter(Number(popupwinX),Number(popupwinY));
	window.open("/Popup/FirstEntrance.asp?seq="+seq,"","width="+ popupwinX +", height="+ popupwinY +", left= "+ winX +",top="+ winY);
}

function popGetStudyGuide(seq){
	popupwinX = "800";
	popupwinY = "600";
	screenCenter(Number(popupwinX),Number(popupwinY));
	window.open("/StudyHelp/GetStudyGuide.asp?seq="+seq,"","width="+ popupwinX +", height="+ popupwinY +", left= "+ winX +",top="+ winY);
}

function getBranchContentsList(sel1, sel2, Div) {
	var strDivCode = ''
	if (typeof(Div) != 'undefined' ) strDivCode = 's';
	if (sel1 == 'null') sel1 = '';
	if (sel2 == 'null') sel2 = '';
	if (typeof(sel1) == 'undefined' || sel1 == ''){
		//top.index.location.href = "/Branch/BranchMain.asp?d="+ strDivCode;
		document.location.href = strHost + "/Branch/BranchMain.asp?d="+ strDivCode;
	}else{
		//top.index.location.href = "/Branch/BranchContentsList.asp?CurLevel="+sel1+"&CurUnit="+sel2+"&d="+strDivCode;
		document.location.href = strHost + "/Branch/BranchContentsList.asp?CurLevel="+sel1+"&CurUnit="+sel2+"&d="+strDivCode;
	}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

String.prototype.trim = function()
{
	var str = this;
//	str = str.replace( /^\s*(.*)/ ,  "$1" );
//	str = str.replace(/(.*?)\s*$/, "$1");
	str = str.replace(/^\s*/,'').replace(/\s*$/, '');
	return str;
}

function checkField(field,strAlert){
	field.value = field.value.trim();
	if(!field.value){
		alert(strAlert);
		field.focus();
		return true;
	}
	return false;
}

function checkEmail(field,strAlert) {
	var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.pe.kr)|(\.co.kr)|(\.org)|(\..{2,2}))$)\b/gi);
	if (!goodEmail){
		alert(strAlert);
		field.select();
		return true;
	}
	return false;
}

/*
function formLoginCheck(){
//	try{
		var f = document.theLoginForm;
		if(checkField(f.loginID,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä"))return false;
		if(checkField(f.password,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä"))return false;
		f.target = "hidBottom";
		f.action="/Member/LoginVerify.asp"
		return true;
//	}catch(e){return false;}
}
*/
function formLoginCheck(){
//	try{
		var f = document.theLoginForm;
		if(checkField(f.loginID,"¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä"))return false;
		if(checkField(f.password,"ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä"))return false;
//		f.target = "hidBottom";
//		f.action="/Member/LoginVerify.asp"
		f.target = "LOGIN_SOCKET";
//		f.action="/Member/LoginSocket.asp"
		f.action="https://www.genienglish.com:444/Member/LoginSocketSSL.asp"
		return true;
//	}catch(e){return false;}
}

function cookie_check(check_box)
{
	if (check_box.checked)
	{
		// ÄíÅ° ÀúÀå ÇÏÀÚ
		var expr = new Date((new Date()).getTime() + ((24 * 365) * 3600000))
		var cookie_value = document.theLoginForm.loginID.value;
		save_cookie("GENIENGLISH_COOKIE_ID", cookie_value, expr, "/", ".genienglish.com");
		cookie_value = document.theLoginForm.password.value;
		save_cookie("GENIENGLISH_COOKIE_PASSWORD", cookie_value, expr, "/", ".genienglish.com");
	}
	else
	{
		// cookie ¸¦ Áö¿ìÀÚ.
		delete_cookie("GENIENGLISH_COOKIE_ID");
		delete_cookie("GENIENGLISH_COOKIE_PASSWORD");
	}
}

function save_cookie(name, cookie_value, hours, path, domain)
{

	var cookie = name + "=" + cookie_value;
	cookie += "; expires=" + hours.toGMTString();
	cookie += "; path=" + path;
	cookie += "; domain=" + domain;
	document.cookie = cookie;
}

function delete_cookie(name)
{
	var cookie = name + "=";
	cookie += "; expires=Fri, 02-Jan-1970 00:00:00 GMT";
	cookie += "; path=" + "/";
	cookie += "; domain=" + ".genienglish.com";
	document.cookie = cookie;
}

function getCookie( name )
{
	var nameOfCookie = name + "=";
  var x = 0;
  while ( x <= document.cookie.length )
  {
		var y = (x+nameOfCookie.length);
    if ( document.cookie.substring( x, y ) == nameOfCookie ) {
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;
			return unescape( document.cookie.substring( y, endOfCookie ) );
		}
    x = document.cookie.indexOf( " ", x ) + 1;
    if ( x == 0 )
			break;
	}
	return "";
}

function logOut(){
	top.hidBottom.document.location.href="/Member/LogOut.asp";
}

function getGeniEnglish() {
	if( strProtocol == "http:" ){
		if( typeof(top.index) == "undefined" )
		{
			top.location.href = "http://www.genienglish.com";
			return;
		}
		top.index.location.href = "/index.asp";
	}else{
		document.location.href = strHost + "/index.asp";
	}
}

function getContentsList(CurLevel, CurUnit) {
	var referURL;
	if ( typeof(CurLevel) == 'undefined' ) {
		referURL = '/Contents/ContentsList.asp';
	} else {
		if ( typeof(CurUnit) == 'undefined' )
		{
			if ( isNaN(CurLevel) ) {
				referURL = '?CurCate=' + CurLevel;
			} else {
				referURL = '?CurLevel=' + CurLevel;
			}
		}
		else
		{
			referURL = '?CurLevel=' + CurLevel + '&CurUnit=' + CurUnit;
		}
	}
	location.href = '/Contents/ContentsList.asp'+referURL;
}

function getBBSFile(FileName) {
	//var popdown = window.open('/BBS/BBSDownLoad.asp?finfo='+ FileName +'&fname='+ FileName,'popdown','height=10,left=0,scrollbars=0,top=10, width=10')
	//top.hidBottom.document.location.href = '/BBS/BBSDownLoad.asp?finfo='+ FileName +'&fname='+ FileName;
	document.location.href = '/DownLoad/'+ FileName;
	//popdown.close();
}

function setChangeCate(strTarName,nowCate,bbs_idx){
	var objS = eval("document.all."+strTarName);
	var intCate = objS.options[objS.options.selectedIndex].value;
	top.hidBottom.document.location.href = '/BBS/BBSchangeCate.asp?bbs_idx='+ bbs_idx +'&nowCate='+ nowCate +'&chgCate='+ intCate;
}

function delBBSFile(bbs_idx, idx){
	if(confirm("ÇØ´ç ÆÄÀÏÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?"))
		top.hidBottom.document.location.href = '/BBS/BBSdelFile.asp?bbs_idx='+ bbs_idx +'&idx='+ idx;
}

function getCustomerCenter() {
	//alert('getCustomerCenter');
	location.href = '/CustomerCenter/CustomerCenter.asp';
}

function getParentCorner(CurLevel, CurUnit, CurPage) {
	//alert('getParentCorner');
	var strCurLevel = '';
	var strCurUnit = '';
	var strCurPage
	if ( typeof(CurLevel) != 'undefined' ) strCurLevel = '?CurLevel='+CurLevel;
	if ( typeof(CurUnit) != 'undefined' ) strCurUnit = '&CurUnit='+CurUnit;
	if ( typeof(CurPage) != 'undefined' ) strCurPage = '&CurPage='+CurPage;
	location.href = '/ParentCorner/ParentCorner.asp'+strCurLevel+strCurUnit;
}

function getSitePolicy()
{
	window.open('/Introduction/sitepolicy1.htm','','height=500,left=0,scrollbars=yes,top=0, width=648');
}

function getCompanyIntroduction()
{
	window.open('/Introduction/company.htm','','height=430,left=0,scrollbars=no,top=0,width=640');
}

function getSiteMap() {
	//alert('getSiteMap');
	location.href = '/SiteMap.asp';
}

function sendMailToGeniEnglish() {
	//alert('SendMailToGeniEnglish');
	location.href = '/CustomerCenter/CustomerCenter.asp?CurLevel=5';
}

function alertGeniBranch(intStr){
	alert("Áö»çÀå,°­»ç·Î ·Î±×ÀÎÇÏ¼¼¿ä.");
}

function getGeniBranch(CurLevel, CurUnit, CurPage, Div) {
	var strCurLevel = '?CurLevel=';
	var strCurUnit = '&CurUnit=';
	var strCurPage = '&CurPage=';
	var strDivCode = ''
	if ( typeof(CurLevel) != 'undefined' ) strCurLevel = strCurLevel+CurLevel;
	if ( typeof(CurUnit) != 'undefined' ) strCurUnit = strCurUnit+CurUnit;
	if ( typeof(CurPage) != 'undefined' ) strCurPage = strCurPage+CurPage;
	if ( typeof(strDiv) != 'undefined' ) strDivCode = '&d='+strDiv;
	if ( typeof(Div) != 'undefined' ) strDivCode = '&d='+Div;
	location.href = '/Branch/Branch.asp'+strCurLevel+strCurUnit+strCurPage+strDivCode;
}

function getGeniBranchPopUp(intDiv,	intPID){
	if(intPID == 0){
		alert("·Î±×ÀÎ ÈÄ ½ÅÃ»ÇÏ¼¼¿ä.");
		return;
	}else{
		if(intDiv == 1){
			intHeight = "400";
		}else if(intDiv == 2){
			intHeight = "250";
		}else if(intDiv == 3){
			intHeight = "448";
		}else if(intDiv == 4){
			intHeight = "285";
		}
		window.open('/Branch/bu10Pop.asp?divCode='+intDiv,'StudyGuide','width=420,height='+ intHeight +',left=180,top=20,scrollbars=no,menubar=no,toolbar=no,status=no');
	}
}

function getStudyGuide() {
	//alert('getStudyGuide');
	window.open('/StudyHelp/GetStudyGuide.asp','StudyGuide','width=660,height=600,left=180,top=20,scrollbars=yes,menubar=no,toolbar=no,status=no');
}

function getMonthSchedule(CurYear, CurMonth, CurLevel) {
	document.location.href="/Branch/Branch.asp?CurLevel=3&CurUnit=2&CurPage=1";
	//alert(CurYear+'³â '+CurMonth+'¿ù '+CurLevel+'·¹º§ ¿ù°£±âÈ¹¾È´Ù¿î');
}

function getYearSchedule(CurYear) {
	document.location.href="/Branch/Branch.asp?CurLevel=3&CurUnit=2&CurPage=2";
	//alert(CurYear+'³â ¿¬°£±âÈ¹¾È´Ù¿î');
}

function getStudyNote(CurLevel, CurUnit) {
	//alert(CurLevel+'·¹º§ '+CurUnit+'À¯´Ö ÇÐ½À³ëÆ®º¸¿©ÁÖ¼À');
	window.open('/StudyHelp/GetStudyNote.asp?CurLevel='+CurLevel+'&CurUnit='+CurUnit,'StudyNote','width=537,height=540,scrollbars=yes,menubar=no,toolbar=no,status=no');
}

function getFreeContentsList(sel) {
	var referURL;
	if ( typeof(sel) == 'undefined' ) {
		referURL = '/Contents/FreeContentsList.asp?CurLevel=0';
	} else {
		if ( isNaN(sel) ) {
			referURL = '/Contents/FreeContentsList.asp?CurCate=' + sel;
		} else {
			referURL = '/Contents/FreeContentsList.asp?CurLevel=' + sel;
		}
	}
	location.href = referURL;
}

function addFavorite() {
	parent.hidBottom.location.href = "addLoginLog.asp?pageCode=AddFavor";
	window.external.AddFavorite('http://www.genienglish.com/','¶È¶ÈÇÑ¾ÆÀÌ¸¸µé±â Áö´ÏÀ×±Û¸®½¬ :::: www.genienglish.com')
}

function setHomepage() {
	obj = document.Homepage
	//alert(obj)
	parent.hidBottom.location.href = "addLoginLog.asp?pageCode=setHomeP";
	obj.style.behavior='url (#default#homepage)';
	obj.setHomePage('http://www.genienglish.com');
}

function getShortCut() {
	//alert('getShortCut');
	if ( confirm('Áö´ÏÀ×±Û¸®½¬ ¹Ù·Î°¡±â ¾ÆÀÌÄÜÀ» ¹ÙÅÁÈ­¸é¿¡ »ý¼ºÇÕ´Ï´Ù.\n\n [ È®ÀÎ ]À» ´©¸£½Å ÈÄ ÆÄÀÏ ´Ù¿î·Îµå½Ã ¿­±â(È¤Àº ½ÇÇà)¹öÆ°À» ´­·¯ÁÖ¼¼¿ä.') ) getBBSFile('Áö´ÏÀ×±Û¸®½¬.exe');
}

function getNoticeList() {
	//alert('getNoticeList');
	location.href = '/News/News.asp?CurLevel=1';
}

function getNoticeView() {
	//alert('getNoticeList');
	location.href = '/News/News.asp?CurLevel=1';
}

function getNewsList() {
	//alert('getNewsList');
	location.href = '/News/News.asp?CurLevel=2';
}

function getGoodsList() {
	alert('getGoodsList');
}

function getPaymentInfo() {
	//alert('getPaymentInfo');
	location.href = strHost + '/Payment/Payment.asp';
}

function getMemberInfo() {
	document.location.href = '/Member/Member.asp?CurLevel=3'
}

function getGateMemberJoin() {
	document.location.href = strHost +'/Member/Member.asp';
}

function getPowerUpClass() {
	//alert('Æ¯°­¼ö¾÷±â°£ÀÌ ¾Æ´Õ´Ï´Ù.');
	document.location.href = '/Contents/PowerUpClass.asp';
}

function setUseTime() {
	window.open('/Member/SetUseTime.asp','setUseTime2','width=360,height=400,left='+winX+',top='+winY);
}

function disableUseTime() {
	if (document.setusetime.i_usehour.disabled) {
		document.setusetime.i_usehour.disabled = false;
		document.setusetime.i_useminute.disabled = false;
	} else {
		document.setusetime.i_usehour.disabled = true;
		document.setusetime.i_useminute.disabled = true;
	}
}

function getPassword() {
	//alert('getPassword');
	location.href = '/Member/Member.asp?CurLevel=5';
}

function setLevelNUnit()
{
	//opener.parent.location.href = '/Member/mypage1.asp';
	alert('´Ü°èÁ¶Á¤ÆäÀÌÁö');
	window.close();
}

function pageReload(queryStr) {
	/*
	var current_page = document.URL;
	queryStr_index = current_page.lastIndexOf('?');
	if (queryStr_index == -1)	{
		url = current_page
	} else {
		url = current_page.substring(0,queryStr_index);
	}
	*/
	url = document.location.pathname;
	location.href = strHost + url+'?'+queryStr;
}

function ConPageReload(queryStr) {
	location.href = strHost + '/Contents/ContentsList.asp?'+queryStr;
}

function getExpireDate() {
	window.open('/Member/GetExpireDate.asp','GetExpireDate','width=340,height=180,left='+winX+',top='+winY);
}

function pageLoad(url) {
	location.href = url;
}

function clickHelp(url) {
	geniHelp = window.open('http://partner.genikids.com/help.asp?url='+url,'geniHelp','width=520, height=400, left=' + winX + ',top=' + winY);
	geniHelp.focus();
}

function GameOpenFocus(gameURL) {
	secWin = window.open(gameURL,'ContentsWindow','fullscreen=1');
	secWin.focus();
}

// °ÔÀÓ¿¡ Ä«¿îÆ®¸¦ ³Ö´Â ºÎºÐÀÌ´Ù.
function Update_FeedStr(p,p2) {
	if ( typeof(mainswf) != "undefined" )
	{
//		mainswf.setVariable("gcount0"+p, p2);
//		mainswf.TCallLabel("/","view_init");
		document.getElementById("mainswf").counterSetting("gcount0"+p, p2);
	}else{
		document.getElementById("c" + p).setVariable("gameCount", p2);
		document.getElementById("c" + p).SetVariable("gameIndex",1);
		document.getElementById("c" + p).TCallLabel("/","view_init");
	}
}

function openMsgBox() {
	document.all['MsgBox'].style.visibility = '';
	//alert(document.all['MsgBox'].style.visibility);
}

function initMsgBox(opt, sub) {
	//alert(opt);
	if ( !isNaN(sub) && opt == '1' ) {
		sub = ( Math.floor(Math.random()*10) % sub ) + 1;
	}
	//alert(sub);
	MsgBoxSWF.setVariable("opt",opt);
	MsgBoxSWF.setVariable("sub",sub);
	MsgBoxSWF.TCallLabel("/","view_init");
	openMsgBox();
}

function closeMsgBox() {
	//MsgBoxSWF.TCallLabel("/","unload");
	document.all['MsgBox'].style.visibility = 'hidden';
}

function LevelUnitControl() {
	location.href = '/ParentCorner/ParentCorner.asp?CurLevel=3&CurUnit=3';
}

function writeCheck() {
	var subject = document.writeFrm.subject.value;
	var contents = document.writeFrm.contents.value;

	String.prototype.trim = function() {
   return this.replace(/(^\s*)|(\s*$)/g, "");
	}

	if (subject.trim().length == 0)
	{
		alert("Á¦¸ñÀ» ÀÔ·ÂÇØ ÁÖ¼¼¿ä.");
		document.writeFrm.subject.focus();
		return false;
	}

	if (contents.trim().length == 0)
	{
		alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä");
		document.writeFrm.contents.focus();
		return false;
	}
	return true;
}

function comment_submit() {
	if ( document.commentFrm.comment.value == '') {
		alert('²¿¸®±Û ³»¿ëÀ» ±âÀÔÇØÁÖ¼¼¿ä');
		return false;
	}
}

function showTitle() {
	document.commentFrm.comment.value = '·Î±×ÀÎÀ» ÇÏ½Ã¸é ±ÛÀ» ³²±â½Ç ¼ö ÀÖ½À´Ï´Ù.';
}

function removeTitle() {
	if ( document.commentFrm.comment.value == '·Î±×ÀÎÀ» ÇÏ½Ã¸é ±ÛÀ» ³²±â½Ç ¼ö ÀÖ½À´Ï´Ù.' ) {
		document.commentFrm.comment.value = '';
	}
}

function searchBBS() {
	var a = document.searchFrm;
	if ( a.SearchValue.value == '' ) {
		a.SearchCate[1].checked = true;
		//alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
		//return false;
	}
	b=0;
	for(i=0; i<3; i++)
	{
		 if(a.SearchCate[i].checked == true)
			{
					b++;
			}
	}
	if ( b == 0 ) {
		alert('°Ë»öºÐ·ù¸¦ ÀÔ·ÂÇÏ¿© ÁÖ¼¼¿ä');
		return false;
	}
	a.intNowPage.value = "1";
	a.submit();
}

function DeleteComment(intCommIDX,PathInfo){
	document.location.href = "/BBS/BBSDeleteProcess.asp?idx="+ intCommIDX +"&mode=delComm&PathInfo="+ PathInfo;
}

function getBBSMode( Mode, IDX, TempIDX, intNowPage, CurLevel, CurUnit, CurPage, PathInfo) {
	var objFrm = document.searchFrm;
	objFrm.Mode.value = Mode;
	if ( typeof(IDX) != 'undefined' && IDX != '' ) objFrm.IDX.value = IDX;
	if ( typeof(TempIDX) != 'undefined' && TempIDX != '' ) objFrm.TempIDX.value = TempIDX;
	if ( typeof(intNowPage) != 'undefined' && intNowPage != '' ) objFrm.intNowPage.value = intNowPage;
	if ( typeof(CurLevel) != 'undefined' && CurLevel != '' ) objFrm.CurLevel.value = CurLevel;
	if ( typeof(CurUnit) != 'undefined' && CurUnit != '' ) objFrm.CurUnit.value = CurUnit;
	if ( typeof(CurPage) != 'undefined' && CurPage != '' ) objFrm.CurPage.value = CurPage;
	if ( Mode == 'Delete' ){
		objFrm.action = "/BBS/BBSDeleteProcess.asp?PathInfo="+PathInfo;
	} else {
		if ( typeof(PathInfo) != 'undefined' && PathInfo != '' ) objFrm.action = "/"+PathInfo+"/"+PathInfo+".asp";
	}
	objFrm.submit();
	//var CurLevel = objFrm.CurLevel.value;
	//var CurUnit = objFrm.CurUnit.value;
	//pageReload('CurLevel='+CurLevel+'&CurUnit='+CurUnit+'&intNowPage='+intNowPage+'&Mode='+Mode+'&IDX='+IDX+'&TempIDX='+TempIDX);
}

function getStatistics(CurLevel, CurUnit) {
	var a = document.F_DATE
	var datediff = ( ( new Date(a.Date1.value.replace(/-/g,'/'))- new Date(a.Date2.value.replace(/-/g,'/')) ));
	if (datediff > 0) {
		alert('³¯Â¥¼³Á¤ÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.');
		return false;
	}
	pageReload('CurLevel='+CurLevel+'&CurUnit='+CurUnit+'&sDate='+a.Date1.value+'&eDate='+a.Date2.value);
}

function select_clear(obj, remain_no){
    var len = obj.length;
    if( remain_no < 0 ){
        remain_no = 0;
    }
    for(var k=len-1 ;  k>=remain_no   ; k-- ){
        obj.options.remove(k);
    }
}

function PreInit()
{
    if (top == self)
        top.document.location.replace("/");
}
//if (typeof(PreInit) == 'function' && opener == null) PreInit();

function PrintJSSWF(strURL, strwidth, strheight){
	document.open();
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="'+ strwidth + '" height="'+ strheight + '">\r' );
	document.write( '<param name="movie" value="'+ strURL + '">\r' );
	document.write( '<param name="quality" value="high">\r' );
	document.write( '<param name="wmode" value="transparent">\r' );
	document.write( '<param name="menu" value="false">\r' );
	document.write( '<param name="scale" value="exactfit">\r' );
	document.write( '<param name="allowScriptAccess" value="always">\r' );
	//document.write( '<embed src="'+ strURL + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  type="application/x-shockwave-flash" width="'+ strwidth + '" height="'+ strheight + '"wmode="transparent">\r' );
	document.write( '<embed src="'+ strURL + '" quality="high" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" devicefont="false" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+ strwidth + '" height="'+ strheight + '" wmode="transparent">\r' );
	document.write( '</embed>' );
	document.write( '</object>' );
	document.close();
}

function PrintJSSWFID(strURL, strwidth, strheight, strID){
	document.open();
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="'+ strwidth + '" height="'+ strheight + '" id="'+ strID +'">\r' );
	document.write( '<param name="movie" value="'+ strURL + '">\r' );
	document.write( '<param name="quality" value="high">\r' );
	if(strID != "GAMESWF") document.write( '<param name="wmode" value="transparent">\r' );
	document.write( '<param name="menu" value="false">\r' );
	document.write( '<param name="scale" value="exactfit">\r' );
	document.write( '<param name="allowScriptAccess" value="always">\r' );
	//document.write( '<embed src="'+ strURL + '" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+ strwidth + '" height="'+ strheight + '"wmode="transparent">\r' );
	document.write( '<embed src="'+ strURL + '" quality="high" allowScriptAccess="always" allowFullScreen="false" scale="exactfit" devicefont="false" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+ strwidth + '" height="'+ strheight + '" id="'+ strID + '" wmode="transparent">\r</embed>' );
	document.write( '</embed>' );
	document.write( '</object>' );
	document.close();
}

function CheckPage(TLevel,Step){
		document.location.href = "BranchCheckTest.asp?CurLevel="+ CurLevel +"&t="+ TLevel +"&s="+ Step;
}

function CheckTestOpen(TLevel, Mode, CurPage) {
	GameOpenFocus("CheckTestFrame.asp?CurLevel="+ CurLevel +"&TLevel="+ TLevel +"&Mode="+ Mode +"&CurPage="+ CurPage +"");
}

function getScreenHeightResolution(){
	var strReturn = "100%";
	var isJS12=(window.screen)?true:false;
	if(isJS12){
		var SCRate = screen.width / screen.height;
		if( SCRate >= 1.6 ){
			strReturn = String(Math.floor(screen.height * 1.3));
		}
	}
	return strReturn;
}

var createSWF = function (divID, swfID, strMovieSrc, divLeft, divTop, intWidth, intHeight){
	var oSWF;
	isMSIE ? oSWF = document.createElement( "OBJECT" ) : oSWF = document.createElement( "EMBED" );
	if ( isMSIE ) {
		oSWF.setAttribute("classid", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");
		oSWF.setAttribute("codebase", "/JScript/swflash.cab#version=9,0,28,0");
		oSWF.setAttribute("allowScriptAccess","always");
		//oSWF.setAttribute("quality","high");
	 	oSWF.setAttribute("scale","exactfit");
	 	oSWF.setAttribute("movie", strMovieSrc);

		/*
		var oParam = document.createElement("param");
		oParam.setAttribute("name", "movie");
		oParam.setAttribute("value", strMovieSrc);

		var oParam1 = document.createElement("param");
		oParam1.setAttribute("name","quality");
		oParam1.setAttribute("value","high");

		var oParam2=document.createElement("param");
		oParam2.setAttribute("name","allowScriptAccess");
		oParam2.setAttribute("value","sameDomain");

		var oParam3=document.createElement("param");
		oParam3.setAttribute("name","scale");
		oParam3.setAttribute("value","exactfit");

		var oParam4=document.createElement("param");
		oParam4.setAttribute("name","allowScriptAccess");
		oParam4.setAttribute("value","always");
		oSWF.appendChild(oParam);
		oSWF.appendChild(oParam1);
		oSWF.appendChild(oParam2);
		oSWF.appendChild(oParam3);
		oSWF.appendChild(oParam4);
		*/
	}else{
		oSWF.setAttribute("type", "application/x-shockwave-flash");
		oSWF.setAttribute("pluginspage", "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash");
		oSWF.setAttribute("src", strMovieSrc);
		oSWF.setAttribute("quality", "high");
		oSWF.setAttribute("align", "center");
		oSWF.setAttribute("scale", "showall");
		oSWF.setAttribute("quality", "high");
		oSWF.setAttribute("allowScriptAccess", "always");
	}
	oSWF.setAttribute("id", swfID);
	oSWF.setAttribute("width", intWidth);
	oSWF.setAttribute("height", intHeight);
	oSWF.setAttribute("wmode", "transparent");

	createDIV(divID, divLeft, divTop, intWidth, intHeight).appendChild( oSWF );
	//return oSWF ;
}

var createDIV = function(divID, divLeft, divTop, divWidth, divHeight){
	var oDiv = document.createElement( 'DIV' ) ;
	oDiv.id 				= divID;
	oDiv.style.overflow	= 'hidden';
	oDiv.style.position	= 'absolute';
	oDiv.style.top			= divTop;
	oDiv.style.left			= divLeft;
	oDiv.style.width		= divWidth;
	oDiv.style.height		= divHeight;
	oDiv.style.visibility	= '';
	oDiv.style.zIndex 		= 300;
	//oDiv.style.border		= '1px blue solid';
	//oDiv.style.overflow = 'auto';
	oDiv.className		= "drag";

	document.body.appendChild( oDiv ) ;
	return oDiv ;
}

var removeObj = function(divObj) {
	document.body.removeChild(document.getElementById(divObj));
}

function bluring(){
	if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus();
}
document.onfocusin=bluring;