/* ÄíÅ°¸¦ ¾ò½À´Ï´Ù. */
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 createXMLHttpAjax() 
{     
  if(window.ActiveXObject) {
	  xmlHttpL = new ActiveXObject('Microsoft.XMLHTTP');
	  return xmlHttpL;
  } else if(window.XMLHttpRequest) {
	  xmlHttpL = new XMLHttpRequest();   
	  return xmlHttpL;
  } else {   
	alert('XMLHttpRequest °´Ã¼¸¦ »ý¼ºÇÏÁö ¸øÇß½À´Ï´Ù!\nÀÌ »çÀÌÆ®ÀÇ ±â´É ÀÏºÎ¸¦ »ç¿ëÇÏÁö ¸øÇÒ ¼ö ÀÖ½À´Ï´Ù.');   
	is_xhrL = false;   
	return is_xhrL;
  }   
}

function startRequestAjax(url,postValue,elementID) {	// È£ÃâµÉ ÇÚµé·¯,ÇÚµé·¯¿¡¼­ È£ÃâµÉ ÁÖ¼Ò,È£ÃâµÉ ÁÖ¼Ò·Î º¸³¾ º¯¼öµé (a=0&b=0), »Ñ·ÁÁú ¿¤¸®¸ÕÆ® ID
	var url			= url;
	var postValue;
	var elementID	= elementID;
	var xmlHttpL;

	xmlHttpL = createXMLHttpAjax();
	
	if(xmlHttpL) { 
		xmlHttpL.open('POST',url,true);
		xmlHttpL.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");  
		xmlHttpL.onreadystatechange = function() {
			if(xmlHttpL.readyState == 4) {   
				if(xmlHttpL.status == 200) {
					var data = xmlHttpL.responseText;
					document.getElementById(elementID).innerHTML = xmlHttpL.responseText;

					if (match = data.match(/<script[^>]*>(([^<]|\n|\r|<[^\/])+)<\/script>/)) {
						eval.call(window, match[1]);
					}

					if ( elementID == 'layer_pop_div') {
						var position = $(window).scrollTop(); // ÇöÀç ½ºÅ©·Ñ¹ÙÀÇ À§Ä¡°ªÀ» ¹ÝÈ¯ÇÕ´Ï´Ù.
						var _login_layer = $("#layer_pop_div");
						_login_layer.show();
						_login_layer.css({top: ($(window).height()-_login_layer.height())/2 + position , left: ($(window).width()-_login_layer.width())/2});
					}

					if ( elementID == 'SMSSENDLIST') {
						var sCnt	= document.getElementById("sendCnt").value;
						document.getElementById("sendCount").innerHTML	= sCnt;
					}

				} else {   
				  //alert('¼­¹ö ¿¬°á¿¡ ½ÇÆÐÇÏ¿´½À´Ï´Ù!A8');
				  //document.AJAX_ERROR_CHECK.location.href = 'http://dbi.wisepeer.com/visitor/pageViewCountingExterior.php?lowpage=AJAX_ERROR';
				}   
			}   
		}
		xmlHttpL.send(postValue);
	} else {   
		alert('XMLHttpRequest °´Ã¼¸¦ »ç¿ëÇÒ ¼ö ¾ø½À´Ï´Ù!');   
	}
}

function ClearStop(){
	stop1 = 0;
	stop2 = 0;
}

// divº¸ÀÌ°í ¾Èº¸ÀÌ±â
function viewCheck(divName) 
{
	var divName;

	if (document.getElementById(divName).style.display == 'none')
	{
		document.getElementById(divName).style.display	= '';

	} else
	{
		document.getElementById(divName).style.display	= 'none';
	}

}

function viewClose(divName) 
{
	var divName;
	document.getElementById(divName).style.display	= 'none';
}

function viewOpen(divName) 
{
	var divName;
	document.getElementById(divName).style.display	= '';
}
