var offsetxpoint=-60 //Customize x offset of tooltip
var offsetypoint=20 //Customize y offset of tooltip
var ie=document.all
var ns6=document.getElementById && !document.all
var enabletip=false
if (ie||ns6)
var tipobj=document.all? document.all["dhtmltooltip"] : document.getElementById? document.getElementById("dhtmltooltip") : ""

function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.x+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.y+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function Marq(kind){
	switch(kind) {
	case 1:
	mq_notice.stop();
	break;
	}
	switch(kind) {
	case 2:
	mq_notice.start();
	break;
	}
}



function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}
document.onmousemove=positiontip


var prev_divid		= "";
var prev_formCount	= "";
var prev_mode		= "";

function GoWrite( divid, mode, name, title, content, Count, Msg )
{

	chk	= mode +"_"+ Count;
	if ( prev_divid != "" && prev_mode != chk )
	{
		document.all[prev_divid].style.display = "none";
		var prev_frm = document.forms["reply_frm_"+prev_formCount];
		prev_frm.mode.value		= "";
		prev_frm.name.value		= "";
		prev_frm.content.value	= "";
	}
	prev_divid			= divid;
	prev_formCount		= Count;
	prev_mode			= mode +"_"+ Count;



	var chk = document.all[divid].style.display;
	chk = ( chk == '' )?'none':'';
	document.all[divid].style.display = chk;

	var frm =document.forms["reply_frm_"+Count];
	frm.mode.value		= mode;
	frm.name.value		= name;
	frm.content.value	= content;

	field_space_check2("reply_frm_"+prev_formCount, 'name','','ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä','black');
	field_space_check2("reply_frm_"+prev_formCount, 'content','','ÀÇ°ßÀ» ÀÔ·ÂÇÏ¼¼¿ä (´ç½ÅÀÇ ÇÑ¸¶µð°¡ ´ç½ÅÀÇ ÀÎ°ÝÀ» ÁÂ¿ìÇÕ´Ï´Ù.)','black');
	//frm.sendit.value	= Msg;


}

var prev_replyDiv	= "";
function ShowReply( replyDiv )
{
	if ( prev_replyDiv != replyDiv && prev_replyDiv != "" )
	{
		document.all[prev_replyDiv].style.display = "none";
	}
	prev_replyDiv	= replyDiv;

	var chk	= document.all[replyDiv].style.display;
	chk = ( chk == '' )?'none':'';
	document.all[replyDiv].style.display = chk;
}

function ReplyDelete(number)
{
	if ( confirm("Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?" ) )
	{
		alert("¾Ë°Ù´Ù");
	}
}

function login()
{
	link	= window.location.href;

	window.location.href = "/new_login.php?returnUrl="+link;
}


//ÀÌ¹ÌÁöÃ¼ÀÎÁö
var prevImg  = new Array();
prevImg[0]  = "";
prevImg[1]  = "img_1";
prevImg[2]  = "img_3";

var prevLayer = new Array();
prevLayer[1] = "layer_1";
prevLayer[2] = "layer_3";






 function viewLayer(nowLayer,no)
 {
  document.all[prevLayer[no]].style.display = "none";
  document.all[nowLayer].style.display = "";
  prevLayer[no] = nowLayer;
 }

 function changeImg(nowImg,no)
 {
  if ( nowImg != prevImg[no] )
  {
		if ( prevImg[no] != "" )
		{
			prevImgSrc = document.all[prevImg[no]].src.replace("_on.gif",".gif");
			document.all[prevImg[no]].src = prevImgSrc.replace(".gif","_off.gif");
		}
		nowImgSrc = document.all[nowImg].src.replace("_off.gif",".gif");

		document.all[nowImg].src = nowImgSrc.replace(".gif","_on.gif");
		prevImg[no] = nowImg;
  }
 }


function FlashXmlbody(Ftrans,wid,hei) {
 mainbody = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='"+ wid +"' height='"+ hei +"'>";
 mainbody += "<param name='movie' value='"+ Ftrans +"'>";
 mainbody += "<param name='quality' value='high'>";
 mainbody += "<param name='menu' value='false'>";
 mainbody += "<param name='scale' value='noscale'>";
 mainbody += "<param name='wmode' value='transparent'>";
 mainbody += "<param name='salign' value='lt' />";
 mainbody += "<embed src='"+ Ftrans +"' quality='high' align='middle' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='"+ wid +"' height='"+ hei +"'></embed>"
 mainbody += "</object>";

 document.write(mainbody);
 return;
}

function messageReloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=messageReloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
messageReloadPage(true);

