function hideUnhide(pelement, element, selement){
	$("#"+element).toggle();
	//$("#"+pelement+" > .toggle_div > .leftLine").toggleClass("leftLineFull");
	//$("#"+pelement+" > .toggle_div > .leftLine > h3").toggleClass("orange");
	
	$("#"+pelement+" > .toggle_div > table tr td > .toggleme").toggleClass("open");
	$("#"+pelement+" > .toggle_div > table tr td > .toggleme").toggleClass("close");

	
	if (selement.className == "toggleme close"){
		$("#"+pelement+" > .toggle_div > table tr td > .toggleme").attr("src", "img/button-minus.gif");
	}
	if (selement.className == "toggleme open"){
		$("#"+pelement+" > .toggle_div > table tr td > .toggleme").attr("src", "img/button-plus.gif");
	}


}

function hideUnhideOBH(elementId){
	$(".oglasavanjeBoxHidden").hide();
	$("#obh"+elementId).show();
}



function showChildren(element, elementChild){
	$(".subMenu > li > div").removeClass("selected");
	$(element).toggleClass("selected");
	$(".rightColumn > div").hide();
	$("#"+elementChild).show();
}


var openvcat="";
var showvcattimerID=0;

function showvcat(divid) {
	closevcat();
	openvcat=divid;
	document.getElementById(divid).style.display="block";
	
}

function hidevcat(divid) {
	openvcat="";
	document.getElementById(divid).style.display="none";
	if (document.getElementById("loginbox") != null){
		document.getElementById("loginbox").style.display='none';
	}
}


function closevcat() {
	if (showvcattimerID != 0) killtimedclose();
	if (openvcat!="") hidevcat(openvcat);
}



function timedvcatclose(divid) {
	if (showvcattimerID++ == 0) {
		showvcattimerID=setTimeout("closevcat()",300);

	} else {
		showvcattimerID--;
	}
}


function killtimedclose() {
	clearTimeout(showvcattimerID);
	showvcattimerID=0;
}

//function debug(mymsg) {
//	document.getElementById("debugdiv").innerHTML+=mymsg+" | ";
//}

function showlogin(){
	showvcat("loginboxInner");
	 document.getElementById("loginbox").style.display='block';
}

function submitSearchForm(searchForm, hiddenSearchForm){
	hiddenSearchForm.q.value = searchForm.q.value;
//	alert(hiddenSearchForm.childNodes);
	for(node in hiddenSearchForm.childNodes)
		alert(hiddenSearchForm.childNodes[node]);
	hiddenSearchForm.submit();
}


function getXmlHttp(){
	var xmlHttp;
	try{
		xmlHttp=new XMLHttpRequest();
	}catch (e){
		try{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try{
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){
			    alert("Your browser does not support AJAX!");
				return null;
			}
		}
	}
	return xmlHttp;
}

function xmlLoadUrl(url, callback){
	var xmlHttp = getXmlHttp();
	if(xmlHttp == null){
		return false;
	}
	xmlHttp.onreadystatechange=function(){
		if(xmlHttp.readyState==4){
			callback(xmlHttp);
		}
	}
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}

function openDivById(id){
	document.getElementById(id).style.display='block';
}

function closeDivById(id){
	document.getElementById(id).style.display='none';
}

function openCloseDivById(id){
	var node = document.getElementById(id);
	if(node.style.display=='none'){
		document.getElementById(id).style.display='block';
		return false;
	}
	document.getElementById(id).style.display='none';
	return true;
}

