//Home Business Online ToolBox Functions

function NSLpopup(mypage,myname,w,h,pos,infocus) {
	//var NSLpopupWindow=null;
	if(GetCookie("hbb") == "999"){return;} 
	   document.cookie="hbb=999; Path=/; Expires= " + getFuture(30); 
	  {LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;} 
	   settings='width='+ w + ',height='+ h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no'; 
	   //NSLpopupWindow=window.open(mypage,myname,settings);
	   NSLpopupWindow=window.open('','',settings);

	if(infocus=='front'){NSLpopupWindow.focus(); NSLpopupWindow.location='http://www.homebusinessonline.com/ezine/popup2.html';}

	function getFuture(f){
	var d = new Date();
	d.setTime(d.getTime() + (86400000 * f));
	return d;
	}

	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 getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) endstr = document.cookie.length;
	  return unescape(document.cookie.substring(offset, endstr));
	}
}

function nslCountDownWeek(iDay,description,sImage) {
var todaysDate = new Date();
var dayOfWeek = todaysDate.getDay();
var days;
var dateDiff;

document.write("<img src=" + sImage + " valign=middle>&nbsp;");
	
	if (iDay < 7){
		if (iDay > dayOfWeek){
			days = (iDay - dayOfWeek);
		} else if (iDay < dayOfWeek) {
			days = ((iDay + 7) - dayOfWeek);
		} else if (iDay == dayOfWeek){
			days = 0;
		}

		if (days == 0){
			document.write("Later today is " + description + "!");
		} else if (days == 1){
			document.write("Tomorrow is " + description);
		} else if (days > 1){
			document.write(days + " days until " + description);
		}
	} else if (iDay > 6){
		document.write("More than 7 days until " + description);
	}
	
}