$('div#pr_archive').click(togglePR);
$('div#pr2_archive').click(togglePR);

function togglePR() {

    thisId = $(this).attr('id');
    thisClass = $(this).attr('class');
    //alert(thisId + ' ; ' + thisClass)
    
    if(thisClass == 'pr_archive_closed') {
        $(this).attr('class','pr_archive_open');
        $('#' + thisId + '_div:hidden').slideDown(300);
    
    } else if(thisClass == 'pr_archive_open') {
        $(this).attr('class','pr_archive_closed');
        $('#' + thisId + '_div:visible').slideUp(300);
        
    }

}

function mapGetLoc(st,stat) {
  $('div#dialog-loc:ui-dialog').dialog('destroy');

  var dlg = $('div#dialog-loc').html('<iframe id="dlg-frame" name="dlg-frame" scrolling="yes" frameBorder="0"'+
    'style="height:440px; width:310px; border:none; outline:none; margin:none; padding:none;"'+
    '></iframe>');

  dlg.dialog({
    modal: true,
    autoOpen: true,
    minWidth: 320,
    minHeight: 480,
    maxWidth: 320,
    maxHeight: 480,
    draggable: false,
    position: ['center',20],
    resizable: false,
    title: st+' Licensed Agents:'
  });

  $('div#dialog-loc>iframe#dlg-frame').attr('src', 'mapGetLoc.aspx?st='+st+'&stat='+stat);
}

$(function() {
  // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore!
  //$( "div#dialog-paysel" ).dialog( "destroy" );

  $( "div#dialog-paysel" ).dialog({
    modal: true,
    autoOpen: false,
    minWidth: 400,
    minHeight: 200,
    maxWidth: 500,
    maxHeight: 300,
    draggable: false,
    position: ['center',180],
    resizable: false
  });
});
