function deleteProperty(propertyId)
{
	if (confirm('Delete this property?')) {
		window.location.href = 'index.php?deleteproperty&property=' + propertyId;
	}
}

function deleteAgent(agentId)
{
	if (confirm('Delete this agent?')) {
		window.location.href = 'index.php?deleteagent&agent=' + agentId;
	}
}

function deleteCountry(cyId)
{
	if (confirm('Delete this country?')) {
		window.location.href = 'index.php?deletecountry&country=' + cyId;
	}
}

function deleteState(stateId)
{
	if (confirm('Delete this province?')) {
		window.location.href = 'index.php?deletestate&state=' + stateId;
	}
}

function deleteArea(areaId)
{
	if (confirm('Delete this area?')) {
		window.location.href = 'index.php?deletearea&area=' + areaId;
	}
}

function deleteCategory(catId)
{
	if (confirm('Delete this category?')) {
		window.location.href = 'index.php?deletecategory&category=' + catId;
	}
}

function deleteImage(propertyId, imgId) 
{
	if (confirm('Delete this image?')) {
		window.location.href = 'index.php?page=list-image&delete&property=' + propertyId + '&imgId=' + imgId;
	}
}

function viewProperty(categoryId) {
	if (categoryId != '') {
		window.location.href = 'index.php?page=list-property&category=' + categoryId;
	} else {
		window.location.href = 'index.php?page=list-property';
	}
}

function viewImage(propertyId) {
	if (propertyId != '') {
		window.location.href = 'index.php?page=list-image&property=' + propertyId;
	} else {
		window.location.href = 'index.php?page=list-image';
	}
}

function viewLargeImage(imageName)
{
	imgWindow = window.open('', 'largeImage', "width=" + screen.availWidth + ",height="  + screen.availHeight + ",top=0,left=0,screenY=0,screenX=0,status=yes,scrollbars=yes,resizable=yes,menubar=no");
	imgWindow.focus();
	imgWindow.location.href = '../view-image.php?type=glimage&name=' + imageName;
}

function featureProperty(propertyId)
{
	if (confirm('Feature this property?')) {
		window.location.href = 'index.php?featureproperty&property=' + propertyId;
	}
}

function checkNumber()
{
	var checkthis = document.frmproperty.txtPrice.value
	//var anum=/(^\d+$)|(^\d+\.\d+$)/
	var validno = /(^\d+$)/
	if (validno.test(checkthis))
		testresult = true
	else {
		alert("Please input a valid Price. No R, no spaces, no decimals.")
		testresult = false
	}
	return (testresult)
}

function checkAlert()
{
	if (document.layers||document.all||document.getElementById)
		return checkNumber()
	else
		return true
}

function popUpWindow(URLStr, left, top, width, height) {
  var popUpWin=0;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  popUpWin.focus();
}

function popUpResize(URLStr, left, top, width, height) {
  var popUpWin=0;
  if(popUpWin)
  {
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menub ar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
  popUpWin.focus();
}

