var xmlHttp;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
    
function handleStateChange() {
		var foo = new Array();

    if(xmlHttp.readyState == 4) {
        if(xmlHttp.status == 200) {
        	
        	if (xmlHttp.responseText == "S")
        	{
			    	moveToScrapHome();
        	}
        	else if  (xmlHttp.responseText == "D")
        	{
			    	alert("ÀÌ¹Ì ½ºÅ©·¦ µÇ¾î ÀÖ½À´Ï´Ù !") ;
        	}
        	else
        	{
    				alert ("Server Error!");        		
        	}
        }
    }
}

var scrapCate ;

function scrapNow(p1,p2)
{
		var url = "sub_scrap_proc.asp?cate=" + p1 + "&pIdx=" + p2 ;
    
    scrapCate = p1 ;
    createXMLHttpRequest();
    xmlHttp.onreadystatechange = handleStateChange;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null);
		
		
}

function moveToScrapHome()
{
	var answer = confirm("½ºÅ©·¦µÇ¾ú½À´Ï´Ù. \n\n ½ºÅ©·¦ ÆäÀÌÁö·Î ÀÌµ¿ÇÏ½Ã°Ú½À´Ï±î?");
	
	if (answer)
	{
		
		document.location.href = "sub_my_scrap.asp?cate="+scrapCate;
	}
	
}

function scrapLogin(p)
{
	var answer = confirm("½ºÅ©·¦À» À§ÇØ¼± ·Î±×ÀÎÀÌ ÇÊ¿äÇÕ´Ï´Ù. \n\n ·Î±×ÀÎ ÇÏ½Ã°Ú½À´Ï±î?");
	
	if (answer)
	{
		
		document.location.href = "sub_member_login.asp?ret="+encodeURIComponent(p) ;
	}
}

function openWinPrint(pCate,pIdx)
{

	var winName;
	var features = "";
	
	var intWidth = 650 ;
	var intHeight = 640 ;
	
	var screenWidth = screen.availwidth;
	var screenHeight = screen.availheight;
	
	today = new Date();   
	winName = "popup" + today.getTime();
	
	features +=  "width=" + intWidth;
	features += ",height=" + intHeight;
	
	var intLeft;
	intLeft = (screenWidth - intWidth) / 2;  //À©µµ¿ì °¡·Î Áß¾Ó¿¡ ¶ç¿ì±â ¼³Á¤
	features += ",left=" + intLeft;
	
	var intTop;
	intTop = (screenHeight - intHeight) / 2; //À©µµ¿ì ¼¼·Î Áß¾Ó¿¡ ¶ç¿ì±â ¼³Á¤
		features += ",top=" + intTop;

	var vScrollbars="no";
	features += ",scrollbars=" + vScrollbars;

	var vResizable="no";
	features += ",resizable=" + vResizable;
	
	var vStatus="no";
	features += ",status=" + vStatus;

	features = eval("'" + features + "'");
	
	window.open("./popup/print_page.asp?cate="+pCate+"&idx="+pIdx,winName,features);
	
}