function messageFindObj(n, d) { //v4.01
  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=messageFindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function messageShowHideLayer() { // MM_showHideLayersv6.0 ÇÔ¼ö ÀÌ¸§¸¸ º¯°æ (Ãæµ¹¹æÁö)
	var i,p,v,obj,args=messageShowHideLayer.arguments;
	for (i=0; i<(args.length-2); i+=3)
	{
		if ((obj=messageFindObj(args[i]))!=null) {
			v=args[i+2];
			if (obj.style) {
				obj=obj.style;
				v=(v=='show')?'visible':(v=='hide')?'hidden':v;
			}

			obj.visibility=v;
			if ( v == 'hide' || v == 'hidden' )
			{
				obj.left	= -555;
				obj.top		= -555;
			}
			else
			{
				happyMessageLayerCheck	= true;
				obj.left	= event.x + ietruebody().scrollLeft - 0 ;
				obj.top		= event.y + ietruebody().scrollTop - 0;
			}
		}
	}
}


function messageShowUser( userid )
{
	document.getElementById('dhtmltooltip').style.border	= '';
	document.getElementById('dhtmltooltip').style.background	= '';
	document.getElementById('dhtmltooltip').style.width = '130';
	document.getElementById('dhtmltooltip').innerHTML = "<table cellpadding='2' cellspacing='0' onClick=\"messageShowHideLayer('dhtmltooltip','','hide')\"><tr><td width='110' bgcolor='#D9D9D9'><table cellpadding='2' cellspacing='1' width='100%' bgcolor='#CACACA'><tr><td bgcolor='white'><table cellpadding='2' cellspacing='0' width='100%'><tr><td height='25'><a href='#1' onClick=\"window.open('happy_message.php?mode=send&receiveid="+userid+"','happy_message_send','width=700,height=400,toolbar=no,scrollbars=no')\"><img align='absmiddle' src='img/message/icon_messicon.gif' width='15' height='12' border='0'><img src='img/binimg.gif' width='5' height='1' border='0'>ÂÊÁöº¸³»±â</a></td></tr><tr><td height='25'><a href='price_search.php?get_si=&kind=id&search_word="+userid+"'><img align='absmiddle' src='img/message/icon_messregi.gif' width='16' height='16' border='0'><img src='img/binimg.gif' width='4' height='1' border='0'>µî·Ï¾÷Ã¼º¸±â</a></td></tr></table></td></tr></table></td></tr></table>";
	messageShowHideLayer('dhtmltooltip','','show');


	//document.onClick	= messageShowHideLayer('dhtmltooltip','','hide');
}

var happyMessageLayerCheck = false;
document.onclick = function()
{
	if (!happyMessageLayerCheck)
		messageShowHideLayer('dhtmltooltip','','hide');
	else
		happyMessageLayerCheck = false;
}

//»õ À©µµ¿ìÃ¢ ¶ç¿ì±â
function open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable){
	toolbar_str = toolbar ? 'yes' : 'no';
	menubar_str = menubar ? 'yes' : 'no';
	statusbar_str = statusbar ? 'yes' : 'no';
	scrollbar_str = scrollbar ? 'yes' : 'no';
	resizable_str = resizable ? 'yes' : 'no';
	window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}


dal1 = new Image()
var dal = new Image();
function view_img(bi,dalai){
	var wid;
	var hei;
	wid = '800'; w= '800'		;
	hei = '650'; h = '650'
	if (ie)  window.open(bi,'detail_popup','width='+wid+',height='+hei+',resizable=1,top=50,left=50');
	else window.open(bi,'detail_popup','width='+w+',height='+h+',resizable=1');
}


//PNG¾ËÆÄ IEÀû¿ë
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
	//alert(obj.src);
    obj.style.filter =
    "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    //obj.src='';
    return '';
}

function field_space_check( objId , fieldCheck , outText , outColor)
{
 var obj  = document.getElementById(objId);

 objValue = obj.value;

 if ( objValue == fieldCheck )
 {
  obj.value  = outText;
  obj.style.color = outColor;
 }
}


function field_space_check2( form, objId , fieldCheck , outText , outColor)
{
 var obj  = eval( 'document.'+ form +'.'+ objId );

 objValue = obj.value;

 if ( objValue == fieldCheck )
 {
  obj.value  = outText;
  obj.style.color = outColor;
 }
}

function objectTAG(name,file,width,height,wmode,bgcolor) {
	document.write('\
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'" id="'+name+'" align="middle">\
<param name="allowScriptAccess" value="sameDomain">\
<param name="movie" value="'+file+'">\
<param name="quality" value="high">\
<param name="wmode" value="'+wmode+'">\
<param name="bgcolor" value="'+bgcolor+'">\
<embed src="'+file+'" quality="high" wmode="'+wmode+'" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" name="'+name+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\
</object>\
	');
}