
var HELLO_TEXT = "Å·Ä«´åÄÄ¿¡ ¿À½Å°ÍÀ» È¯¿µÇÕ´Ï´Ù.";


function js_Logout( url ) {
	try {
		SessionAX_Logout();
	} catch(e) {
	}

    if( url == undefined )
        document.location.href = "/?_module=auth&_do=logout";
    else
        document.location.href = url + "/?_module=auth&_do=logout";
}


function js_GotoHompy(mkey, inner, param, paramVar, target)
{
	if( mkey == "" )
	{
		mkey = mem_no;	// index.frame.htm ¿¡¼­ ¼±¾ðµÈ mem_no
	}
	
    if (typeof(paramVar) == "undefined") paramVar = "";
    else paramVar = ':' + paramVar;

    if (typeof(param) == "undefined") param = "";
    else param = ':' + param;

    if (typeof(inner) == "undefined")
    {
        inner = "HOME";
        param = ':main';
    }

	if (target=="service") {

	    var url = "http://www.tingcity.com/?_kernel=hompy&hompyKey=" + mkey + "&innerURL=" + inner + param + paramVar;


	} else {

    	var url = "/?_kernel=hompy&hompyKey=" + mkey + "&innerURL=" + inner + param + paramVar;

	}

    winHOMPY = js_PopupWindow(url, "EZC_MINIHOMPY" + mkey, "width=940,height=610,status=yes");
    //winHOMPY.gotoHompyMenu(mkey, inner, param, paramVar);
    if (winHOMPY == "[object]") winHOMPY.focus();
}



function js_FindIdPassword()
{
    var idpassword = window.open( "/?_module=auth&_do=find.idpasswords" , "idpassword", "top=100, left=100, width=465, height=400, sizable=no, scrolbars=yes, status=no" );
}


// ÂÊÁö
function fn_ikmgr_msgsend(to) {
    fn_NW('/?_module=wmms&_do=msg.send&dst_no='+to,512,395);
}

// 1:1 Ã¤ÆÃ
function fn_ikmgr_chatsend(to) {
	fn_NW('/?_module=wmms&_do=p2p.chat&dst_no='+to,612,495,'');
}

// Ä£±¸µî·Ï
function fn_ikmgr_friendadd(to) {
    fn_NW('/?_module=wmms&_do=friend.add&dst_no='+to,512,395,'fn_ikmgr_friend'+to);
}

// Âò
function fn_ikmgr_jjim(to) {
    fn_NW('/?_module=wmms&_do=jjim&dst_no='+to,512,395,'fn_ikmgr_jjim'+to);
}

// SMS
function fn_ikmgr_sms(my,to) {
	js_GotoHompy( to , "SMS" ,"main");
}

// ÇÁ·ÎÆ÷Áî
function fn_ikmgr_propose(to) {
    fn_NW('/?_module=wmms&_do=propose.send&dst_no='+to,594,530,'fn_ikmgr_propose'+to);
}

// ºÎÅ·
function fn_ikmgr_booking(receiver) {
    fn_NW('/?_module=wmms&_do=booking.send&dst_no='+receiver,500,530,'fn_ikmgr_booking'+receiver);
}

// ½Å°í
function fn_ikmgr_police(target,pattach) {
    pattach=escape(pattach);
    fn_NW('/?_module=helpdesk&_do=cyber.police&dst_no='+target+'&pattach='+pattach,464,425);
}

function js_CyberPolice( dst_no , where , where_no) {
    popupWindow( '/?_module=helpdesk&_do=cyber.police&dst_no'+dst_no+'&where='+where+'&where_no='+where_no,'',460 ,480 );
}

function js_ProposeView( what , no ) {
    fn_NW('/?_module=mypage&_do=propose.view&what='+what+'&no='+no,594,530);
}


// ¹«ºñÆÃ
function fn_ikmgr_mvting(receiver, misn) {
	//var misn2 = parseInt(misn);
	//if ( isNaN(misn) ) misn="";
    fn_NW('/?_module=movieting&_do=request.view&dst_no='+receiver+'&misn='+misn,400,350,'fn_ikmgr_mvting'+receiver);
}


