dbnt.co.kr2019/common/popup.php

80 lines
2.7 KiB
PHP

<?
#팝업#
//$language = "ko";
$_p_list = $Obj_popup -> get_main_popup($language,$branch);
?>
<!--<script src="http://code.jquery.com/jquery-latest.js"></script> -->
<script>
function setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function closeWin(name) {
//document.getElementById(name).style.display = "none";
$('#'+name).hide();
}
function todaycloseWin(name,id) {
var chkbox = "chkbox" + id;
var ncookie = "ncookie_" + name;
if ( document.getElementById(chkbox).checked ){
setCookie( ncookie, "done" , 1 );
}
//document.getElementById(name).style.display = "none";
$('#'+name).hide();
}
cookiedata = document.cookie;
$(document).ready(function(){
<?
if(count($_p_list) > 0){
for($i=0;$i<count($_p_list);$i++){
$pop_no = $_p_list[$i]["p_idx"];
$pop_name= "#pop".$pop_no;
?>
var pop = "<?=$pop_name?>";
//alert(cookiedata.indexOf("ncookie_pop<?=$pop_no?>=done"));
if ( cookiedata.indexOf("ncookie_pop<?=$pop_no?>=done") < 0 ){
$(pop).show();
} else {
$(pop).hide();
}
<?
}
}
?>
});
</script>
<?
if(count($_p_list) > 0){
for($i=0;$i<count($_p_list);$i++){
$pop_no = $_p_list[$i]["p_idx"];
$title=$_p_list[$i]["p_title"];
$p_width = $_p_list[$i]["p_width"];
$p_height = $_p_list[$i]["p_height"]+25;
$p_left = $_p_list[$i]["p_left"];
$p_top = $_p_list[$i]["p_top"];
//$p_content = str_replace("&lt;br style=&quot;clear:both;&quot;&gt;","",$_p_list[$i]["p_content"]);
$p_content = $_p_list[$i]["p_content"];
//$lang["POPUP_TODAY"] = "오늘 하루동안 보지 않기";
$width = ($chk_m == "PC") ? $p_width."px" : "100%";
$left = ($chk_m == "PC") ? $p_left."px" : "0px";
?>
<div id="pop<?=$pop_no?>" class="layerpopup" style="position:absolute;left:<?=$left?>;top:<?=$p_top?>px;width:<?=$width?>;z-index:10000">
<div class="popup1" style="background:#ffffff"><?=txtParse($p_content,2)?></div>
<div class="close1" style="position:relative;font-size:13px;background:#ffffff;padding:10px 10px 10px 35px;width:<?=$width?>;margin-top: -15px;">
<form name="pop_form<?=$pop_no?>">
<div id="check"><input type="checkbox" name="chkbox" id="chkbox<?=$pop_no?>" value="checkbox" onclick="todaycloseWin('pop<?=$pop_no?>','<?=$pop_no?>');" style="left:20px;">&nbsp;<span><?=$lang["POPUP_TODAY"]?></span>&nbsp;</div>
<div id="close" style="position:absolute;right:20px;top:10px;"><a href="#" onclick="closeWin('pop<?=$pop_no?>');" style="color:#111">CLOSE</a></div>
</form>
</div>
</div>
<?
}
}
?>