if (top != self) { top.location.href = self.location.href; } else { var nowDate = new Date(); nowDate.setHours(nowDate.getHours() + 24); var expires = nowDate.toGMTString(); document.cookie = "Visits=1; expires=" + expires + "; path=/"; parent.name = 'test'; }