// ¸ÂÃã½Ã¸®Áî
function fn_ikmgr_custom( what ) {
    window.open( '/?_module=wmms&_do=custom.index&what='+what , 'fn_ikmgr_custom', 'top=10,width=594,height=700,scrollbars=no,status=yes,resizable=no');
}

// ¼ºÀÎ¿µÈ­ º¸±â
function js_ViewADT_VOD( CPTYPE, OWNERID, CP_OPTION )
{
	try {
	var cpfrm = document.cpform;

	fn_NW( '', 400, 400, CPTYPE );

	cpfrm.cptype.value = CPTYPE;
	cpfrm.ownerid.value = OWNERID;
	cpfrm.cp_option.value = CP_OPTION;
	cpfrm.target = CPTYPE

	cpfrm.submit();
	} catch(e) {
	}
}

function js_OpenVODGuide( url, oname, width, height )
{
	var bsleft=(screen.width/2)-width/2;
	if(screen.height>600) var bstop=(screen.height/2)-height/2; 
	else var bstop=10;
	
	var obj=window.open(url,obj,"scrollbars=yes,resizable=no,width="+width+",height="+height+",top="+bstop+",left="+bsleft);
	obj.focus();
}


function requestTicket( mi_key, title, movie_seq )
{
	// ÇöÀç ½ÅÃ»¿µÈ­ - 
/*
	var MyMovie = window.MyMovieName.innerHTML;
	//if( confirm( "±âÁ¸¿¡ ½ÅÃ»ÇÏ½Å [" + MyMovie + "] ¿µÈ­´Â Ãë¼ÒµÇ¾ú½À´Ï´Ù." ) )
	alert ( "±âÁ¸¿¡ ½ÅÃ»ÇÏ½Å [" + MyMovie + "] ¿µÈ­´Â Ãë¼ÒµÇ¾ú½À´Ï´Ù." );
	alert ( "¹«ºñÆÃ ¿µÈ­ [" + title + "] À»(¸¦) ½ÅÃ» ÇÏ¼Ì½À´Ï´Ù." );	
*/
	
	document.moviefrm.mi_key.value = mi_key;
	document.moviefrm.movie_seq.value = movie_seq;
	document.moviefrm.title.value = title;
	document.moviefrm.submit();
}

function viewRequestList( mi_key, title )
{
    popupWindow( '/?_module=movieting&_do=request.list&mi_key=' + mi_key + '&title=' + title , 'RequestList', 400,  900);
}


// ·©Å© Á¡¼ö (ÃßÃµÇÏÆ®)
function fn_ikmgr_heart(to) {
    fn_NW('/?_module=wmms&_do=heart.send&dst_no='+to,400,350,'fn_ikmgr_heart'+to);
}

// »õÃ¢¶Ù¿ì±â
function fn_NW(url,width,height,name) {
    var bsleft=(screen.width/2)-width/2;
    var bstop=(screen.height/2)-height/2;
    if(name) var NW=open(url,name,'left='+bsleft+',top='+bstop+',width='+width+',height='+height+',toolbars=no,scrollbars=no,resizable=no');
    else var NW=open(url,'','left='+bsleft+',top='+bstop+',width='+width+',height='+height+',toolbars=no,scrollbars=no,resizable=no');
    NW.focus();
}




function menuShowReset(ev) {
}

function menuShow(url, ev) {
    try {
        var evCookie = ev;
        if ( evCookie != '' ) eval("document." + evCookie + ".src='" + url + evCookie + "s.gif'");
    } catch( e ) { 
    }
}





/*
	»çÀÌÆ®³»¿¡¼­ ÀÚÁÖ ¾²ÀÎ ÇÔ¼öµé
*************************************************************/

function js_PopupWindow(theURL,winName,features)
{
    if (typeof(winName) == "undefined") winName = "";
    if (typeof(features) == "undefined") features = "";

    return window.open(theURL,winName,features);
}



