DAN ZEN EXPO - CODE EXHIBIT - TAPOLL
<?PHP

// id.php is the main page that shows a poll
// it was updated to be able to show several polls - for instance on the front
// it includes the "header" and "footer" files which are themselves, quite complex
// the header file is the logo strip and the left hand margin which are common to all pages
// the footer file is the ad, the three poll functions (add, edit, view), the inspire area and footer

// it receives its parameters on the end of the URL - http://www.tapoll.com/poll/id/822876197/politics
// the .htaccess file makes it so id.php in the poll direcory is read as just id
// the $_SERVER['PATH_INFO'] gets extra stuff after the page - in this case id so that is /822876197/politics 
// when you explode on the / the first element is the nothing before the first slash
// explode() and split() are the same thing - you can use either one
// $dummy therefore stores the nothing, $id gets the id and politics goes in $id2
// when there are two polls shown, $id2 would be the second id
    
list($dummy, $id, $id2, $id3) = explode('/', $_SERVER['PATH_INFO']);

// the default id used to be hardcoded here to determine what polls were on the front page
// the feature to let users decide what polls go on the front was added later
// this line reads in the poll ids from a text file
// the front feature seen later is what writes the poll ids to this file
// file("somefile") reads any file - even from an absolute url of somebody else's site
// it puts each line into an element of an array
// if you want to put the file back into a single string then you can join it with ""

$defaultid = join("",file("ids.txt"));

// below are the default polls left in to give an indication of what it is like to manage the site
//$defaultid = "874534653/438064478";  // city / hat
//$defaultid = "855921507/862729514";  // facebook / ipod
//$defaultid = "862729514/651361678"; // iFuture / what would you give up
//$defaultid = "144339204/918483666"; // facebook / microsoft yahoo
//$defaultid = "256046457/438064478"; // oled / hat
//$defaultid = "68579486/438064478"; // thumb / hat
//$defaultid = "406426746/992857411"; // what do you want in life / Died and come back
//$defaultid = "697037554"; // second life
//$defaultid = "928336442"; // google vs microsoft
//$defaultid = "884884716"; // youtube watch
//$defaultid = "205175698"; // multiTouch
//$defaultid = "884981357"; // iPhone
//$defaultid = "610081839"; // New Year
//$defaultid = "473615410"; // best bond
//$defaultid = 437679150; // phone
//$defaultid = 594706440; // google youtube
//$defaultid = 409251330; // halloween
//$defaultid = 88780207; // applications
//$defaultid = 750737540; // web 2.0
//var pollid = 210262534; // world cup
//var pollid = 219654809; // valentine


// if the url is just to poll

if ($id == "poll") {
    header("Location: http://www.tapoll.com/poll/id/".$defaultid);
    return;
}
if ($id == "") {
    list($id, $id2, $id3) = explode('/', $defaultid);
}	
$tag = "";	
if ($id2 == "" || $id2 < 10) {$id2 = "";}
if ($id3 == "" || $id3 < 10) {$id3 = "";}
    
include ("part1.php");


?>

<script>

function expandfront(w,i) {	
	if (!w) {w=""; i=pollid;}	
	document.getElementById("bartarget"+w).style.display="none";
	document.getElementById("sharetarget"+w).style.display="none";
	document.getElementById('fronttarget'+w).style.display ='block';
	document.getElementById('frontform'+w).infofield.value = "put poll on front?";
	setSelect(document.getElementById('frontform'+w).infofield);
}
function expandlink(w,i) {	
	if (!w) {
		w=""; 
		i=pollid;	
		document.getElementById('fronttarget'+w).style.display ='none';		
	} 
	document.getElementById("sharetarget"+w).style.display="none";	
	url = "http://www.tapoll.com/poll/id/" + i;
	document.getElementById('bartarget'+w).style.display ='block';
	document.getElementById('infoform'+w).infofield.value = url;
	setSelect(document.getElementById('infoform'+w).infofield);	
}
function expandembed(w,i) {	
	if (!w) {
		w=""; 
		i=pollid;	
		document.getElementById('fronttarget'+w).style.display ='none';		
	} 
	document.getElementById("sharetarget"+w).style.display="none";
	url = '<scr' + 'ipt src="http://www.tapoll.com/poll/embed/' + i + '/width/220"></scri' + 'pt><br /><div style="width:220px; position:relative; top:-20px; padding:2px 0px 5px 0px; background-color:#CCCCCC;"><div style="padding-left:5px;"><a href="http://www.tapoll.com/poll/create/" title="Tapol - predict a poll web 2.0 site" class="pp_link" target="_tapoll">Create a Tapol poll</a><br /><a href="http://www.tapoll.com/poll/similar/' + i + '" class="pp_link" target="_tapoll">View similar polls</a></div></div>';
	document.getElementById('bartarget'+w).style.display ='block';
	document.getElementById('infoform'+w).infofield.value = url;
	setSelect(document.getElementById('infoform'+w).infofield);
}
function expandshare(w,i) {	
	if (!w) {
		w=""; 
		i=pollid;	
		document.getElementById('fronttarget'+w).style.display ='none';	
	} 
	document.getElementById("bartarget"+w).style.display="none";
	document.getElementById('sharetarget'+w).style.display ='block';
	document.getElementById('shareform'+w).infofield.value = "please enter e-mail";
	setSelect(document.getElementById('shareform'+w).infofield);
}
function sendshare(w,i) {
	if (!w) {w=""; i=pollid;}
	if (!document.getElementById('shareform'+w).infofield.value.match(/^[^ <>()@?-?]+@[^ <>()@?-?]+\.[a-zA-Z]{2,4}$/)) {
		alert ("Please use a correct e-mail format");		
		return;	
	}
    //AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	var client = new HttpClient();
	client.isAsync = true;	
	client.callback = function(result) {
		 alert ("An invitation has been sent! Thanks!");	
	}
	client.makeRequest('http://www.tapoll.com/poll/ajax.php','command=send&pollid='+i+'&email='+document.getElementById('shareform'+w).infofield.value);
 	//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	
}
function sendfront(w,i) {
	if (!w) {w=""; i=pollid;}
    //AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	var client = new HttpClient();
	client.isAsync = true;	
	client.callback = function(result) {
		 alert ("The poll is on the front! Thanks!");	
	}
	client.makeRequest('http://www.tapoll.com/poll/ajax.php','command=front&pollid='+i);	
 	//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	
}

</script>	

    <td width="431" valign="top">
	
