
function Opshun(key,magic_string,text)
{
  this.key = key ;
  this.magic_string = magic_string ;
  this.text = text ;
}

function Opshun1(key,magic_string,text)
{
  this.key = key ;
  this.magic_string = "type1=all" + magic_string ;
  this.text = text ;
}

function submit_form( form,query_start,query_length,options,neighborhoods )
{
  form = get_form_and_process_option( form,form.option.selectedIndex,options ) ;
  
  form = get_form_and_adjust_sort( form, form.type.value ) ;
  
  form = get_form_and_process_query(form,form.query.value,query_start,query_length) ;
  
  form = get_form_and_update_action( form,form.option.selectedIndex,options,neighborhoods ) ;
  
  form = get_form_and_finalize( form )
  // form.submit() ;
  top.location.href = form.action ;
 
}

function submit_form_all( form,query_start,query_length,options,neighborhoods )
{
  form = get_form_and_process_option( form,form.option.selectedIndex,options ) ;
  
  form = get_form_and_adjust_sort( form, form.type.value ) ;
  
  form = get_form_and_process_query(form,form.query.value,query_start,query_length) ;
  
  form = get_form_and_update_action( form,form.option.selectedIndex,options,neighborhoods ) ;
  
  form = get_form_and_finalize( form )
  // form.submit() ;
  
  top.location.href = form.action + "&sele=all" ;
  
}


function get_form_and_finalize( form )
{
  form.category.value = '' ;
  form.query.value = '' ;
  form.sort.value  = '' ;
  return form ;
}

function get_form( index,name )
{
  var form ;
  if ( (typeof document.layers != "undefined") && document.layers.length>0 )
	form = eval("document.layers["+index+"].document.forms."+name) ;
  else
    form = eval("document.forms."+name) ;

  return form ;
}



//=================================================

	function setCookie(name, value, expire)
 	{ 
        document.cookie = name + "=" + escape(value)  + ((expire == null) ? "" : ("; expires=" +expire.toGMTString()))
	}


	function getCookie(Name) 
	{ 
        var search = Name + "="          
		if (document.cookie.length > 0) 
		{ // if there are any cookies                    
			offset = document.cookie.indexOf(search)                     
			if (offset != -1) { // if cookie exists                               
				offset += search.length                               
				// set index of beginning of value                              
				end = document.cookie.indexOf(";", offset)                               
				// set index of end of cookie value                              
				if (end == -1)                                         
				end = document.cookie.length                              
				return unescape(document.cookie.substring(offset, end))                    
			}           
		}
	}
	
	function register(name) 
	{
	 var today = new Date()          
	var expires = new Date()          
	expires.setTime(today.getTime() + 60*60*24*50)        
	setCookie("page", name, expires)
	}

	
//=================================================

function get_form_and_update_action( form,index,options,neighborhoods )
{
  var action = form.action ;
  var option = options[index].key ;
  var neighborhood = ( form.neighborhood.type != "hidden" ) ? neighborhoods[form.neighborhood.selectedIndex].magic_string : "" ;
  var delimiter = "?" ;
  var parameter_ary = new Array("node","type","cw1","cw2","category","query","sort") ;
  for ( var i=0; i<parameter_ary.length; i++ )
  {
    var p = parameter_ary[i] ;
	var value = eval('form.'+p+'.value') ;
    delimiter = action.indexOf("?") == -1 ? "?" : "&" ;
    action += (value) ? delimiter+p+"=" + value : "" ;
  }
  action += ( neighborhood ) ? delimiter+"neighborhood="+neighborhood : "" ;
  // begin hack for including rdc/date parameter if it's already present
  if ( getValue("type").indexOf("event") != -1 )
    action += ( getValue("rdc") ) ? delimiter+"rdc="+getValue("rdc") : "" ;
  // end hack
  // begin hack for including query parameter if it's already present
  action += ( getValue("query") ) ? delimiter+"query="+getValue("query") : "" ;
  // end hack
  // begin hack for including category parameter if it's already present
  action += ( getValue("category") ) ? delimiter+"category="+getValue("category") : "" ;
  action += ( getValue("CATEGORY") ) ? delimiter+"category="+getValue("CATEGORY") : "" ;
    // end hack
  action += ( option ) ? delimiter+"option="+option : "" ;
  form.action = action.split(" ").join("+") ;
  return form ;
}

