/*
 * $Author: dbibbens $
 * $Revision: 1.1 $
 * $Date: 2008/01/31 06:21:25 $ 
 * $Source: /home/cvs/unitedhomeinsurance.com/local/lib/functions.js,v $
 */

var selected = false;

function change_state(aid, subid)
{
  var select = document.getElementById('state');
  var zipcode = document.getElementById('zipcode');
  
  if(select) {
    var state = select.options[select.selectedIndex].value;
    if(subid && subid != '') {
      document.location = 'results.xsl?state=' + state + '&aid=' + aid + '&subid=' + subid;
    } else {
      document.location = 'results.xsl?state=' + state + '&aid=' + aid;
    } 
  }

  if(zipcode) {
    document.location = 'results.xsl?zipcode=' + zipcode.value + '&aid=' + aid;
  }
}

function adj_change_state(select, aid) 
{
  var state = select.options[select.selectedIndex].value;
  if(state) {
    window.moveTo(0,0);
    window.resizeTo(screen.width,screen.height);
    document.location = 'results.xsl?state=' + state + '&aid=' + aid;
  }
}

function openWin(url, width, height) 
{
  var features = "toolbar=yes,location=yes,directories=no,status=yes," + 
    "menubar=yes,marginwidth=0,marginheight=0,resizable=yes,scrollbars=" +
    "yes,width=" + width + ",height=" + height;
  
  if(!selected) {
    popup_win(url, 'results', features);
  }
}

function popup_win(url, name, features) 
{
  window.open(url, name, 'screenX=0,screenY=0,left=0top=0,' + 
			  features);
}