function popupWindow( url, popupName, width, height ) {

	var pTop = Math.round(screen.height/2) - Math.round(height/2);
	var pLeft = Math.round(screen.width/2) - Math.round(width/2);

	winPop = window.open( url, popupName, 'top=' + pTop +', left=' + pLeft + ', width=' + width + ', height=' + height + ', location=no, scrollbars=no, status=yes, resizable=no');
	if ( winPop == "[object]" )
	{
		winPop.focus();
	}
}

function popupWindow2( url, popupName, width, height ) {

	var pTop = Math.round(screen.height/2) - Math.round(height/2);
	var pLeft = Math.round(screen.width/2) - Math.round(width/2);

	winPop = window.open( url, popupName, 'top=' + pTop +', left=' + pLeft + ', width=' + width + ', height=' + height + ', location=no, scrollbars=yes, status=yes, resizable=no');
	if ( winPop == "[object]" )
	{
		winPop.focus();
	}
}

function js_InsertFlash(file, width, height)
{
    var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" WIDTH="'+width+'" HEIGHT="'+height+'">';
    str += '<PARAM NAME="movie" VALUE="'+file+'">';
    str += '<PARAM NAME="quality" VALUE="high">';
    str += '<PARAM NAME="wmode" VALUE="transparent">';
    str += '<PARAM NAME="menu" VALUE="false">';
    str += '<EMBED src="'+file+'" quality="high" wmode="transparent" TYPE="application/x-shockwave-flash" WIDTH="'+width+'" HEIGHT="'+height+'" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>';
    str += '</OBJECT>';
    document.write(str);
}

function js_InsertVOD(file, width, height, play )
{
	autostart = "false";
	if( play == 1 )	autostart = "true";
	
	setHeight = " height=\""+height+"\" ";
	if( height == 0 )	setHeight = "";
	
    var str = "<embed  type=\"application/x-mplayer2\" id=\"raon\" showDisplay=\"false\" autostart=\""+autostart+"\" width=\""+width+"\" "+setHeight+" src=\""+file+"\">";
    document.write(str);
}


function js_SetTitle(title) {
	document.title = title;
}

function js_Trim(str) {
    var count = str.length;
    var len = count;
    var st = 0;
    while ((st < len) && (str.charAt(st) <= ' '))  st++;
    while ((st < len) && (str.charAt(len - 1) <= ' ')) len--;
    return ((st > 0) || (len < count)) ? str.substring(st, len) : str ;
}


function js_IsEmail(strEmail) {
    /** ±ÝÁö»çÇ×
     - @°¡ 2°³ÀÌ»ó
     - .ÀÌ ºÙ¾î¼­ ³ª¿À´Â °æ¿ì
     -  @.³ª  .@ÀÌ Á¸ÀçÇÏ´Â °æ¿ì
     - ¸ÇÃ³À½ÀÌ.ÀÎ °æ¿ì **/
    var regDoNot = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; 
    /** ÇÊ¼ö»çÇ×
     - @ÀÌÀü¿¡ ÇÏ³ªÀÌ»óÀÇ ¹®ÀÚ°¡ ÀÖ¾î¾ß ÇÔ
     - @°¡ ÇÏ³ªÀÖ¾î¾ß ÇÔ
     - Domain¸í¿¡ .ÀÌ ÇÏ³ª ÀÌ»ó ÀÖ¾î¾ß ÇÔ
     - Domain¸íÀÇ ¸¶Áö¸· ¹®ÀÚ´Â ¿µ¹®ÀÚ 2~3°³ÀÌ¾î¾ß ÇÔ **/
    var regMust = /^[a-zA-Z0-9\-\.\_]+\@[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3})$/;
    
    if ( !regDoNot.test(strEmail) && regMust.test(strEmail) )
        return true;
    else    
        return false;
}

function popupMasterPhoto()
{
	popupWindow( '?_module=member&_do=mphoto','masterPhoto',410 ,600 );
}