function get_form_and_process_option( form,index,options )
{
  var key_value_pair_list = new Array() ;
  if ( options[index].magic_string )
    key_value_pair_list = options[index].magic_string.split(";") ;
  for( var i=0; i<key_value_pair_list.length; i++ )
  {
    var key_value_pairs = new Array() ;
	key_value_pairs = key_value_pair_list[i].split("=") ;
	key   = key_value_pairs[0] ;
	value = key_value_pairs[1] ;
	eval( "form."+key+".value = '"+value+"'" ) ;
  }
  return form ;
}

function get_form_and_adjust_sort( form,type )
{
  if ( form.s.checked )
  {
    form.sort.value = 'recommended-desc' ;
    form.s.value = '' ;
  }
  return form ;
}

function get_form_and_process_query( form,query,start,length )
{
  var delimiter = " " ;
  for ( var i=start+1; i<=length+start; i++ )
  {
    if ( form.elements[i].checked )
	{
	  if ( query.indexOf( form.elements[i].value ) == -1 )
	  {
	    if ( query )
	      query += delimiter ;
	    query += form.elements[i].value ;
	  }
	  // form.elements[i].checked = false ;
	}
	else
	{
	  if ( query.indexOf( form.elements[i].value ) != -1 )
	  {
	    var q = '' ;
	    var ary = new Array( ) ;
		ary = query.split(" ") ;
	    for ( var j=0; j<ary.length; j++)
	    {
	      if ( ary[j] != form.elements[i].value )
		  {
		    if ( q )
			  q += delimiter ;
			q += ary[j] ;
		  }
	    }
		query = q ;
	  }
	}
	// form.elements[i].value = "" ;
  }
  form.elements[start].value = query ;
  return form ;
}

function check_for_invalid_option( selected )
{
  if ( selected[selected.selectedIndex].value == "-" )
  {
    selected.selectedIndex = rememberNeighborhoodIndex ;
    alert('You selected an invalid option.') ;
  }
  rememberNeighborhoodIndex = selected.selectedIndex ;
}

function getValue(name)
{
  var re = new RegExp("[&\?]"+name+"=([^&]+)&?","g") ;
  if (location.search.match(re)) return RegExp.$1 ;
  else return "" ;
}

function getCategoryPulldown1( option,ary,fontsize)
{

  var output = "" ;
  output += ('<select name="option" style="width:162px"') ;
  if(arguments[2] != null)
  {
  output += 'style="font-size:'+fontsize+'"';
  }
  output +=')>';
  for ( var i=0; i<ary.length; i++ )
  {
    var key = ary[i].key ;
    var magic_string = ary[i].magic_string ;
    var text = ary[i].text ;
    var selected = ( option == key ) ? "selected" : "" ;

    output += ('<option value="'+key+'" '+selected+'>'+text) ;
  }
  output += ('</select>') ;
  return output ;
  
}

function getCategoryPulldown( option,ary,fontsize,widthsize)
{

  var output = "" ;
 
  if(arguments[3] != null)
  {
  output += ('<select name="option" style="width:'+widthsize+'px"') ;
  }
  else
  {
    output += ('<select name="option" style="width:162px"') ;
  }

  if(arguments[2] != null)
  {
  output += 'style="font-size:'+fontsize+'"';
  }
  output +=')>';
  for ( var i=0; i<ary.length; i++ )
  {
    var key = ary[i].key ;
    var magic_string = ary[i].magic_string ;
    var text = ary[i].text ;
    var selected = ( option == key ) ? "selected" : "" ;

    output += ('<option value="'+key+'" '+selected+'>'+text) ;
  }
  output += ('</select>') ;
  return output ;
  
}

