function logout()
{ if (confirm("Are you sure you want to logout ?\r\n\r\nNote:\r\n- If you are using Internet Explorer, the window will close.\r\n- Else you will have to close the window (hence logging out)")) window.close(); }

function alphanumCheck(str)
{
	for (var j = 0; j < str.length; j++)
	{
		var aChar		= str.charAt(j);
		var charCode	= aChar.charCodeAt(0);

		if (!((charCode > 47 && charCode < 59) || (charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123)))
		{
			return false;
		}
	}
	return true;
}

function validateURL(url)
{
	url = url.replace(/ /g, '');
	if(url.length != 0)
	{
		var regex = /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{2,6}/
		if (!regex.test(url)) return false;
		else return true;
	}
	else return false;
}

function advert(photo)
{
	var w_width = 600;
	var w_height = 600;
	var screen_width = screen.width;
	var screen_height = screen.height;
	var w_top = (screen_height/2) - (w_height/2);
	var w_left = (screen_width/2) - (w_width/2);
	window.open('show.php?img=adv&ph=' + photo, '', 'scrollbars=no ,width='+w_width+', height='+w_height+', top='+w_top+', left='+w_left);
}