/*
Å×ÀÌºí¿¡ µû¸¥ ºÐ·ù
mode : ¸ðµ¨Â¯ : MODELJJANG, ´ëÇ¥»çÁø : mphoto
*/
function showPicture( mode, unique_no )
{
	winPop = window.open( "/?_module=common&_do=view.picture&mode="+mode+"&unique_no="+unique_no , mode+"viewpicture", 'top=100,left=100,width=600, height=600, scrollbars=yes, status=no, resizable=yes');
	if ( winPop == "[object]" )
	{
		winPop.focus();
	}
}

function showPicture2( mPhoto, width, height )
{
	var width = parseInt(width);
	var height = parseInt(height);

	window.open( "/?_module=common&_do=view.picture2&mPhoto="+mPhoto , 'picture','top=100,left=100,width='+width+', height='+height+', scrollbars=no, status=no, resizable=yes');
	
}
/*function alert( msg )
{
	var r=window.showModalDialog('/?_module=common&_do=notice.pop&msg='+msg,'',"dialogWidth:471px;dialogHeight:252px;resizable:no; center:yes; help:no; status:no ;scroll:no");
}*/

function js_PopDoumi( type ) {
	var url = "/?_module=etc&_do=doumi&type=" + type;
	fn_NW(url,500,400,'help'+type);
}

function js_FindId( ifr , id) {
	ifr.document.location.href = "/?_module=common&_do=findid&mem_id=" + id;
}

function js_PaperRecv(type,stream) {
	var w = window.open('/?_module=wmms&_do=paper.recv&type='+type+'&stream='+stream,'','width=500,height=400,top=10,left=10');
	w.focus();
}

function js_BookingRecv(type,stream) {
	try {
    	//var szUserID        = SessionAX_GetCommand(stream, 2);
    	var url = "/?_module=wmms&_do=booking.recv&type="+type+"&stream="+stream;
    	fn_NW(url,500,400,'');
    	//fn_NW(url,500,400,'bookingr'+szUserID);
	} catch(e) {
	}
}

function js_GiftRecv(stream) {
	var w = window.open('/?_module=wmms&_do=gift.recv&stream='+stream,'','width=468,height=315,top=10,left=10');
	w.focus();
}

function js_AppealRecv(stream) {
	var w = window.open('/?_module=wmms&_do=appeal.recv&stream='+stream,'','width=468,height=315,top=10,left=10');
	w.focus();
}


function js_ForLogin(url) {
	alert('·Î±×ÀÎÈÄ ÀÌ¿ëÇÏ¿© ÁÖ¼¼¿ä.');
	document.location.href = '/?_module=auth&_do=logon';
}


function js_CopyClipBoard(id) {
	text = document.body.createTextRange();
	text.moveToElementText(id);
	text.execCommand("Copy");
	alert("È¨ÇÇ URLÀÌ º¹»çµÇ¾ú½À´Ï´Ù. Ctrl V¸¦ ÀÌ¿ëÇÏ¿© ºÙ¿©³Ö±â ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù");
}

/******************************** ÀÌ¹ÌÁöÆ÷Ä¿½º ºí·¯Ã³¸® :: 070608¹ÚÁöÈ£*************************************/
function bluring()
{
/** Æç¸®½º editor ¹®Á¦·Î A ºÎºÐ Á¦°ÅÇÔ. edited by kyuhwa at 070701
	if(event.srcElement.tagName == "A" || event.srcElement.tagName == "IMG" ) {
*/
	if(event.srcElement.tagName == "IMG" ) {

		document.body.focus();

	}
}
document.onfocusin=bluring;
// end ÀÌ¹ÌÁö¸¶¿ì½º´Ù¿î½Ã ¿Ü°û¼± Á¦°Å 

