var oc_mozilla_is = false;
if(/Netscape/.test(navigator.appName)) {
	oc_mozilla_is = true;
}

var oc_ie_is = document.all;
var oc_ns6_is = document.getElementById && !document.all;

function oc_ie_true_body() {
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function help_window(url) {aWindow=window.open(url,"",'toolbar=0,resizable=0,scrollbars=1, left=100, top=50, width=800,height=600');}
function new_win(url, win_name, option) {window.open(url, win_name, option);}

function GetXmlHttpObject() {
	var xmlHttp=null;
	try {xmlHttp=new XMLHttpRequest();}
	catch (e) {
		try {xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}
		catch (e) {xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}
	}
	return xmlHttp;
}

var firstmcux;
var firstmcuy;

function oc_mouse_move_event (evt) {
  firstmcux = document.all ? event.clientX : document.layers ? evt.x : evt.clientX;
  firstmcuy = document.all ? event.clientY : document.layers ? evt.y : evt.clientY;
}

// ³Ý½ºÄÉÀÌÇÁ 4ÀÏ °æ¿ì
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
// ³Ý½ºÄÉÀÌÇÁ 4 ¹× ÀÍ½ºÇÃ·Î·¯ 4 ÀÌ»ó
if (document.layers || document.all) document.onmousemove = oc_mouse_move_event;
// ³Ý½ºÄÉÀÌÇÁ 6ÀÏ °æ¿ì
if (document.addEventListener) document.addEventListener('mousemove', oc_mouse_move_event, true);

function oc_set_inner_html(object, html)
{
	if(oc_mozilla_is)
	{
		var r = object.ownerDocument.createRange();
		r.selectNodeContents(object);
		r.deleteContents();
		var df = r.createContextualFragment(html);
		object.appendChild(df);
	}
	else
	{
		object.innerHTML = html;
	}
}

function oc_get_inner_html(object)
{
	if(oc_mozilla_is)
	{
		if(object.childNodes.length == 0)
		{
			return "";
		}
		else
		{
			return object.childNodes[0];
		}
	}
	else
	{
		return object.innerHTML;
	}
}

function oc_original_image(img, ImageWidth, ImageHeight) {
	mm = window.open('', '', 'width='+ImageWidth+', height='+ImageHeight+', top='+Math.ceil((screen.height - ImageWidth)/2.6)+',left='+Math.ceil((screen.width - ImageHeight)/2.6)+',scrollbars=1');
	var doc = mm.document;
	doc.body.style.margin = 0;
	if (oc_mozilla_is)
	{
		doc.body.style.cursor = "pointer";
	} else {
		doc.body.style.cursor = "hand";
	}	
	var previewimg = doc.createElement("img");
	previewimg.src = img.src;
	doc.body.appendChild(previewimg);
	previewimg.onmousedown = function(){ mm.close();}
}

function showhide(targetID) {
    //change target element mode
    var elementmode = document.getElementById(targetID).style;
    elementmode.display = (!elementmode.display) ? 'none' : '';
}

function changetext(changee,oldText,newText) {
    //changes text in source element
    var elementToChange = document.getElementById(changee);
    elementToChange.innerHTML = (elementToChange.innerHTML == oldText) ? newText : oldText;
}

function workforchange(targetID,sourceID,oldContent,newContent) {
    showhide(targetID);
    changetext(sourceID,oldContent,newContent);
}
