// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this header

isIE=document.all;
isNN=!document.all&&document.getElementById;
isN4=document.layers;
isHot=false;

function ddInit(e){
  topDog=isIE ? "BODY" : "HTML";
  whichDog=isIE ? document.all.theLayer : document.getElementById("theLayer");  
  hotDog=isIE ? event.srcElement : e.target;  
  while (hotDog.id!="titleBar"&&hotDog.tagName!=topDog){
    hotDog=isIE ? hotDog.parentElement : hotDog.parentNode;
  }  
  if (hotDog.id=="titleBar"){
    offsetx=isIE ? event.clientX : e.clientX;
    offsety=isIE ? event.clientY : e.clientY;
    nowX=parseInt(whichDog.style.left);
    nowY=parseInt(whichDog.style.top);
    ddEnabled=true;
    document.onmousemove=dd;
  }
}

function dd(e){
  if (!ddEnabled) return;
  whichDog.style.left=isIE ? nowX+event.clientX-offsetx : nowX+e.clientX-offsetx; 
  whichDog.style.top=isIE ? nowY+event.clientY-offsety : nowY+e.clientY-offsety;
  return false;  
}

function ddN4(whatDog){
  if (!isN4) return;
  N4=eval(whatDog);
  N4.captureEvents(Event.MOUSEDOWN|Event.MOUSEUP);
  N4.onmousedown=function(e){
    N4.captureEvents(Event.MOUSEMOVE);
    N4x=e.x;
    N4y=e.y;
  }
  N4.onmousemove=function(e){
    if (isHot){
      N4.moveBy(e.x-N4x,e.y-N4y);
      return false;
    }
  }
  N4.onmouseup=function(){
    N4.releaseEvents(Event.MOUSEMOVE);
  }
}

function hideMe(){
  if (isIE||isNN) whichDog.style.visibility="hidden";
  else if (isN4) document.theLayer.visibility="hide";
}

function showMe(){
  if (isIE||isNN) whichDog.style.visibility="visible";
  else if (isN4) document.theLayer.visibility="show";
}

document.onmousedown=ddInit;
document.onmouseup=Function("ddEnabled=false");

/*
One Time Popup Script
By Website Abstraction (http://www.wsabstract.com) and
Java-Scripts.net (http://www.java-scripts.net)
Over 200+ free scripts here!
*/

//number of days the cookie should 
//last (0 will cause it to always pop up)
var expDays = 1; 

function GetCookie (name) { 
  var arg = name + "="; 
  var alen = arg.length; 
  var clen = document.cookie.length; 
  var i = 0; 
  while (i < clen) { 
  var j = i + alen; 
  if (document.cookie.substring(i, j) == arg) 
  return getCookieVal (j); 
  i = document.cookie.indexOf(" ", i) + 1; 
  if (i == 0) break; 
} 
return null;
}

function SetCookie (name, value) { 
  var argv = SetCookie.arguments; 
  var argc = SetCookie.arguments.length; 
  var expires = (argc > 2) ? argv[2] : null; 
  var path = (argc > 3) ? argv[3] : null; 
  var domain = (argc > 4) ? argv[4] : null; 
  var secure = (argc > 5) ? argv[5] : false; 
document.cookie = name + "=" + escape (value) + 
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
((path == null) ? "" : ("; path=" + path)) + 
((domain == null) ? "" : ("; domain=" + domain)) + 
((secure == true) ? "; secure" : "");

}

function DeleteCookie (name) { 
  var exp = new Date(); 
  exp.setTime (exp.getTime() - 1); 
  var cval = GetCookie (name); 
  document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date(); 
exp.setTime(exp.getTime() + (expDays*3*60*60*1000));
//exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
  var count = GetCookie('count')
  if(count == null) {
    SetCookie('count','1')
    return 1
} else {
   var newcount = parseInt(count) + 1;
   DeleteCookie('count')
   SetCookie('count',newcount,exp)
return count

}
}

function getCookieVal(offset) {
   var endstr = document.cookie.indexOf (";", offset);
   if (endstr == -1)
     endstr = document.cookie.length;
     return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
  var count = GetCookie('count');
  
  //remove below
  //var count = null;
  //remove above
  
  if (count == null) {
    count=1;
    SetCookie('count', count, exp);
    setTimeout("document.getElementById('theLayer').style.display='block';",3000);
    //setTimeout("document.getElementById('theLayer').style.display='block';",1);
  } else {
    count++;
    SetCookie('count', count, exp);
  }

}

window.onload=checkCount


var ran_number=Math.floor(Math.random()*2);
//if (ran_number == 1) {alert ('hello')} else alert ('bye');


divx=(window.screen.availWidth/2-160);
divy=(window.screen.availHeight/2-102);

document.write("<div id='theLayer' style='position:absolute;width:300px;left:");
document.write(divx);
document.write(";top:150;visibility:visible'>");

document.getElementById('theLayer').style.display='none';

document.write("<table border='0' bgcolor='#18306B' cellspacing='0' cellpadding='0'><tr><td>");
document.write("<table border='0' bgcolor='#18306B' cellspacing='0' cellpadding='0'><tr><td>");
document.write("<table border='0' cellspacing='2' cellpadding='2'><tr><td id='titleBar'");
document.write("style='cursor:move' align='center'><ilayer onSelectStart='return false'>");
document.write("<layer onMouseover='isHot=true;if (isN4) ddN4(theLayer)' onMouseout='isHot=false'>");
document.write("<b><font color='#FFFFFF'>CleverDot.com - Special Package!</font></b></layer></ilayer>");
document.write("</td><td style='cursor:hand' align='right'><a style='text-decoration:none' href='#'");
document.write(" onClick='hideMe();return false'><b><font color=#ffffff size=2 face=arial>X  </font>");
document.write("</b></a></td></tr><tr><td bgcolor='#FFFFFF' style='padding:0px' colspan='2'>");
document.write("<table border='0' cellpadding='0' cellspacing='0'><tr><td id='VU'>");

if (ran_number == 0) {
document.write("<a href='http://www.cleverdot.com/special.php?0'");
document.write(" target='_blank'><img src='images/special-package.gif' width='300' height='205'");
document.write(" border='0' alt='Click For Details'></a></td></tr></table></td></tr></table>");}

else {document.write("<a href='http://www.cleverdot.com/special.php?1'");
document.write(" target='_blank'><img src='images/special-package-test.gif' width='300' height='205'");
document.write(" border='0' alt='Click For Details'></a></td></tr></table></td></tr></table>");}

document.write(" </td></tr></table></td></tr></table></div>");
