PHP + jQuery change background based on server time
<p>I have an Apache based server, which currently hosts my PHP + HTML5 app. I wrote a jquery script, which should change background image of specific div, if some conditions regarding server time are met. Problem is - the script is not working :)</p>

<p>I've already red some issues here, and tried to fix script, but those didn't help, because they are not completely related to my problem.</p>

<p>Ok, here's the script:</p>

<pre><code>$(document).ready(function () {

var serverdate = new Date("&lt;?php echo date('l,g,i,s'); ?&gt;");
var currentTime = serverdate.getTime();
var gameTime = getTimeFromString("8:45 pm");
var endTime = getTimeFromString("11:45 pm");
var currentDay = serverdate.getDay();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
    if (currentDay === "Tuesday" || currentDay ==="Wednesday"){
    if (currentTime&lt;gameTime) {
    $('#bodymain').addClass('day').removeClass('game');
    }

else if (currentTime&gt;endTime) {
    $('#bodymain').addClass('day').removeClass('game');
}

else {
    $('#bodymain').addClass('game').removeClass('day');
}
}
else {
$('#bodymain').addClass('day').removeClass('game');
}

function getTimeFromString(timeString){
var theTime = new Date();
var time = timeString.match(/(\d+)(?::(\d\d))?\s*(p?)/);
theTime.setHours(parseInt(time[1])+(time[3]?12:0));
theTime.setMinutes(parseInt(time[2]) || 0);
return theTime.getTime();
}

});
</code></pre>

<p>Any clues?</p>
