function overlay() {
        el = document.getElementById("signup");
        el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
}

var xmlhttp=false;
   
function createXMLHttpObj(){    
        if (window.XMLHttpRequest){
           try{
                 xmlhttp = new XMLHttpRequest();
                 }catch(e){             
                        xmlhttp=false;    
                 }
        }else if(window.ActiveXObject){
                 try {
                          xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (e) {
                                 try {
                                          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
                                  } catch (E) {
                                          xmlhttp = false;
                                  }
                }
        }
}//end of createHttpObj


function signup(){
	 createXMLHttpObj();
	if(xmlhttp) {           
		var url = "signup.php";
		var username = document.getElementById("susername").value;
		var passwd	 = document.getElementById("spasswd").value;
		var params = "username="+username+"&passwd="+passwd;
		
	//	alert("posting to db"+params);
		
		xmlhttp.open("POST", url, true);

		//Send the proper header information along with the request
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", params.length);
		xmlhttp.setRequestHeader("Connection", "close");

		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				if(xmlhttp.responseText == "Success"){
					window.location.reload();
				}else{
					document.getElementById("signupresponse").innerHTML	 = xmlhttp.responseText;
					document.getElementById("signupresponse").style.visibility = "visible";
					document.getElementById("signupresponse").style.display	 = "block";
				}
			
			}
		}
		xmlhttp.send(params);                
    }	
	
}

var saveclr;

function vote(msgid,up){
       createXMLHttpObj();
       if(xmlhttp) {                           
             	//xmlhttp.onreadystatechange = processXmlHttpChange;
               xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
					if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
			            //alert("Response from server"+xmlhttp.responseText);
						document.getElementById("votevalue"+msgid).innerHTML	 = xmlhttp.responseText+" votes";
						//document.getElementById("votediv"+curvoteid).innerHTML = xmlhttp.responseText+" votes";
						minDiv(msgid);
						document.body.style.cursor = 'default';
					}
               }
               xmlhttp.open("GET", "messagewallvote.php?msgid="+msgid+"&up="+up, true);
			   document.body.style.cursor = 'wait';
               if(window.ActiveXObject){
                     xmlhttp.send();
               }else{
                     xmlhttp.send(null);
               }                         
      }
}

function showBusyIcon(e){
	var posx = 0;
	var posy = 0;
	if(!e) e = window.event;
	if (e.pageX || e.pageY)		{
		posx = e.pageX;
		posy = e.pageY;
	}
	else if (e.clientX || e.clientY)	{
		posx = e.clientX + document.body.scrollLeft
			+ document.documentElement.scrollLeft;
		posy = e.clientY + document.body.scrollTop
			+ document.documentElement.scrollTop;
	}
	alert("left"+posx+" top"+posy);
	document.getElementById("busyimg").style.left= posx+"px";
	document.getElementById("busyimg").style.top= posy+"px";
	document.getElementById("busyimg").style.visibility = "visible";

  return true
}

function onMouseOverD(divid){  
	var divObj = document.getElementById("mesgdiv"+divid);
	if(divObj.style.zIndex==0){
			saveclr = divObj.style.backgroundColor;
			divObj.style.backgroundColor = "#d7e2ef";
   }
}

var msgrowclr;
function msgOver(rowid){  
	var divObj = document.getElementById("t"+rowid);
	msgrowclr = divObj.style.backgroundColor;
	divObj.style.backgroundColor = "#d7e2ef";
	
	//document.getElementById("r"+rowid).checked = true;
}

function msgOut(rowid){  
	var divObj = document.getElementById("t"+rowid);
	divObj.style.backgroundColor = msgrowclr;
	
}
		
function onMouseOutD(divid){	
	var divObj = document.getElementById("mesgdiv"+divid);
	if(divObj.style.zIndex==0){
			divObj.style.backgroundColor= saveclr;	
	}		
//	if(divObj.style.zIndex==11){
//		 minDiv(divid);
//	}
}

function setMaxNum(maxnum){
	maxn = maxnum;
	startRandomPop();
}
	
function startRandomPop(){
	var popupdiv=Math.round(maxn*Math.random())
	var callfun = "popDiv("+popupdiv+")";
	setTimeout(callfun,2000);
}
var curwidth;
var curheight;

