Hmm, well I couldn't get it to work in FF and I'm not sure why. As I was trying to figure it out I thought of a much easier method since its a bit of a hack anyway. The ad is created when the page first loads and the google ad is in a div called "adsense". Instead of getting rid of it then trying to recreate it, it is easier to just hide it when you don't want it seen then put it back when the sponsor tab is clicked again.
To do this only 3 changes need to be made (I think).
1) Clear out any google adsense stuff from test.html so I think it would look something like this
<div id="rightc">
<div id="search">
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.ca/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img></a>
</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="www.PicSpot.com"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="15" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb"></input>
</td></tr>
<tr>
<td> </td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="www.PicSpot.com" id="ss1"></input>
<label for="ss1" title="Search www.PicSpot.com"><font size="-1" color="#000000">www.PicSpot.com</font></label></td>
</tr>
</table>
<input type="hidden" name="client" value="pub-5041827444844508"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="1054467746"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000 000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->
</div>
2) Change the code in the header to look something like this
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid, url=="test.html");
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}
function loadpage(page_request, containerid, doAds){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
var adiv = document.getElementById(containerid);
adiv.innerHTML=page_request.responseText;
if (doAds) {
document.getElementById("adsense").style.display = "";
} else {
document.getElementById("adsense").style.display = "none";
}
}
}
3) And last move the "adsense" div outside the "rightc" div.
Notice that the doAds variable is set when the url == "test.html" and when that is not true it sets the style display of the adsense div to "none" and clears it otherwise.
Here is my overall test code. I was having issues with loadobjs() so I commented it out since I didn't download all the styles, graphics and such but just the html.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid, url=="test.html")
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}
function loadpage(page_request, containerid, doAds){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
var adiv = document.getElementById(containerid);
adiv.innerHTML=page_request.responseText;
if (doAds) {
document.getElementById("adsense").style.display = "";
} else {
document.getElementById("adsense").style.display = "none";
}
}
}
/*
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
*/
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="style.css" rel="stylesheet" type="text/css" />
<title>Upload Images & Win Prizes | PicPrize.com</title>
</head>
<body>
<div id="container">
<div id="header">
<div id="logo">
<a href="index.php"><img src="images/logo.png" alt="PicPrize.com" width="208" height="69" /></a>
</div>
<div id="nav">
<ul class="nav">
<li class="fs_home"><a href="index.php">Home</a></li>
<li class="fs_about"><a href="about.php">About</a></li>
<li class="fs_other"><a href="other.php">Other</a></li>
<li class="fs_sponsors"><a href="javascript:ajaxpage('test.html','rightc');">Sponsors</a></li>
<li class="fs_winners"><a href="javascript:ajaxpage('test2.html','rightc');">Winners</a></li>
<li class="fs_links"><a href="javascript:ajaxpage('test3.html','rightc');">Links</a></li>
</ul>
</div>
</div>
<div id="content">
<div id="leftc">
<div id="register">
<a class="reg" href="register.php">Register to Win Prizes!</a>
</div>
<div id="login">
<form method="post" enctype="multipart/form-data" action="upload.php">
<div id="form">
<label><strong>Username:</strong></label>
<input name="username" type="text" value="Username" size="20" maxlength="10" />
<label><strong>Password:</strong></label>
<input name="password" type="password" value="Password" size="20" maxlength="10" />
<a href="register.php" class="links">Need to register?</a>
<a href="password.php" class="links">Forgot your password?</a> </div>
<div id="form2">
<input name="login" type="image" src="images/login.png"/>
</div>
</form>
</div>
<div id="prize">
<h1 class="title">This Weeks Prize</h1>
<a href="prize.php"><img src="images/prize.png" alt="Win Me!" border="0" /></a>
</div>
<div id="sponsor">
<h1 class="title">Sponsor</h1>
<div id="info">
<script type="text/javascript"><!--
google_ad_client = "pub-5041827444844508";
google_ad_width = 234;
google_ad_height = 60;
google_ad_format = "234x60_as";
google_ad_type = "text";
//2007-04-04: HomeLC1
google_ad_channel = "9765978322";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</div>
<div id="upload">
<h1 class="title">Upload a Picture</h1>
<div id="info2">
<center>
<h3 class="subtitle">Select a Picture File to Upload</h3>
<form method="post" enctype="multipart/form-data" action="upload.php">
<input type="file" name="userfile" size="25" />
<br /> <br />
<input name="login" type="image" src="images/upload.png"/>
</form>
</center>
</div>
</div>
</div>
<div id="rightc">
<div id="search">
<!-- SiteSearch Google -->
<form method="get" action="http://www.google.ca/custom" target="_top">
<table border="0" bgcolor="#ffffff">
<tr><td nowrap="nowrap" valign="top" align="left" height="32">
<a href="http://www.google.com/">
<img src="http://www.google.com/logos/Logo_25wht.gif" border="0" alt="Google" align="middle"></img></a>
</td>
<td nowrap="nowrap">
<input type="hidden" name="domains" value="www.PicSpot.com"></input>
<label for="sbi" style="display: none">Enter your search terms</label>
<input type="text" name="q" size="15" maxlength="255" value="" id="sbi"></input>
<label for="sbb" style="display: none">Submit search form</label>
<input type="submit" name="sa" value="Search" id="sbb"></input>
</td></tr>
<tr>
<td> </td>
<td nowrap="nowrap">
<table>
<tr>
<td>
<input type="radio" name="sitesearch" value="" checked id="ss0"></input>
<label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td>
<td>
<input type="radio" name="sitesearch" value="www.PicSpot.com" id="ss1"></input>
<label for="ss1" title="Search www.PicSpot.com"><font size="-1" color="#000000">www.PicSpot.com</font></label></td>
</tr>
</table>
<input type="hidden" name="client" value="pub-5041827444844508"></input>
<input type="hidden" name="forid" value="1"></input>
<input type="hidden" name="channel" value="1054467746"></input>
<input type="hidden" name="ie" value="ISO-8859-1"></input>
<input type="hidden" name="oe" value="ISO-8859-1"></input>
<input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:663399;AH:center;BGC:FFFFFF;LBGC:336699;ALC:0000FF;LC:0000FF;T:000 000;GFNT:0000FF;GIMP:0000FF;FORID:1"></input>
<input type="hidden" name="hl" value="en"></input>
</td></tr></table>
</form>
<!-- SiteSearch Google -->
</div>
</div>
<div id="adsense">
<script type="text/javascript"><!--
google_ad_client = "pub-5041827444844508";
google_ad_width = 300;
google_ad_height = 250;
google_ad_format = "300x250_as";
google_ad_type = "text";
//2007-04-04: HomeRC1
google_ad_channel = "3330026039";
google_color_border = "336699";
google_color_bg = "FFFFFF";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
</div>
<div id="footer">
<div id="btmlinks">
</div>
</div>
</div>
</body>
</html>
david_kw