<script>
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 "";
}
</script>

<?php
$controller = $this->uri->segment(2);
$method     = $this->uri->segment(3);

$ci=& get_instance();
$popup_menu_code = '';
if($controller == '' && $method == '')      $popup_menu_code = '1';
if($controller == 'life' && $method == '')  $popup_menu_code = '3';
if($controller == 'news' && $method == '')  $popup_menu_code = '4';

if($popup_menu_code!='') {
    $now_date = date("Y-m-d H:i:s");

    $req_data = array();
    $req_data['menu_code']      = $popup_menu_code;
    $req_data['now_date']       = $now_date;

    $ci->load->model('web/m_popup');
    $list   = $ci->m_popup->popup_where_menu_code_list($req_data);
    foreach ($list as $val) {
        $top_margin     = $val['top_margin'];
        $left_margin    = $val['left_margin'];
        $width_size     = $val['width_size'];
        $height_size    = $val['height_size'];

?>
<script type="text/javascript">
$(document).ready(function() {
var cookie = getCookie('popup<?=$val['idx']?>');
if(cookie != 'N') {
    var w = window.open('/web/comm/popup_body?idx=<?=$val['idx']?>','<?=$val['idx']?>', 'width=<?=$width_size?>, height=<?=$height_size+35?>, left=<?=$left_margin?>, top=<?=$top_margin?>');
}

});

</script>
<?

    }
}
?>

