
  function ln_forget_pwd() {
    if(document.Form.LoginName.value != "") { 
      var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=no,resizable=yes,width=220,height=320';
      var url = "/ForgotPassword?timestamp="+(new Date()).getTime()+"&login="+document.Form.LoginName.value;
      var newWin = open (url, 'ForgotPasswordWin', myBars);
    } else {
      alert( 'Please, enter you e-mail as your user name' );
      document.Form.LoginName.focus();
      return;
    }
  }

  function common_viewMap(map_location,city,state,zip) {
      var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=600';
    if(city || state || zip){
      var address = map_location;
      var city = city;
      var state = state;
      var zip = zip;
    } else {
      var address = map_location.substring(0, map_location.indexOf(','));
      var pre_city = map_location.substring(map_location.indexOf(address)+address.length+1);
      var city = pre_city.substring(0, pre_city.indexOf(','));
      var pre_state = pre_city.substring(pre_city.indexOf(city)+city.length+1);
      var state = pre_state.substring(0, pre_state.indexOf(','));
      var zip = pre_state.substring(pre_state.indexOf(state)+state.length+1);
      if(zip && zip.length>5){
        if(!state || state.length==0)
          state=zip.substring(0,2);
        zip=zip.substring(zip.length-5,zip.length);
      }
    }
    var url = "http://www.mapquest.com/maps/map.adp?level=10&state="+state+"&zipcode="+zip+"&city="+city+"&address="+address;
    var newWin = open (url, '', bars);
    newWin.focus();
  }

  function common_viewMapNew(map_type,sid,map_location,city,state,zip) {
    var bars = '';
    var url="";

      bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes,width=600,height=600';
      if(city || state || zip){
        var address = map_location;
        var city = city;
        var state = state;
        var zip = zip;
      } else {
        var address = map_location.substring(0, map_location.indexOf(','));
        var pre_city = map_location.substring(map_location.indexOf(address)+address.length+1);
        var city = pre_city.substring(0, pre_city.indexOf(','));
        var pre_state = pre_city.substring(pre_city.indexOf(city)+city.length+1);
        var state = pre_state.substring(0, pre_state.indexOf(','));
        var zip = pre_state.substring(pre_state.indexOf(state)+state.length+1);
        if(zip && zip.length>5){
          if(!state || state.length==0)
            state=zip.substring(0,2);
          zip=zip.substring(zip.length-5,zip.length);
        }
      }
      url = "http://www.mapquest.com/maps/map.adp?level=10&state="+state+"&zipcode="+zip+"&city="+city+"&address="+address;
    var newWin = open (url, '', bars);
    newWin.focus();
  }

  function common_viewGMap(sid, domain, fl_hook, mls_id, mls_num, address, idx){
    var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes';
    var append = '';
    if(mls_id&&mls_id=='FMLS'){
      bars+=",width=800,height=750";
    }else if(mls_id&&mls_id=='LMETROCO'){
      append = '&show_property=true';
      bars+=",width=800,height=750";
    }else{
      bars+=",width=800,height=640";
    }
      
    var propertyIdentity = fl_hook
            ?"&fl_hook="+fl_hook
            :"&pid="+mls_num+"&ls="+mls_id;

    var url = "";

    if (domain) {
      url = "http://"+domain;
    }
    else {
      url = "http://"+window.location.hostname;
    }

    url += "/ShowMap?operation=getListing&realtor="
            + sid
            + propertyIdentity
            + "&address="+escape(address)
            +(idx?"&idx=true":"")
            +append;

    var newWin = open (url, '', bars);
    newWin.focus();
  }

  function common_viewGMapByAddress(sid, domain, address){
    var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes,width=800,height=640';
    var url = "http://"+domain+"/ShowMap?realtor="+sid+"&address="+escape(address);
    var newWin = open (url, '', bars);
    newWin.focus();
  }

  function common_viewNativeGMapByAddress(address){
    var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes,width=1000,height=640';
    var url = "http://maps.google.com/maps?q="+escape(address);
    var newWin = open (url, '', bars);
    newWin.focus();
  }

  function common_viewTour(url) {
    var lower_url=url.toLowerCase();
    if (lower_url.indexOf('http://')!=0 && lower_url.indexOf('https://')!=0) url = 'http://' + url;
    var myBars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=yes,resizable=yes,alwaysRaised=yes,width=616,height=605';
    var newWin = open (url, "viewTour", myBars);
    newWin.focus();
  }

  function common_openMorePistures(url) {
    var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,scrollbars=yes,resizable=yes,width=400,height=400';
    var newWin = open ('','', bars);
    newWin.document.location.href = url;
    newWin.focus();
  }


  function showMortgageCalculator(url) {
    var bars = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=yes,scrollbars=no,resizable=no,width=410,height=430';
    var newWin = open ('', "MortgageCalculator", bars);
    newWin.document.location.href = url;
    newWin.focus();
  }

  function showMortgageCalculatorWithPrice(price,down,mbcalc_rate,payment_term) {
    showMortgageCalculatorWithPriceAndRoot("",price,down,mbcalc_rate,payment_term);
  }
  function showMortgageCalculatorWithPriceAndRoot(root,price,down,mbcalc_rate,payment_term) {
    showMortgageCalculator(root+"/MBCalc?operation=calc_payment_ext&price="+price+"&down="+down+"&rate="+mbcalc_rate+"&years="+payment_term);
  }

  function showMortgageCalculatorWithPriceAndRootAMLSReady(root,price,down,mbcalc_rate,payment_term) {
    showMortgageCalculator(root+"&operation=calc_payment_ext&price="+price+"&down="+down+"&rate="+mbcalc_rate+"&years="+payment_term);
  }

  function showMortgageCalculatorDefault(mbcalc_rate,payment_term) {
    showMortgageCalculatorWithPrice("","10",mbcalc_rate,payment_term);
  }
  function showMortgageCalculatorDefaultWithRoot(root,mbcalc_rate,payment_term){
    showMortgageCalculator(root+"/MBCalc?operation=calc_payment_ext&price=&down=10&rate="+mbcalc_rate+"&years="+payment_term);
  }

  function goMortgageCalculatorWithPriceAndRoot(root,price,down,mbcalc_rate,payment_term) {
    document.location.href = root+"/MBCalc?operation=calc_payment_ext&price="+price+"&down="+down+"&rate="+mbcalc_rate+"&years="+payment_term;
  }

  function showOrderServiceScreen(service){
    window.opener.location.href="/MyAccount?operation=service_upgrade&service="+service;
    window.close();
  }