<table width="431" border="0"  cellpadding="0" cellspacing="0">
	<tr class="pp_subbar">
		<td><img src="http://www.tapoll.com/poll/graphics/poll.jpg" width="76" height="29"></td>
		<td align=right>		
			<table>
			<tr>
			<td class="pp_barlink"><? if  (!$id2) { ?><a class="pp_barlink" href="javascript:expandfront()"> front </a>|<? } ?><a class="pp_barlink" href="javascript:expandlink()"> link </a>|<a class="pp_barlink" href="javascript:expandembed()"> embed </a>|<a class="pp_barlink" href="javascript:expandshare()"> share </a></td>
			</tr>
			</table>
		</td>
	</tr>
</table>

<div id="bartarget" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="0" cellspacing="0" border="0"><form id="infoform" action=""><tr><td><input id="infofield" type="text" size="40" style="color:#999999" value="" /></td><td>  </td><td valign="bottom"><a href="" onClick='document.getElementById("bartarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="17" height="17" border="0"></a></td></tr></form></table></div>

<div id="sharetarget" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="0" cellspacing="0" border="0"><form id="shareform" action=""><tr><td><input id="infofield" type="text" size="32" style="color:#999999" value="please enter e-mail" /> <input type="submit" value="Send" onClick="sendshare(); return false;"></td><td>  </td><td valign="bottom"><a href="" onClick='document.getElementById("sharetarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="17" height="17" border="0"></a></td></tr></form></table></div>

<div id="fronttarget" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="0" cellspacing="0" border="0"><form id="frontform" action=""><tr><td><input id="infofield" type="text" size="32" style="color:#999999" value="put poll on front?" /> <input type="submit" value="Yes" onClick="sendfront(); return false;"></td><td>  </td><td valign="bottom"><a href="" onClick='document.getElementById("fronttarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="17" height="17" border="0"></a></td></tr></form></table></div>

<script src="http://www.tapoll.com/poll/embed/<? echo $id ?>/width/431/local/1/<? echo $googleadtopics ?>"></script>

<p>
<map name="MapSocial">
  <area shape="rect" coords="6,4,38,35" href="Share_on_facebook" onMouseOut="show('share',0);" onMouseOver="show('share',1);" onclick="window.open('<?PHP echo "http://www.facebook.com/sharer.php?u=".urlencode("http://www.tapoll.com/poll/id/$id")."&t=".urlencode($title); ?>','fb','width=600,height=500,scrollbars=1,resizable=1'); return false;">
  <area shape="rect" coords="44,3,76,34" href="Post_to_Twitter" onMouseOut="show('share',0);" onMouseOver="show('share',2);"  onclick="window.open('<?PHP echo "http://twitter.com/share?original_referer=".urlencode("http://www.tapoll.com/poll/id/$id")."&text=".urlencode($title)."&url=".urlencode("http://www.tapoll.com/poll/id/$id"); ?>','tw','width=600,height=500,scrollbars=1,resizable=1'); return false;">
</map>
<img style="margin-left:0px;" name="share" id="share" src="http://www.tapoll.com/poll/graphics/share.jpg" width="431" height="38" border="0" usemap="#MapSocial"></p>



<? if  ($id2) { ?>

<br />
<table width="431" border="0"  cellpadding="0" cellspacing="0">
	<tr class="pp_subbar">
		<td><img src="http://www.tapoll.com/poll/graphics/poll.jpg" width="76" height="29"></td>
		<td align=right>		
			<table>
			<tr>
			<td class="pp_barlink"><a class="pp_barlink" href="javascript:expandlink('2','<? echo $id2; ?>')"> link </a>|<a class="pp_barlink" href="javascript:expandembed('2','<? echo $id2; ?>')"> embed </a>|<a class="pp_barlink" href="javascript:expandshare('2','<? echo $id2; ?>')"> share </a></td>
			</tr>
			</table>
		</td>
	</tr>
</table>
<div id="bartarget2" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="0" cellspacing="0" border="0"><form id="infoform2" action=""><tr><td><input id="infofield" type="text" size="40" style="color:#999999" value="" /></td><td>  </td><td valign="bottom"><a href="" onClick='document.getElementById("bartarget2").style.display="none"; return false;'><img src="/zenmix/close.gif" width="17" height="17" border="0"></a></td></tr></form></table></div>
<div id="sharetarget2" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="0" cellspacing="0" border="0"><form id="shareform2" action=""><tr><td><input id="infofield" type="text" size="32" style="color:#999999" value="please enter e-mail" /> <input type="submit" value="Send" onClick="sendshare('2','<? echo $id2; ?>'); return false;"></td><td>  </td><td valign="bottom"><a href="" onClick='document.getElementById("sharetarget2").style.display="none"; return false;'><img src="/zenmix/close.gif" width="17" height="17" border="0"></a></td></tr></form></table></div>

<script src="http://www.tapoll.com/poll/embed/<? echo $id2 ?>/width/431/local/1/<? echo $googleadtopics ?>"></script>

<p>
<map name="MapSocial2">
  <area shape="rect" coords="6,4,38,35" href="Share_on_facebook" onMouseOut="show('share2',0);" onMouseOver="show('share2',1);" onclick="window.open('<?PHP echo "http://www.facebook.com/sharer.php?u=".urlencode("http://www.tapoll.com/poll/id/$id2")."&t=".urlencode($title2); ?>','fb','width=600,height=500,scrollbars=1,resizable=1'); return false;">
  <area shape="rect" coords="44,3,76,34" href="Post_to_Twitter" onMouseOut="show('share2',0);" onMouseOver="show('share2',2);"  onclick="window.open('<?PHP echo "http://twitter.com/share?original_referer=".urlencode("http://www.tapoll.com/poll/id/$id2")."&text=".urlencode($title2)."&url=".urlencode("http://www.tapoll.com/poll/id/$id2"); ?>','tw','width=600,height=500,scrollbars=1,resizable=1'); return false;">
</map>
<img style="margin-left:0px;" name="share2" id="share2" src="http://www.tapoll.com/poll/graphics/share.jpg" width="431" height="38" border="0" usemap="#MapSocial2"></p>

<? } ?>

