// JavaScript Document



Date.prototype.getNextWkDay = function(iWkDay){
	if (typeof iWkDay != "number" || iWkDay < 0){
		// next Monday is the default
		iWkDay = 1;
	}

	iWkday = Math.floor(iWkDay) % 7;

	var x = (iWkDay - this.getDay() + 7) % 7, d = this;
	if (x != 0){
		var iDate = this.getDate();

		d = new Date(
			this.getFullYear(),
			this.getMonth(),
			iDate,
			this.getHours(),
			this.getMinutes(),
			this.getSeconds(),
			this.getMilliseconds());

		d.setDate(iDate + x);
	}

	return d;
};

 

function countdown_clock(year, month, day, hour, minute, format)
         {
         //I chose a div as the container for the timer, but
         //it can be an input tag inside a form, or anything
         //who's displayed content can be changed through
         //client-side scripting.
        html_code = '<span id="countdown"></span>';
         
         document.write(html_code);
		 
		 countdown(year, month, day, hour, minute, format);
         }
		 
         
function countdown(year, month, day, hour, minute, format)
         {
         Today = new Date();
         Todays_Year = Today.getFullYear() - 2000;
         Todays_Month = Today.getMonth() + 1;                  
         
         //Convert both today's date and the target date into miliseconds.                           
         Todays_Date = (new Date(Todays_Year, Todays_Month, Today.getDate(), 
                                 Today.getHours(), Today.getMinutes(), Today.getSeconds())).getTime();
								                                  
         Target_Date = (new Date(year, month, day, hour, minute, 00)).getTime();                  
//alert(Todays_Date+"  "+Target_Date);         
         //Find their difference, and convert that into seconds.                  
         Time_Left = Math.round((Target_Date - Todays_Date) / 1000);
         
         if(Time_Left < 0)
            Time_Left = 0;
         
         switch(format)
               {
               case 0:
                    //The simplest way to display the time left.
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
                    break;
               case 1:
                    //More datailed.
                    days = Math.floor(Time_Left / (60 * 60 * 24));
                    Time_Left %= (60 * 60 * 24);
                    hours = Math.floor(Time_Left / (60 * 60));
                    Time_Left %= (60 * 60);
                    minutes = Math.floor(Time_Left / 60);
                    Time_Left %= 60;
                    seconds = Time_Left;
                    
                    dps = 's'; hps = 's'; mps = 's'; sps = 's';
                    //ps is short for plural suffix.
                    if(days == 1) dps ='';
                    if(hours == 1) hps ='';
                    if(minutes == 1) mps ='';
                    if(seconds == 1) sps ='';
                    
                    document.all.countdown.innerHTML = days + ' day' + dps + ' ';
                    document.all.countdown.innerHTML += hours + ' hr' + hps + ' ';
                    document.all.countdown.innerHTML += minutes + ' min' + mps + ' ';
                    document.all.countdown.innerHTML += seconds + ' sec' + sps;
                    break;
               default: 
                    document.all.countdown.innerHTML = Time_Left + ' seconds';
               }
               
         //Recursive call, keeps the clock ticking.
         setTimeout('countdown(' + year + ',' + month + ',' + day + ',' + hour + ',' + minute + ',' + format + ');', 1000);
         }
		 
		  function getVWDheader1(dNF){
			 
				document.write('<table width="95%" border="0" cellspacing="0" cellpadding="2"><tr><td class="txtNDraw"><span class="style3">Next Draw:</span> <span class="style2">');
				document.write(dNF.toLocaleDateString());
				document.write('</span></td><td class="txtNDraw"><span class="style3">&nbsp;Remaining: </span><span class="style2">');
				
		  }

			function getVWDheader2(){
			  	document.write('</span></td></tr></table>');
		  }
		  
		  function getJackpot(){
			document.write('<table width="160" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#C60000"><tr><td></td><td width="150" align="center" class="headerWhite">UK Lottery Jackpot</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td width="150" bgcolor="#FFFFFF"><div class="row">&pound;3 million GBP</div><div class="row1">£16 million   	 GBP</div><div class="row">$30 million  	USD</div><div class="row1">$34 million  	CAD</div><div class="row">$40 million  	AUD</div></td><td>&nbsp;</td></tr><tr><td><img src="../images/bdld_w.gif" width="15" height="30"></td><td width="150" align="center"><span class="btnPlayNow"><a href="http://www.v-w-d.com/redir.asp?m=emvwd&target=/default.asp?goto=/vwdguest/signup.asp?rp=L" target="_blank" class="btnPlayNow"><strong>PLAY Online Now!</strong></a></span></td><td>&nbsp;</td></tr></table>');					  
		  }