// this will be replaced by global.js in public/theme/javascrtips/
function popUpWin(location)
{
	window.open(location, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=650,height=400');
}
function popUpWinNS(location)
{
	window.open(location, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,width=650,height=400');
}
function replaceQueryString(url, param, value) {
     preURL = "";
     postURL = "";
     newURL = "";
     url = url.replace("#", "");

      start = url.indexOf(param + "=");
      if(start > -1){
       end = url.indexOf("=", start);
       preURL=url.substring(0,end) +"="+value;

       startRest = url.indexOf("&",start);
       postURL="";
       if(startRest > -1){
                  postURL=url.substring(startRest);
       }

      }else{
        preURL=url;
        postURL="&"+param+"="+value;
      }
      newURL = preURL+postURL;

      return newURL;

  }
function gosort(sort){
    location.href=replaceQueryString(window.location.href,'order_by',sort)
}

function email_home_finder()
{
  email_element = document.getElementById('email_home_finder_email');
  var email;
  if (email_element != null) {
    email = email_element.value;
  }
  if (email == ' Enter your email address')
	{
		email = '';
	}
	email = escape(email);

	window.open('/subscribers/new?type=advanced&email=' + email, 'HomeSearch', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+screen.width+',height='+screen.height);

}