//var msiteUrl = "http://www.bloombergutv.com/";
var msiteUrl = "http://www.bloombergutv.com/";
function trimAll(sString)
{
	while (sString.substring(0,1) == ' ')
	{
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ')
	{
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}

function winpopup(mylink, windowname, mywidth, myheight)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width='+mywidth+',height='+myheight+',scrollbars=yes');
return false;
}

function rateBlog(memo)
{
	var xmlHttp = false;
	try
	{
		xmlHttp = new XMLHttpRequest();
	} 
	catch(trymicrosoft) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) 
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed) 
			{
				xmlHttp = false;
			}  
		}
	}
	
	//var comment=document.getElementById("comment").value;
	//var aid=document.getElementById("aid").value;
	var str=memo;	
	var url=msiteUrl+"rateblog.php";
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.onreadystatechange = function() 
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			var result=xmlHttp.responseText;
			//alert(result)
			document.getElementById("rated").innerHTML=result;
			if(result.length>0)
			{
								
			}
		} 
		else
		{
		//		document.getElementById("commentbody").innerHTML="<table width=\"403\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"greenborder_3sides\"><tr><td width=\"405\" height=\"315\"><img src='images/busy.gif'></td></tr></table>";
		}
	}
	xmlHttp.send(str);	
}

function postBlogComment()
{
	var xmlHttp = false;
	try
	{
		xmlHttp = new XMLHttpRequest();
	} 
	catch(trymicrosoft) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) 
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed) 
			{
				xmlHttp = false;
			}  
		}
	}
	
	var comment=document.getElementById("comment").value;
	var blog_id=document.getElementById("blog_id").value;
	var str="action=SaveData&comment="+comment+"&blog_id="+blog_id;
	
	var url=msiteUrl+"postblogcomment.php";
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.onreadystatechange = function() 
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			var result=xmlHttp.responseText;
				document.getElementById("commentbody").innerHTML=result;
			if(result.length>0)
			{
								
			}
		} 
		else
		{
				document.getElementById("commentbody").innerHTML="<table width=\"403\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"greenborder_3sides\"><tr><td width=\"405\" height=\"315\"><img src='images/busy.gif'></td></tr></table>";
		}
	}
	xmlHttp.send(str);	
}

function rateBoard(memo)
{
	var xmlHttp = false;
	try
	{
		xmlHttp = new XMLHttpRequest();
	} 
	catch(trymicrosoft) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) 
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed) 
			{
				xmlHttp = false;
			}  
		}
	}
	
	//var comment=document.getElementById("comment").value;
	//var aid=document.getElementById("aid").value;
	var str=memo;	
	var url=msiteUrl+"rateboard.php";
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.onreadystatechange = function() 
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			var result=xmlHttp.responseText;
			//alert(result)
			document.getElementById("rated").innerHTML=result;
			if(result.length>0)
			{
								
			}
		} 
		else
		{
		//		document.getElementById("commentbody").innerHTML="<table width=\"403\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"greenborder_3sides\"><tr><td width=\"405\" height=\"315\"><img src='images/busy.gif'></td></tr></table>";
		}
	}
	xmlHttp.send(str);	
}


function rateBoardComment(memo)
{
	var xmlHttp = false;
	try
	{
		xmlHttp = new XMLHttpRequest();
	} 
	catch(trymicrosoft) 
	{
		try 
		{
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (othermicrosoft) 
		{
			try
			{
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (failed) 
			{
				xmlHttp = false;
			}  
		}
	}
	
	//var comment=document.getElementById("comment").value;
	//var aid=document.getElementById("aid").value;
	var str=memo;	
	var url=msiteUrl+"rateboardcomment.php";
	xmlHttp.open("POST",url,true);
	xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
	xmlHttp.onreadystatechange = function() 
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			var result=xmlHttp.responseText;
			//alert(result)
			document.getElementById("rated").innerHTML=result;
			if(result.length>0)
			{
								
			}
		} 
		else
		{
		//		document.getElementById("commentbody").innerHTML="<table width=\"403\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"greenborder_3sides\"><tr><td width=\"405\" height=\"315\"><img src='images/busy.gif'></td></tr></table>";
		}
	}
	xmlHttp.send(str);	
}
