function getStyleObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId).style;
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function getObject(objectId) {
  // checkW3C DOM, then MSIE 4, then NN 4.
  //
  if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId);
   }
   else if (document.all && document.all(objectId)) {  
	return document.all(objectId);
   } 
   else if (document.layers && document.layers[objectId]) { 
	return document.layers[objectId];
   } else {
	return false;
   }
}

function changeObjectVisibility(objectId, newVisibility) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
		return false;
    }
}

function changeObjectDisplay(objectId, newDisplay) {
    // first get a reference to the cross-browser style object 
    // and make sure the object exists
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.display = newDisplay;
	return true;
    } else {
	// we couldn't find the object, so we can't change its visibility
		return false;
    }
}

function displayText(objectId, text){
	if (document.all) {
		if (document.all[objectId]) {
			document.all[objectId].innerHTML = text;
		}
	}
	else
	{
		var obj = document.getElementById(objectId);
		if (obj) {
		obj.innerHTML = text;  
		}
	}
}

var temp_explain = "";

function open_explain (width, height, file, eventObj) {
	var xOffset = 0;
	var yOffset = 0;

	if (temp_explain == file) {
		close_explain ();
		return;
	}
	
	temp_explain = file;

	str_html = "<table width=100% cellpadding=0 cellspacing=1 border=0 bgcolor=CDCDCD>"
			 + "<tr>"
			 + "  <td><iframe width='100%' height='"+height+"' frameborder='0' scrolling='no' src='"+file+"'></iframe></td>"
			 + "</tr>"
			 + "</table>";


	var xpos = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
	var ypos = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0);
	
	if ((xpos + width) > document.body.scrollWidth) {
		xpos = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x - width;
	}
	
	displayText ("layer_explain_main", str_html);
	
	objectstyle = getStyleObject ("layer_explain_main");
	objectstyle.top  = ypos;
	objectstyle.left = xpos;
	objectstyle.width  = width;
	objectstyle.height = height;

	changeObjectDisplay("layer_explain_main", "");
}


// www ÁÂÃø¿µ¿ª
var temp_explain = "";

var msg_array = new Array();
msg_array[0] = "°¡ºñ¾Æ ÀüÃ¼ ¼­ºñ½º ¸ÊÀ» º¸½Ç ¼ö ÀÖ½À´Ï´Ù.";
msg_array[1] = "³ª¸¸ÀÇ Æí¸®ÇÑ Á¶È¸±â´ÉÀ» ÀúÀåÇØº¸¼¼¿ä. ·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù";
msg_array[2] = "¼­ºñ½º ÀÌ¿ë½Ã ±Ã±ÝÇÑÁ¡À» ÇÑÀÚ¸®¿¡ °¡ºñ¾Æ °í°´¼¾ÅÍ";
msg_array[3] = "³õÄ¡¸é ÈÄÈ¸ÇÒ ÇýÅÃ! Áö±Ý È®ÀÎÇÏ¼¼¿ä.";
msg_array[5] = "My°¡ºñ¾Æ¿¡¼­ ¸Þ´º Ãß°¡/»èÁ¦ÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù.";

function open_explain_main (width, height, msg_no, eventObj) {

	var xOffset = 0;
	var yOffset = 0;

	if (temp_explain == msg_no) {
		close_explain ();
		return;
	}

	temp_explain = msg_no;

	var msg = msg_array[msg_no];

	str_html = "<table width='"+width+"' border='0' cellpadding='0' cellspacing='0'>"
		+ " <tr>"
		+ "   <td width='9' height='4'><img src='http://www.gabia.com/images/index/2008_index/q_ro01.gif'></td>"
		+ "   <td width='3'><img src='http://www.gabia.com/images/index/2008_index/q_ro02.gif'></td>"
		+ "   <td background='http://www.gabia.com/images/index/2008_index/q_ro03.gif'>"
		+ "   </td>"
		+ "   <td width='4'><img src='http://www.gabia.com/images/index/2008_index/q_ro04.gif'></td>"
		+ " </tr>"
		+ " <tr>"
		+ "   <td valign='top' background='http://www.gabia.com/images/index/2008_index/q_ro10.gif'><img src='http://www.gabia.com/images/index/2008_index/q_ro11.gif'></td>"
		+ "   <td bgcolor='FFFCE2'>"
		+ "   </td>"
		+ "   <td bgcolor='#FFFCE2' style='padding:3px;font-family:µ¸¿ò;font-size:11px;letter-spacing:-1px;'>" + msg + "</td>"
		+ "   <td background='http://www.gabia.com/images/index/2008_index/q_ro05.gif'>"
		+ "   </td>"
		+ " </tr>"
		+ " <tr>"
		+ "   <td height='4'><img src='http://www.gabia.com/images/index/2008_index/q_ro09.gif'></td>"
		+ "   <td><img src='http://www.gabia.com/images/index/2008_index/q_ro08.gif'></td>"
		+ "   <td background='http://www.gabia.com/images/index/2008_index/q_ro07.gif'>"
		+ "   </td>"
		+ "   <td><img src='http://www.gabia.com/images/index/2008_index/q_ro06.gif'></td>"
		+ " </tr>"
		+ " </table>"
	
	if (navigator.appName == "Netscape") {
		var xpos = -20;
		var ypos = eventObj.pageY - 20;
	} else {
		var xpos = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0) + 100;
		var ypos = (eventObj.pageY)?eventObj.pageY + yOffset:eventObj.y + yOffset + ((document.body.scrollTop)?document.body.scrollTop:0) - 80;
	}
	
	if ((xpos + width) > document.body.scrollWidth) {
		xpos = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x - width;
	}
	
	displayText ("quick_menu_layer_explain", str_html);
	
	objectstyle = getStyleObject ("quick_menu_layer_explain");
	objectstyle.top  = ypos;
	objectstyle.left = xpos;
	objectstyle.width  = width;
	objectstyle.height = height;

	changeObjectDisplay("quick_menu_layer_explain", "");
}


function close_explain_main () {
	changeObjectDisplay("quick_menu_layer_explain", "none");
	displayText ("quick_menu_layer_explain", '');
	temp_explain = "";
}

function close_explain () {
        changeObjectDisplay("layer_explain", "none");
	        displayText ("layer_explain_main", '');
		        temp_explain = "";
}
