function openInNewWindow()
{
	var newWindow = window.open(this.getAttribute('href'), 'wikipedia');
	newWindow.focus();
	return false;
}

function controlForm()
{
	var post = document.forms["post"];
	var nick = post.elements["nick"].value;
	var message = post.elements["message"].value;
	var spamFilter = post.elements["spamFilter"].value;
	var approve = post.elements["approve"].checked;

	if(nick == "")
	{
		alert("Enter your nick name");
		return false;
	}
	
	if(message == "")
	{
		alert("Enter a message");
		return false;
	}
	 
	if(spamFilter != 4)
	{
		alert("replace the text in the 'Spam guard' textfield with the sum of 2+2");
		return false;
	}

	if(approve != 1)
	{
		alert("You have to certify that you have the right to distribute the text and pictures of this post, and that you comply with the Terms of Use.");
		return false;
	}
	
	return true;
}

function createRequestObject()
{  
	var ro;
	
	try
	{    
		// Firefox, Opera 8.0+, Safari    
		ro = new XMLHttpRequest();    
	}
	catch(e)
	{    
		try
		{      
			// Internet Explorer 6.0+
			ro = new ActiveXObject("Msxml2.XMLHTTP");      
		}
		catch(e)
		{      
			try
			{        
				// Internet Explorer 5.5+
				ro = new ActiveXObject("Microsoft.XMLHTTP");        
			}
			catch(e)
			{        
				alert("Your browser does not support AJAX!");        
				ro = false;
			}
		}
	}
	
	return ro;
}

var http = createRequestObject();

function sndReq(action,id) 
{
	http.open('get', 'http://www.ihatemyipod.com/updaterate.php?action='+action+'&id='+id);
	http.onreadystatechange = handleResponse;
	http.send(null);
}

function handleResponse() 
{
	if(http.readyState == 4)
	{
		var response = http.responseText;
		var update = new Array();
		
		if(response.indexOf('|' != -1))
		{
			update = response.split('|');
			document.getElementById(update[0]).innerHTML = update[1];
		}
	}
}