function getNeighborhoodPulldown( option,ary,fontsize,widthsize )
{
  var output = "" ;
  
  if(arguments[3] != null)
  {
  output += ('<select name="neighborhood" style="width:'+widthsize+'px" onchange="check_for_invalid_option(this)" ') ;
  }
  else
  {
  output += ('<select name="neighborhood" style="width:162px" onchange="check_for_invalid_option(this)" ') ;
  }

  if(arguments[2] != null)
  {
  output += 'style="font-size:'+fontsize+'"';
  }
  output +=')>';
  for ( var i=0; i<ary.length; i++ )
  {
    var key = ary[i].key ;
    var magic_string = ary[i].magic_string ;
    var text = ary[i].text ;
    var selected = ( option == magic_string ) ? "selected" : "" ;

    output += ('<option value="'+magic_string+'" '+selected+'>'+text) ;
  }
  output += ('</select>') ;

  return output ;
}

function getNeighborhoodPulldown1( option,ary,fontsize )
{
  var output = "" ;
	
  output += ('<select name="neighborhood" style="width:162px" onchange="check_for_invalid_option(this)" ') ;
   if(arguments[2] != null)
  {
  output += 'style="font-size:'+fontsize+'"';
  }
  output +=')>';
  for ( var i=0; i<ary.length; i++ )
  {
    var key = ary[i].key ;
    var magic_string = ary[i].magic_string ;
    var text = ary[i].text ;
    var selected = ( option == magic_string ) ? "selected" : "" ;

    output += ('<option value="'+magic_string+'" '+selected+'>'+text) ;
  }
  output += ('</select>') ;

  return output ;
}

/*
function getCheckBoxes( ary )
{
  var output = ""
  for ( var i=0; i<ary.length; i++ )
  {
    var key = ary[i].key ;
    var magic_string = ary[i].magic_string ;
    var text = ary[i].text ;
    var checked = "" ;
	if ( magic_string == "s" )
	{
	  if ( getValue("sort") == "recommended-desc" )
	    checked = "checked"
	}
	else
	{
	  var q = unescape( getValue("query") ) ;
	  if ( q == key || (q.indexOf(key+"+") != -1) || (q.indexOf("+"+key) != -1) )
	    checked = "checked" ;
	}
    if ( magic_string == "q1" )
      output += ('<input type="hidden" name="query" value="">') ;
	output += ('<input type="checkbox" name="'+magic_string+'" value="'+key+'" '+checked+'>'+text+'\n') ;
  }

  return output ;
}
*/

function getCheckBoxes( checkboxes,boxes_per_row,width)
{
  var output = '' ;

  if ( typeof boxes_per_row == "undefined" )
    var boxes_per_row = checkboxes.length ;

  if ( typeof width == "undefined" )
    var width = 75 ;
  
  var first = true ;
  var count = Math.floor(checkboxes.length/boxes_per_row) ;
  var therest = checkboxes.length%boxes_per_row ;
  var width_of_cell = Math.floor( (width-75)/boxes_per_row ) ;
  if ( width_of_cell == 0 ) width = 0 ;

  if ( therest != 0 )
    count++ ;

  if ( width )
    output += '<table width="'+width+'" border="0" cellpadding="0" cellspacing="0" bgcolor="#E7EEF6">' ;
  for ( var i=0; i<count; i++ )
  {
    if ( width )
      output += '<tr>' ;
    if ( first )
	{
	  if ( width )
        output += '<td rowspan="'+count+'" valign="top" width="75">' ;
	  if ( width )
        output += '</td>' ;
    }

	if ( therest == 0 || ( therest != 0 && i<count-1 ) )
	{
	  for ( var j=0; j<boxes_per_row; j++ )
	  {
	    output += getCBXCells( checkboxes[(boxes_per_row*i)+j],width_of_cell ) ;
	  }
	}
	else
	{
	  for ( var m=0; m<therest; m++ )
	  {
	    output += getCBXCells( checkboxes[(boxes_per_row*i)+m],width_of_cell ) ;
	  }
	  for ( var n=0; n<boxes_per_row-therest; n++ )
	  {
	    if ( width )
		  output += '<td width="'+width_of_cell+'">' ;
		output += '<FONT face="arial,sans-serif" size="-2">&nbsp;</font>' ;
		if ( width )
		  output += '</td>' ;
	  }
	}
	if ( width )
      output += '</tr>' ;

	first = false ;
  }
  
  if ( width )
    output += '</table>' ;

  return output ;
}

