function refreshpage()
{
	current = document.location;
	document.location = current;
}

function show_login_error(error_msg_type)
{
	//Switch the error msg type.
	switch(parseInt(error_msg_type))
	{
		case 5:
			$('#login_error').html('<strong>Confirm Email</strong><br> ' +
									'Please confirm your email address.<br>' +
									'<a href="/confirm-membership.php?send=Y">Send confirmation email?</a>');
			break;
		default:
			$('#login_error').html('<strong>Bad log in!</strong><br> ' +
									'Please check your sign-on details.<br>' +
									'<a href="/password-reset.php">Forgotten your password?</a>');
									
	}
	$('#login_error_container div:first').fadeIn(750, function() {
        $('#login_error_container').cycle({nowrap:  1, pause: 1, timeout: 10000});
    });
}

function SetVisibility(id, action)
{
	// Browser sniffer.
	type = "IE";
	if(navigator.userAgent.indexOf("Opera") != -1)
	{
		type = "OP";
	}
	else if(navigator.userAgent.indexOf("Gecko") != -1)
	{
		type = "MO";
	}
	else if(navigator.userAgent.indexOf("Firefox") != -1)
	{
		type = "MO";
	}
	else if(navigator.userAgent.indexOf("AOL") != -1)
	{
		type = "IE";
	}
	else
	{
		if (document.all)
		{
			type = "IE";
		}
		if (document.layers)
		{
			type = "NN";
		}
		if (document.addEventListener)
		{
			type = "NN";
		}
	}

	if (type=="IE") eval("document.all." + id + ".style.display='" + action + "'");
	if (type=="NN") eval("document." + id + ".display='" + action + "'");
	if (type=="MO" || type=="OP") eval("document.getElementById('" + id + "').style.display='" + action + "'");
}

function strpos (haystack, needle, offset) {
    var i = (haystack+'').indexOf(needle, (offset || 0));
    return i === -1 ? false : i;
}

