<?php

	include "library.php";

	$cxn = start_code();

	$on_load = "document.getElementById('screen_width').value = screen.width; document.getElementById('screen_height').value = screen.height; document.getElementById('has_javascript').value = 'yes';";

	page_header( "Search Profiles", $cxn, $on_load );

	if (val( $_GET, 'country' ) != "")
		$curr_country = rawurldecode( val( $_GET, 'country' ) );
	else
		$curr_country = "";

	$countries = build_country_list( $cxn );

	$_SESSION['search_attempt'] = "1";

	$min_age = val( $_SESSION, "min_age" );
	$max_age = val( $_SESSION, "max_age" );
	$search_for = val( $_SESSION, "search_for" );
	$sex = val( $_SESSION, "sex" );
	$sex_wanted = val( $_SESSION, "sex_wanted" );
	$city = val( $_SESSION, "city" );
	$state = val( $_SESSION, "state" );
	$country = val( $_SESSION, "country" );
	$search_for_word = val( $_SESSION, "search_for_word" );
	$compatability = val( $_SESSION, "compatability" );
	$logged_on = val( $_SESSION, "logged_on" );


	echo "<form action='".url_encode( "search_init.php", "country", rawurlencode( $curr_country ) )."' method='POST'><table width='100%'>\n";


		/* show ads for non-charging countries */

/*
	if (non_charging_country( $cxn ))
	{
		echo "<tr><td width='15%'></td><td></td><td rowspan='24' width='10%'>";

		show_ads_vertical();

		echo watermark( "Ads relevant to singles, travel, ".$curr_country." etc." )."</td><td rowspan='24' width='5%'>";

		show_ads_vertical();

		echo watermark( "Ads relevant to singles, travel, ".$curr_country." etc." )."</td><td rowspan='24' width='5%'>";

		echo "</td></tr>";
	}
	else
*/
	
	echo "<tr><td width='18%'></td><td width='37%'></td><td width='25%'></td><td width='20%'></td></tr>";

	echo "<tr>".form_radioy( "Search For", "sex", "", "Men", $sex );

	echo "<td rowspan='9' align='center'><img src='sunset1a.jpg' height=160' width='240'></td></tr>";

	form_radio( "", "sex", "", "Women", $sex );

	form_radio( "", "sex", "", "Either", $sex );

	form_text( "Minimum Age", "min_age", "3", $min_age );
	form_text( "Maximum Age", "max_age", "3", $max_age );

	form_radio( "For", "search_for", "Relationship", "A Relationship", $search_for );

	form_radio( "", "search_for", "Friendship", "Friendship", $search_for );
	form_radio( "", "search_for", "Either", "Either", $search_for );

	form_dropdown( "Who are looking for&nbsp;&nbsp;", "sex_wanted", "<option></option><option>Men</option><option>Women</option>", $sex_wanted );

	echo "<tr>".form_texty( "City", "city", "34", $city );

	echo form_checkboxy( "List by compatability (you must log in)", "compatability", $compatability )."</tr>";

	echo "<tr>".form_texty( "State", "state", "34", $state );

	echo form_checkboxy( "Currently logged on only", "logged_on", $logged_on )."</tr>";

	form_dropdown( "Country", "country", $countries, $country );

	form_text( "Search for Word", "search_for_word", "34", $search_for_word );

	form_hidden( "screen_width" );
	form_hidden( "screen_height" );
	form_hidden( "has_javascript" );
	form_hidden( "came_from_search", "yes" );

	$data = get_first_row( "SELECT count(*) as num FROM profile WHERE deleted = 'no' AND locked = 'no'", $cxn );
//	$data = get_first_row( "SELECT count(*) as num FROM profile WHERE deleted = 'no' AND locked = 'no' AND email_address_valid = 'yes'", $cxn );

	echo "<tr><td></td><td colspan='3'>".black( "Leave fields blank if they are not important to your search criteria" ).sp(30).watermark( number_format( $data['num'] )." members" )."</td></tr>";
//	echo "<tr><td></td><td colspan='3'>".black( "Leave fields blank if they are not important to your search criteria" ).sp(30).watermark( number_format( $data['num'] )." active members" )."</td></tr>";

	echo "<tr><td></td><td><br><input type='image' src='buttons/".button_filename( "search" )."' border='0'></td></tr>";


		/* don't delete these of there won't be space for the ads */

	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";
	echo "<tr><td>".sp(1)."</td></tr>";

	form_end();

	function show_ads_vertical()
	{
		echo "<script type='text/javascript'>";
		echo "<!--\n";
		echo "google_ad_client = 'pub-9796091010231719';\n";

// yellow background
//		echo "google_ad_slot = '3453530291';\n";

		echo "google_ad_slot = '3924824859';\n";
		echo "google_ad_width = 120;\n";
		echo "google_ad_height = 600;\n";
		echo "//-->\n";
		echo "</script>\n";
		echo "<script type='text/javascript' src='http://pagead2.googlesyndication.com/pagead/show_ads.js'>\n";
		echo "</script>\n";
	}

?>