// ¹ÙÀÌÆ® Á¦ÇÑ
function byteLimit(aObj,sObj,limitByte) {
    var tmpStr1 = new String(aObj.value);
    var tmpStr2 = '';
    var onechar;
    var tcount = 0;
	
    for (k=0;k<tmpStr1.length;k++) {
        onechar = tmpStr1.charAt(k);

        if (escape(onechar).length > 4) {
                tcount += 2;
		}else if (onechar!='\r') {
                tcount++;
        }
        
        if(tcount >limitByte) {
        	reserve = tcount-limitByte;
            alert("±ÛÀÚ¼ö°¡ ÃÊ°ú µÇ¾ú½À´Ï´Ù.");
            aObj.value = tmpStr2;
            sObj.innerHTML = windyCount(tmpStr2);
            return false;
        }else{  // ¹Ì´Þ½Ã
            tmpStr2 = tmpStr2 + onechar;
            if (sObj != null)  sObj.innerHTML = tcount.toString();
        }
    } // for
    
    return true;
}

function windyCount(aquery) {
    var tmpStr = new String(aquery);
    var onechar;
    var tcount = 0;

    for (var k=0;k<tmpStr.length;k++) {
        onechar = tmpStr.charAt(k);

        if (escape(onechar).length > 4) {
            tcount += 2;
        }else if (onechar!='\r') {
            tcount++;
        }
    }
    return tcount;
}

function js_IsVista() {
	if (navigator.userAgent.indexOf("Windows NT 6.0") > -1) 
		return true;
	return false;
	
}

function js_ResizeTo(width,height) {
	try {
	if( js_IsVista() ) {
		window.resizeTo( width , height+30);
	} else {
		window.resizeTo( width , height);
	}
	} catch(e) {
		setTimeout( "js_ResizeTo("+width+","+height+")" , 1000);
	}
}

function js_Text2HTML( str ) {
	var newstr = str.replace(/ /g, "&nbsp;");
	newstr = newstr.replace( /</g , "&lt;");
	newstr = newstr.replace( /\n/g , "<BR>");
	return newstr;
}

function js_NotLogin() {
	alert("·Î±×ÀÎ ÈÄ ÀÌ¿ëÇÏ¼¼¿ä.");
	top.document.location.href = "/?_module=auth&_do=logon";
}

function js_NotMember() {
	alert("Á¤È¸¿øÀÌ µÇ¼Å¾ß ¼­ºñ½º ÀÌ¿ëÀÌ °¡´ÉÇÕ´Ï´Ù.");
	top.document.location.href = "/?_module=bead&_do=member.sign";
}

function js_GetLeftTimeOfToday() {
	var now = new Date()
	var year = now.getYear()
	var month = now.getMonth() +1
	var day = now.getDate()

	var year2 = year%2000;
	var last = new Date(year, month, day, 23, 59, 59);
	var depth = last.getTime() - now.getTime();
	var depth2 = parseInt( depth / 1000);
	return depth2;
}

function js_SessionOnOffClose() {
	try {
		idSessionOff.style.visibility = "hidden";
	}catch(e) {}
}

function js_SessionOnOffCloseToday() {
    try {
        js_SetGrpCookie( "C" , "sesonoff" , "Y" );
        idSessionOff.style.visibility = "hidden";
        idSessionOff.style.display = "block";
    }catch(e) {}
}

var js_SessionOnOff_Click = false;
function js_SessionOnOff(obj) {
	try {
		if( js_SessionOnOff_Click ) return;
		js_SessionOnOff_Click = true;

		var isview = js_GetGrpCookie( "C" , "sesonoff" );
        if(isview=="Y") return;

		obj.style.visibility = "visible";
		obj.style.display = "block";
		var isow =  parseInt( document.body.clientWidth/2);
		var isoh =  parseInt( document.body.clientHeight/2);
		if( isow > 150 ) isow -= 150; else isow = 10;
		if( isoh > 150 ) isoh -= 150; else isoh = 10;
		obj.style.top = isoh;
		obj.style.left= isow;
	} catch(e) {}
}


///////////////////////////////////////////////////////////ÆË¾÷¸®»çÀÌÁî(IE6.0&IE7.0È£È¯)////////////////////////////////////
function js_FitPopupSize( arg1, arg2, arg3) {
	try {
		fitPopupSize( arg1, arg2, arg3 );
	} catch(e) {
		//alert(e);
	}
}