function getCBXCells( option, width_of_cell )
{
  var output = '' ;

  var key = option.key ;
  var magic_string = option.magic_string ;
  var text = option.text ;
  var text = text.split(" ").join("&nbsp;") ;
  if ( !width_of_cell )
    text += "&nbsp;&nbsp;"

  var checked = "" ;
  if ( magic_string == "s" )
  {
    if ( getValue("sort") == "recommended-desc" )
    checked = "checked"
  }
  else
  {
    var q = unescape( getValue("query") ) ;
    if ( q == key || (q.indexOf(key+"+") != -1) || (q.indexOf("+"+key) != -1) )
      checked = "checked" ;
  }

  if ( width_of_cell )
    output += '<td width="'+width_of_cell+'" valign="top">' ;
  output += '<FONT face="arial,sans-serif" size="-2">' ;

  if ( magic_string == "q1" )
    output += ('<input type="hidden" name="query" value="">') ;
  output += ('<input type="checkbox" name="'+magic_string+'" value="'+key+'" '+checked+'>'+text+'\n') ;  
  if ( width_of_cell )
    output += '</td>' ;

  return output ;
}

function setWindowName()
{
  window.name = "washpostwx";
  return true ;
}

function setDefaultSearchString( text,str )
{
  if (text.value=='')
    text.value=str ;
}

function setBlankSearchString( text,str )
{
  if (text.value==str)
    text.value='' ;
}

function getRDCValue(dateAsString)
{
  MILLISECONDS_IN_24_HOURS = 86400000; //24*60*60*1000

  iStartDate = Math.floor( (new Date("01/01/1970")).getTime() / MILLISECONDS_IN_24_HOURS ) ;
  iEndDate   = Math.floor( (new Date(dateAsString)).getTime() / MILLISECONDS_IN_24_HOURS ) ;

  result = baseConverter(iEndDate-iStartDate+"",10,36) ;
  return result ;
}

function baseConverter (number,ob,nb)
{
  // Created 1997 by Brian Risk.  http://members.aol.com/brianrisk
  number = number.toUpperCase();
  var list = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var dec = 0;
  for (var i = 0; i <=  number.length; i++)
  {
    dec += (list.indexOf(number.charAt(i))) * (Math.pow(ob , (number.length - i - 1)));
  }
  number = "";
  var magnitude = Math.floor((Math.log(dec))/(Math.log(nb)));
  for (var i = magnitude; i >= 0; i--)
  {
    var amount = Math.floor(dec/Math.pow(nb,i));
    number = number + list.charAt(amount); 
    dec -= amount*(Math.pow(nb,i));
  }
  return (number+"").toLowerCase() ;
}

function makeRemote()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calendar.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
}   

function makeRemoteMuseums()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calen-mus.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
}  

function makeRemoteTheater()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calen-the.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
}  

function makeRemoteMusic()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calen-music.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
} 

function makeRemoteBooks()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calen-books.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
} 

function makeRemoteBars()
{
  var remote = window.open("","remotewin","width=216,height=212,screenX=10,screenY=10") ;
  remote.location.href = "http://www.washingtonpost.com/wp-srv/artsandliving/coretool/refine/calen-bars.htm" ;
  if (remote.opener == null) remote.opener = window ;
    remote.opener.name = "opener" ;
  remote.focus();
} 