var itop;
var ileft;

var savein;
var todisp;

var trmsgsave;

var curwidth1;
var curheight1;

var itop1;
var ileft1;


function showDiv(divid){
	if(document.getElementById("mesgdiv"+divid).style.zIndex>1)
		return;
		
	trmsgsave 	= 	""+document.getElementById("onlymsg"+divid).innerHTML;
	//alert('before inc'+trmsgsave);
	fetchDivMesg(divid);
	document.getElementById("mesgdiv"+divid).style.backgroundColor = saveclr;
	var sttop = document.getElementById("mesgdiv"+divid).style.top;
	var stleft =  document.getElementById("mesgdiv"+divid).style.left;
		
	curwidth1 = globalw;
	curheight1 = globalh;
	
	 //alert("w="+curwidth1+" or h="+curheight1);
	document.getElementById("mesgdiv"+divid).style.zIndex=11;
	
	sttop = sttop.substring(0,sttop.length-2);
	stleft = stleft.substring(0,stleft.length-2);
	itop1 = parseInt(sttop);
	ileft1 = parseInt(stleft);
	startInc1(divid);	
//	alert('after inc'+trmsgsave);
	

/*  	var closestr 	= "<div style=\"min-height:10px;float:right;cursor:pointer;\">&nbsp;<a href=\"javascript:minDiv("+divid+");\">[close x]</a> </div>";

  	var curvote   	= "<hr/> <div style=\"margin-top:10px;margin-bottom:10px;text-align:center;\">Current Votes:<b> "+document.getElementById("votesave"+msgid).innerHTML+"</b></div>";
		
  	var addvote		= "<div class=\"mtxt\">Your Vote:<a href=\"javascript:void(null);\" onclick=\"javascript:vote("+divid+","+msgid+",1);\">Yay!(+)</a> &nbsp;&nbsp;"+
		                "<a href=\"javascript:void(null);\" onclick=\"javascript:vote("+divid+","+msgid+",0);\">Nay!(-)</a> </div>";
	
	
	var formattodisp = "<div id=\"todisp"+msgid+"\" class=\"readauth\">"+todisp1+"</div>";

//	var addreplyhref	= "<a href=\"javascript:addReplyToggle("+msgid+");\"></a>";
	var	addreplyline	= "<hr/> <div id=\"msgreplybox"+msgid+"\"> <div style=\"margin-top:10px;margin-bottom:10px;text-align:center;\">Add Reply</div>";
	var addreplybox		= '<table>\
<tr>\
<td align="right">\
<span class="msg">Message: </span>\
</td>\
<td>\
<textarea id="mesg'+msgid+'" style="width:80px;height:60px"></textarea>\
</td>\
</tr>\
<tr>\
<td align="right">\
<span class="msg">Name: </span>\
</td>\
<td align="left">\
<input  type="text" id="name'+msgid+'" style="width:80px;"/>\
</td>\
</tr>\
<tr>\
<td align="right">\
<span class="msg">Location: </span>\
</td>\
<td align="left">\
<input type="text" id="loc'+msgid+'" style="width:80px;"/>\
</td>\
</tr>\
<tr>\
<td>\
</td>\
<td align="left">\
<input type="submit" id="btnmsg'+msgid+'" style="width:80px;" onclick="javascript:addReply('+msgid+','+divid+')" value="Reply!"/>\
</td>\
</tr>\
</table></div>';
	var replyresponse = '<div id="replyresponse"/>'
	var replycat = addreplyline+addreplybox+replyresponse;
	document.getElementById("mesgdiv"+divid).innerHTML 		= closestr+formattodisp+curvote+addvote+replycat+closestr;
	document.getElementById("mesgdiv"+divid).style.overflow = "scroll";
	document.getElementById("storetext"+divid).innerHTML 	= savein1;*/
}

