function ignoreSpaces(string) {
var temp = "";
string = '' + string;
splitstring = string.split(" ");
for(i = 0; i < splitstring.length; i++)
temp += splitstring[i];
return temp;
}

function ChangePicture(picture) {
document.theimg.src = picture
}


function DisplayPicture(pic)
{
 
var theq = "viewpicture.asp?pic=" + pic;
 
window.open(theq,"sp","width=100,height=100,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no");
 

}


function calculator(){
	window.open('mortgage_calulator.asp','calculator','width=517,height=530,top=200,left=200, resize=no,scrollbars=yes');
} 
		
  function HowToSearch(){
window.open('howtosearch.asp','how','width=397,height=218,top=200,left=200, resize=no,scrollbars=no');
		} 
		
  function MortgageCalculator(Amount)
  {
	  if (Amount != "")
	  {
			window.open('mortgage_calulator.asp?amount='+Amount,'calculator','width=517,height=530,top=200,left=200, resize=no,scrollbars=yes');
	  }
	  else
	  {
			window.open('mortgage_calulator.asp','calculator','width=517,height=530,top=200,left=200, resize=no,scrollbars=yes');
	  }

  } 
  
   function OtherProperties()
  {
	var thenum = window.screen.width;
	var mapwidth
	var mapheight
	

	if (thenum < 2400)
	{
		mapwidth = 1100
		mapheight = 900
	}
	
	if (thenum < 1200)
	{
		mapwidth = 1000
		mapheight = 800
	}
	
	if (thenum < 850)
	{
		mapwidth = 750
		mapheight = 500
	}

	


  	window.open("otherproperties.asp","othr","width="+mapwidth+",height="+mapheight+",toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no");
  
  } 
		
  function customerInquiry(){
window.open('customerInquiry.asp','branscombe','width=740,height=550,top=200,left=200, resize=no,scrollbars=yes');
		} 
		
function InteractiveMap()
{
	var thenum = window.screen.width;
	var mapwidth
	var mapheight
	

	if (thenum < 2400)
	{
		mapwidth = 1100
		mapheight = 900
	}
	
	if (thenum < 1200)
	{
		mapwidth = 1000
		mapheight = 800
	}
	
	if (thenum < 850)
	{
		mapwidth = 750
		mapheight = 500
	}

	

	page = "map.asp?h="+mapheight+"&w="+mapwidth
	window.open(page,"stmap","width="+mapwidth+",height="+mapheight+",toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,menubar=no");
}


function SingleMap(longitude,latitude)
{
	
	page = "singlemap.asp?longitude="+longitude+"&latitude="+latitude
	window.open(page,"smallmap","width=750,height=520,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no");
}

function ChathamAd()
{
	
	window.open("5thchathampopup.asp","chatham","width=605,height=530,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,menubar=no");
}

function OfficeMap(longitude,latitude)
{
	
	page = "officemap.asp?longitude="+longitude+"&latitude="+latitude
	window.open(page,"officesmallmap","width=750,height=520,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,menubar=no");
}

function ConfirmDeleteRealtor(RealtorID) {
  if (confirm("Are you sure you want to delete this realtor?")) {
    document.location = "realtor-modify-delete.asp?ID=" + RealtorID;
  }
}

function ConfirmDeleteUser(UserID) {
  if (confirm("Are you sure you want to delete this user?")) {
    document.location = "users-delete.asp?ID=" + UserID;
  }
}

function ConfirmDeleteProperty(PropertyID) {
  if (confirm("Are you sure you want to delete this property?")) {
    document.location = "property-modify-delete.asp?ID=" + PropertyID;
  }
}

function ConfirmDeleteContactForm(ID) {
  if (confirm("Are you sure you want to delete this contact form submission?")) {
    document.location = "contactform-delete.asp?ID=" + ID;
  }
}


function ConfirmDeleteProject(ProjectID) {
  if (confirm("Are you sure you want to delete this project?")) {
    document.location = "project-modify-delete.asp?ID=" + ProjectID;
  }
}

function GetFileName(fieldname) {
    if (fieldname.indexOf('/') > -1)
        answer = fieldname.substring(fieldname.lastIndexOf('/')+1,fieldname.length).toLowerCase();
    else
        answer = fieldname.substring(fieldname.lastIndexOf('\\')+1,fieldname.length).toLowerCase();
    return answer;
}



// FUNCTIONS RELATING TO DHTML/CSS USED IN ADMIN AREA FOR PHOTOS
function getItem(id)
    {
        var itm = false;
        if(document.getElementById)
            itm = document.getElementById(id);
        else if(document.all)
            itm = document.all[id];
        else if(document.layers)
            itm = document.layers[id];

        return itm;
    }

    function Show(id)
    {
        itm = getItem(id);

        if(!itm)
            return false;


        itm.style.display = '';


        return false;
    }
	
	
	  function Hide(id)
    {
        itm = getItem(id);

        if(!itm)
            return false;

           itm.style.display = 'none';

        return false;
    }
	