function getCalendar(begin,duration,type,color,misc,bottom)
{
  var output = '' ;
  if ( typeof type == "undefined" || type == null || type == "" )
    type = "allevent" ;

  if ( typeof color == "undefined" || color == null || color == "" )
    color = "66758A" ;

  if ( typeof use_text == "undefined" || use_text == null || use_text == "" )
    use_text = false ;

  if ( typeof misc == "undefined" || misc == null || misc == "" )
    misc = "" ;

  if ( typeof bottom == "undefined" || bottom == null || bottom == "" )
    bottom = "" ;


  var days = new Array("Su","Mo","Tu","We","Th","Fr","Sa") ;
  var full_days = new Array("sunday","monday","tuesday","wednesday","thursday","friday","saturday") ;
  var start = new Date() ;
  var day = 1*24*60*60*1000 ;
 
  var output = '<table cellpadding="0" cellspacing="0" style="border: 1px solid #BAAA22" ><tr>';
 
  for (var i=begin; i<duration; i++)
  {
    var ms = start.getTime()+i*day ;
    var now = new Date( ms ) ;
	if ( i == 0 )
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;
	else
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;

	var search_url = "/ac2/wp-dyn?node=entertainment/search&type="+type+"&sort=name" ;
	var date  = ( now.getDate() < 10 ) ? "0"+now.getDate() : now.getDate() ;
	var month = ( now.getMonth()+1 < 10 ) ? "0"+(now.getMonth()+1) : now.getMonth()+1 ;
	var year  = now.getFullYear() ;
	var rdc = getRDCValue(month+"/"+date+"/"+year) ;

	var query = "" ;
	if ( misc == "barsandclubs" )
      query = "&option=1065&query=bar/club+event+"+full_days[now.getDay()] ;
	else
      search_url += "&rdc="+rdc ;

    /*
    if ( type.indexOf("event") != -1 )
	{
	  var cw1 = getValue("cw1") ;
	  search_url += ( cw1 ) ? "&cw1="+cw1 : "" ;
	  var cw2 = getValue("cw2") ;
	  search_url += ( cw2 ) ? "&cw2="+cw2 : "" ;
	  var option = getValue("option") ;
	  search_url += ( option ) ? "&option="+option : "" ;
	  var neighborhood = getValue("neighborhood") ;
	  search_url += ( neighborhood ) ? "&neighborhood="+neighborhood : "" ;

	  var query_from_url = getValue("query") ;
	  if ( query )
	    query += " "+query_from_url ;
	  else
	    search_url += ( query_from_url ) ? "&query="+query_from_url : "" ;
	}
	*/

    search_url += query ;
	
	  if ( bottom == "museums" )
      {
	  search_url = search_url +  '&option=6060' ;
      }
	
	if ( i == 0 )
	{
	output += '<td bgcolor = "#455588" align = "center" >';
    output += '<DIV  style="width: 22px; height:25px; font:normal 10px Verdana; color:#FFFFFF; font-weight:bold; border: solid 0 #BAAA22;  border-left-width:1px ;">' ;
	output += '<a href="'+search_url+'" style="text-decoration:none" target="_top">' ;
	output += '<font color = "#FFFFFF">' + text +'</font>' ;
	output += '</a>' ;
	output += '</div>' ;
	output += '</td>';
	}
	else
	{
	

	output += '<td align = "center" >';
    output += '<DIV  style="width: 22px; height:25px; font:normal 10px Verdana; color:#3333cc; font-weight:bold; border: solid 0 #BAAA22;  border-left-width:1px ;">' ;
    output += '<a href="'+search_url+'" style="text-decoration:none" target="_top">' ;
	output += '<font color = "#455588">' + text +'</font>' ;
	output += '</a>';
	output += '</div>';
	output += '</td>';
	}
  }

  output += '</tr></table>' ;
  

      if ( bottom == "" )
      output += '<div style="clear:both; width:153px; text-align:right; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemote()"><font color = "#455588">More Dates</font></a></div></span>'
      
      if ( bottom == "theater" )
      {
	  output += '<div style="clear:both; width:153px; text-align:left; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemoteTheater()"><font color = "#455588">More Dates</font></a></div></span>'
	  output += '<div style="clear:both; width:153px; text-align:left; padding-top:0px; padding-bottom:8px;font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="http://www.washingtonpost.com/wp-dyn/content/article/2005/04/26/AR2005042600451.html" target = "_top"><font color = "#455588">Ticketplace Discounts</font></a></div></span>'
      }

	  if ( bottom == "music" )
      {
	  output += '<div style="clear:both; width:153px; text-align:left; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemoteMusic()"><font color = "#455588">More Dates</font></a></div></span>'
	  output += '<div style="clear:both; width:153px; text-align:left; padding-top:0px; padding-bottom:8px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="/ac2/wp-dyn?node=entertainment/search&type=musiclocation&sort=name&option=15" target = "_top"><font color = "#455588">Top Music Venues</font></a></div></span>'
      }
	  
	  if ( bottom == "museums" )
      {
	  output += '<div style="clear:both; width:153px; text-align:right; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemoteMuseums()"><font color = "#455588">More Dates</font></a></div></span>'
	  }
	  
	  if ( bottom == "books" )
      {
	  output += '<div style="clear:both; width:153px; text-align:right; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemoteBooks()"><font color = "#455588">More Dates</font></a></div></span>'
	  }
	  
	  if ( bottom == "bars" )
      {
	  output += '<div style="clear:both; width:153px; text-align:right; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemoteBars()"><font color = "#455588">More Dates</font></a></div></span>'
	  }
	  
  return output ;
}