function fetchDivMesg(divid){
	createXMLHttpObj();
	if(xmlhttp) {           
		var url 	= "fetchDivMesg.php";
		var params 	= "wallid="+wallid+"&msgid="+divid;
		
		//alert("posting to db"+params);
		
		xmlhttp.open("POST", url, true);

		//Send the proper header information along with the request
		
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", params.length);
		xmlhttp.setRequestHeader("Connection", "close");

		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
					result			 = eval("(" + xmlhttp.responseText + ")");
					var msgid		 = result.msgid;
				
					document.getElementById("votetimediv"+msgid).style.display				= "none";
					document.getElementById("votetimediv"+msgid).style.visibility			= "invisible";
					document.getElementById("closespan"+msgid).style.display				= "inline";
					document.getElementById("closespan"+msgid).style.visibility				= "visible";
					document.getElementById("onlymsg"+msgid).innerHTML						=  result.message;
					document.getElementById("mesgdiv"+msgid).style.overflow 				= "scroll";
					
					//when opening div.. the current number of votes = result.votes
					//add votes info for full view
					// var fullvotediv		= document.createElement("div");
					// fullvotediv.id		= "fullvotevalue"+msgid;
					// //margin-top:10px;margin-bottom:10px;text-align:center;
					// fullvotediv.style.marginTop	= "10px";
					// fullvotediv.style.marginBottom	= "10px";
					// fullvotediv.style.textAlign	= "center";
					// 
					// var fullvotetxt		= document.createTextNode("Current Votes: "+result.votes);
					// fullvotediv.appendChild(fullvotetxt);
					
					
					//HERE WE PRINT THE MOST CURRENT VOTE COUNT.. WHEN THE USER OPENS A NEW BOX
						var curvote   	= "<hr/> <div style=\"margin-top:10px;margin-bottom:10px;text-align:center;\">Current Votes:<b> "+result.votes+"</b></div>";

					  	var addvote		= "<div class=\"mtxt\">Your Vote:<a href=\"javascript:void(null);\" onclick=\"javascript:vote("+msgid+",1);\">Yay!(+)</a> &nbsp;&nbsp;"+
					"<a href=\"javascript:void(null);\" onclick=\"javascript:vote("+msgid+",0);\">Nay!(-)</a> </div>";

					//	var addreplyhref	= "<a href=\"javascript:addReplyToggle("+msgid+");\"></a>";
						var	addreplyline	= "<hr/> <div id=\"msgreplybox"+msgid+"\"> <div style=\"margin-top:10px;margin-bottom:10px;text-align:center;\">Add Reply</div>";
						var addreplybox		= '<table>\
<tr>\
<td align="right">\
<span class="msg">Message: </span>\
</td>\
<td>\
<textarea id="mesg'+msgid+'" style="width:80px;height:60px"></textarea>\
</td>\
</tr>\
<tr>\
<td align="right">\
<span class="msg">Name: </span>\
</td>\
<td align="left">\
<input  type="text" id="name'+msgid+'" style="width:80px;"/>\
</td>\
</tr>\
<tr>\
<td align="right">\
<span class="msg">Location: </span>\
</td>\
<td align="left">\
<input type="text" id="loc'+msgid+'" style="width:80px;"/>\
</td>\
</tr>\
<tr>\
<td>\
</td>\
<td align="left">\
<input type="submit" id="btnmsg'+msgid+'" style="width:80px;" onclick="javascript:addReply('+msgid+')" value="Reply!"/>\
</td>\
</tr>\
</table></div>';
					document.getElementById("bottomdiv"+msgid).style.visibility = "visible";
					document.getElementById("bottomdiv"+msgid).style.display	= "block";
					document.getElementById("bottomdiv"+msgid).innerHTML= curvote+addvote+addreplyline+addreplybox;

			}
		}
		xmlhttp.send(params);                
    }
}

