function getgcd(x,y)
{
/*
Calculates the GCD (greatest common divisor, aka HCF, highest common factor) using the Euclidean Algorithm
*/
	x = eval(x);
	y = eval(y);
	
	var gcd = Number.POSITIVE_INFINITY;  //greatest common divisor
	var remainder;
	if(x > y)
	{
		
		if(y == 0)
			{gcd = x;}
		else
		{
			//alert("X: " + x + " Y: " + y);
			window.status = x%y;
			gcd = getgcd(y,x%y);
		}
	}
	else if(y > x)
	{
		gcd = getgcd(y,x);	
	}
	else
	{
		gcd = x;
	}
	return gcd;
}
