function locateVineyard(v,sp){
  var q="locateVineyard";
  if(sp){q="locateSponsor"};
  var map=window.frames['vineyardmap'];
  map.positionLoadingLyr();
  map.location.replace("../maps/default.asp?appid={E28401E7-A319-4594-AC35-5B06720E7B56}&windowWidth=430&windowHeight=495&mapfunction1=40&queryName1="+q+"&queryValue1="+escape(v)+"&mapfunction2=101&mapscale2=10"+escape("%"));
}
function locateWinery(v){
  var map=window.frames['winerymap'];
  map.positionLoadingLyr();
  map.location.replace("../maps/default.asp?appid={DF86F0B7-33BB-474B-8D88-08FC3E734974}&windowWidth=430&windowHeight=495&mapfunction1=40&queryName1=locateWinery&queryValue1="+escape(v)+"&mapfunction2=101&mapscale2=10"+escape("%"));
}
function getMapImage(f){
  var map=window.frames[f],img=MM_findObj('mapimg'),leg=MM_findObj('legimg');
  img.src=map.getImage();
  if(leg!=null)leg.src='../images/legend.gif';
}
function showlegend(s){
  if(s=='soils')popUpWindow('../maps/soils_legend.htm',200,170,'soils_legend','no','center','no');
  if(s=='geology')popUpWindow('../maps/geology_legend.htm',360,260,'geology_legend','no','center','no');
}
function popUpWindow(target,w,h,windowName,scroll,pos,resize){
  if(popUpWindow.arguments.length>1){
    if(w<=0){w=550};if(h<=0){h=400};
  }else{
    w=550;h=400;
  };
  if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
  if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
  }else{if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}}
  if(scroll==null){scroll='yes'};
  if(resize==null){resize='no'};
  if(windowName==''){windowName='mpt_popup'};
  settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable='+resize;
  newWin=window.open(target,windowName,settings);
  if(!newWin.opener){newWin.opener=self};
  newWin.focus();
}