function addReply(msgid,divid){
	createXMLHttpObj();
	if(xmlhttp) {           
		var url = "addreply.php";
		
		document.getElementById("btnmsg"+msgid).value = "Posting..";
		
		var message = document.getElementById("mesg"+msgid).value;
		var name	 = document.getElementById("name"+msgid).value;
		var loc	 = document.getElementById("loc"+msgid).value;
		var params = "wallid="+wallid+"&mesg="+message+"&name="+name+"&loc="+loc+"&replyto="+msgid+"&wallname="+wallname;
		
	//	alert("posting to db"+params);
		
		xmlhttp.open("POST", url, true);

		//Send the proper header information along with the request
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", params.length);
		xmlhttp.setRequestHeader("Connection", "close");

		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				if(xmlhttp.responseText == "Success"){
					document.getElementById("btnmsg"+msgid).value 				 = "Reply!";
					
					//append the new message to the set of replies
					var curdispcontent	= 
					
					//hide the reply box
					document.getElementById("msgreplybox"+msgid).style.display		= "none";
					document.getElementById("msgreplybox"+msgid).style.visibility 	= "false";
					
					
					//change the reply count
					
					document.getElementById("replyresponse").innerHTML	 = "Thank You for your reply,"+name+"!";
				}else{
					document.getElementById("replyresponse").innerHTML	 = "Sorry are facing technical difficulties "+xmlhttp.responseText;
				}
			
			}
		}
		xmlhttp.send(params);                
    }	
}

function minDiv(divid){
    //alert(divid);
	document.getElementById("mesgdiv"+divid).style.zIndex=0;
	var swidth 		= 	document.getElementById("mesgdiv"+divid).style.width;
	var sheight 	=   document.getElementById("mesgdiv"+divid).style.height;

	curwidth1 	 = swidth.substring(0,swidth.length-2);
	curheight1 	 = sheight.substring(0,sheight.length-2);
	
	var sttop	 =  document.getElementById("mesgdiv"+divid).style.top;
	var stleft 	 =  document.getElementById("mesgdiv"+divid).style.left;
	
	sttop 	= sttop.substring(0,sttop.length-2);
	stleft 	= stleft.substring(0,stleft.length-2);
	itop1 	= parseInt(sttop);
	ileft1 	= parseInt(stleft);

//	var savein1 = document.getElementById("mesgdiv"+divid).innerHTML;
//	var todisp1 = document.getElementById("storetext"+divid).innerHTML;
	startDec1(divid);
	// alert("trmsgave"+trmsgsave);
	document.getElementById("onlymsg"+divid).innerHTML = trmsgsave;
}

function startInc1(divid){
     if(curwidth1<=globalw*1.5 || curheight1<=globalh*1.5){ //only decrement if size is less than 1.5 times given size
		 var funcall = "incrementSize1("+divid+")";
		 setTimeout(funcall,10);
	}
	//else{
		// alert("w="+curwidth1+" or h="+curheight1);
	//	 var funcall = "startDec1("+divid+")";
		// document.getElementById("mesgdiv"+divid).innerHTML = savein1;
	     //setTimeout(funcall,500);
	//}    
}

function startDec1(divid){
   if(curwidth1>globalw || curheight1>globalh){
		 var funcall = "decrementSize1("+divid+")";
		 setTimeout(funcall,10);
	}else{
	//	alert("w="+curwidth1+" or h="+curheight1);
		document.getElementById("closespan"+divid).style.display				= "none";
		document.getElementById("closespan"+divid).style.visibility				= "hidden";
		document.getElementById("votetimediv"+divid).style.display				= "block";
		document.getElementById("votetimediv"+divid).style.visibility			= "visible";
		document.getElementById("mesgdiv"+divid).style.overflow 				= "hidden";
		document.getElementById("bottomdiv"+divid).style.visibility 			= "hidden";
		document.getElementById("bottomdiv"+divid).style.display				= "none";
		
		document.getElementById("mesgdiv"+divid).style.zIndex					= 0;
		document.getElementById("mesgdiv"+divid).style.overflow 				= "hidden";
	}
}

function incrementSize1(divid){
	curwidth1 = curwidth1+6;
	curheight1 = curheight1+6;
	itop1 = itop1-3;
	ileft1= ileft1-3;
	document.getElementById("mesgdiv"+divid).style.top = itop1+"px";
	document.getElementById("mesgdiv"+divid).style.left = ileft1+"px";
	document.getElementById("mesgdiv"+divid).style.width=curwidth1+"px";
	document.getElementById("mesgdiv"+divid).style.height=curheight1+"px";
	startInc1(divid);
}

function decrementSize1(divid){
	curwidth1	= curwidth1-6;
	curheight1 	= curheight1-6;
	itop1 		= itop1+3;
	ileft1		= ileft1+3;
	document.getElementById("mesgdiv"+divid).style.top 		= itop1+"px";
	document.getElementById("mesgdiv"+divid).style.left 	= ileft1+"px";
	document.getElementById("mesgdiv"+divid).style.width	= curwidth1+"px";
	document.getElementById("mesgdiv"+divid).style.height	= curheight1+"px";
	startDec1(divid);
}

