var admsg="Your Message Here";						// default message in picture
var changed=false;								// sees if they have changed the message 
var adnum=Math.round(Math.random()*5); 					// random number that selects fake ad to display

offfake= new Image();							// creates and sets the image for the fake ad
offfake.src=ROOT + "gizmos/bannerads/banner" + adnum + ".gif";			// source of picture of fake ad
onfake = new Image()							// creates and sets image for mouseover fake ad
onfake.src=ROOT + "gizmos/bannerads/bannermsg.cgi?msg=" + admsg;		// source of underneath message 

function updatescreen()
    // makes all changes to screen, based on current message and ad
	{onfake.src=ROOT + "gizmos/bannerads/bannermsg.cgi?msg=" + admsg;
	jscode="&lt;script language=\"JavaScript\" src=\"" + ROOT + "gizmos/gizmos.js\">&lt;/script>\n";
	jscode+="&lt;script>pj_bannerad(\"" + admsg + "\");&lt;/script>";
	document.getElementById("scriptbody").innerHTML=jscode;
	}
function ae_bannerads()
    // loads on start up to set banner ad and message
	{admsg=document.getElementById("umsg").value;
	document["fakead0"].src=offfake.src;
	document["fakead1"].src=offfake.src;
	updatescreen();
	}
function pjbanner(n)
    // toggles images from ad to message, depending on cursor location 
	{pic="fakead" + n;
	if (document[pic].src==offfake.src) document[pic].src=onfake.src;
	else document[pic].src=offfake.src;
	}
function changemsg()
    // operates button when user changes message, validates message, changes it on screen 
	{inmsg=document.getElementById("umsg").value;
	at=inmsg.indexOf("\"");
	while (at>0)
    // replaces double quotes with single quotes so it won't screw up javascript snippet 
		{inmsg=inmsg.substring(0, at) + "'" + inmsg.substring(at+1);
		at=inmsg.indexOf("\"");
		}
	if (inmsg==admsg)
    // if message unchanged and change message button clicks, yells at them
		{note="Hey Hooker Lips,\n\nYou didn't change the message. Fill in your own text in the box above the button and try it again.";
		note+="\nIt's the one that used to say \"" + admsg + "\" but now says \"You're A Dumbass\".";
		alert(note);
		inmsg="You're A Dumbass";
		document.getElementById("umsg").value=inmsg;
		}
	if (inmsg.length>65)
    // if message is too long, tells them
		{note="Your Message Is Too Long";
		alert(note);
		}
	else
    // if message good, changes everything and shows it
		{admsg=inmsg;
		updatescreen();
		if ((changed==false) && (inmsg!="You're A Dumbass"))
    // if this is 1st time they changed it, tells them what to do 
			{alert("Now put your cursor over the ad and your message will be displayed.\n\nI won't bug you with this prompt again.");
			changed=true;
			}
		}
	return false;
	}