<? if  ($id3) { ?>
<br />
<script src="http://www.tapoll.com/poll/embed/<? echo $id3 ?>/width/431/local/1/<? echo $googleadtopics ?>"></script>

<p>
<map name="MapSocial3">
  <area shape="rect" coords="6,4,38,35" href="Share_on_facebook" onMouseOut="show('share3',0);" onMouseOver="show('share3',1);" onclick="window.open('<?PHP echo "http://www.facebook.com/sharer.php?u=".urlencode("http://www.tapoll.com/poll/id/$id3")."&t=".urlencode($title3); ?>','fb','width=600,height=500,scrollbars=1,resizable=1'); return false;">
  <area shape="rect" coords="44,3,76,34" href="Post_to_Twitter" onMouseOut="show('share3',0);" onMouseOver="show('share3',2);"  onclick="window.open('<?PHP echo "http://twitter.com/share?original_referer=".urlencode("http://www.tapoll.com/poll/id/$id3")."&text=".urlencode($title3)."&url=".urlencode("http://www.tapoll.com/poll/id/$id3"); ?>','tw','width=600,height=500,scrollbars=1,resizable=1'); return false;">
</map>
<img style="margin-left:0px;" name="share3" id="share3" src="http://www.tapoll.com/poll/graphics/share.jpg" width="431" height="38" border="0" usemap="#MapSocial3"></p>


<? } ?>
</td>


<? include "part2.php" ?>


////////////////////////////////////////////

// PART 1

////////////////////////////////////////////


<?

// part1.php sets the start of the html some JavaScript, the logo bar
// the left hand navigation and tips section
// part1.php is used on most pages
// some (not many) of the functions are for specific pages

// here we get the username and password for the database and select the database i.e.
// $db = mysql_connect("localhost", "username", "password");
// mysql_select_db("database", $db);

// removed for exhibit

// ads get called based on topics (tags or keywords) of the polls 
// the topics come from the user at poll creation time and are stored in the database per poll	
// set up the default ad topics and topics not to use
// set up functions for filtering the the topics

$defaultadtopics = array("digital cameras", "ipod mini", "ipod touch", "iphone", "sony playstation");
$filteradtopics = array("favourite", "movies", "books", "actors"); // not for polls or similar list
$filterbadadtopics = array("favourite"); // never show
function filterads($ar) {	
    // here we set the global variables so we can read variables outside this function
    // this is different than how we do it in Flash where the globals are set outside
    global $defaultadtopics, $filteradtopics;
    foreach ($filteradtopics as $fi) {
        if (array_search($fi, $ar) != false) { // like indexOf() in ActionScript
            array_splice($ar, array_search($fi, $ar), 1); // remove any filteradtopics from array of topics
            if (count($ar) < 1) {
                $ar = $defaultadtopics;
            }
        }
    }
    return $ar;
}
function filterbadads($ar) {
    global $defaultadtopics, $filterbadadtopics;
    foreach ($filterbadadtopics as $fi) {
        if (array_search($fi, $ar) != false) {
            array_splice($ar, array_search($fi, $ar), 1);
            if (count($ar) < 1) {
                $ar = $defaultadtopics;
            }
        }
    }
    return $ar;
}		

// create an array of topics
// this will be the poll's topic or if the poll was found via a specific tag use the tag ($tag)
// $tag is used when tag.php is called to list polls based on a tag

$adtopics = array();
if ($id != "") {
    $sql = "SELECT * FROM pp_poll WHERE id='$id'";
    $result = mysql_query($sql, $db);
    $poll = mysql_fetch_array($result);	
    $question = $poll["question"];
    // topics are held in the keyword field like so:  actors^james bond^movies
    // we want to get to the paramater PREG_SPLIT_NO_EMPTY to make sure no blanks
    // to get there we have to put something in for the limit of results parameter
    // so we just put in a -1 and this means could be any number of results
    $adtopics = preg_split("/\^/",$poll["keywords"], -1, PREG_SPLIT_NO_EMPTY);	
    $title = "Tapoll Question: $question";		
    if ($id2 != "") {
        $sql = "SELECT * FROM pp_poll WHERE id='$id2'";
        $result = mysql_query($sql, $db);
        $poll = mysql_fetch_array($result);	
        $question2 = $poll["question"];
        $adtopics2 = preg_split("/\^/",$poll["keywords"], -1, PREG_SPLIT_NO_EMPTY);	
        $title2 = "Tapoll Question: $question2";		
    }
    if ($id3 != "") {
        $sql = "SELECT * FROM pp_poll WHERE id='$id3'";
        $result = mysql_query($sql, $db);
        $poll = mysql_fetch_array($result);	
        $question3 = $poll["question"];
        $adtopics3 = preg_split("/\^/",$poll["keywords"], -1, PREG_SPLIT_NO_EMPTY);	
        $title3 = "Tapoll Question: $question3";		
    }
    
}  else if ($tag != "" && $tag != "all") {
    $adtopics = array($tag);
    // adjust the title - titles are important for search engine rankings 
    $title = "Tapoll | Predict a Poll about ".ucfirst($tag);
}
$title = preg_replace("/<a[^>]*>/i", "", $title);
$title = preg_replace("/<\/a>/i", "", $title);
// prepare the topics to be used in the google ad
// note the joining of the topics with the / so they appear as directories
// these are used in part2.php
$googleadtopics = filterbadads($adtopics);		
$googleadtopics = join("/",$googleadtopics);

// collect their e-mail from a cookie if there is one otherwise set to ""
if (!isset($email)) {
    $email = (isset($_COOKIE['tapoll_email'])) ? $_COOKIE['tapoll_email'] : "";
}

// going out of PHP starting the HTML
// note how we can embed the PHP variables into the HTML for example the title
// note how we can embed the PHP variables into the JavaScript as well
// these variables get used in various JavaScript function set in the various pages that use part1.php

function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
        $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
        $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
}	
	
?>
<html>
<head>
<title><? echo $title; ?></title>
<meta name="Keywords" content="tapoll,poll,polls,predict,prediction,predictapoll2,survey,free,vote,voting,danzen,dan zen">
<meta name="Description" content="<? echo $title; ?> ... See if you can predict the results of the poll as you vote or will the poll predict you!  No sign-up required and it's completely fun and free!">

<link rel=Stylesheet TYPE='text/css' HREF='http://www.tapoll.com/poll/styleBig.css'>
<link rel="shortcut icon" type="image/ico" href="http://www.tapoll.com/icons/tapoll.ico" />
<link rel="image_src" href="http://www.tapoll.com/poll/graphics/logo2.jpg" />
<link rel="image_src" href="http://www.tapoll.com/poll/graphics/heads/01.jpg" />


<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<? if  ($id2) { ?>
<link rel="image_src" href="http://www.tapoll.com/poll/graphics/heads/03.jpg" />
<? }
if  ($id3) { ?>
<link rel="image_src" href="http://www.tapoll.com/poll/graphics/heads/04.jpg" />
<? } ?>

