#!/usr/local/bin/perl 

# CPAN Modules Used

use CGI::Cookie;
use CGI qw(:standard );
use Time::ParseDate ;
use Time::CTime ;



# initialize variables

####
# Author Information
$author_name = param('author_name') || "" ;	
$author_email = param('author_email') || "" ;	
# if ( $author_email eq 'nobody@undesign.org' ) { $nobody = "true" ; }
$author_url = param('author_url') || "" ;


	%cookies = fetch CGI::Cookie;
	@jar = (exists($cookies{'user'})) ? $cookies{'user'}->value : ();
	if ($jar[0] ne "" && $author_name eq "" ) { $author_name = $jar[0] ; }
	if ($jar[1] ne "" && $author_email eq "" ) { $author_email = $jar[1] ; }
	if ($jar[2] ne "" && $author_url eq "" ) { $author_url = $jar[2] ; }
	if ($jar[3] ne "" && $password eq "" )  { $password = $jar[3] ; }

if (exists($cookies{'user'})) {
$personal_directory = <<"_____EoI2_____";
        <a href="kalman.cgi" onMouseOver="swapON('viewmine');" onMouseOut='swapOFF("viewmine");'>
        <img src="/images/orbit/buttons/viewmine.gif" border="0" name="viewmine"></a>
_____EoI2_____
        }

	$author_safe_email = $author_email ;
	$author_safe_email =~ s/\^\&\|\<\>/./g ;

# search parameters
$search_string = param('search_string') || "" ;	
$date_human_start = param('date_human_start') || "" ;	
$author_page = param('author_page') || "" ;	
$search_combine = param('search_combine') || "or" ;
if ( $search_combine eq "and" ) { $and_checked = "checked" ; } else { $or_checked = "checked" ; }

# if not a search, based on a date range
$date_start = param('date_start') || "" ;	

# build the date window
$show_date_win = param('show_date_win') || "" ;	
$offset_in_date = param('offset_in_date') || "0" ;	
$dates_per_column = 7 ;
$dates_per_page = 20 ;


$offset_in_holding = param('offset_in_holding') || "0" ;	
# remember: offset 0
$max_images = 5 ;

	open (DIR_FILE, "fgrep -l PUBLISHED_true ./MyOrbit/*/*info | ") ;
	@published_list = grep(!/^.*MyOrbit\/deleted.*$/, <DIR_FILE>) ;
	chop @published_list;
	&sort_by_date ;
	close DIR_FILE ;

	&read_info_files ;

	if ( $search_string eq "" && $date_human_start eq "" && $author_page eq "" ) 
		{ $noparams = "true" ; } else { $noparams = "false" ; }
	if ( $date_start eq "" && $noparams eq "true" ) { $date_start = $info_creation[0] ; }
		
	&read_author_files ;

	&build_holding_array ;
	if ( $show_date_win eq "true" ) {
		&print_date_win ;
	} else {
		&print_screen ;
	}

exit(0);

