function getBrowserWidth()
{
	if ( window.innerWidth )
	{
		return window.innerWidth;
	}
    else if ( document.documentElement && document.documentElement.clientWidth != 0 )
    {
		return document.documentElement.clientWidth;
	}
	else if ( document.body )
	{
		return document.body.clientWidth;
	}
		return 0;
}

function getBrowserHeight()
{
	if ( window.innerHeight )
	{
		return window.innerHeight;
	}
	else if ( document.documentElement && document.documentElement.clientHeight != 0 )
	{
		return document.documentElement.clientHeight;
	}
	else if ( document.body )
	{
		return document.body.clientHeight;
	}
	return 0;
}

function postdata()
{
	var rpt = document.postmail.rpt.value;
	if(rpt == 0)
	{
	
		if(google.loader.ClientLocation !== null)
		{
			var country = google.loader.ClientLocation.address.country;
			var region  = google.loader.ClientLocation.address.region;
			var city    = google.loader.ClientLocation.address.city;
		}
		var browserWidth  = getBrowserWidth();
		var browserHeight = getBrowserHeight();
		var screenWidth   = screen.width;
		var screenHeight = screen.height;
		var unique = document.postmail.unq.value;
		
		var req = new XMLHttpRequest();
		if (req)
		{
			req.onreadystatechange = function()
			{
				if (req.readyState == 4 && (req.status == 200 || req.status == 304))
				{
					return false;
				}
			}
			req.open('POST', '/lib/screendata.php');
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
			req.send('id='+unique+'&bw='+browserWidth+'&bh='+browserHeight+'&sw='+screenWidth+'&sh='+screenHeight+'&country='+country+'&region='+region+'&city='+city);
		}
	}
}