<!--here is the JavaScript AJAX functions -->
<script type="text/javascript" src="http://www.tapoll.com/poll/ajax.js"></script>

<!-- this is JavaScript with embeded PHP variables - view the source and you will only see ids here -->
<script>
pollid = <? if ($id != "") {echo $id;} else {echo "null";} ?>;
pollid2 = <? if ($id2 != "" && $id2 > 10) {echo $id2;} else {echo "null";} ?>;
pollid3 = <? if ($id3 != "" && $id3 > 10) {echo $id3;} else {echo "null";} ?>;

// heads are the pictures on the left hand side under the logo
// there used to be dozens to choose from but then reduced the variety to 5 - well actually 4 as head 2 shows head 1
function gethead() {	

	var numberofheads = 5; // must be less than ten unless do quick rewrite...
	var head = Math.ceil(Math.random()*numberofheads);
	if (head == 2) {head = 1;}
	document.write('<img src="http://www.tapoll.com/poll/graphics/heads/0' + head + '.jpg" hspace="12" height="91" vspace="9" />');
	
}

// this is danzen standard JavaScript rollover code to handle poll tools (create, edit, view) round bullets
// and to handle share rollovers
if (document.images) {
	myImages = [];  // [normal image, rollover image]
	myImages["video"] = ["http://www.tapoll.com/poll/graphics/video1.jpg", "http://www.tapoll.com/poll/graphics/video2.jpg"];
	myImages["tool1"] = ["http://www.tapoll.com/poll/graphics/createpoll.jpg", "http://www.tapoll.com/poll/graphics/createpoll2.jpg"];
	myImages["tool2"] = ["http://www.tapoll.com/poll/graphics/managepolls.jpg", "http://www.tapoll.com/poll/graphics/managepolls2.jpg"];
	myImages["tool3"] = ["http://www.tapoll.com/poll/graphics/viewmypolls.jpg", "http://www.tapoll.com/poll/graphics/viewmypolls2.jpg"];
	myImages["share"] = ["http://www.tapoll.com/poll/graphics/share.jpg", "http://www.tapoll.com/poll/graphics/share_fb.jpg", "http://www.tapoll.com/poll/graphics/share_tw.jpg"];
	myImages["share2"] = ["http://www.tapoll.com/poll/graphics/share.jpg", "http://www.tapoll.com/poll/graphics/share_fb.jpg", "http://www.tapoll.com/poll/graphics/share_tw.jpg"];
	myImages["share3"] = ["http://www.tapoll.com/poll/graphics/share.jpg", "http://www.tapoll.com/poll/graphics/share_fb.jpg", "http://www.tapoll.com/poll/graphics/share_tw.jpg"];

	for (i in myImages) {
		for (j in myImages[i]) {
			temp = myImages[i][j];
			myImages[i][j] = new Image();
			myImages[i][j].src = temp;
		}
	}
}

function show(tag,type) {
    if (document.images) {
        document[tag].src = myImages[tag][type].src;
    }
}

// this is danzen standard JavaScript cookie code
function setCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	} else {
		var expires = "";
	}
	// document.cookie = "variable=value; expires=Thu, 2 Aug 2006 20:47:11 UTC; path=/"; 
	document.cookie = name+"="+escape(value)+expires+"; path=/";
}

function getCookie(name) {
	var outer = document.cookie.split(/;\s*/);	
	var cookies = new Array();
	for (i=0; i<outer.length; i++) {		
		inner = outer[i].split("=");
		cookies[inner[0]] = inner[1];
	}	
	return unescape(cookies[name]);
}


function deleteCookie(name) {
	setCookie(name,"",-1);
}


// this function had some problems in some browsers so not using it
function setSelect(f) {
	return;
	f.focus();
	f.blur();
	f.select();
}

