var Check_flag=true

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 login_check() {
	if (getCookie('Joins_LoginStatus') != 'True')
	{
		alert("·Î±×ÀÎÀ» ÇØÁÖ¼¼¿ä.");
		document.location.href = "http://login.joins.com/login_myfriday.asp?TargetURL=" + escape(window.location);
		//document.location.href = "http://myfriday2.joins.com/myfriday/member_consolidation/unite_login/?TargetURL=" + escape(window.location);
		return 'False';
	}
	return 'True';
}

function change_stat()
{

	if(document.check_form.chk_all.checked == true) {
		document.check_form.chk_all.checked=true;
		checkall('check_form','chk_list',true);
	}
	else {
		document.check_form.chk_all.checked=false;
		checkall('check_form','chk_list',false);
	}
}

function checkall(formname,checkname,thestate){
	var el_collection=eval("document.forms."+formname+"."+checkname)

	if(el_collection != null)
	{
		if(el_collection.length){
			for (c=0;c<el_collection.length;c++)
				el_collection[c].checked=thestate
		}
		else{
			el_collection.checked=thestate;
		}
	}
	if (thestate==true){
		Check_flag=false
	}
	else{
		Check_flag=true
	}
}

function goCheckbox(ntype) {
	if (login_check() == 'True')
	{
		var f = document.check_form;

		if (ntype != 'basket') {
			f.mode.value = ntype;
			//f.target = "sub";
			f.action = "http://efriday.joins.com/common/account_list.asp";
		} else {
			f.target = "sub";
			f.action = "http://efriday.joins.com/common/"+ntype+"_chk.asp";
		}
		f.submit();
		return;
	}

}

function goCategory(formname)	{
		document.location.href = "http://efriday.joins.com/list/category_list.asp?select_category="+document.forms[formname].select_category.value;
		return;
}

function goAmount(amount_type)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "http://efriday.joins.com/common/amount_chk_new.asp?chk_list="+amount_type;
		return;
	}
}

function goBasket(wcode)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "http://efriday.joins.com/common/basket_chk_new.asp?chk_list="+wcode;
		return;
	}
}

function goBuy(wcode)	{
	if (login_check() == 'True')
	{
		document.location.href= "http://efriday.joins.com/common/account_list_new.asp?mode=buy&trade_code=TR003&chk_list="+wcode;
		return;
	}
}

function goBuy2(wcode)	{
	if (login_check() == 'True')
	{
		document.location.href= "http://efriday.joins.com/common/account_list.asp?mode=buy&trade_code=TR004&chk_list="+wcode;
		return;
	}
}

function goDetail(wcode)	{
	document.frames("sub").location.href = "http://efriday.joins.com/common/detail_chk_new.asp?wcode="+wcode;
	//document.location.href= "http://efriday.joins.com/list/detail.asp?wcode="+wcode;
}

function goGift(wcode)	{
	if (login_check() == 'True')
	{
		document.location.href= "http://efriday.joins.com/common/account_list_new.asp?mode=gift&trade_code=TR003&chk_list="+wcode;
		return;
	}
}

function goPreview(wcode, url)	{
		document.frames("sub").location.href= "http://efriday.joins.com/common/preview_chk.asp?wcode="+wcode;
		return;
}

function goView(wcode)	{
	if (login_check() == 'True')
	{
		document.frames("sub").location.href= "http://efriday.joins.com/common/view_chk.asp?wcode="+wcode;
		return;
	}
}

function goNextPage(formname) {
	if (login_check() == 'True')
	{
		var f = document.forms[formname];
		/*if (f.totalprice.value == '0'){
			alert("°áÁ¦ÇÒ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.");
			return;
		}*/
		f.action = "http://efriday.joins.com/BillingIPG/pay.asp";
		f.submit();
		return;
	}
}

function goFree(formname) {
	if (login_check() == 'True')
	{
		var f = document.forms[formname];
		/*if (f.totalprice.value == '0'){
			alert("°áÁ¦ÇÒ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.");
			return;
		}*/
		f.action = "http://efriday.joins.com/common/buy_insert_free_new.asp";
		f.submit();
		return;
	}
}




function goDelete(formname,del_wcode) {

	if (login_check() == 'True')
	{
		var f = document.forms[formname];
		f.del_wcode.value = del_wcode;
		f.target = ""
		f.action = "/common/account_list_new.asp";
		f.submit();
		return;
	}
}

function goPay(formname,mode) {
	if (login_check() == 'True')
	{
		var f = document.forms[formname];
		f.target = "sub"
		/*if (f.totalprice.value == '0'){
			alert("°áÁ¦ÇÒ Ç×¸ñÀÌ ¾ø½À´Ï´Ù.");
			return;
		}*/

		if (mode == 'buy'){
			f.action = "/common/buy_chk_new.asp";
		} else if (mode == 'gift') {
			f.action = "/common/gift_chk_new.asp";
		}
		f.submit();
		return;
	}
}

function send_message(formname) {
		var f = document.forms[formname];
		f.target = "sub";
		f.action = "http://mfclub.joins.com/main2/memo/MfMemoWrite_eFriday.asp";
		f.submit();
	
		hrefstr ="http://efriday.joins.com/common/popup/gift_ok.asp?to_memid="+f.to_memid.value;
		window.open (hrefstr,"popup",'toolbar=no,width=420,height=324,location=no, directories=no,status=no,menubar=no,scrollbars=no,resizable=no');
		document.frames("sub").location.href= "about:blank";
		return;

}