// »ç¿ëÀÚ ¼³Á¤ ºÎºÐ 
Layer_popup_close=2;  //¸Þ´º ´Ý´Â ¹æ¹ý 1(Å¬¸¯À¸·Î ´ÝÀ½ )¶Ç´Â 2(¸¶¿ì½º ¾Æ¿ôÀ¸·Î ´ÝÀ½ )

var satuas; //¸¶¿ì½º°¡ ÆË¾÷Ã¢ À§¿¡ ³õ¿© ÀÖ´ÂÁö¸¦ ¾Ë±â À§ÇÑ Àü¿ªº¯¼ö ¼±¾ð
function popup_Layer(event,popup_name,card_kind1,card_no1,gourl) {    //ÆË¾÷·¹ÀÌ¾î »ý¼º
     var main,_tmpx,_tmpy,_marginx,_marginy;
     main = document.getElementById(popup_name);
     if(Layer_popup_close==2){
        satuas=1;//Å¬¸¯À¸·Î ÀÎÇÑ ´ÝÈû ¹æÁö¸¦ À§ÇØ
     }
     main.style.display = '';//ÆË¾÷ »ý¼º 
     _tmpx = event.clientX+parseInt(main.offsetWidth);
     _tmpy = event.clientY+parseInt(main.offsetHeight);
     _marginx = document.body.clientWidth - _tmpx;
     _marginy = document.body.clientHeight - _tmpy;

     // ÁÂ¿ì À§Ä¡ ÁöÁ¤
     if(_marginx < 0){//¿ìÃø;
        main.style.left = event.clientX + document.body.scrollLeft + _marginx-2+"px";
     }
     else{
        main.style.left = event.clientX + document.body.scrollLeft-5+"px";
     }
     //³ôÀÌ ÁöÁ¤
     if(_marginy < 0){//¾Æ·¡ºÎºÐ;
        main.style.top = event.clientY + document.body.scrollTop + _marginy-5+"px";
     }  
     else{
        main.style.top = event.clientY + document.body.scrollTop-5+"px";
     } 
     event.returnValue = false;
	 document.card_form.card_kind.value = card_kind1;
	 document.card_form.card_no.value = card_no1;
	 document.card_form.gourl.value = gourl;
}

function popup_Layer2(event, popup_name, albumno, gourl) {    //ÆË¾÷·¹ÀÌ¾î »ý¼º
    var main, _tmpx, _tmpy, _marginx, _marginy;
    main = document.getElementById(popup_name);
    if (Layer_popup_close == 2) {
        satuas = 1; //Å¬¸¯À¸·Î ÀÎÇÑ ´ÝÈû ¹æÁö¸¦ À§ÇØ
    }
    main.style.display = ''; //ÆË¾÷ »ý¼º 
    _tmpx = event.clientX + parseInt(main.offsetWidth);
    _tmpy = event.clientY + parseInt(main.offsetHeight);
    _marginx = document.body.clientWidth - _tmpx;
    _marginy = document.body.clientHeight - _tmpy;

    // ÁÂ¿ì À§Ä¡ ÁöÁ¤
    if (_marginx < 0) {//¿ìÃø;
        main.style.left = event.clientX + document.body.scrollLeft + _marginx - 2 + "px";
    }
    else {
        main.style.left = event.clientX + document.body.scrollLeft - 5 + "px";
    }
    //³ôÀÌ ÁöÁ¤
    if (_marginy < 0) {//¾Æ·¡ºÎºÐ;
        main.style.top = event.clientY + document.body.scrollTop + _marginy - 5 + "px";
    }
    else {
        main.style.top = event.clientY + document.body.scrollTop - 5 + "px";
    }
    event.returnValue = false;
    document.aform.albumno.value = albumno;
    document.aform.gourl.value = gourl;
}  

function mouse_anchor(type){ //¸¶¿ì½ºÀÇ À§Ä¡¿¡ µû¸¥ ÆË¾÷ÀÇ ´ÝÀ½À» °áÁ¤
    if(type=="1"){
       satuas="1";
    }
    if(type=="0"){
       satuas="0";
    }
}