</script>

		<script type="text/javascript" src="http://www.tapoll.com/poll/swfobject.js"></script>
		<script type="text/javascript">
			<!-- Adobe recommends that developers use SWFObject2 for Flash Player detection. -->
			<!-- For more information see the SWFObject page at Google code (http://code.google.com/p/swfobject/). -->
			<!-- Information is also available on the Adobe Developer Connection Under "Detecting Flash Player versions and embedding SWF files with SWFObject 2" -->
			<!-- Set to minimum required Flash Player version or 0 for no version detection -->
			
		
			countTimes = getCookie("count");
			showTimes = 5;
			if (countTimes != "undefined") {
				countTimes++;				
			} else {
				countTimes = 1;
			}
			setCookie("count", countTimes, 0);
			if (countTimes == 1 || countTimes % showTimes == 0) {			
					
				var swfVersionStr = "10.0.0";
				<!-- xiSwfUrlStr can be used to define an express installer SWF. -->
				var xiSwfUrlStr = "";
				var flashvars = {"tag":"<?PHP echo $adtopics[array_rand($adtopics)]; ?>"};
				var params = {};
				params.quality = "high";
				params.bgcolor = "#ffffff";
				params.play = "true";
				params.loop = "true";
				params.wmode = "window";
				params.scale = "showall";
				params.menu = "true";
				params.devicefont = "false";
				params.salign = "";
				params.allowscriptaccess = "sameDomain";
				var attributes = {};
				attributes.id = "touchyad";
				attributes.name = "touchyadad";
				attributes.align = "middle";
				//swfobject.createCSS("html", "height:100%; background-color: #ffffff;");
				//swfobject.createCSS("body", "margin:0; padding:0; overflow:hidden; height:100%;");
				swfobject.embedSWF(
					"http://www.tapoll.com/poll/ad.swf", "flashContent",
					"291", "116",
					swfVersionStr, xiSwfUrlStr,
					flashvars, params, attributes);
					
				
			}
		</script>

</head>


<!----------------------------------------------- body -------------------------------------------->


<body bgcolor="#ffffff" style="margin-top:-4px;">

<table width="980" border="0" align="center" cellpadding="0" cellspacing="10">
	<tr><td><img src="/graphics/s.gif" width="238" height="1"></td><td><img src="/graphics/s.gif" width="431" height="1"></td><td><img src="/graphics/s.gif" width="280" height="1"></td></tr>
  <tr>
    <td colspan="3"><table width="980" border="0" cellpadding="0" cellspacing="0" class="pp_mainbar">
      <tr>
        <td><a href="http://www.tapoll.com/poll/id/"><img src="http://www.tapoll.com/poll/graphics/logo2.jpg" alt="Poll Web 2.0 Site" width="197" height="70" border="0"></a></td>
        <td align="right"><img src="http://www.tapoll.com/poll/graphics/circles2.jpg" width="783" height="70"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td valign="top" class="pp_marginbox"> 
 <table cellpadding="6" cellspacing="0" width="238">	 
	<tr><td class="pp_margin">    
<table cellspacing="0" cellpadding="0" width="196"><tr><td class="pp_margin" align="center">
<img src="http://www.tapoll.com/poll/graphics/intro.jpg" style="margin-left:8px; margin-top:6px;" width="203" height="110" alt="Tapoll - Predict and Vote Free Poll Tool">
</td></tr></table>

<div style="margin-top:12px; padding:6px; border-top:1px dotted #CCCCCC;" />

<a href="http://www.youtube.com/watch?v=GdmhKpoC3VM" target="video" onMouseOut="show('video',0);" onMouseOver="show('video',1);"><img name="video" src="http://www.tapoll.com/poll/graphics/video1.jpg" width="200" height="31" border="0"></a>

<div style="margin-top:12px; padding:6px; border-top:1px dotted #CCCCCC;" />


<?
		
		// get a random 16 active tags (less than 14 letters long) to display as a menu on the left side
		$sql = "SELECT * FROM pp_keywords WHERE active > 0 AND LENGTH(keyword) < 14 ORDER BY RAND() LIMIT 16";
		$result = mysql_query($sql, $db);
		$tally = 0;
		while ($m = mysql_fetch_array($result)) {	
			// trim takes off any spaces or new line characters
			// ucfirst uppercases the first letter for more consistent viewing - works in most cases	
			echo "<li> <a href='http://www.tapoll.com/poll/tag/".trim($m["keyword"])."' class='pp_topics'>".ucfirst(trim($m["keyword"]))."</a>\n";
			$tally++;
			
			// if ten keywords have been listed we insert some links and then continue listing the other six
			if ($tally == 10) { ?>

<div style="margin-top:12px; margin-bottom:10px; padding:6px; padding-bottom:12px; border-top: 1px dotted #CCCCCC; border-bottom: 1px dotted #CCCCCC;">			
<a href="http://www.tapoll.com/poll/tag/" class="pp_extralink">See All Tags</a>
<br /><a href="http://www.tapoll.com/poll/last/" class="pp_extralink">Last 20 Polls</a>		
<br /><a href="http://tapoll.blogspot.com" class="pp_extralink" target="tech">Tapoll Tech Blog</a>
</div>

<?			
			}
		}		
?>


<!-- here we handle the DHTML hidden and expand part for the tips at the bottom of the left hand column -->

<div style="margin-top:10px; padding:6px;"><a class="pp_extralink" onclick='document.getElementById("tipsTarget").style.display="block"; return false;' href="tapollTips">Tapoll Tips</a></div>
	
<div id="tipsTarget" style="display:none;">
<div style="padding-bottom:5px; text-align:right; border-bottom:1px dotted #cccccc;"><a href="closePanel" onclick='document.getElementById("tipsTarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="24" height="24" border="0"></a></div>
	<div class="tipBox">
You must predict and vote to see results
	</div>
	<div class="tipBox">
There is no search - just use the See all tags link
	</div>
	<div class="tipBox">
You can create your own polls - read the little help links as you go
	</div>
	<div class="tipBox">
You cannot change a poll you have made but you can set it inactive under MANAGE POLLS
	</div>		
	<div class="tipBox">
You can create private polls or at any time make a poll private or public.
	</div>			
	<div class="tipBox">
See the top of a poll to link to any poll or embed a poll on your site
	</div>			
	<div class="tipBox">
Click the Tapoll icon (on polls and inspirational items) to make a poll that refers to that item
	</div>		
	<div class="tipBox">
Get people to take your poll by placing the poll link in the comment area of the inspirational site.
	</div>			
	<div class="tipBox">
Use the words, "This inspired a Tapoll poll - URL to poll goes here"
	</div>			
	<div class="tipBox">
Have fun and take as many polls as you can!
	</div>		

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

// PART 2

////////////////////////////////////////////



<script>

<?
// scripts to toggle right hand column - edit and view
// a little AJAX to send the poll management based on e-mail
// make sure the cookie for email is reset if they send an e-mail
// AJAX Class and cookie script is loaded in part1.php
?>

function managePolls() {
	if (document.getElementById("managetarget").style.display=="block") {
		document.getElementById("managetarget").style.display="none";
	} else {
		document.getElementById("managetarget").style.display="block";
		setSelect(manageform.infofield);
	}
}
function sendManage() {
	if (!manageform.infofield.value.match(/^[^ <>()@?-?]+@[^ <>()@?-?]+\.[a-zA-Z]{2,4}$/)) {
		alert ("Please use a correct e-mail format");		
		return;	
	}
    //AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	var client = new HttpClient();
	client.isAsync = true;	
	client.callback = function(result) {
		if (result != "success") {
			alert ("Sorry, no polls with that e-mail have been found.\n\nContact us if you would like...");	
		} else {
			setCookie("tapoll_email", manageform.infofield.value, 360);
			alert ("A management e-mail has been sent! Thanks!");				
		}
	}
	client.makeRequest('http://www.tapoll.com/poll/ajax.php','command=manage&email='+manageform.infofield.value);
 	//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	
}

function viewPolls() {
	<?
	// show message and e-mail field and if e-mail is there then ajax questions
	// when result comes in set innerhtml of sub div
	// put a message at the bottom about private polls.
	// private polls can be seen through MANAGE POLLS
	?>
	if (document.getElementById("viewtarget").style.display=="block") {
		document.getElementById("viewtarget").style.display="none";
		setCookie("tapoll_view", "off", 360);
	} else {
		document.getElementById("viewtarget").style.display="block";
		setSelect(viewform.infofield);
		setCookie("tapoll_view", "on", 360);
		if (document.getElementById("viewpollholder").innerHTML == "" && viewform.infofield.value != "" && viewform.infofield.value != "please enter e-mail") {
			sendView();
		}
	}
}
function sendView() {
	if (!viewform.infofield.value.match(/^[^ <>()@?-?]+@[^ <>()@?-?]+\.[a-zA-Z]{2,4}$/)) {
		alert ("Please use a correct e-mail format");		
		return;	
	}
    //AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
	var client = new HttpClient();
	client.isAsync = true;	
	client.callback = function(result) {
		if (result == "error") {
			alert ("Sorry, no polls with that e-mail have been found.\n\nContact us if you would like...");	
			document.getElementById("viewpollholder").innerHTML = "";
		} else {
			setCookie("tapoll_email", viewform.infofield.value, 360);
			document.getElementById("viewpollholder").innerHTML = result;
		}
	}
	client.makeRequest('http://www.tapoll.com/poll/ajax.php','command=view&email='+viewform.infofield.value);
 	//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX	
	
}

<?
// below we have the HTML for the tools at top right
// we use the danzen rollover script to show and hide the round dot graphics infront of the tool links
// the clicks toggle the content as per the functions above
// the divs for each of the collapsed and expanded sections are right after each link
// they are called managetarget and viewtarget.  There is also viewpollholder for the polls
// you might want to make sure word wrap is on in your code view - not sure why I mangled it all up like this
// note the usage of JavaScript alert() for tips along the way - not the most elegant but quick to do and infallible
?>

</script>
   
    <td valign="top">
 
<div id="flashContent"></div>

		<script>			
			if (countTimes == 1 || countTimes % showTimes == 0) {
				var r=Math.round(Math.random()*1000000);
				document.write('<img src=/cgi-bin/traffic_plus?company=danzen&page=touchyTapoll&r='+r+' width=1 height=10 />');
			}
		</script>
            
    <div id="myPolls" style="width:289px; border:1px solid #8EBEEE;"><table cellpadding="8" cellspacing="0"><tr><td><img src="http://www.tapoll.com/poll/graphics/mypolls.jpg" width="123" height="25"><br>
          
		  <a href="http://www.tapoll.com/poll/create/" onmouseout="show('tool1',0);" onmouseover="show('tool1',1);"><img name="tool1" src="http://www.tapoll.com/poll/graphics/createpoll.jpg" width="202" height="35" border="0"></a><br />  
          
		  <a href="http://www.tapoll.com/poll/manage/" onclick="managePolls(); return false;" onmouseout="show('tool2',0);" onmouseover="show('tool2',1);"><img name="tool2" src="http://www.tapoll.com/poll/graphics/managepolls.jpg" width="202" height="34" border="0"></a><br />
<div id="managetarget" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="4" cellspacing="0" border="0"><form id="manageform" action=""><tr><td class="pp_manage" colspan="2">Send management e-mail:</td></tr><tr><td colspan="2"><input style="color:#999999" id="infofield" type="text" size="22" value="<? if ($email != "") {echo $email;} else {echo "please enter e-mail";} ?>" /></td></tr><tr><td class="pp_manage"><input type="submit" value="Send" onclick="sendManage(); return false;">   (<a href="javascript:alert('When you make a poll, you are asked for\nyour e-mail to activate the poll. Please\nenter that e-mail here to be sent a\nmanagement e-mail for all your polls')" class=pp_manage>help</a>)</td><td align="right"><a href="closePanel" onclick='document.getElementById("managetarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="24" height="24" border="0"></a></td><td valign="bottom"> </td></tr></form></table></div>

          <a href="http://www.tapoll.com/poll/view/" onclick="viewPolls(); return false;" onmouseout="show('tool3',0);" onmouseover="show('tool3',1);"><img name="tool3" src="http://www.tapoll.com/poll/graphics/viewmypolls.jpg" width="202" height="34" border="0"></a><br />
<div id="viewtarget" style="display:none; padding-top:5px; padding-bottom:5px;"><table cellpadding="4" cellspacing="0" border="0"><form id="viewform" action=""><tr><td class="pp_manage" colspan="2">View polls for e-mail:</td></tr><tr><td colspan="2"><input style="color:#999999" id="infofield" type="text" size="22" value="<? if ($email != "") {echo $email;} else {echo "please enter e-mail";} ?>" /></td></tr><tr><td class="pp_manage"><input type="submit" value="View" onclick="sendView(); return false;">   (<a href="javascript:alert('When you make a poll, you are asked for\nyour e-mail to activate the poll. Please enter\nthat e-mail here to see the public polls you\nhave created.  Private polls can be accessed\nthrough the MANAGE POLLS section.')" class=pp_manage>help</a>)</td><td align="right"><a href="closePanel" onclick='document.getElementById("viewtarget").style.display="none"; setCookie("tapoll_view", "off", 360); return false;'><img src="/zenmix/close.gif" width="24" height="24" border="0"></a></td><td valign="bottom"> </td></tr></form></table>
<br />
<div id="viewpollholder" style="padding-bottom:5px;"></div>

</div>

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


		  <div class="pp_articles">

<table width="289" border="0"  cellpadding="0" cellspacing="0">
	<tr class="pp_subsubbar">
		<td><img src="http://www.tapoll.com/poll/graphics/inspiration.jpg" hspace="3" width="162" height="28"></td>
		<td align=right>		
			<table>
			<tr>
			<td class="pp_inspirationlink"><a class="pp_inspirationlink" href="javascript:alert('Click the Tapoll button next to an inspirational item to start a\nnew poll that references that item so poll takers can click on it.\n\n\nYou can get more people to take your poll if you then post a link to\nyour poll in the comment area on the site where the item is listed.')">guide</a></td>
			</tr>
			</table>
		</td>
	</tr>
</table>

<div class="pp_iconbox" style="display:none; margin-top:14px; margin-bottom:10px;">

<script>

// handle view polls first
if (getCookie("tapoll_view") == "on") {
	viewPolls();
}

// function to handle raising as you rollover
function moveIcon(icon,w) {
	if (icon == selectedIcon) {return;}
	var d = -5 * w;
	document.getElementById("icon"+icon).style.top = d + "px";
	return false;
}

<?
// function to handle clicking on inspirational item 
// the clicked icon gets brighter and raises
// did this with two images - now I would set the opacity - see http://www.danzen.com/focusotalk/ and roll over pics on right
// loop through and put all the icons to default location and image
// then put the selected icon to move up be the bright image and get news
?>
function replaceIcon(icon) {
	selectedIcon = icon;
	setCookie('tapoll', icon, 365);	
	for (i=1; i<=newsArray.length; i++) {
		var t = document.getElementById("icon"+i);
		t.style.top = "0px";
		t.src = iconPics["icon"+i][0].src;
		t.style.marginRight = "4px";
	}
	t = document.getElementById("icon"+icon);
	t.style.top = "-5px";	
	t.src = iconPics["icon"+icon][1].src;
	t.style.marginRight = "4px";	
	
	loadNews(newsArray[icon-1]);
	
	return false;
}

// HTML code to call functions above as you roll over and click
</script>
<style>.icon {position:relative;}</style>
<a href="YouTube" onclick="return replaceIcon(1);" onmouseout="moveIcon(1,0);" onmouseover="moveIcon(1,1);"><img src="http://www.tapoll.com/poll/graphics/off1.jpg" alt="YouTube - video sharing" name="icon1" width="50" height="50" border="0" id="icon1" class="icon"></a><a href="Amazon" onclick="return replaceIcon(2);" onmouseout="moveIcon(2,0);" onmouseover="moveIcon(2,1);"><img src="http://www.tapoll.com/poll/graphics/off2.jpg"  alt="Amazon - books and review sharing" name="icon2" width="50" height="50" border="0" id="icon2" class="icon"></a><a href="Digg" onclick="return replaceIcon(3);" onmouseout="moveIcon(3,0);" onmouseover="moveIcon(3,1);"><img src="http://www.tapoll.com/poll/graphics/off3.jpg" alt="Digg - news story sharing" name="icon3" width="50" height="50" border="0" id="icon3" class="icon"></a><a href="Flickr" onclick="return replaceIcon(4);" onmouseout="moveIcon(4,0);" onmouseover="moveIcon(4,1);"><img src="http://www.tapoll.com/poll/graphics/off4.jpg" alt="Flickr - photo sharing" name="icon4" width="50" height="50" border="0" id="icon4" class="icon"></a><a href="Del.icio.us" onclick="return replaceIcon(5);" onmouseout="moveIcon(5,0);" onmouseover="moveIcon(5,1);"><img src="http://www.tapoll.com/poll/graphics/off5.jpg" alt="Del.icio.us - bookmark sharing" name="icon5" width="50" height="50" border="0" id="icon5"  class="icon"></a>

</div>

<!-- a div for each feed so that it caches the content rather than reload it again  -->
<div id="feed1" style="display:none; padding-top:5px; padding-bottom:5px; color:#cccccc"></div>
<div id="feed2" style="display:none; padding-top:5px; padding-bottom:5px; color:#cccccc"></div>
<div id="feed3" style="display:none; padding-top:5px; padding-bottom:5px; color:#cccccc"></div>
<div id="feed4" style="display:none; padding-top:5px; padding-bottom:5px; color:#cccccc"></div>
<div id="feed5" style="display:none; padding-top:5px; padding-bottom:5px; color:#cccccc"></div>



<style type="text/css">
div#amazoncontent { font-family:'Arial', sans-serif;   font-size:10px;   color:#000000;   background-color:#ffffff;   position:relative;   overflow:hidden;   text-align:left; } 
div#amazoncontent { width:221px;   height:837px; position:relative; left:25px;} 
div.product { position:relative;   padding:3px;   height:76px;   margin-left:65px;   background-color:#ffffff; } 
img.productImage { position:absolute;   left:-65px;   top:3px; } 
p.author { margin:2px 0px; } 
.pp_amazon { width:217px; height:120px; } 
.product { position:absolute; left:-65px; border:none; width:60px; height:60px; background-image:url("http://rcm-images.amazon.com/images/G/01/associates/2005/OM/NoImageAvailable_60x60.gif"); background-repeat:no-repeat; padding:0px; margin:2px; z-index:1; } 	
.pp_amazon p { position:relative; margin:1px; margin-left:65px; } 
.pp_amazon div.prices { color:#990000;  display:none;} 

</style>

<script>

// check cookie and update graphic depending on last selected
// this code runs inline so as the page is loading - note that it is not a function
var defaultNews = "delicious";
var newsArray = ["youtube","amazon","digg","flickr","delicious"];
var newsLookup = [];
iconPics = [];
for (i=0; i<newsArray.length; i++) {
	ii = i+1;
	// for example newsLookup["youTube"] = 1 etc.
	newsLookup[newsArray[i]] = ii;
	// add to previously created empty array of images
	iconPics["icon"+ii] = ["http://www.tapoll.com/poll/graphics/off"+ii+".jpg", "http://www.tapoll.com/poll/graphics/onn"+ii+".jpg"];
}

// a loop to make text references to images into actual image objects
// this type of manipulation is also done in the danzen rollover functions
for (i in iconPics) {
	for (j in iconPics[i]) {
		temp = iconPics[i][j];
		iconPics[i][j] = new Image();
		iconPics[i][j].src = temp;
	}
}

// whenever we select an icon we store its number in a tapoll cookie
if (getCookie("tapoll") != "undefined") {
	news = newsArray[getCookie("tapoll")-1];	
} else {
	news = defaultNews;
}
// because the default news is a name rather than a number it adds a touch of cumbersomeness - speaking of which...
selectedIcon = newsLookup[news];
currentNews = "";

// call the function to to change the icon!
replaceIcon(selectedIcon);

// function to load news via AJAX from news.php to the appropriate div holder (feed1, feed2, etc.)
// note that if there is already something in the holder then it does not go and get it again
// news.php is absolutely full of regular expressions to parse various sites for related stories!
function loadNews(which) {

	if (which != currentNews) {	
		currentNews = which;
		//if the innerHTML for the div is empty		
		if (document.getElementById("feed"+newsLookup[currentNews]).innerHTML == "") {
			document.getElementById("feed"+newsLookup[currentNews]).innerHTML = "loading...";
			//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
			var client = new HttpClient();
			client.isAsync = true;	
			client.callback = function(result) {
				if (result == "error") {
					//alert ("Could not connect to news feed");	
					document.getElementById("feed"+newsLookup[currentNews]).innerHTML = "";
				} else if (result == "") {
					document.getElementById("feed"+newsLookup[currentNews]).innerHTML = "no feed at the moment";
				} else {
					//alert ("-"+result+"-");
					document.getElementById("feed"+newsLookup[currentNews]).innerHTML = result;
				}
			}
			client.makeRequest('http://www.tapoll.com/poll/news.php','app=tapoll&feed='+currentNews+'&topic=<? echo urlencode($adtopics[array_rand($adtopics)]); ?>');
			//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX						
		}
		//show the div and hide the others		
		for (i=0; i<newsArray.length; i++) {
			ii = i+1;				
			document.getElementById("feed"+ii).style.display = "none";				
		}			
		document.getElementById("feed"+newsLookup[currentNews]).style.display = "block";			
	}			
}

<?
// this function is called from any Tapoll button on the news content
// its purpose is to transfer the news item to the create a poll page where it gets placed as related content
// the way it does it is by parsing out the content it needs and putting it into a cookie
// then the window is told to go to the create.php page and pass a parameter of tapoll
// this tells the create page to look for a cookie with the related content
// kind of strange but inventive ;-)
// I have done this type of stuff by storing variables right on the window as opposed to the document - so window.variableName = "hello"
// and then when you get to the other page you can access the same variables via window.variableName
// this is how I managed http://www.hipcats.com which was about 20 times more twisted than Tapoll ;-)
?>
function tapoll(w) {
	var n = document.getElementById(w).innerHTML;
	var s = / <a class="*pp_tapoll"*/i;
	temp = n.split(s);	
	n = temp[0];
	setCookie("tapoll_news", n, 1);
	window.location = "http://www.tapoll.com/poll/create/tapoll"; 
}

<?
// this function is called from any Tapoll button on another poll and then uses the same cookie passing technique as above
// note the technique for removing the link and leaving the question to be inserted into a new link
// and for replacing the image with the word [image] in case there is a prior reference image
// the reference is not passes along in the new reference - it gets a little silly when we do that ;-)
?>
function tapoll2() {
	<?
		$question = (isset($question)) ? $question : "";
		$question2 = preg_replace("/<a[^>]*>/i","",$question);
		$question2 = preg_replace("/<\/a[^>]*>/i","",$question2);		
		$question2 = preg_replace("/<\/img[^>]*>/i","[image]",$question2);			
		$question2 = preg_replace("/'/i","`~`",$question2);
		$question2 = stripslashes($question2);
		$id = (isset($id)) ? $id : "";
	?>
	n = '[poll] <a href="http://www.tapoll.com/poll/id/<? echo $id; ?>"><? echo "$question2"; ?></a>';

	setCookie("tapoll_news", n, 1);
	window.location = "http://www.tapoll.com/poll/create/tapoll"; 
}

// a special parsing for Amazon
function tapolla(w) {
	w = w.replace(/`\^`/g,"\"");
	w = w.replace(/`\~`/g,"'");	
	setCookie("tapoll_news", w, 1);
	window.location = "http://www.tapoll.com/poll/create/tapoll"; 
}	

</script>

	</div> <!-- /feeds -->
						
    </div> <!-- /inspiration -->   </td>
  </tr>
  
  <!-- start of footer with expand and collapse manipulation similar to the other expanding and collapsing sections -->
  <!-- the hidden divs are above the footer links rather than below -->
  
  <tr>
    <td colspan="3"><div align="center" class="pp_copy" style="border-top:1px dotted #dddddd; margin-top:10px; padding-top:10px;">
<div id="footerTarget" style="border-bottom:1px dotted #dddddd; display:none; padding-bottom:6px;"></div>	
<div id="faqTarget" style="border-bottom:1px dotted #dddddd; display:none; padding-bottom:6px;"><table width='980' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' class='pp_footertext'><table cellpadding='0' cellspacing='0' border='0'><form id="faqForm" action=""><tr><td class='pp_footertext'>Please submit a question or a tip you have for the Tapoll Tips  <input type='text' name='faqq'></td><td>  <input type='submit' value='Submit' onclick='faqMail(); return false;'></td></tr></form></table></td><td align='right'><a href="closePanel" onclick='document.getElementById("faqTarget").style.display="none"; return false;'><img src="/zenmix/close.gif" width="24" height="24" border="0"></a></td></tr></table></div>
	
	<table align="center"><tr><td valign="center"><img src="/graphics/cc.gif"></td><td class="pp_copy" valign="center"> <? echo date(Y); ?> <a class="pp_copy" href="http://www.danzen.com" target="danzen">Dan Zen - mad inventor meets Internet finds peace</a> | <a class="pp_copy" onclick = "showFooter('privacy'); return false;" href="privacy">privacy</a> | <a class="pp_copy" onclick = "showFooter('terms'); return false;" href="terms">terms</a> | <a class="pp_copy" onclick = "showFaq(); return false;" href="tips">tips</a> | <a class="pp_copy" onclick = "showFooter('contact'); return false;" href="contact">contact</a></td></tr></table></div></td>
  </tr>
</table>
<script>
	function showFooter(w) {	
		document.getElementById("faqTarget").style.display="none";
		d = document.getElementById("footerTarget");
		d.style.display="block";
		c = "<table width='980' cellpadding='0' cellspacing='0' border='0'><tr><td align='center' class='pp_footertext'>";
		
		<?
		// a case statement is like a fancy if else if statement
		// switch(w) means test the w (which is the target div id)
		// if the w is the first case, "privacy" then do what is down below
		// break takes you out of the switch otherwise it goes to the next test and on to the default
		// note as well the breaking up of the e-mail message with JavaScript so that crawlers cannot find it\
		// the FAQ or Tips section is a little different so it uses the next function to handle sending a tip with AJAX - like we did for share above the poll
		?>
		
		switch (w) {
			case "privacy":
				c += "Your poll activation e-mail will be kept private.  Private polls will not be listed under the tags section.";
				break;
			case "terms":
				c += "Tapoll and creators have rights to their polls and results. Public is subject to Creative Commons.";
				break;
			case "contact":
				c += "Please e-m" + "ail us if you have any concerns, comments or suggestions! <a class='pp_copy' style='font-size:12px' href='mai"+"lto"+":door"+"@"+"danzen.com'>door"+"@"+"danzen.com</a>";															
				break;
			default: 
				d.style.display="none";			
		}			
		c += "</td><td align='right'><a href=\"closePanel\" onclick='document.getElementById(\"footerTarget\").style.display=\"none\"; return false;'><img src=\"/zenmix/close.gif\" width=\"17\" height=\"17\" border=\"0\"></a></td></tr></table>";
		d.innerHTML = c;	
	}
	function showFaq() {
		document.getElementById("faqTarget").style.display="block";
		document.getElementById("footerTarget").style.display="none";
	}
	function faqMail() {
		if (faqForm.faqq.value=="") {
			alert("Please enter a question..."); 
			return;
		} else {
			//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
			var client = new HttpClient();
			client.isAsync = true;	
			client.callback = function(result) {
				 alert ("Thank you for your suggestion\nwe will review and perhaps work it\nin to the Tapoll Tips");	
			}
			client.makeRequest('../ajax.php','command=faq&q='+faqForm.faqq.value);
			//AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA   /AJAX   XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX				
		}
	}
	
</script>

<p> </p>
<p><br>
  <br>
  <br>  
    <script>
	// here is the tracking code used on all my Dan Zen pages and more it puts in a random number to avoid caching
var r=Math.round(Math.random()*1000000);
document.write('<img src=/cgi-bin/traffic_plus?company=danzen&page=tapoll&r='+r+' width=1 height=1>');
    </script>
</p>
</body>
</html>