function setClassName2(object){
	var cn = object.className;
	object.className = cn=='show'?'hide':'show';
	}
var QS = new Array;
var Selected = new Array;
var timeout = null;
var openned = [];

function init_paging (o) {
	var ul = o.getElementsByTagName('UL')[0];
	setClassName2(ul);
		
	o.onclick = function(){if(!openned[o.id]){
			setClassName2(ul);}
			return false;	
		}
			
	o.onmouseout = function(){
		if(!openned[o.id]){
		timeout = setTimeout(function(){
		ul.className = 'hide';
		}, 500);
		}
	}

	ul.onmouseover = function(){
		clearTimeout(timeout);
		if(openned[o.id] != true)
		{
		openned[o.id] = true;
		ul.className = 'show 2';
		}
	}
	ul.onmouseout = function(){
		timeout = setTimeout(function(){
		ul.className = 'hide';
		openned[o.id] = false;
		}, 500);
	}
	
	
	init_qs();
	for(var x in ul.getElementsByTagName('a'))
	{
		var a = ul.getElementsByTagName('a')[x];
		a.onclick = function()
		{
			//this.parentNode.className ='hide';
				QS[o.id] = this.getAttribute('rel');
				Selected[o.id] = this.childNodes[0].nodeValue;
			o.getElementsByTagName('SPAN')[0].innerHTML = Selected[o.id];
			
			
			if(null != document.getElementById('oid')){
				document.getElementById('oid').value= this.getAttribute('rel');
			}
			if('undefined' !=  typeof o.getElementsByTagName('INPUT')[0])
			{				
				o.getElementsByTagName('INPUT')[0].value = Selected[o.id];
			}	
			if('paging' == this.parentNode.parentNode.parentNode.id 
				|| 'faq' == this.parentNode.parentNode.parentNode.id)
				{
					window.location = this.href;
				}
			openned[o.id] = true;
			//alert(ul.className)	
			ul.className ='hide';
			return false;
		}
	}
}
function bild_location(){
	var str = '';
	for(var x in QS)
	{
		if('page' != x)
		{
			str += '&'+x+'='+QS[x];
		}
	}
	window.location = window.location.pathname+'?'+ str;
}
function init_qs(){
	var search = window.location.search;
	var qs =  search.split('&');
	for(var x in qs)
	{
		if(qs[x]!='?' && qs[x]!='')
		{			
			var cur = qs[x].split('=');
			QS[cur[0]] = cur[1];
		}
		
	}
}

