/*
	CET Virtual Library™

	Centre for Educational Technology,
	Ramat-Aviv, Israel.
	http://lib.cet.ac.il/

	important.JS
*/

	function showImportant (id)
	{
		var b1 = document.all(id)
		var b2 = document.all(id + "On")
		
		b1.style.display = "none"
		b2.style.display = "block"
	}
	function hideImportant (id)
	{
		var b1 = document.all(id)
		var b2 = document.all(id + "On")
		
		b1.style.display = "block"
		b2.style.display = "none"
	}
	
	function setImportant (id, iid)
	{	
		showImportant(id)	
		doImportantAction (iid, sid.value, "set")
	}
	
	function removeImportant (id, iid)
	{
		hideImportant(id)
		doImportantAction (iid, sid.value, "remove")
	}
	
	function doImportantAction(iid, sid, action)
	{
		var e = document.createElement("IMG")
		e.src = "submit.asp?item=" + iid + "&rel=" + action + "&sid=" + sid
	
		//try
		//{
			with(document)
			{
				document.appendChild (e)
			}	
		//}catch(e){}
	}
	
	function show_important ()
	{		
		if ( new Number(impCount.innerText)  > 0 )
			window.location.href = "sub.asp?imp=1"
	}
	
	function update_important (count)
	{
		try
		{
			if ( count > 0)
			{
				impIcon.className = "clsMediaBarIcon"
				impIcon.style.cursor = "hand"
			}
			else
			{
				impIcon.className = "clsMediaBarIconD"
				impIcon.style.cursor = "default"
			}				
			
			impCount.innerText = count
		}
		catch(e)
		{
		}
	}

