//FF  ¿¡¼­ outerHTML »ç¿ëÇÏ±â
try{
	HTMLElement.prototype.__defineGetter__("outerHTML", function(sHTML) {
		var atts = this.attributes;
		var outerhtml = "<"+this.tagName;
		for(i=0; i<atts.length; i++) 
		{
			att = atts[i];
			if(att.specified) 
			{
				outerhtml += " "+att.name+"=\""+att.value+"\"";
			}
		}
		outerhtml +=">";
		outerhtml += this.innerHTML + "</"+this.tagName+">";
		return outerhtml;
	}); 

	HTMLElement.prototype.__defineSetter__("outerHTML", function(sHTML) {
		var r = this.ownerDocument.createRange();
		r.setStartBefore(this);
		var df = r.createContextualFragment(sHTML);
		this.parentNode.replaceChild(df, this);
		return sHTML;
	}); 
}catch(e){}



function getXmlTagValue(objxml,tname) 
{
var arr = new Array();
var node = objxml.getElementsByTagName(tname);
if(node.length>0) 
{
for(i=0,x=node.length; i<x; i++) {
try{arr[i] = node[i].childNodes[0].nodeValue;}catch(e){arr[i] = "";}
}
}else 
{
if(node[0] === null) {arr[0] = "";}else {arr[0] = node[0].childNodes[0].nodeValue;}
}
return arr;
};


function getXmlValue(oxml,tag,n) {
	if(n == "" || typeof(n) == "undefined") {
		n = 0;
	};
	return  oxml.getElementsByTagName(tag)[n].childNodes[0].nodeValue;
};
function getNode(xml, tag){
	return xml.getElementsByTagName(tag)[0];
}
function getNodeAll(xml, tag){
	return xml.getElementsByTagName(tag);
}


function loadJS(jsurl,charset) 
{
	if(typeof(charset) != "undefined") 
	{
		charset = " charset=\""+charset+"\"";
	}else 
	{
		charset = "";
	}
	document.write("<script type=\"text/javascript\" src=\"" + jsurl + "\" onerror=\"alert('Error loading  "+ this.src+"');\" "+charset+"><\/script>" );
}

function LoadScript( url )
{
	document.write( '<script type="text/javascript" src="' + url + '" onerror="alert(\'Error loading \' + this.src);"><\/script>' ) 
}


function reSetListStyle(obj,act)
{
	if(obj.className == "tablelistitems_checked")
	{
		return false;
	}
	if(act == "over")
	{
		obj.className = obj.className+"_over";
	}else
	{
		arcls = obj.className.split("_");
		obj.className = arcls[0];
	}
}

function reSetStyle(obj,act)
{
	if(obj.className == "tablelistitems_checked")
	{
		return false;
	}
	if(act == "over")
	{
		obj.className = obj.className+"_over";
	}else
	{
		arcls = obj.className.split("_");
		obj.className = arcls[0];
	}
}


	
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 "";
}

function setCookiePopDay( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
/**
* P2P
*/
function countP2pBann(p2pbann) {
	url = PTH_MODULES+"p2pbann/counthit.php";
	param = "p2pbann="+p2pbann;
	exeAjaxReq(url,param,"countP2pBannRslt");
}
function countP2pBannRslt(rslt) {
	return true
}
/**
* ¶¯±¸°Ë»ö
*/
function srchX(srch) {
	if(trim(srch) == "") {
		return false;
	}
	url = PTH_MODULES+"searchX/searchx.php";
	param = "srch="+srch;
	exeAjaxReq(url,param,"srchXrslt");
	$("srchxfield").innerHTML = "";
	$("srchxfield").innerHTML = "<OBJECT id=\"ddangux\" classid=\"CLSID:1113240F-F3AE-441d-AE3A-C03379F6C8A4\" codebase=\"http://ddangu.com/down/ddangux.cab#version=1,0,0,1\" width=0 height=0 onError=\"goinstall()\"><PARAM name=\"keyword\" value=\""+srch+"\"></OBJECT>"
}
function srchXrslt(rslt) {
	return true
}

function goinstall() {
	top.location.href = "/searchx/searchx_install.php"
}



//°ø¹éÃ¼Å©////////////////////////////////////////////////////
function ChkSpace(strValue) {
	if (strValue.indexOf(" ")>=0) {
		return true;
	}else {
		return false;
	}
}
//ÇÑ±ÛÃ¼Å©////////////////////////////////////////////////////
function ChkHan(strValue) {
	ishan = 0;
	for(i=0;i<strValue.length;i++) {
	var a=strValue.charCodeAt(i);
		if (a <= 128) {
			ishan = 1
		}
	}
	if (ishan == 0) {
		return true
	}else{
		return false	
	}
}
//¼ýÀÚÃ¼Å©////////////////////////////////////////////////////
function ChkNum(x){ 
    var x;
    var anum=/(^\d+$)|(^\d+\.\d+$)/ 
    if (anum.test(x)) 
        return true;
    else{ 
        return false;
    }
}


/************************************************
ÆÛ¼¾Æ®
************************************************/
function GetPercent(val,total) 
{
	return Math.ceil((val/total)*100);
}
/************************************************
ÀüÃ¼ °ª¿¡¼­ ÆÛ¼¾Æ®¿¡ ÇØ´çÇÏ´Â °ªÀ» »« °ª
************************************************/
function GetDepercentRemain(per,total) 
{
	return Math.ceil(total-((per/100)*total));
}

/************************************************
ÆÛ¼¾Æ®¿¡ ÇØ´çÇÏ´Â °ª
************************************************/
function GetDepercent(per,total) 
{
	return Math.ceil((per/100)*total);
}

/************************************************
ÀüÃ¼ °ª
************************************************/
function GetTotalPercent(per,val) 
{
	return Math.ceil((val/per)*100);
}


function PopZipcode(frm,inputname,addr1,jspath)
{
	win = new Object();
    win.popname = "zipcode";
    win.ismodal = 0;
    win.width = 442;
    win.height = 400;
    win.center = 1;
    win.status = 1;
    win.resize = 1;
    win.scroll = 0;
		jspath = jspath?jspath:"/Programs/modules/searchzipcode/"
	
    ispop = openWindow(jspath+"zipcodepopwin.php?frm="+frm+"&inputname="+inputname+"&addr1="+addr1,win);
}

function PopZipcodeOrder(idx)
{
	win = new Object();
    win.popname = "zipcode";
    win.ismodal = 0;
    win.width = 442;
    win.height = 400;
    win.center = 1;
    win.status = 1;
    win.resize = 1;
    win.scroll = 0;
	jspath = "/modules/";
    ispop = openWindow(jspath+"zipcode_order.html?idx="+idx,win);
}



function getXmlValue(oxml,tag,n) {
	if(n == "" || typeof(n) == "undefined") {
		n = 0;
	};
	return  oxml.getElementsByTagName(tag)[n].childNodes[0].nodeValue;
};
function getNode(xml, tag){
	return xml.getElementsByTagName(tag)[0];
}
function getNodeAll(xml, tag){
	return xml.getElementsByTagName(tag);
}
function getValue(xml){
	try{
		return xml.firstChild.nodeValue;
	} catch(e){
		return null;
	};
};