function getCalendar1(begin,duration,type,color,misc)
{
  var output = '' ;
  if ( typeof type == "undefined" || type == null || type == "" )
    type = "allevent" ;

  if ( typeof color == "undefined" || color == null || color == "" )
    color = "66758A" ;

  if ( typeof use_text == "undefined" || use_text == null || use_text == "" )
    use_text = false ;

  if ( typeof misc == "undefined" || misc == null || misc == "" )
    misc = "" ;

  var days = new Array("Su","Mo","Tu","We","Th","Fr","Sa") ;
  var full_days = new Array("sunday","monday","tuesday","wednesday","thursday","friday","saturday") ;
  var start = new Date() ;
  var day = 1*24*60*60*1000 ;
 
  var output = '<table cellpadding="0" cellspacing="0" style="border: 1px solid #BAAA22" ><tr>';
 
  for (var i=begin; i<duration; i++)
  {
    var ms = start.getTime()+i*day ;
    var now = new Date( ms ) ;
	if ( i == 0 )
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;
	else
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;

	var search_url = "http://www.washingtonpost.com/ac2/wp-dyn?node=entertainment/search&type="+type+"&sort=name" ;
	var date  = ( now.getDate() < 10 ) ? "0"+now.getDate() : now.getDate() ;
	var month = ( now.getMonth()+1 < 10 ) ? "0"+(now.getMonth()+1) : now.getMonth()+1 ;
	var year  = now.getFullYear() ;
	var rdc = getRDCValue(month+"/"+date+"/"+year) ;

	var query = "" ;
	if ( misc == "barsandclubs" )
      query = "&query=bar/club+event+"+full_days[now.getDay()] ;
	else
      search_url += "&rdc="+rdc ;

    /*
    if ( type.indexOf("event") != -1 )
	{
	  var cw1 = getValue("cw1") ;
	  search_url += ( cw1 ) ? "&cw1="+cw1 : "" ;
	  var cw2 = getValue("cw2") ;
	  search_url += ( cw2 ) ? "&cw2="+cw2 : "" ;
	  var option = getValue("option") ;
	  search_url += ( option ) ? "&option="+option : "" ;
	  var neighborhood = getValue("neighborhood") ;
	  search_url += ( neighborhood ) ? "&neighborhood="+neighborhood : "" ;

	  var query_from_url = getValue("query") ;
	  if ( query )
	    query += " "+query_from_url ;
	  else
	    search_url += ( query_from_url ) ? "&query="+query_from_url : "" ;
	}
	*/

    search_url += query ;
	if ( i == 0 )
	{
	output += '<td bgcolor = "#455588" align = "center" >';
    output += '<DIV  style="width: 22px; height:25px; font:normal 10px Verdana; color:#FFFFFF; font-weight:bold; border: solid 0 #BAAA22;  border-left-width:1px ;">' ;
	output += '<a href="'+search_url+'" style="text-decoration:none" target="_top">' ;
	output += '<font color = "#FFFFFF">' + text +'</font>' ;
	output += '</a>' ;
	output += '</div>' ;
	output += '</td>';
	}
	else
	{
	

	output += '<td align = "center" >';
    output += '<DIV  style="width: 22px; height:25px; font:normal 10px Verdana; color:#3333cc; font-weight:bold; border: solid 0 #BAAA22;  border-left-width:1px ;">' ;
	output += '<font color = "#455588">' + text +'</font>' ;
	output += '</a>';
	output += '</div>';
	output += '</td>';
	}
  }

  output += '</tr></table>' ;
  
  output += '<div style="clear:both; width:158px; text-align:right; padding-top:5px; font-weight:normal; "><span class="hidethis"><span style="color:#455588; font:normal 11px Arial;">&#149;</span> <a href="javascript:makeRemote()"><font color = "#455588">More Dates</font></a></div></span>'
  return output ;
}

