function window_open(Url, Name, Etc)
{
  window.open(Url,Name,Etc);
}

/*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 getCookieVal (offset) {
      var endstr = document.cookie.indexOf (";", offset);
      if (endstr == -1)
        endstr = document.cookie.length;
      return unescape(document.cookie.substring(offset, endstr));
    }
    
    function getCookie (name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
            var j = i + alen;
            if (document.cookie.substring(i, j) == arg)
                return getCookieVal (j);
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) break;
        }
        return null;
    }
    
    function getCookieA(uName,uName2){		//ÄíÅ°¿­ Áß¿¡ uName2ÀÇ °ªÀ» ±¸ÇÑ´Ù 
    	var string = getCookie(uName);
    	if(string==null) string="";    	
    	
    	var flag = string.indexOf(uName2+'=');
    	if (flag != -1){ 
    		flag += uName2.length + 1
    		end = string.indexOf('&', flag) 
    
    		if (end == -1) end = string.length
    		return unescape(string.substring(flag, end))
    	}else{
    		return ""
    	}
    }    
    
    function check_domain()
    {
		var string=document.domain;
		
		var tmpval= string.indexOf('patzzi.com',document.domain)
		if (tmpval !=-1)
			{ return "patzzi"}
		else
			{ return "joins"}	
		
	}

function login_check() {
	if (getCookieA('Patzzi_MemArray','userloginChk') != 'Y')
	{
		alert("·Î±×ÀÎÀ» ÇØÁÖ¼¼¿ä.");
		document.location.href = "http://login.patzzi.joins.com/login.asp?BackURL=" + escape(window.location);
		return 'False';
	}
	return 'True';
}


function goBasket(wcode)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "/emagazine/common/basket_chk.asp?chk_list="+wcode;
		return;
	}
}

function goBuy(wcode)	{
	if (login_check() == 'True')
	{
		now=new Date();
	
	nowmonth	=now.getMonth()+1;
	if (nowmonth<10 ){
		nowmonth	="0"+	nowmonth	;	
	}
	
	nowday	=now.getDate();

	if (nowday<10 ){
		nowday	="0"+	nowday	;	
	}

	today=	now.getYear()+"-"+nowmonth+"-"+	nowday;
	if( today > '2009-02-09'){
		alert("2¿ù 10ÀÏºÎÅÍ ½Å±Ô ±¸ÀÔÀÌ ºÒ°¡´ÉÇÕ´Ï´Ù. °¨»çÇÕ´Ï´Ù.");
				return;
			}else{
				document.frames("sub").location.href= "/emagazine/common/buy_chk.asp?chk_list="+wcode;
				return;
		}
	}
}

function goBuyPhone(wcode)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "/emagazine/common/buy_chk.asp?chk_list="+wcode+"&by=phone";
		return;
	}
}




function goView(wcode)	{
	if (login_check() == "True")
	{
		document.frames("sub").location.href= "/emagazine/common/view_chk.asp?wcode="+wcode;
		return;
	}
}

function goView_coupon(wcode)	{
	if (login_check() == "True")
	{
		document.frames("sub").location.href= "/emagazine/common/view_chk.asp?wcode="+wcode+"&mode=c";
		return;
	}
}

function goFree(wcode)	{
	document.frames("sub").location.href= "/emagazine/common/preview_chk.asp?wcode="+wcode;
}

function goDetail(wcode)	{
	//document.frames("sub").location.href= "/emagazine/common/detail_chk.asp?chk_list="+wcode;
	document.location.href= "/emagazine/list/detail.asp?wcode="+wcode;
}

function delBasket(wcode)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "/emagazine/common/del_basket.asp?wcode="+wcode;
		return;
	}
}
