
$(window).bind('load resize', function(e){
	 
 if ($.browser.msie) { 
 if (e.type === 'resize'){
	$('.drop_shadow_layer').remove();
    }
	$('.widget, .shadow, .post_box').each(function(){
	  $('<div class=\"drop_shadow_layer\">').appendTo($('body')).css({
				position: 'absolute',
				width: ($(this).width() + 4) + 'px',
				height: ($(this).height() + 2) + 'px',
				backgroundColor: '#d5d6d6',
				zIndex: -5000,
				top: ($(this).offset().top - 2) + 'px',
				left: ($(this).offset().left - 6) + 'px'
	  });
				  
	});

	$('.myform').each(function(){
	  $('<div class=\"drop_shadow_layer\">').appendTo($('body')).css({
				position: 'absolute',
				width: ($(this).width() - 18) + 'px',
				height: ($(this).height() - 14) + 'px',
				backgroundColor: '#d5d6d6',
				zIndex: -5000,
				top: ($(this).offset().top - 5) + 'px',
				left: ($(this).offset().left - 6) + 'px'
	  });	  
	});

	$('.mymenu').each(function(){
	  $('<div class=\"drop_shadow_layer\">').appendTo($('body')).css({
				position: 'absolute',
				width: ($(this).width() -4) + 'px',
				height: ($(this).height() + 14) + 'px',
				backgroundColor: '#e1e1e1',
				zIndex: -5000,
				top: ($(this).offset().top - 7) + 'px',
				left: ($(this).offset().left - 10) + 'px'
	  });	  
	});
    }
	else {
    DD_roundies.addRule('.mymenu', '0 0 7px 7px', true);	
	}
}); 


function createQCObjectNew() 
{ 
    var req=null; 
    if(window.XMLHttpRequest)
    { 
    	req = new XMLHttpRequest(); 
    } 
    else if(window.ActiveXObject) 
    { 
    	req = new ActiveXObject("Microsoft.XMLHTTP"); 
    } 
    else 
    { 
   		alert('Problem creating the XMLHttpRequest object'); 
    } 
    return req; 
}

function gettime()
{
	var http = createQCObjectNew(); 
	http.open('get', 'http://'+window.location.host+'/servertime.php');
	http.onreadystatechange = function() 
	{
		if (http.readyState == 4 && http.status == 200) 
		{ 
			img = document.getElementById('serverchat');
			link = document.getElementById('serverchatlink');
			var response = http.responseText;					
			tempzone = response.split('-');
			timezone = tempzone[1];
			temptime = tempzone[0].split(':');
			hours = temptime[0];
			minutes = temptime[1];
			if(timezone == 'am') { 
               if(hours == 8) {
                  if(minutes >=30) {
                     img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat.png';
                     link.href = 'http://chat.livechatinc.net/licence/1030227/open_chat.cgi?groups=0&lang=en';
				  }
				  else { 
				     img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat-offline.png';
				     link.href = 'http://'+window.location.host+'/contact-us/';
				  }
			   }
			   else if(hours == 12) {
	   		       img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat-offline.png';
				   link.href = 'http://'+window.location.host+'/contact-us/';			   
			   }
			   else if(hours > 8) { 
                 img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat.png';
                 link.href = 'http://chat.livechatinc.net/licence/1030227/open_chat.cgi?groups=0&lang=en';
			   }
			   else { 
				   img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat-offline.png';
				   link.href = 'http://'+window.location.host+'/contact-us/';
			   }
			}
			else {  
			  if(hours < 5 ) {
                 img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat.png';
    		     link.href = 'http://chat.livechatinc.net/licence/1030227/open_chat.cgi?groups=0&lang=en';
			   }
			   else if(hours == 12) {
                 img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat.png';
    		     link.href = 'http://chat.livechatinc.net/licence/1030227/open_chat.cgi?groups=0&lang=en';
			   }
			  else if(hours == 5) {
                 if(minutes <= 30) {
				      img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat.png';
    		          link.href = 'http://chat.livechatinc.net/licence/1030227/open_chat.cgi?groups=0&lang=en';
				 }
				 else {
				      img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat-offline.png';
			          link.href =  'http://'+window.location.host+'/contact-us/';
				  }
			   }
			   else {
				   img.src = 'http://'+window.location.host+'/wp-content/themes/thesis_18/custom/images/chat-offline.png';
			       link.href =  'http://'+window.location.host+'/contact-us/';
			   }
               
			}
		} 
	}
	http.send(null);
	req=null;
	setTimeout("gettime()",1000);
}

gettime();