function fitPopupSize( arg1, arg2, arg3 ) {
	var toWidth = null;
	var toHeight = null;
	var objOut = null;
	var positionRequired = true;

	var typeArg1 = typeof(arg1);
	var typeArg2 = typeof(arg2);
	var typeArg3 = typeof(arg3);
	
	if( typeArg1 == "undefined" || typeArg1 == "boolean" ) {
		objOut = document.getElementById("page_content");
		
		if( typeArg1 == "boolean" ) {
			positionRequired = arg1;
		}
	}
	if( typeArg1 == "string" ) {
		objOut = document.getElementById(arg1);
		if( objOut == null ) { return; }
				
		if( typeArg2 == "boolean" ) {
			positionRequired = arg2;
		}
	}

	if( typeArg1 == "object" ) {
		objOut = arg1;
				
		if( typeArg2 == "boolean" ) {
			positionRequired = arg2;
		}
	}
	
	if( objOut != null ) {
		var objParent = objOut.parentNode;
		var getStyle = function(obj) {
			if( obj.currentStyle ) {
				return obj.currentStyle;
			} else if( document.defaultView.getComputedStyle ) {
				return document.defaultView.getComputedStyle(obj, null);
			}
			}

		if( objParent != null && objParent.tagName == "BODY" && getStyle(objOut).position == "absolute" ) {
			try {
				var bodyPaddingTop = 0; var outerPaddingTop = 0;
				var bodyPaddingBottom = 0; var outerPaddingBottom = 0;
				var bodyPaddingLeft = 0; var outerPaddingLeft = 0;
				var bodyPaddingRight = 0; var outerPaddingRight = 0;
				
				if( document.body.currentStyle ) {
					var bodyCurrentStyle = document.body.currentStyle;
					bodyPaddingTop = parseInt(bodyCurrentStyle.paddingTop);
					bodyPaddingBottom = parseInt(bodyCurrentStyle.paddingBottom);
					bodyPaddingLeft = parseInt(bodyCurrentStyle.paddingLeft);
					bodyPaddingRight = parseInt(bodyCurrentStyle.paddingRight);
					
					var outerCurrentStyle = objOut.currentStyle;
					outerPaddingTop = parseInt(outerCurrentStyle.paddingTop);
					outerPaddingBottom = parseInt(outerCurrentStyle.paddingBottom);
					outerPaddingLeft = parseInt(outerCurrentStyle.paddingLeft);
					outerPaddingRight = parseInt(outerCurrentStyle.paddingRight);
					
				} else if( document.defaultView.getComputedStyle ) {
					var objBodyStyle = document.defaultView.getComputedStyle(document.body, null);
					bodyPaddingTop = parseInt(objBodyStyle.getPropertyValue("padding-top"));
					bodyPaddingBottom = parseInt(objBodyStyle.getPropertyValue("padding-bottom"));
					bodyPaddingLeft = parseInt(objBodyStyle.getPropertyValue("padding-left"));
					bodyPaddingRight = parseInt(objBodyStyle.getPropertyValue("padding-right"));
					
					var outerCurrentStyle = document.defaultView.getComputedStyle(objOut, null);
					outerPaddingTop = parseInt(outerCurrentStyle.getPropertyValue("padding-top"));
					outerPaddingBottom = parseInt(outerCurrentStyle.getPropertyValue("padding-bottom"));
					outerPaddingLeft = parseInt(outerCurrentStyle.getPropertyValue("padding-left"));
					outerPaddingRight = parseInt(outerCurrentStyle.getPropertyValue("padding-right"));
				}
				
				var adjustHeight = bodyPaddingTop + bodyPaddingBottom;
				var adjustWidth = bodyPaddingLeft + bodyPaddingRight;
				
				var oWidth = objOut.clientWidth;
				var oHeight = objOut.clientHeight;
				
				// objOut.style.height = oHeight + adjustHeight;				
				objOut.style.paddingTop = outerPaddingTop + bodyPaddingTop;
				objOut.style.paddingBottom = outerPaddingBottom + bodyPaddingBottom;

				// objOut.style.width = oWidth + adjustWidth;
				objOut.style.paddingLeft = outerPaddingLeft + bodyPaddingLeft;
				objOut.style.paddingRight = outerPaddingRight + bodyPaddingRight;
			} catch(e) {
				// do nothing
				// alert( e.message );
			}
		}
		toWidth = objOut.clientWidth;
		toHeight = objOut.clientHeight;
	}

	if( typeArg1 == "number" && typeof(arg2) == "number" ) {
		toWidth = arg1;
		toHeight = arg2;
		
		if( typeArg3 == "boolean" ) {
			positionRequired = arg3;
		}
	}

	if( toWidth == null && toHeight == null ) { return; }

	if( positionRequired ) {
		fitPopupSize_adjustPosition( toWidth, toHeight );
	}

	fitPopupSize_resize( toWidth, toHeight );
}

