// <![CDATA[
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";


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_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_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];}
}

//°ø·æ Ã¥ º¸±â ·¹ÀÌ¾î
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function showHideLayers(objL, v) { //v3.0
if ((obj=document.getElementById(objL))!=null) {
    if (obj.style) { obj=obj.style; v=(v=='show')?'':(v='hide')?'none':v; }
    obj.display=v; }
}

function callError(msg, url, linenumber){
	alert(msg+"\n"+ url +"\n"+ linenumber)
	//if ( typeof(top.hidBottom) != "undefined" ) top.hidBottom.document.location.href = "/ScriptError.asp?msg=" +escape(msg) + "&url=" + escape(url) +"&linenumber="+linenumber;
	return true;
}
//window.onerror=callError;

function getPayHistory() {
	window.open( strHost + "/Member/GetPayHistory.asp","PayHistory","width=630, height=560");
}

var winX, winY
function screenCenter(objX, objY){
	if (parseInt(navigator.appVersion) >= 4) {
		winX = ((screen.availWidth*.5)-(objX*.5));
		winY = ((screen.availHeight*.5)-(objY*.5));
	}
}

function MiniPop(num) {
	popupwinX = "280";
	popupwinY = "260";

	if(num==1) imgName = "FindAccount.gif";
	else imgName = "NoEmail.gif";

	SimpleImgPop("/image/"+ imgName, 280,  260 );
}

function SimpleImgPop(imgSrc, imgWidth, imgHeight, isPrint){
	screenCenter(Number(imgWidth),Number(imgHeight));
	var p = window.open("","","width="+ imgWidth +", height="+ imgHeight +", left= "+ winX +",top="+ winY);
	var d = p.document.open();

	d.write("<html><meta http-equiv='imagetoolbar' content='no'><body leftmargin='0' topmargin='0'><img src='"+ imgSrc +"' width='"+ imgWidth +"' height='"+ imgHeight +"' style='cursor:hand' onclick='window.close();'></body></html>");
	d.close();
	if( typeof(isPrint) != 'undefined' ) p.print();
}

function MainPop(popupwinX,popupwinY,strSrc) {
	screenCenter(Number(popupwinX),Number(popupwinY));
	window.open(strSrc,"MainPop","width="+ popupwinX +", height="+ popupwinY +", left="+ winX +" ,top="+ winY);
}

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 "";
}

var setCookie = function(name, value, expiredays) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays);
	todayDate.setHours(0,0,0);
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

function addFavorite() {
//	top.bottom.location.href = "addLoginLog.asp?pageCode=AddFavor";
	window.external.AddFavorite('http://www.genikids.com/','¶È¶ÈÇÑ¾ÆÀÌ¸¸µé±â Áö´ÏÅ°Áî :::: www.genikids.com')
}

function checkReturn(objForm, e) {
	if ( e.keyCode == 13 ) {
		formCheck();
	}
}

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));
			strReturn = "81%";
		}
	}
	return strReturn;
}

function reSize(objSel)
{
	var objFrame = objSel;
	var objBody = objFrame.document.body;
	objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
//	alert(objBody.offsetHeight +'-'+ objBody.clientHeight+'+'+objBody.scrollHeight);
}

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=9,0,28,0" width="'+ strwidth + '" height="'+ strheight + '">\r' );
	document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="/JScript/swflash.cab#version=9,0,28,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="allowScriptAccess" value="always">\r' );
	document.write( '<param name="scale" value="exactfit">\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=9,0,28,0" width="'+ strwidth + '" height="'+ strheight + '" id="'+ strID +'">\r' );
	if(isMSIE){document.write( '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="/JScript/swflash.cab#version=9,0,28,0" width="'+ strwidth + '" height="'+ strheight + '" id="'+ strID +'">\r' );
	document.write( '<param name="movie" value="'+ strURL + '">\r' );
	strURL.indexOf("13592.swf") > 0 ?  document.write( '<param name="quality" value="medium">\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="allowScriptAccess" value="always">\r' );
	document.write( '<param name="scale" value="exactfit">\r' );
	document.write( '</object>' );
	}else{
	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 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 + '" id="'+ strID + '"wmode="transparent">\r</embed>' );
	}
	document.close();
}

function PrintObj(id) {
	document.open();
	document.write(id.innerHTML); delete(id);
	document.close();
}

var categoryChange = function(tab, sel, len) {		//tab:±¸ºÐÀÚ sel:¼±ÅÃµÈÀÎµ¦½º len:°³¼ö
	for ( i=0 ; i < len ; i++ )
		sel == i ? document.getElementById(tab + i).style.display = '' : document.getElementById(tab + i).style.display = 'none';
}

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));
}

var removeObjOut = function(divObj) {
	document.body.removeChild(document.getElementById(divObj));
	top.hidBottom.document.location.href="/Member/LogOutStay.asp";
}

//chk if an object is an array or not.
var isArray = function (obj) {
//returns true is it is an array
	if(obj.constructor.toString().indexOf("function Array()") != -1)
		return true;
	else
		return false;
}

var ranRange = function(min, max){	//MJs. 2008.12.11
	var randomNum = Math.floor(Math.random()*(max - min+1))+ min;
	return randomNum;
}

function genikidsIntro(){
	window.open("http://www.genikids.com/HelpGuide/tour2.htm", "_blank", "width="+screen.availWidth+",height="+screen.availHeight+",status=no")
}
function HelpGuide(url) {
	//geniHelp = window.open("http://partner.genikids.com/help.asp?url="+url,"geniHelp","width=520, height=400, left=" + winX + ",top=" + winY);
	geniHelp = window.open("http://www.genikids.com/HelpGuide/help.asp?url="+url,"geniHelp","width=520, height=400, left=" + winX + ",top=" + winY);
	geniHelp.focus();
}
function addEvent(obj, evType, fn) {                     //ºê¶ó¿ìÀúº° ÀÌº¥Æ®Ã³¸®
 if(obj.addEventListener) {
  obj.addEventListener(evtype, fn, true);
  return true;
 }else if(obj.attachEvent) {
  var r = obj.attachEvent("on" + evType, fn);
  return r;
 }else{
  return false;
 }
}

function hiddenLayer(){
	document.all['event55'].style.visibility = 'hidden';
}

// ]]>
