var serverPath = "http://www.forsale.com.cy/calculators/";
function openMortgageWin()
{
  var szUrl;
  var szFeatures;
  var szReturnedValue;
  
  szUrl = serverPath + "mortgage.asp";
  szFeatures = 'width=300,height=400,status=no,help=no,center=yes,resizable=no,scroll=yes';
  
  // Open the window and return(0) the name of the window
  window.open(szUrl, "MortgageCalc", szFeatures)
}
function openCurrencyWin()
{
  var szUrl;
  var szFeatures;
  var szReturnedValue;
  
  szUrl = serverPath + "currency.asp";
  szFeatures = 'width=320,height=480,status=no,help=no,center=yes,resizable=no,scroll=yes';
  
  // Open the window and return(0) the name of the window
  window.open(szUrl, "CurrencyCalc", szFeatures);
}
function openMetricWin()
{
  var szUrl;
  var szFeatures;
  var szReturnedValue;
  
  szUrl = serverPath + "metric.asp";
  szFeatures = 'width=300,height=320,status=no,help=no,center=yes,resizable=no,scroll=yes';
  
  // Open the window and return(0) the name of the window
  window.open(szUrl, "MetricCalc", szFeatures);
}
//cookie mainpulation
function setCookie(name, value)
{
  var curCookie = name + "=" + escape(value);
  document.cookie = curCookie;
}
function getCookie(name)
{
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1)
  {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  }
  else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}
function deleteCookie(name, path)
{
  if (getCookie(name))
    document.cookie = name + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}
function wish_add(id_property)
{
  var s;
  s = getCookie("property_wish_list");
  if( !s )
      s = "-" + id_property + "-";
  else
    {
      var i = s.indexOf("-" + id_property + "-");
      if( i == -1 )
        s += "-" + id_property + "-";
      else
        return;
    }
  setCookie("property_wish_list", s);
}
function wish_del(id_property)
{
  var s = getCookie("property_wish_list");
  if( !s )
    return;
  var t = "-" + id_property + "-";
  var i = s.indexOf(t);
  if( i == -1 ){ alert("i=-1"); return;}
  var s1 = s.substring(0, i) + s.substring(i+t.length);
  setCookie("property_wish_list", s1);
}
function wish_cls()
{
  deleteCookie("property_wish_list");
}
function wish_show()
{
  alert(getCookie("property_wish_list"));
}
// general function
function openNewWin(myUrl, w, h)
{
  var szFeatures;
  var x, y;
  x = window.screenX + (window.outerWidth-w)/2;
  y = window.screenY + (window.outerHeight-h)/2;
  if( x < 0 ) x = 0;
  if( y < 0 ) y = 0;
  szFeatures = 'width='+w+',height='+h+',screenx='+x+',screeny='+y+'status=no,help=no,resizable=no,scrollbars=yes';
  //alert(szFeatures);
  window.open(myUrl, "CyprusProperty", szFeatures);
}
function openNewWin1(win, myUrl, w, h)
{
  var szFeatures;
  var x, y;
  x = win.screenX + (win.outerWidth-w)/2;
  y = win.screenY + (win.outerHeight-h)/2;
  if( x < 0 ) x = 0;
  if( y < 0 ) y = 0;
  szFeatures = 'width='+w+',height='+h+',screenx='+x+',screeny='+y+'status=no,help=no,resizable=no,scroll=yes';
  //alert(szFeatures);
  win.open(myUrl, "picture", szFeatures);
}