function fitPopupSize_adjustPosition( toWidth, toHeight ) {
	var posLeft = (window.screenLeft) ? window.screenLeft : window.screenX;
	var posTop = (window.screenTop) ? window.screenTop : window.screenY;
	var adjustLeft = 0;	var marginWidth = 50;
	var adjustTop = 0;	var marginHeight = 50;
	var movingRequired = false;

	if( posTop + toHeight + marginHeight > screen.availHeight ) {
		adjustTop = -(posTop + toHeight + marginHeight - screen.availHeight);
		movingRequired = true;
	}
	if( posLeft + toWidth + marginWidth > screen.availWidth ) {
		adjustLeft = -(posLeft + toWidth + marginWidth - screen.availWidth);
		movingRequired = true;
	}
	if( movingRequired ) {
		window.moveBy( adjustLeft, adjustTop );
	}
}

function fitPopupSize_resize( toWidth, toHeight ) {
	var oBody = document.body;
	if( oBody == null ) { return; }

	if( typeof(window.innerHeight) != "undefined" && typeof(window.innerWidth) != "undefined" ) {
		window.innerHeight = toHeight;
		window.innerWidth = toWidth;
	} else {
		var diffX = toWidth - oBody.clientWidth;
		var diffY = toHeight - oBody.clientHeight;

		window.resizeBy( diffX, diffY );
	}
}

function fitPopupSizeEx() {
	var oBody = document.body;
	if( oBody == null ) { return; }
	
	var idPrefix = "page_content";
	var objId = "";
	var chkResult = false;
	var objChk = null;
	
	for( var i=65; i<=90; i++ ) {
		objId = idPrefix + String.fromCharCode(i);
		objChk = document.getElementById(objId);
		if( objChk == null ) { break; }
	}
	if( objChk != null ) { return; }

	var objOut = window.document.createElement("<div id='" + objId + "' style='position:absolute;left:0;top:0;'>");

	var existNodeList = window.document.body.childNodes;
	while( existNodeList.length > 0 ) {
		objOut.appendChild( existNodeList[0] );
	}
	document.body.appendChild( objOut );

	var toWidth = objOut.clientWidth;
	var toHeight = objOut.clientHeight;
	if( toWidth == null && toHeight == null ) { return; }

	fitPopupSize_adjustPosition( toWidth, toHeight );

	fitPopupSize_resize( toWidth, toHeight );
}
function flash_event(url, tVar, width,height) { 
 
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+width+'" height="'+height+'">');
    //document.write('<param name=movie value="'+url+'?mVar='+mVar+'&sVar='+sVar+'&aVar='+aVar+'&lVar='+lVar+'"');
    document.write('<param name=movie value="'+url+'?tVar='+tVar+'"');    document.write('<param name=menu value="false">');
    document.write('<param name=scale value=noscale> ');
    document.write('<PARAM NAME=wmode VALUE="transparent">');
    document.write('<param name=quality value=high>');
    //document.write('<embed src="'+url+'?mVar='+mVar+'&sVar='+sVar+'&aVar='+aVar+'&lVar='+lVar+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">');
    document.write('<embed src="'+url+'?tVar='+tVar+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'">');
    document.write('</embed> ');
    document.write('</object>');
 
}