function generateNextMesg(curmsgindx){
	
	createXMLHttpObj();
	
	if(xmlhttp) {           
		var url 	= "/awareness/generateNextMesg.php";
		var params 	= "wallid="+wallid+"&curmsgindx="+curmsgindx;
		
		//alert("posting to db"+params);
		
		xmlhttp.open("POST", url, true);

		//Send the proper header information along with the request
		xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
		xmlhttp.setRequestHeader("Content-length", params.length);
		xmlhttp.setRequestHeader("Connection", "close");

		xmlhttp.onreadystatechange = function() {//Call a function when the state changes.
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				//if(xmlhttp.responseText != "Done"){
				//	alert(xmlhttp.responseText);
					
					result = eval("(" + xmlhttp.responseText + ")");
					
					var msgid	= result.msgid;
					
					setRandomColorForCurDiv();
					
					var docfrag	=	document.createDocumentFragment();
					var msgdiv	=	document.createElement("div");
				
					//	echo "<div id=\"mesgdiv$indx\" class=\"p-shadow\" style=\"cursor:pointer;position:absolute; color:$textclr; vertical-align:top; top:".$ptop."px; left:".$pleft."px; z-index:0; background-color:$var\" onmouseover=\"onMouseOverD($indx);\" onmouseout=\"onMouseOutD($indx);\" onclick=\"this.style.cursor='auto';showDiv($indx,$msgid);\">";
					
					
					var trmesg  = "";
					if(result.message.length>60){
							trmesg	= result.message.substring(0,60)+"...";
					}else{
						trmesg	= result.message;
					}
					
					var trloc	= "";
					if(result.location && result.location.length>16){
							trloc	= result.location.substring(0,16);
					}else{
							trloc	= result.location;
					}
				
					msgdiv.setAttribute("class","p-shadow");
					msgdiv.id						= "mesgdiv"+msgid;
					msgdiv.style.position 			= "absolute";
					msgdiv.style.cursor				= "pointer";
					msgdiv.style.top				= ptop+"px";
					msgdiv.style.left 				= pleft+"px";
					msgdiv.style.width 				= globalw+"px";
					msgdiv.style.height				= globalh+"px";
					msgdiv.style.backgroundColor	= msgbkclr;
					msgdiv.style.fontStyle			= "italic";
					msgdiv.style.color				= textclr;

					msgdiv.setAttribute("onmouseover","onMouseOverD("+msgid+")");
					msgdiv.setAttribute("onmouseout","onMouseOutD("+msgid+")");
					msgdiv.setAttribute("onclick","showDiv("+msgid+")");
			
					//create vote time div for top
					var votetimediv		= document.createElement("div");
					votetimediv.setAttribute("class","auth");
					votetimediv.id					= "votetimediv"+msgid;
					votetimediv.style.display 		= "block";
					votetimediv.style.color			= textclr;
					votetimediv.style.fontSize		= "10px";
					votetimediv.style.height		= "15px";
					//votetimediv.style.marginTop		= "10px";
					//msgdiv.appendChild(votetimediv); //append it to main div
				
					var votediv						= document.createElement("div");
					votediv.id						= "votevalue"+msgid;
					var votetxt						= document.createTextNode(result.votes+" votes");
					
					var timediv						= document.createElement("div");
					var timetxt						= document.createTextNode(result.timediff);
					
					votediv.style.cssFloat			= "left";
					votediv.style.display			= "inline";
					votediv.style.fontSize			= "10px";
					//votediv.style.width				= "100%";
					
					timediv.style.cssFloat			= "right";
					timediv.style.display			= "inline";
					timediv.style.height			= "10px";
					timediv.style.fontSize			= "10px";
				
					votediv.appendChild(votetxt);
					timediv.appendChild(timetxt);
				
					votetimediv.appendChild(votediv);
					votetimediv.appendChild(timediv);
				
					msgdiv.appendChild(votetimediv);
				
					//close url
					var closespan					= document.createElement("span");
					closespan.id					= "closespan"+msgid;
					closespan.style.cssFloat		= "right";
					closespan.style.display			= "none";
					closespan.style.visibility		= "invisible";
					closespan.innerHTML				= "<a href=\"javascript:minDiv("+msgid+");\">[close x]</a>";
				
					msgdiv.appendChild(closespan);
					
					//display msg
					var msgtxtdiv					= document.createElement("div");
					
					var onlymsg						= document.createElement("div");
					onlymsg.id						= "onlymsg"+msgid;
					onlymsg.style.display 		= "inline";
					onlymsg.style.overflow		= "hidden";
					onlymsg.style.marginBottom	= "15px";
					var msgtext						= document.createTextNode("\""+trmesg+"\"");
					onlymsg.appendChild(msgtext);
					
					msgtxtdiv.appendChild(onlymsg);

					if(result.name && result.name.length>0){
						
						var commaspan					= document.createElement("span");
						var commatxt					= document.createTextNode(", ");
						commaspan.appendChild(commatxt);
						
						var namelocspan					= document.createElement("span");
						namelocspan.style.color			= getRandomNameColor();
						
						var nameloctxt					= document.createTextNode(result.name+" - "+result.location);
						namelocspan.appendChild(nameloctxt);
						
						msgtxtdiv.appendChild(commaspan);
						msgtxtdiv.appendChild(namelocspan);
					
					}
					
					var bottomdiv 				= document.createElement("div");
					bottomdiv.id				= "bottomdiv"+msgid;
					bottomdiv.style.visibility	= "hidden";
					bottomdiv.style.display		= "none";
					
					msgdiv.appendChild(msgtxtdiv);
					msgdiv.appendChild(bottomdiv);
					
					bodyTag.appendChild(msgdiv);
					
					
					//append reply count
					if(result.replycnt>0){
					//	alert(result.replycnt);
						var replyspan					= document.createElement('span');
						replyspan.id				 	= "replyspan";
						replyspan.style.position		= "absolute";
					//	replyspan.style.zIndex			= "10";
						replyspan.style.top				= (ptop+globalh)+"px";
						replyspan.style.left  			= (pleft+globalw-30)+"px";
						
						replyspan.style.fontStyle		= "italic";
						replyspan.style.fontSize		= "10px";
						replyspan.style.color			= textclr;
						replyspan.style.fontFamily		= "Arial";
						
						var replytxt					= document.createTextNode(result.replycnt+" replies");
						replyspan.appendChild(replytxt);
						
						bodyTag.appendChild(replyspan);
					//	msgdiv.appendChild(replyspan);
					}
						
					if(curmsgindx<totalrecordisp){
						
						pleft = pleft+globalw+20;

						if(curmsgindx % cols==0){										
							savepleft 	= pleft;
							pleft 	 	= globalpleft;
							ptop 		= ptop+globalh+20;
							hindx 		= hindx+1;
							//echo "</tr>";
							//echo "<tr>";
						}
						generateNextMesg(curmsgindx+1);
					}
		//		}else{
					//set some variable to stop calling this method
		//		}
				
			}
		}
		xmlhttp.send(params);                
    }
}

var msgbkclr = "#ffffff";
var textclr	 = "#666666";

function setRandomColorForCurDiv(){

	var randm = Math.random();
	
	if(randm>0.2){
		msgbkclr = "#ebff61";
		textclr = "#666666";
	}

	if(randm>0.4){
		msgbkclr = "#878787";
		textclr = "#ffffff";
	}
	
	if(randm>0.6){
		msgbkclr = "#baf1ff";
		textclr = "#666666";
	}
}

function getRandomNameColor(){
		
		var randm 		= Math.random();
		var namecolor 	= "";
		
		if(randm>0){
			namecolor = "#FD7A00";
		}

		if(randm>0.4){
			namecolor = "#FF24ED";
		}

		if(randm>0.6){
			namecolor = "#2CBD00";
		}
		
		if(msgbkclr == "#878787" ){
			namecolor = "#FDFBBD";
		}
		
		return namecolor;
}
function startFetchingMsg(){
	bodyTag=document.getElementsByTagName("body")[0];
	generateNextMesg(1);
}

