function postMessages(to, p0, p1, p2) {
	//http://mentaljetsam.wordpress.com/2008/06/02/using-javascript-to-post-data-between-pages/
	var myForm = document.createElement("form");
	myForm.method = "post";
	myForm.action = to;
	var myInput0 = document.createElement("input");
	myInput0.setAttribute("name", "type");
	myInput0.setAttribute("value", p0);
	myForm.appendChild(myInput0);
	var myInput1 = document.createElement("input");
	myInput1.setAttribute("name", "ref");
	myInput1.setAttribute("value", p1);
	myForm.appendChild(myInput1);
	if (p2 != null) {
		var myInput2 = document.createElement("input");
		myInput2.setAttribute("name", "q");
		myInput2.setAttribute("value", p2);
		myForm.appendChild(myInput2);
	}
	document.body.appendChild(myForm);
	myForm.submit();
	document.body.removeChild(myForm);
}
function calculatePositions() {
	xPositions = new Array();
	yPositions = new Array();
	var currentAngle = Math.random() * ((Math.PI * 2) / 24);
	var step = (2 * Math.PI) / 24;
	var centreX = 280;
	var centreY = 300;
	var radius = 250;
	for ( var i = 1; i <= 24; i++) {
		xPositions.push(Math.round(centreX + Math.sin(currentAngle) * radius));
		yPositions.push(Math.round(centreY + Math.cos(currentAngle) * radius));
		currentAngle = currentAngle + step;
	}
}
function initialiseCards() {
	for ( var i = 1; i <= 24; i++) {
		deck.push(new Draggable('' + i, {
			starteffect : new Effect.Pulsate('' + i)
		}));
		$('' + i).setStyle( {
			left : (xPositions[i - 1] - 30) + 'px',
			top : (yPositions[i - 1] - 40) + 'px'
		});
	}
	new Effect.Pulsate('shuffle');
	new Effect.Pulsate('pentagon');
}
function removeArrayElement(array, index) {

	var temp = new Array();
	for ( var i = 0; i < array.length; i++) {
		if (i != index) {
			temp.push(array[i]);
		}
	}
	return temp;
}