function popUp(URL,w,h) 
{
	day = new Date();
	id = day.getTime();
	l = (screen.width) ? (screen.width-w)/2 : 0;
	t = (screen.height) ? (screen.height-h)/2 : 0;	
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width='+w+',height='+h+',left='+l+',top='+t+'');");	
}


function ShowAlertCloseWindow(msg)
{
	alert(msg);
	self.close();
}

function addressSearch(txtHouseID, txtStreetID, txtTownID, txtCountyID, txtPostcodeID)
{
   //First of all get the postcode to search on
   var postcode = document.getElementById(txtPostcodeID).value
    
   //Popup the addressSearch
   var newWindow;
   var nHeight = 300; 
   var nWidth = 580; 
   var nXpos = (screen.availWidth - nWidth) / 2; 
   var nYpos = (screen.availHeight - nHeight) / 2;  
   newWindow = window.open('/addressSearch.aspx?postcode=' + postcode + '&txtHouseID=' + txtHouseID + '&txtStreetID=' + txtStreetID + '&txtTownID=' + txtTownID + '&txtCountyID=' + txtCountyID,'newWindow','width=' + nWidth + ',height=' + nHeight + ',left=' + nYpos + ',top=' + nXpos);
    
    if (newWindow != null)
      newWindow.focus();      
}   
    
function UpdateAddress(txtHouseID, hfHouseID, txtStreetID, hfStreetID, txtTownID, hfTownID, txtCountyID, hfCountyID)
{
    window.opener.document.getElementById(txtHouseID).value = document.getElementById(hfHouseID).value;
    window.opener.document.getElementById(txtStreetID).value = document.getElementById(hfStreetID).value;
    window.opener.document.getElementById(txtTownID).value = document.getElementById(hfTownID).value;
    window.opener.document.getElementById(txtCountyID).value = document.getElementById(hfCountyID).value;        
}
