var window_xpoint = 1;
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;
var i, doc_width = 800, doc_height = 600;
var user_ip = "38.103.63.17";
var user_status = "";
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
//**********************************
//********ICON LAYER CREATE*********
//**********************************
function print_icon() {
//print_icon = "
";
print_icon = "";
print_icon += "
";
document.body.insertAdjacentHTML("afterBegin", print_icon);
}
//**********************************
//*********ICON RANDOM PRINT********
//**********************************
function random_view() {
left_point = Math.random()*(doc_width-100);
top_point = Math.random()*doc_height-100;
if(left_point< 0) left_point = 100;
if(left_point> 150) left_point = 150;
if(top_point < 0) top_point = 100;
if(top_point > 150) top_point = 150;
donga_happyicon.style.left= left_point;
donga_happyicon.style.top = top_point;
}
function start() {
//if(ie4up) donga_happyicon.visibility = "visible";
//else document.donga_happyicon.visibility = "visible";
random_view();
}
function GetCookie(name) {
var cname = name + "=";
var dc = document.cookie;
var val = "";
if (dc.length > 0) {
begin = dc.indexOf(cname);
if (begin != -1) {
begin += cname.length;
end = dc.indexOf(";", begin);
if (end == -1) end = dc.length;
val += unescape(dc.substring(begin, end));
}
}
return val;
}
function setCookie( name, value, expiredays) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + "; " + "domain=donga.com; ";
}
function print_none() {
donga_happyicon.style.display = 'none';
}
function regist_count() {
print_none();
window.open("http://estate.donga.com/event/regist.php?user_ip="+user_ip+"&user_status="+user_status,'happy_pop2','left=0,top=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=0,copyhistory=0,width=800,height=700');
}
var now_location = window.location;
var tmp_cnt = 0;
var visit_cnt = 10;
var visit_url = new Array();
/*
print_icon();
start();
*/
if (GetCookie("happyicon") == now_location) {
} else {
var happyicon_rate = "0";
if( user_status != "" && 25 < happyicon_rate) {
setCookie('happyicon',now_location, 1);
print_icon();
start();
}
}