// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

divid = "0";

function thumbsfunction(idref,todo)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="thumbmanager.php?idref="+idref+"&todo="+todo;
divid = idref;
xmlHttp.onreadystatechange=thumbstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function thumbsfunction_v2(idref,todo)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="thumbmanager_v2.php?idref="+idref+"&todo="+todo;
divid = idref;
xmlHttp.onreadystatechange=thumbstateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function quickvotefunction(idref, todo, instrument)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="quickrate.php?idref="+idref+"&todo="+todo+"&instrument="+instrument;
divid = idref+"_"+instrument
xmlHttp.onreadystatechange=quickvotestateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function votefunction(idref,todo)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="votemanager.php?idnum="+idref+"&todo="+todo;
divid = idref;
xmlHttp.onreadystatechange=votestateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function thumbstateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("thumb_"+divid).innerHTML=xmlHttp.responseText 
 }
}

function quickvotestateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("rate_"+divid).innerHTML=xmlHttp.responseText 
 }
}

function votestateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById("vote_"+divid).innerHTML=xmlHttp.responseText 
 }
}

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
