I am pulling my hair out and about ready to punch something!
I've had a "**** like" ajax voting function on my site for some time, but just recently noticed the voting does not work any other place than the front-page of the site.

The code is the same, but for some reason not all the variables are being passed to the vote script. I found this out by adding some code to the vote.php file the JS calls, to write a log file each time it's called. And on subpages the $id variable is not getting there. I tried renaming the variable to something else, with no effect.

The site is www.canadaka.net and the voting works on that front-page, but any subpage like http://www.canadaka.net/news_links it does not.

Here is the javascript used for the voting
Code:
<script language="javascript" type="text/javascript">
var xmlHttp

function newsvote(str,type)
{ 
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null)
	  {
	  alert ("Your browser does not support AJAX!");
	  return;
	  } 
	var url="http://www.canadaka.net/modules/News_Links/vote.php";
	url=url+"?op="+type;
	url=url+"&id="+str;
	xmlHttp.onreadystatechange=function(){stateChanged(str)}
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}

function stateChanged(str) 
{ 
	if (xmlHttp.readyState==4)
	{ 
		document.getElementById(str).innerHTML=xmlHttp.responseText;
	}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
</script>
and here is the bit of code for the vote buttons
PHP Code:
<strong style="padding-left:4px;" id="'.$result[id].'"><a href="/news/'.$result[id].'-'.$link_title.'" style="font-size:15px; color:#A5A5A5;">'.$rating.'</a></strong></td>';
echo "<td width=\"5\" rowspan=\"2\" calign=\"top\">
    <img src=\"images/news-up.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"news up\" style=\"position:absolute; margin-left:-39px; margin-top:-5px;\" onClick=\"newsvote('
$result[id]','up');\">
    <img src=\"images/news-down.gif\" width=\"11\" height=\"11\" border=\"0\" alt=\"news down\" style=\"position:absolute; margin-left:-39px; margin-top:6px;\" onClick=\"newsvote('
$result[id]','down');\">
    </td>"; 
I really can't understand why it works in one place and not another. I even copied the entire contents of either location into the other and no change.

Please help, i'm not a javascript guru, PHP is more my thing.