
function sc(a)
{
	//var f=document.getElementById('hCurPage');
	//if(f&&f.value!=a.id)
		{s(a);}
	return false;
}


function s(a)
{
	var l=document.getElementById('sl');
	if(l)	{l.innerText=a.title+':';}
	
	var hCurPage=document.getElementById('hCurPage');
	var hSType=document.getElementById('hSType');
	if(hCurPage)
	{
		//deselect all
		var pages = document.getElementsByTagName("SPAN");
        for(var i=0;i<pages.length;i++)
		{
			var page=pages[i]
			if (page.id.indexOf("tp_") > -1)
				page.className="none";
		}
				
		var newP=document.getElementById(a.getAttribute("span")); 
		if(newP){newP.className="arrow";}
		
		hCurPage.value=a.id;
		if (hSType){hSType.value = a.getAttribute("sType");}
	}
	doFocus();
	return true;
}

function doFocus()
{
	var e=document.activeElement;
	var tgt=document.getElementById("sh");
	if(e&&tgt)
	{
		tgt.setAttribute("autocomplete","");
		if(!document.body.scrollTop){tgt.focus();}
	}
}

function doSearch()
{
	var tgt=document.getElementById("sh");
	if (tgt&&tgt.value!='')
	{		
		var hCurPage=document.getElementById('hCurPage');
		var hSType=document.getElementById('hSType');
		if(hCurPage)
		{
			var a=document.getElementById(hCurPage.value);
			if(a)
			{
				var sType = 1;
				if (hSType){sType = hSType.value;}
				hCurPage.value = "sa1";
				hSType.value = "1";
				window.location.reload(a.href + '?stype='+ sType );
			}
		}
	}
}


