
$(document).ready(function(){
	
	var iH = $("#content2").height();
/*	$("#side2_b").css('min-height',iH+'px');
	$("#side_b").css('min-height',iH+'px');*/
	$(".treeviewRecords").show();
	
	$(".onOffLabel label").click( function (){
		$(this).parents('.onOffLabel').find('div').each(function() { $(this).slideToggle('fast'); });
	});		
	

	
	$.expr[':'].icontains = function(obj, index, meta, stack){
	return (obj.textContent || obj.innerText || jQuery(obj).text() || '').toLowerCase().indexOf(meta[3].toLowerCase()) >= 0;
	};	
	
	$.expr[":"].econtains = function(obj, index, meta, stack){
	return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
	}	
	
	$("#searchRelInput").keyup( function (){
		var searchValue = $("#searchRelInput").val();
		
		if(searchValue!=""){
			$('.relativeWithItems').find('a').each( function (){
				$(this).parents('.relativeItem').addClass('displayNone');
			});
			
			$('.relativeWithItems').find('a:icontains("'+searchValue+'")').each( function (){
				$(this).parents('.relativeItem').removeClass('displayNone');
			});
		}else{
			$('.relativeWithItems').find('a').each( function (){
				$(this).parents('.relativeItem').removeClass('displayNone');
			});			
		}
	});			
	
});

function getCookieData(){ // decompile data from cookie
cookieContent=getCookie(cookieName)
if(!cookieContent){return}

retrievedData=cookieContent

return retrievedData;

}

// An adaptation of Dorcht's cookie functions.

function setCookie(name, value, expires, path, domain, secure){
if (!expires){expires = new Date()}
document.cookie = name + "=" + escape(value) + 
((expires == null) ? "" : "; expires=" + expires.toGMTString()) +
((path == null) ? "" : "; path=" + path) +
((domain == null) ? "" : "; domain=" + domain) +
((secure == null) ? "" : "; secure")

}

function getCookie(name) {
var arg = name + "="
var alen = arg.length
var clen = document.cookie.length
var i = 0
while (i < clen) {
var j = i + alen
if (document.cookie.substring(i, j) == arg){
return getCookieVal(j)
}
i = document.cookie.indexOf(" ", i) + 1
if (i == 0) break
}
return null
}

function getCookieVal(offset){
var endstr = document.cookie.indexOf (";", offset)
if (endstr == -1)
endstr = document.cookie.length
return unescape(document.cookie.substring(offset, endstr))
}

function deleteCookie(name,path,domain){
document.cookie = name + "=" +
((path == null) ? "" : "; path=" + path) +
((domain == null) ? "" : "; domain=" + domain) +
"; expires=Thu, 01-Jan-00 00:00:01 GMT"
}