function Layer_popup_Off() { //ÆË¾÷ ´ÝÀ½
    if (satuas == "0") {
        if(document.getElementById("Album_Profile"))
            document.getElementById("Album_Profile").style.display = "none";
        if (document.getElementById("Card_Profile"))
            document.getElementById("Card_Profile").style.display = "none";
    }
    if(Layer_popup_close==2){
      satuas=null;
    }
} 

function mouseout_close() {
    window.setTimeout('Layer_popup_Off()',500);
}


//if(Layer_popup_close==1){
//	document.onmousedown = Layer_popup_Off;//Å¬¸¯À¸·Î ´Ý±â
//}

if(Layer_popup_close==2){
   document.onmouseover=mouseout_close;//·¹ÀÌ¾î ¹ù¾î³ª¸é ´Ý±â
}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////


function login(){	
	var gourl;
	gourl = card_form.gourl.value;
	location.href="/loginform.asp?loginURL="+gourl
}

function cardchart(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 500) / 2;
	Top_P  = (screen.height - 300) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open("/Hall/PopularityCard/PopularityCard_Chart.asp?card_kind="+card_kind+"&card_no="+card_no,"info","height=300,width=500,scrollbars=no,resizable=no,left="+Left_P+",top="+Top_P+"");
	//event.returnValue = false;
	document.getElementById("Card_Profile").style.display = "none";
}


function cardinfo(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 763) / 2;
	Top_P  = (screen.height - 468) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open("/mypage/cardProfile/card_info_begin.asp","info","height=468,width=763,scrollbars=no,resizable=no,left="+Left_P+",top="+Top_P+"");
	//event.returnValue = false;
	document.getElementById("Card_Profile").style.display = "none";
}


function weeklycard(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 453) / 2;
	Top_P  = (screen.height - 363) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/weekly_card.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=363,width=453,scrollbars=yes,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}

function BuyCard1(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 380) / 2;
	Top_P  = (screen.height - 560) / 2;
		
	var settings = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=380,height=560,top='+Top_P+',left='+Left_P;
	new_buy_window = window.open('','buycard',settings);
	card_form.action = "/market/cardmarket/buycard.asp";
	card_form.target = "buycard";
	card_form.submit();
	

}

function BuyBooster(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 388) / 2;
	Top_P  = (screen.height - 300) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/booster.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=300,width=388,scrollbars=no,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}

function TradeTuning(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 757) / 2;
	Top_P  = (screen.height - 510) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/Trade_Tuning.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=510,width=757,scrollbars=yes,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}

function TradeMarket(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 530) / 2;
	Top_P  = (screen.height - 530) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/Trade_Market.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=640,width=530,scrollbars=no,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}

function TradeReal(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 757) / 2;
	Top_P  = (screen.height - 510) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/Trade_Real.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=510,width=757,scrollbars=yes,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}
function CustomBooster(){
	var userid;
	var Left_P;
	var Top_P;
	Left_P = (screen.width - 300) / 2;
	Top_P  = (screen.height - 300) / 2;
	card_kind = card_form.card_kind.value;
	card_no = card_form.card_no.value;
	window.open('/mypage/cardProfile/CustomBooster.asp?card_kind='+card_kind+'&card_no='+card_no,'card',"height=100,width=100,scrollbars=yes,resizable=no,left="+Left_P+",top="+Top_P+"");
	document.getElementById("Card_Profile").style.display = "none";
}
function AlbumView()
{
    var albumno;
    albumno = aform.albumno.value;

    document.location.href = "/Market/Album/cardview.asp?albumno=" + albumno;
    document.getElementById("Album_Profile").style.display = "none";
}

function BuyAlbum()
{
    var albumno;
    var Left_P;
    var Top_P;
    albumno = aform.albumno.value;
    Left_P = (screen.width - 757) / 2;
    Top_P = (screen.height - 510) / 2;
    
    window.open('/Market/Album/BuyAlbum.asp?albumno=' + albumno, 'album', "height=510,width=380,scrollbars=no,resizable=no,left=" + Left_P + ",top=" + Top_P + "");
    document.getElementById("Album_Profile").style.display = "none";
}