function getCalendar2(begin,duration,type,color,misc)
{
  var output = '' ;
  if ( typeof type == "undefined" || type == null || type == "" )
    type = "allevent" ;

  if ( typeof color == "undefined" || color == null || color == "" )
    color = "66758A" ;

  if ( typeof use_text == "undefined" || use_text == null || use_text == "" )
    use_text = false ;

  if ( typeof misc == "undefined" || misc == null || misc == "" )
    misc = "" ;

  var days = new Array("Su","Mo","Tu","We","Th","Fr","Sa") ;
  var full_days = new Array("sunday","monday","tuesday","wednesday","thursday","friday","saturday") ;
  var start = new Date() ;
  var day = 1*24*60*60*1000 ;
  
  for (var i=begin; i<duration; i++)
  {
    var ms = start.getTime()+i*day ;
    var now = new Date( ms ) ;
	if ( i == 0 )
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;
	else
	  var text = days[now.getDay()]+'<br>'+now.getDate() ;

	var search_url = "http://www.washingtonpost.com/ac2/wp-dyn?node=entertainment/search&type="+type+"&sort=name" ;
	var date  = ( now.getDate() < 10 ) ? "0"+now.getDate() : now.getDate() ;
	var month = ( now.getMonth()+1 < 10 ) ? "0"+(now.getMonth()+1) : now.getMonth()+1 ;
	var year  = now.getFullYear() ;
	var rdc = getRDCValue(month+"/"+date+"/"+year) ;

	var query = "" ;
	if ( misc == "barsandclubs" )
      query = "&query=bar/club+event+"+full_days[now.getDay()] ;
	else
      search_url += "&rdc="+rdc ;
    search_url += query ;

	output += '<div id="dates" style="float:left; width:26px; border-right:1px solid #88889d; text-align:center;;">' ;
	output += '<a href="'+search_url+'" target="_top">' ;
	output += text ;
	output += '</a></div>';
  }

  output += '<div style="float:left; width:2px; font-size:0; height:25px; background:#ecf1f8; margin-left:-1px;"></div>'
  return output ;
}
