
function writeswf(flashmovie,width,height,flashvars,transparent)
{

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+width+'" height="'+height+'" align="top">');
	document.write('<param name="movie" value="'+flashmovie+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="menu" value="false">');
	if (typeof(flashvars)=="string")
	{
		flashvars+="&jsenabled=yes"
	}
	else
	{
		flashvars="jsenabled=yes";
	}
	document.write('<param name="flashvars" value="'+flashvars+'">');
	if (transparent==true)
	{
		document.write('<param name="wmode" value="transparent">');
	}
	document.write('<embed src="'+flashmovie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" align="top" menu="false" flashvars="'+flashvars+'"');
	if (transparent==true)
	{
		document.write(' wmode="transparent"');
	}
	document.write('>');
	document.write('</embed>');
	document.write('</object>');
}

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;
var position = 0;

function startPolling(vartopoll){
setInterval("poll('"+vartopoll+"')", 500);
}

function poll(vartopoll){

if (navigator.appName == "Microsoft Internet Explorer")
{position = document.body.scrollTop;}
else {position = window.pageYOffset;}

//determining range
move(vartopoll,0,position);

return true;
}

function move (id, x, y) {
	e=document.getElementById(id);
	e.style.top = parseInt(document.all[id].top) + parseInt(y);
}

function fitif (iframeWindow) {
  if (iframeWindow.document.height) {
    var iframeElement = parent.document.getElementById(iframeWindow.name);
    iframeElement.style.height = iframeWindow.document.height + 'px';
//    iframeElement.style.width = iframeWindow.document.width + 'px';
  }
  else if (document.all) {
    var iframeElement = parent.document.all[iframeWindow.name];
    if (iframeWindow.document.compatMode &&
        iframeWindow.document.compatMode != 'BackCompat') 
    {
      iframeElement.style.height = 
        iframeWindow.document.documentElement.scrollHeight + 'px';
//      iframeElement.style.width = 
//        iframeWindow.document.documentElement.scrollWidth + 'px';
    }
    else {
      iframeElement.style.height = iframeWindow.document.body.scrollHeight + 'px';
//      iframeElement.style.width = iframeWindow.document.body.scrollWidth + 'px';
    }
  }
}

var http = getHTTPObject();

function updaterating(variasid,variastype,variasrating) {
	var url = '/manip.php3?action=rating&id=' + variasid + '&type=' + variastype + '&rating=' + variasrating;
    http.open("GET", url, true);
    http.onreadystatechange = handleHttpResponse;  
    http.send(null); 
}

function handleHttpResponse() {
    if (http.readyState == 4) {  
        var response = http.responseText;
		states = response.split("|");
		var variasid = states[0];
		var variastype = states[1];
		var variasrating = states[2];
		var newrating = states[3];

		if (variasrating == '-1') {
			document.getElementById(variastype + variasid + "thumbdown").src = "/images/thumbdown_on.gif";
			document.getElementById(variastype + variasid + "thumbup").src = "/images/thumbup_noex.gif";
		}
		if (variasrating == '1') {
			document.getElementById(variastype + variasid + "thumbdown").src = "/images/thumbdown_noex.gif";
			document.getElementById(variastype + variasid + "thumbup").src = "/images/thumbup_on.gif";
		}

		if (newrating > 0) {
			document.getElementById("rating" + variastype + variasid).innerHTML = "<font color='#009900'>+"+newrating+"</font>";
		}
		if (newrating < 0) {
			document.getElementById("rating" + variastype + variasid).innerHTML = "<font color='#CC0000'>"+newrating+"</font>";
			document.getElementById(variastype + variasid).style.display='none';
			document.getElementById(variastype + "show" + variasid).style.display='inline';
		}
		if (newrating == 0) {
			document.getElementById("rating" + variastype + variasid).innerHTML = 0;
		}
		document.getElementById("thumbuplink" + variastype + variasid).style.display='none';
		document.getElementById("thumbdownlink" + variastype + variasid).style.display='none';
	}
} 

function getHTTPObject() { 
  var xmlhttp; 
  /*@cc_on 
  @if (@_jscript_version >= 5) 
    try { 
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
    } catch (e) { 
      try { 
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
      } catch (E) { 
        xmlhttp = false; 
      } 
    } 
  @else 
  xmlhttp = false; 
  @end @*/ 
  if (!xmlhttp && typeof XMLHttpRequest != "undefined") { 
    try { 
      xmlhttp = new XMLHttpRequest(); 
    } catch (e) { 
      xmlhttp = false; 
    } 
  } 
  return xmlhttp; 
} 