function cellHighlight (cellID)
{
		document.getElementById(cellID).style.backgroundColor="#C0C0C0";
		document.getElementById(cellID).style.color="#000000";
		document.getElementById(cellID+'b').style.backgroundColor="#C0C0C0";
		document.getElementById(cellID+'b').style.color="#000000";
		document.getElementById(cellID+'td').style.backgroundColor="#C0C0C0";
		document.getElementById(cellID+'td').style.color="#000000";
}
function cellUnHighlight(cellID)
{
		document.getElementById(cellID).style.backgroundColor="black";
		document.getElementById(cellID).style.color="#C0C0C0";
		document.getElementById(cellID+'b').style.backgroundColor="black";
		document.getElementById(cellID+'b').style.color="#C0C0C0";
		document.getElementById(cellID+'td').style.backgroundColor="black";
		document.getElementById(cellID+'td').style.color="#C0C0C0";
}
function showPost(threadID)
{
	if(document.getElementById(threadID+'post').display=='none')
	{
		document.getElementById(threadID+'post').display='';
	}
	else
	{
		document.getElementById(threadID+'post').display='none';
	}
}
function ErrorCheck(element, message, type)
{
	var count=0;
	document.getElementById(element).style.backgroundColor="white";
	document.getElementById(element).style.color="black";
	if (document.getElementById(element).value=='')
	{
		count=1;
		document.getElementById('errors').innerHTML += '<div class="errors" style="margin-bottom: 3px;">'+message+'</div>';
		document.getElementById(element).style.backgroundColor="#505000";
		document.getElementById(element).style.color="white";
	}
	else if(type=='email')
	{
		var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
		if(!(filter.test(document.getElementById(element).value)))
		{
			count=1;
			document.getElementById('errors').innerHTML +='<div class="errors" style="margin-bottom: 3px;">Enter a Valid Email</div>';
			document.getElementById(element).style.backgroundColor="#505000";
			document.getElementById(element).style.color="white";
		}
	}
	return count;
}
function getAjaxObject()
{
		var Ajaxcall=new XMLHttpRequest;
	 if(window.XMLHttpRequest) {
    	try {
			AjaxCall = new XMLHttpRequest();
        } catch(e) {
			AjaxCall = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	AjaxCall = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		AjaxCall = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		AjaxCall = false;
        	}
		}
    }
	return Ajaxcall;
}
function changeCharacter()
{
	var idCharacter=document.getElementById('idChar').value;
	var Ajaxcall=getAjaxObject();
	if(AjaxCall) {
		AjaxCall.onreadystatechange = function()
		{
			//	alert(AjaxCall.responseText);
			if(AjaxCall.readyState==4)	
			{
				document.getElementById('chrCharacterName').innerHTML=AjaxCall.responseText;	
			}
		}
		AjaxCall.open("GET", "includes/ajaxfunctions.php?function=changeCharacter&idCharacter="+idCharacter, true);
		AjaxCall.send(null);
	}
	else
	{
		alert("AJAX Failure!!!!");	
	}
}
