setInterval("getshoutmessages()",5000);
function getrand()
{
	var rand_no = Math.random();
	rand_no = rand_no * 10000;
	rand_no = Math.ceil(rand_no);
	return rand_no;
}
getshoutmessages();

function clearshoutbox()
{
	document.getElementById('shoutxt').value =''
}

function getshoutmessages()

{
var rrr=getrand();
	//  μπήκε μετά ήταν global 
	var http = false;

	if(navigator.appName == "Microsoft Internet Explorer") {
	  http = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  http = new XMLHttpRequest();
	} 
	var data = " ";
	var url="getshoutbox.asp?r="+rrr+"";
	 http.open("GET", url, true);
	 http.onreadystatechange=function() {
	  if(http.readyState == 4) {
	  data = http.responseText
 
	  showthis(data,'shoutbox') ;
	  }
	
	 }
	  http.send(null);
}

function controldiv(divtoexpand) //allagi div / emfanish apokripsi
{
	 if (document.getElementById(divtoexpand).style.display == 'none')
	{
		document.getElementById(divtoexpand).style.display='block'  ;
	}
	else
	{
		document.getElementById(divtoexpand).style.display='none' ;
	
	}
}
function shoutit()
{
	controldiv('process');
	var message = document.getElementById('shoutxt').value;
	if (message!='')
		{
			var rrr=getrand();
			//  μπήκε μετά ήταν global 
			var http = false;
		
			if(navigator.appName == "Microsoft Internet Explorer") {
			  http = new ActiveXObject("Microsoft.XMLHTTP");
			} else {
			  http = new XMLHttpRequest();
			} 
			var data = " ";
			var url="shoutit.asp?r="+rrr+"&message="+escape(message)+"";
			 http.open("GET", url, true);
			 http.onreadystatechange=function() {
			  if(http.readyState == 4) {
			  data = http.responseText
		 
			  shoutitresults(data) ;
	
			  }
			
			 }
			  http.send(null);
		}
			else
		{
		    shoutitresults('0') ;	
		}
			  //controldiv('process');
} 
function shoutitresults(data)
{
controldiv('process');
if (data!='0')
{
document.getElementById('shoutxt').value = 'Thank you!' ;
}
else
{
	
}
}