sub build_holding_array {

if ( $search_string ne "" ) {
	for ($i=0; $i <= $#info_search_string ; $i++)
	{
	if ( (grep(/$search_string/i,$info_search_string[$i])) > 0 ) { push(@search_holding,$i) ; }
	}
}
if ( $author_page ne "" ) {
	while (($key,$value) = each %author_to_name) {
		if ( grep(/$author_page/i,$value) > 0 ) { push(@temp_email_holding,$key) ; }
	}
	for ($i=0; $i <= $#info_author; $i++) {
		if ( (grep(/$info_author[$i]/,@temp_email_holding) > 0) ) { push(@email_holding,$i) ; }
	}
} 
if ( $date_human_start ne "" )
{
	%options = ( 'PREFER_PAST', '1', 'FUZZY', '1' ) ;
	# sigh: convert date input to seconds, then make sure it is only a day
	$the_date = parsedate(strftime("%D",localtime(parsedate($date_human_start,%options))));
	for ($i=0; $i <= $#info_creation ; $i++)
	{
#	push (@temp_readable_date, strftime("%D",localtime($info_creation[$i]))) ;
	if ( $the_date eq (parsedate(strftime("%D",localtime($info_creation[$i])))) ) 
		{ push(@date_holding,$i) ; }

	}

}

# do intersection or union of the three arrays
# combine search_holding, email_holding, date_holding
# date_human_start, search_page, author_page

if ( $search_combine eq "and" && $noparams eq "false" ) {
	if ( $author_page ne "" && $search_string eq "" && $date_human_start eq "" ) {
		push(@holding,@email_holding) ;
	} elsif ( $author_page eq "" && $search_string ne "" && $date_human_start eq "" ) {
		push(@holding,@search_holding) ;
	} elsif ( $author_page eq "" && $search_string eq "" && $date_human_start ne "" ) {
		push(@holding,@date_holding) ;
	} elsif ( $author_page ne "" && $search_string ne "" && $date_human_start eq "" ) {
		# combine email and search
		local(%MARK1);
		grep($MARK1{$_}++,@search_holding);
		@holding = grep($MARK1{$_},@email_holding);
	} elsif ( $author_page ne "" && $search_string eq "" && $date_human_start ne "" ) {
		# combine author and date
		local(%MARK1);
		grep($MARK1{$_}++,@date_holding);
		@holding = grep($MARK1{$_},@email_holding);
	} elsif ( $author_page eq "" && $search_string ne "" && $date_human_start ne "" ) {
		# combine search and date
		local(%MARK1);
		grep($MARK1{$_}++,@date_holding);
		@holding = grep($MARK1{$_},@search_holding);
	} elsif ( $author_page ne "" && $search_string ne "" && $date_human_start ne "" ) {
		# combine search and date
		local(%MARK1);
		grep($MARK1{$_}++,@date_holding);
		@date_and_search = grep($MARK1{$_},@search_holding);
		local(%MARK2);
		grep($MARK2{$_}++,@email_holding);
		@holding= grep($MARK2{$_},@date_and_search);
	}



} elsif ( $search_combine eq "or" && $noparams eq "false" ) {
	push (@temp_holding,@search_holding);
	push (@temp_holding,@email_holding);
	push (@temp_holding,@date_holding);
	@holding = grep { not $found{$_}++ } @temp_holding;
	@holding = sort sort_forward_bynumber @holding ;
}

if ( $date_start ne "" )
	{
	# sigh: convert date input to seconds, then make sure it is only a day
	$the_date = parsedate(strftime("%D",localtime($date_start)));
	for ($i=0; $i <= $#info_creation ; $i++)
	{
		$temp_date = parsedate(strftime("%D",localtime($info_creation[$i]))) ;
		if ( $the_date eq $temp_date )
		{ 
			push(@holding,$i) ; push(@temp_other_date,$temp_date) ; 
		} else { 
			push(@temp_other_date,$temp_date) ; 
		}
	}
	@other_date= grep { not $found{$_}++ } @temp_other_date;
	@other_date= sort sort_bynumber @other_date;



	}
}
sub sort_bynumber { $b <=> $a ; }
sub sort_forward_bynumber { $a <=> $b ; }
sub read_author_files {

	@unique_author = grep { not $found{$_}++ } @info_author ;

	for ($i = 0 ; $i <= $#unique_author ; $i++ )
	{
		$temp_file = "./MyOrbit/" . $unique_author[$i] . "/.author_info" ;
		open (TEMP_FILE, "$temp_file") ;
		while (<TEMP_FILE>)
		{
		if ( /^author_name:/  ) { $author_to_name{$unique_author[$i]} = $_ ;
					  $author_to_name{$unique_author[$i]} =~ s/^author_name:// ; 
					  chop $author_to_name{$unique_author[$i]} ;

		}
		if ( /^author_url:/  ) {  $author_to_url{$unique_author[$i]} = $_ ;
					  $author_to_url{$unique_author[$i]} =~ s/^author_url:// ; 
					  $author_to_url{$unique_author[$i]} =~ s/\n// ; }
					 # chop $author_to_url{$unique_author[$i]} ;
		}
		close TEMP_FILE ;
	}
}
sub encode {
        local($variable) = $_[0];
        $KeepUnencoded = 'a-zA-Z 0-9_\\-@.=' ;
    $variable=~s/([^$KeepUnencoded])/sprintf("%%%02X",ord($1))/ego;
    $variable=~s/ /+/gm;
    return $variable
}
sub sort_function { $KEYS[$b] <=> $KEYS[$a] ; }
sub sort_by_date {
	local(@KEYS);
	foreach (@published_list) {
		$temp_key = $_ ;
		$temp_key =~ s/^\.\/([^\/]+)\/([^\/]+)\/([^\/]+)/$3/ ;
		$temp_key =~ s/^.*\.([0-9]+)\.([0-9]+)\.info$/$1/ ;
		push(@KEYS, $temp_key );
	}
	@published_list = @published_list[sort sort_function $[..$#published_list];
}
sub read_info_files {
	for ($i = 0; $i <= $#published_list ; $i++ )
	{
		&read_in_info_file ;
	}

}
		

sub read_in_info_file
{
	open (TEMP, "$published_list[$i]") ;
	my(@temp_array) = <TEMP> ;
	chop @temp_array;
	$info_image_file[$i] = $temp_array[0] ;
	$info_author[$i] = $published_list[$i] ;
		$info_author[$i] =~ s/^\.\/([^\/]+)\/([^\/]+)\/([^\/]+)/$3/ ;
		$info_author[$i] =~ s/^(.*)\.([0-9]+)\.([0-9]+)\.info$/$1/ ;

	$info_creation[$i] = $published_list[$i] ;
		$info_creation[$i] =~ s/^\.\/([^\/]+)\/([^\/]+)\/([^\/]+)/$3/ ;
		$info_creation[$i] =~ s/^.*\.([0-9]+)\.([0-9]+)\.info$/$1/ ;



	$info_ad_left[$i] = $temp_array[1] ;
	$info_tag_string[$i] = $temp_array[2] ;
	$info_ad_style[$i] = $temp_array[3] ;
	$info_string[$i] = "" ;
	for ( $j = 5 ; $j <= $#temp_array; $j++ )
		{
		$info_string[$i] = $info_string[$i] . $temp_array[$j] . "\n" ;
		}
		chop $info_string[$i] ;
	$info_search_string[$i] = $info_string[$i] ;
	$info_search_string[$i] =~ s/\s+/ /g ;
	close TEMP ;
}
	

###
###	Create list of image files
sub build_image_output {

if ( ! defined(@holding) )
{
print <<"_____EoI2_____";
<tr><td>
<FONT size="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Your search yielded no results.  Please try again!  Or
<a href="tiborocity.cgi">navigate by day.</a></font>
</td></tr>
_____EoI2_____
return ;
}


	for ( $i = 0 + $offset_in_holding ; ($i <= $#holding) && ($i <= $offset_in_holding + $max_images); $i++ )
	{
print <<"_____EoI2_____";
<tr><td align="left" height="95" valign="middle"><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#666666">
Date Created: 
_____EoI2_____

print strftime("%A, %B %e, %Y: %X",localtime($info_creation[$holding[$i]]));
print '<br>' ;
if ( $author_to_url{$info_author[$holding[$i]]} ne "" )
{
print <<"_____EoI2_____";
<a href="$author_to_url{$info_author[$holding[$i]]}"><img src="./MyOrbit/$info_author[$holding[$i]]/$info_image_file[$holding[$i]]" width="468" height="60" border="0" vspace="3" alt="Image by iStock, unad by $author_to_name{$info_author[$holding[$i]]}"></a><br>Author: 
_____EoI2_____
} else {
print <<"_____EoI2_____";
<img src="./MyOrbit/$info_author[$holding[$i]]/$info_image_file[$holding[$i]]" width="468" height="60" border="0" vspace="3" alt="Image by iStock, unad by $author_to_name{$info_author[$holding[$i]]}"><br>Author: 
_____EoI2_____
}

if ( $author_to_url{$info_author[$holding[$i]]} ne "" )
	{ print '<a href="' , $author_to_url{$info_author[$holding[$i]]}, '">', $author_to_name{$info_author[$holding[$i]]}, '</a>' ; }
else 
	{ print $author_to_name{$info_author[$holding[$i]]}  ; }

print ' (<a href="tiborocity.cgi?author_page=', &encode($author_to_name{$info_author[$holding[$i]]}), '">More</a>)', "\n" ;

print <<"_____EoI2_____";
</font></td></tr>
_____EoI2_____
	}
}

sub build_clone_output {
	for ( $i = 0 + $offset_in_holding ; ($i <= $#holding) && ($i <= $offset_in_holding + $max_images); $i++ )
	{
print <<"_____EoI2_____";
<tr><td height="95" valign="middle">
<form method="POST" name="clone_$i" action="context.cgi">
<input type="hidden" name="author_name" value="$author_name">
<input type="hidden" name="author_email" value="$author_email">
<input type="hidden" name="author_url" value="$author_url">
<input type="hidden" name="ad_left" value="$info_ad_left[$holding[$i]]">
<input type="hidden" name="tag_string" value="$info_tag_string[$holding[$i]]">
<input type="hidden" name="sig_string" value="$info_string[$holding[$i]]">
<input type="hidden" name="ad_style" value="$info_ad_style[$holding[$i]]">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.clone_$i.submit();" onMouseOver="swapON(\\'clone$i\\');" onMouseOut="swapOFF(\\'clone$i\\');">' +
        '<img src="/images/orbit/buttons/clone.gif" border="0" name="clone$i"></a>')
</script>
<noscript>
<INPUT type="image" alt="Clone Unad" border="0" src="/images/orbit/buttons/clone.gif">
</noscript>
</form>
</td></tr>
_____EoI2_____
	}

}

sub build_more_navigation {

if ( $offset_in_holding > 0 )
{
        print '<td valign="top" width="60" align="right"><a href="tiborocity.cgi?' ;
        print "offset_in_holding=", $offset_in_holding - $max_images - 1 ;

        if ( $noparams eq "false" ) {
        print '&search_string=', &encode($search_string) ;
        print '&date_human_start=', &encode($date_human_start) ;
        print '&author_page=', &encode($author_page) ;
        print '&search_combine=', &encode($search_combine), '"' ;
        } else {
        print '&date_start=', $date_start, '"';
        }
        print ' onMouseOver=\'swapON("prev")\' onMouseOut=\'swapOFF("prev")\'>' ;

        print '<img border="0" src="/images/orbit/buttons/prev.gif" name="prev"></a></td>', "\n" ;
} else {
        print '<td valign="top" width="60" align="right">' ;
        print '<img border="0" src="/images/orbit/buttons/prev_null.gif"></td>', "\n" ;
}


if ( $offset_in_holding + $max_images < $#holding )
{
        print '<td valign="top"  width="60" align="left"><a href="tiborocity.cgi?' ;
        print "offset_in_holding=", $offset_in_holding + $max_images +1 ;

        if ( $noparams eq "false" ) {
        print '&search_string=', &encode($search_string) ;
        print '&date_human_start=', &encode($date_human_start) ;
        print '&author_page=', &encode($author_page) ;
        print '&search_combine=', &encode($search_combine), '"' ;
        } else {
        print '&date_start=', $date_start, '"';
        }
        print ' onMouseOver=\'swapON("next")\' onMouseOut=\'swapOFF("next")\'>' ;

        print '<img border="0" name="next" src="/images/orbit/buttons/next.gif"></a></td>', "\n" ;

} else {
        print '<td valign="top"  width="60" align="left">' ;
        print '<img border="0" src="/images/orbit/buttons/next_null.gif"></td>', "\n" ;
}

}



sub print_screen {

###
###
### Main Screen
###
print header(-type=>'text/html', -expires=>'now');
print <<"_____EoI2_____";


<HTML>
<HEAD>
<TITLE>undesign - in orbit</TITLE>
<link rel="SHORTCUT ICON" HREF="http://undesign.org/favicon.ico">
<META NAME="Author" CONTENT="media.org">
<META NAME="Keywords" CONTENT="Tibor Kalman,webchick,undesign,Kalle Lasn,adbusters,WWTD,media.org,culture jamming,social responsibility">
<META NAME="Description" CONTENT="Context is everything: Tibor Kalman inspires a plan for all seasons.">
<style type="text/css">
<!--
A:visited {COLOR: #666666; TEXT-DECORATION: underline;}
A:link {COLOR: #666666; TEXT-DECORATION: underline;}
A:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.white:visited {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:link {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.gray:visited {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:link {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:hover {COLOR: #333333; TEXT-DECORATION: underline;}
-->
</style>


<script type="text/javascript" src="/orbit/js/win.js"></script>
<script type="text/javascript" Language="JavaScript">
<!--
        var create_off = new Image() ;
        create_off.src = "/images/orbit/buttons/createnew_off.gif";
        var search_off = new Image()  ;
        search_off.src = "/images/orbit/buttons/search_off.gif" ;
        var navigatedate_off = new Image()  ;
        navigatedate_off.src = "/images/orbit/buttons/navigatedate_off.gif" ;
        var clone_off = new Image()  ;
        clone_off.src = "/images/orbit/buttons/clone_off.gif" ;
        var next_off = new Image()  ;
        next_off.src = "/images/orbit/buttons/next_off.gif" ;
        var prev_off = new Image()  ;
        prev_off.src = "/images/orbit/buttons/prev_off.gif" ;
        var viewmine_off = new Image()  ;
        viewmine_off.src = "/images/orbit/buttons/viewmine_off.gif" ;
        var dates_off = new Image()  ;
        dates_off.src = "/images/orbit/buttons/dates_off.gif" ;
function swapON (imagename)
{
        var imagename ;
        the_swap_image = eval ("document." + imagename) ;
        the_old_swap = the_swap_image.src
        if ( imagename.search(/clone/) >= 0 ) { imagename = "clone" ; }
        the_swap_image.src = eval (imagename + "_off.src") ;

}

function swapOFF (imagename)
{
        var imagename ;
        theimage = eval ("document." + imagename) ;
        theimage.src = the_old_swap  ;

}



// -->
</script>

</HEAD>

<BODY bgcolor="#cccccc" link="#999999" vlink="#999999" alink="#999999" text="#666666" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">


<TABLE width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <TR><td valign="top" height="80%">
  
<!-- BEGIN HEADER TABLE -->

<TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle" bgcolor="#ffffff">
    
<TABLE width="750" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle">
		<a href="/" title="undesign. a plan for all seasons."><img src="/images/undesign_sm.gif" width="291" height="50" hspace="20" border="0" alt="UNDESIGN | the undesigners"></a>
	</TD><td align="right" bgcolor="#ffffff">
				<img src="/trans.gif" hspace="2" vspace="0" name="tibor" width="62" height="13" border="0"><a href="/glimpses.html" title="Context is everything." onMouseOver="wwtson();" onMouseOut="wwtsoff();"><img alt="Context is everything" src="/images/orbit/tibor_sm1.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Money isn't everything." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm2.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Consumption is a treatable disease." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm3.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Good designers (and writers and artists) make trouble." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm4.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="I am in search of the simple elegant seductive and maybe even obvious IDEA..." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm5.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="...with this is my pocket I cannot fail." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm6.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Culture and design are not about fatter wallets but about creating a future." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm7.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="Wealth is poverty." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm8.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a><a href="/glimpses.html" title="As soon as you learn, move on." onMouseOver="wwtson()" onMouseOut="wwtsoff()"><img src="/images/orbit/tibor_sm9.gif" hspace="2" vspace="2" width="15" height="15" border="1"></a>
	</td><TD width="30" bgcolor="#ffffff"><img src="/trans.gif" width="30" height="1">
	</TD>
  </TR>
</table>

</TD>
</TR>
</table>


<!-- BEGIN CONTENT TABLE -->

<TABLE width="750" border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0">  
  <TR><TD colspan="12" align="left">&nbsp;</TD></TR>  
  <TR>
    
      <TD width="85"><img src="/trans.gif" width="85" height="1"></TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top">&nbsp;</TD>
      <TD></TD>
    
      <TD valign="top" width="30%">&nbsp;</TD>
      <TD></TD>
    
  </TR>
  <TR>
  
<!-- LEFT QUOTE -->

    <TD valign="top" align="right"><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/left_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

<!-- BEGIN CORE CONTENT -->

	<TD colspan="9" valign="top" width="100%">


<table cellpadding="4" cellspacing="0" border="0"><tr><td>
<FONT size="2" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
<br>
You are currently viewing the Public <b><font color="#999999">UN</font><font color="#666666">AD</font></b> Gallery. 
You can clone these <b><font color="#999999">UN</font><font color="#666666">ADS</font></b> for your own gallery, or create a new one from scratch.
Browse the entire gallery <a href="tiborocity.cgi?show_date_win=true" onMouseOver="swapON('navigatedate')" onMouseOut="swapOFF('navigatedate')" onClick="javascript:showWIN(375,425,'tiborocity.cgi?show_date_win=true');return false;">by date,</a>
 or search the public gallery using <a href="#theform">the form</a> below.
 <br><br>
 
</FONT>
</td></tr></table>

<table cellpadding="0" cellspacing="0" border="0"><tr><td>
<table cellpadding="4" cellspacing="0" border="0">
_____EoI2_____

&build_image_output ;

print <<"_____EoI2_____";

</table>
</td><td>
<table cellpadding="4" cellspacing="0" border="0">
_____EoI2_____


&build_clone_output ;

print <<"_____EoI2_____";
</table>
</td></tr></table>

<br>


<TABLE CELLPADDING="3" CELLSPACING="0" BORDER="0">
	<TR>
	
_____EoI2_____

&build_more_navigation ;

print <<"_____EoI2_____";

<TD valign="TOP" align="left" width="88">
<a href="tiborocity.cgi?show_date_win=true" onMouseOver="swapON('navigatedate')" onMouseOut="swapOFF('navigatedate')" onClick="javascript:showWIN(375,425,'tiborocity.cgi?show_date_win=true');return false;">
<img border="0" alt="Pick A Date" name="navigatedate" src="/images/orbit/buttons/navigatedate.gif"></a>
	</TD>
	
<TD valign="TOP" align="left" width="119">
<form method="POST" name="createnew" action="context.cgi">
<input type="hidden" name="author_name" value="$author_name">
<input type="hidden" name="author_email" value="$author_email">
<input type="hidden" name="author_url" value="$author_url">
<script Language="JavaScript">
document.write (
        '<a href="javascript:document.createnew.submit();" onMouseOver="swapON(\\'create\\');" onMouseOut="swapOFF(\\'create\\');">' +
        '<img src="/images/orbit/buttons/createnew.gif" border="0" name="create"></a>')
</script>
<noscript>
<input type="image" alt="Create New UNAD" src="/images/orbit/buttons/createnew.gif">
</noscript>
</form>
	</TD>
<TD valign="TOP" align="left" width="118">
$personal_directory
</td>
</TR></TABLE>



<br>

<a name="theform"></a>
		<TABLE cellpadding="2" cellspacing="0" width="571" border="0" bgcolor="#999999">
		<TR>
		<TD align="LEFT" valign="TOP" width="100%">
		<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA" color="#ffffff"><b>
		&nbsp;Search The Public Gallery
		</b></FONT></TD>		
		</TR>
		</TABLE>
		
<table cellspacing="0" cellpadding="1" border="0" width="571">
<tr>
	<td bgcolor="#666666">
	
	
<table cellpadding="0" cellspacing="0" border="0" width="569">
	<tr><td bgcolor="#cccccc" align="center">
	

<table cellpadding="5" cellspacing="0" border="0">
	<tr><td>

<form action="tiborocity.cgi" name="searchtibor" method="POST">
<TABLE cellpadding="5" cellspacing="0" border="0" width="427">

<TR>
<TD align="RIGHT">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Search Text of Unads
</FONT></TD>
<TD align="LEFT">
<input type="text" name="search_string" value="$search_string"></TD>
</TR>

<TR>
<TD align="RIGHT">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Search By Date<br></font>
</FONT></TD>
<TD align="LEFT">
<input type="text" name="date_human_start" value='$date_human_start'></TD>
</TR>

<TR>
<TD align="RIGHT">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
Search By Creator
</FONT></TD>
<TD align="LEFT">
<input type="text" name="author_page" value="$author_page"></TD>
</TR>

<TR>
<TD align="center" colspan="2">
<FONT size="1" FACE="VERDANA,ARIAL,HELVETICA,SANS-SERIF">
<input type="radio" name="search_combine" value="and" $and_checked> \&#147;and\&#148; search results 
<input type="radio" name="search_combine" value="or" $or_checked> \&#147;or\&#148; search results</font></TD>
</TR>

</form>

</table>

</td><td valign="top" align="center">

<a href="/orbit/valid_dates.html" onClick="showWIN(375,425,'/orbit/valid_dates.html');return false;" class="gray"><IMG alt="clock" border="0" height="49" width="49" src="/images/orbit/clocks/clock_anim.gif" vspace="4"></a><BR>
<a href="/orbit/valid_dates.html" onMouseOver='swapON("dates")' onMouseOut='swapOFF("dates")' onClick="showWIN(375,425,'/orbit/valid_dates.html');return false;" class="gray"><img src="/images/orbit/buttons/dates.gif" border="0" name="dates" vspace="8"></a>

<script Language="JavaScript">
document.write (
        '<a href="javascript:document.searchtibor.submit();" onMouseOver="swapON(\\'search\\');" onMouseOut="swapOFF(\\'search\\');">' +
        '<img src="/images/orbit/buttons/search.gif" border="0" name="search"></a>')
</script>
<noscript>
<input type="image" alt="update your gallery" src="/images/orbit/buttons/search.gif">
</noscript>


</td></tr></table>


</TD>
</TR>
</table>
</TD>
</TR>
</table>




<br clear="all"><br>
<br><br>
</TD>
   
<!-- RIGHT QUOTE -->

	<TD valign="top" align="left" nowrap><a href="/orbit/unmadison.cgi"  title="WWYS? Join our un-advertising campaign today!"><img src="/right_quote.gif" border="0" width="70" height="62" alt="quote"></a></TD>

	<TD width="10">&nbsp;</TD>
   
</TR></TABLE>

</td></tr><tr><td valign="top" bgcolor="#ffffff">


<!-- BEGIN FOOTER TABLE -->

<br>
<TABLE width="98%" border="0" cellpadding="0" cellspacing="0"><TR> 
	<TD width="85" bgcolor="#ffffff"><img src="/trans.gif" width="85" height="1"></td>
     <TD nowrap align="left" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/" class="gray" title="undesign. a plan for all seasons."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">&lt;&lt; home </font></a>
		<br clear="all">
		</TD>
	<TD width="100%" align="center" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="http://jam.media.org/" class="gray" title="meet the undesigners."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">[ <b>\&amp\;*\$\#\@~!</b> ] </font></a>
		<br clear="all">
	</TD>
     <TD nowrap align="right" valign="top" bgcolor="#ffffff">
		<br clear="all">
		<A HREF="/orbit/" class="gray" title="undesign in orbit."><font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#999999">orbit \&gt;\&gt;</font></a>
		<img src="/trans.gif" width="30" height="1"> 
		<br clear="all">
		</TD>
  </TR></table>
  <br><br>
  
</td></tr></table>

  
  </BODY>
</HTML>

_____EoI2_____
###
###
### End of Main Screen
###


exit(0);

}
sub print_date_win {

###
###
### Date Navigation Screen
###
print header(-type=>'text/html', -expires=>'now');
print <<"_____EoI2_____";


<HTML>
<HEAD>
<TITLE>undesign in orbit - pick a date, any date</TITLE>
<link rel="SHORTCUT ICON" HREF="http://undesign.org/favicon.ico">
<META NAME="Author" CONTENT="media.org">
<META NAME="Keywords" CONTENT="Tibor Kalman,webchick,undesign,Kalle Lasn,adbusters,WWTD,media.org,culture jamming,social responsibility">
<META NAME="Description" CONTENT="Context is everything: Tibor Kalman inspires a plan for all seasons.">
<style>
<!--
A:visited {COLOR: #666666; TEXT-DECORATION: underline;}
A:link {COLOR: #666666; TEXT-DECORATION: underline;}
A:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.white:visited {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:link {COLOR: #ffffff; TEXT-DECORATION: none;}
A.white:hover {COLOR: #333333; TEXT-DECORATION: underline;}

A.gray:visited {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:link {COLOR: #666666; TEXT-DECORATION: none;}
A.gray:hover {COLOR: #333333; TEXT-DECORATION: underline;}
-->
</style>
<script type="text/javascript" src="/orbit/js/win.js"></script>
<script type="text/javascript" src="/orbit/js/parentWIN.js"></script>
<script type="text/javascript" Language="JavaScript">
<!--
        var next_off = new Image()  ;
        next_off.src = "/images/orbit/buttons/next_off.gif" ;
        var prev_off = new Image()  ;
        prev_off.src = "/images/orbit/buttons/prev_off.gif" ;
function swapON (imagename)
{
        var imagename ;
        the_swap_image = eval ("document." + imagename) ;
        the_old_swap = the_swap_image.src
        the_swap_image.src = eval (imagename + "_off.src") ;

}

function swapOFF (imagename)
{
        var imagename ;
        theimage = eval ("document." + imagename) ;
        theimage.src = the_old_swap  ;

}



// -->
</script>



</HEAD>

<BODY bgcolor="#cccccc" link="#999999" vlink="#999999" alink="#999999" text="#666666" topmargin="0" leftmargin="0" marginwidth="0" marginheight="0">


<TABLE width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <TR><td valign="top" height="80%">
  
<!-- BEGIN HEADER TABLE -->

<TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle" bgcolor="#ffffff">
    
<TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
  <TR> 
    <TD height="75" align="left" valign="middle">
		<a href="/" onClick="parentWIN('/');return false;" title="undesign. a plan for all seasons."><img src="/images/undesign_sm.gif" width="291" height="50" hspace="10" border="0" alt="UNDESIGN | the undesigners"></a>
	</TD><td align="right" bgcolor="#ffffff">
		<a href="/orbit/" onClick="parentWIN('/orbit/');return false;" title="undesign in orbit..."><img src="/images/orbit/tibor_anim_sm.gif" hspace="2" vspace="2" width="22" height="22" border="1"></a>
	</td><TD width="30" bgcolor="#ffffff"><img src="/trans.gif" width="30" height="1">
	</TD>
  </TR>
</table>

</TD>
</TR>
</table>


<!-- BEGIN CONTENT TABLE -->

<TABLE width="100%" border="0" cellpadding="0" cellspacing="0" vspace="0" hspace="0">  
  <TR><TD colspan="3" align="left">&nbsp;</TD></TR>  

  <TR>
  
<!-- LEFT QUOTE -->

    <TD valign="top" align="right"><img src="/trans.gif" border="0" width="55" height="1" alt="quote"></TD>

<!-- BEGIN CORE CONTENT -->

	<TD valign="top" width="100%" nowrap>

	<TABLE cellpadding="5" cellspacing="0" border="0" width="250">
	<TR>
	<TD align="LEFT" valign="TOP" colspan="2" width="166">
<font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#666666">
<font color="#ffffff"><b>pick a date, any date.</b></font><br>
</font>
<font FACE="Verdana, Arial, Helvetica, sans-serif" size="1" color="#666666">
Navigate all the public <b><font color="#999999">UN</font><font color="#666666">ADS</font></b> by date  via the links below. 
</font>
</td>
	<TD align="right" valign="TOP">
<IMG alt="clock" border="0" height="49" width="49" src="/images/orbit/clocks/clock_anim.gif" vspace="4">
</td>

</tr><tr>
	<TD align="LEFT" valign="TOP" WIDTH="33.3%">

	<FONT size="1" FACE="Verdana, Arial, Helvetica, sans-serif">
	
	<B>
_____EoI2_____

&build_date_navigation ;

print <<"_____EoI2_____";
</tr></table>
	


<br clear="all">
</TD>
   
<!-- RIGHT QUOTE -->

	<TD valign="top" align="left" nowrap><img src="/trans.gif" border="0" width="55" height="1" alt="quote"></TD>

	<TD width="10">&nbsp;</TD>
   
</TR></TABLE>

</td></tr><tr><td valign="top" bgcolor="#ffffff">


<!-- BEGIN FOOTER TABLE -->

<br>

<TABLE cellpadding="3" cellspacing="0" border="0" width="100%">
	<TR>
_____EoI2_____

&build_date_bottom ;

print <<"_____EoI2_____";
</TR></TABLE>


  <br><br>
  
</td></tr></table>


  
  </BODY>
</HTML>

_____EoI2_____
###
###
### End of Date Navigation
}
sub build_date_navigation {
$marker = 0 ;
for ( $i = 0 + $offset_in_date ; ($i <= $#other_date) && ($i <= $offset_in_date + $dates_per_page); $i++ )
{
print <<"_____EoI2_____";
	<a href="tiborocity.cgi?date_start=$other_date[$i]" onClick='parentWIN("tiborocity.cgi?date_start=$other_date[$i]");return false;'> 
_____EoI2_____
	print strftime("%D",localtime($other_date[$i])), '</a><br>' ;
        print '<img src="/trans.gif" width="62" height="9" border="0" alt=""><BR>' ;
	$marker++ ;
	if ($marker >= $dates_per_column ) {
		$marker = 0 ;
print <<"_____EoI2_____";
		</b></font></td>
		<TD align="right" valign="TOP" WIDTH="33.3%">
		<FONT size="1" FACE="Verdana, Arial, Helvetica, sans-serif">
	
		<B>
_____EoI2_____
	}
}

if ( $marker > 0 && $marker < $dates_per_column ) { 
		print '</b></font></td>', "\n" ;
		}
}

sub build_date_bottom {

if ( $offset_in_date > 0 )
{
        print '<td valign="top" width="50%" align="right"><a href="tiborocity.cgi?' ;
        print "offset_in_date=", $offset_in_holding - $dates_per_page - 1 ;
        print '&show_date_win=true"' ;
        print ' onMouseOver=\'swapON("prev")\' onMouseOut=\'swapOFF("prev")\'>' ;
        print '<img border="0" src="/images/orbit/buttons/prev.gif" name="prev"></a></td>', "\n" ;
} else {
        print '<td valign="top" width="50%" align="right">' ;
        print '<img border="0" src="/images/orbit/buttons/prev_null.gif"></td>', "\n" ;
}

print '<TD valign="TOP" width="151"></TD>' ;

if ( $offset_in_date + $dates_per_page < $#other_date )
{
        print '<td valign="top" width="50%" align="left"><a href="tiborocity.cgi?' ;
        print "offset_in_date=", $offset_in_date + $dates_per_page +1 ;
        print '&show_date_win=true"' ;
        print ' onMouseOver=\'swapON("next")\' onMouseOut=\'swapOFF("next")\'>' ;

        print '<img border="0" name="next" src="/images/orbit/buttons/next.gif"></a></td>', "\n" ;

} else {
        print '<td valign="top" width="50%" align="left">' ;
        print '<img border="0" src="/images/orbit/buttons/next_null.gif"></td>', "\n" ;
}



}
