var arrPopup = new Array;
var nPopup = 0;

function p_windowclose(pID, bSetCookie, strURL) {
 	var iDiv;

	if (bSetCookie == "1"){	//´õÀÌ»ó¿­Áö¾Ê±â
		SetCookie(pID, "1");
	} else if(bSetCookie == "2"){ //ÇÏ·çµ¿¾È¿­Áö¾Ê±â
		SetCookie(pID, "2");
	}
	else if(bSetCookie == "3"){ //¿µ¿øÈ÷¿­Áö¾Ê±â
		SetCookie(pID, "3");
	}
		
	for( i=0 ; i < nPopup; i++){
		if(pID  == arrPopup[i]){
			iDiv = arrPopup[i];
			break;
		}			
	}
	
	document.all[iDiv].style.display="none";
	if (strURL != "") document.location.href = strURL;
}
		
function p_windowopen(pID, pPopSrc, pWidth, pHeight, pLeft2, pTop2){
	var pTop, pLeft;
  
	if( pWidth == 0 ) pWidth = 682;
	if( pHeight == 0 ) pHeight = 408;

	if( GetCookie(pID)=='' ) {
		pTop = 85 + 20;
		pLeft = popLeft.offsetLeft + -20;

		arrPopup[nPopup] = pID;
		if ( nPopup != 0 ){
			pTop = posPopup.offsetTop + (nPopup * 40);
			pLeft = popLeft.offsetLeft + (nPopup * 200);
		}
		if( pLeft2>0 && pTop2>0 ) {
			pLeft = pLeft2;
			pTop = pTop2;
		}
		nPopup = nPopup + 1;
		
		strPopupScript = "<div id='" + pID + "' style='border-width:0px;POSITION: absolute;TOP: " + pTop + "px; LEFT: " + pLeft + "px;z-index:199;width:" + pWidth + ";height:" + pHeight + "'>\
				<IFRAME src='" + pPopSrc + "' frameBorder=0 scrolling=no width="+pWidth+" height="+pHeight+"></IFRAME>\
		</div>";
		
		document.writeln(strPopupScript); 
	}
}

function p_windowupper(pID){
 	var iDiv;
	var nZindex;
	
	for( i=0 ; i < nPopup; i++){
		iDiv = arrPopup[i];
		if (pID == iDiv) nZindex = 300;
		else nZindex = 200;

		document.all[iDiv].style.zIndex = nZindex;
	}
 	
}

function p_moveLayer(){
	var iDiv;
	for( i=0 ; i < nPopup; i++){
		iDiv  = arrPopup[i];
		document.all[iDiv].style.left = popLeft.offsetLeft + (i * 200)  + 20;
	}
}

function p_resizeLayer(i,w,h){
   
  document.all[i].style.width = w;
	document.all[i].style.height = h;

}

window.onresize = p_moveLayer;