function display(contents) {
	var resultDiv = document.getElementById("institut-area-filter");
	resultDiv.innerHTML = contents;
}

function proces() {
	var procesDiv = document.getElementById("institut-area-filter");
	procesDiv.innerHTML = "Nalagam...";
}

function procesResult() {
	var procesDiv = document.getElementById("result-container");
	procesDiv.innerHTML = "Nalagam...";
}

function checkUncheckAll(FormName, idName, checkName) {
	var i = 1;
	var idName = idName;
	var FormName = document.getElementById(FormName);

	for (i = 0; i <= FormName.elements.length; i++) {
		if (FormName.elements[i]) {
			if (typeof checkName == 'undefined') {
				if (FormName.elements[i].name.match(idName)) {
					if (FormName.checker.checked == true) {
						FormName.elements[i].checked = true;
					} else {
						FormName.elements[i].checked = false;
					}
				}
			} else {
				if (FormName.elements[i].name.match(idName)) {
					if (FormName[checkName].checked == true) {
						FormName.elements[i].checked = true;
					} else {
						FormName.elements[i].checked = false;
					}
				}
			}
		}
	}
}

function openVideo(id, width, height) {
	window.open("/mma_bin.php?static_id=" + id, "help", "width =" +width +",height =" + height +",location=no,menubar=no,directories=no,toolbar=no,scrollbars=no,resizable=no,status=no");
}

//mail decode
function mDec(ensl, enlsShow, addToHref, firstPartHrefOnly) {
	if ((enlsShow == undefined || enlsShow == "") && (firstPartHrefOnly == undefined || firstPartHrefOnly == "")) {
		enlsShow = ensl;
	}

	if (addToHref == undefined) {
		addToHref = "";
	}

	s="";
	for(i=0; i<enlsShow.length; i++) {
		n=enlsShow.charCodeAt(i);
		if (n >= 35 && n <= 126) {
			s+=String.fromCharCode((n-3));
		} else {
			s+=enlsShow.charAt(i);
		}
	}
	nslvShow = s;

	a="pdlowr="+ensl;
	nslv = "";
	for(i=0; i<a.length; i++) {
		n=a.charCodeAt(i)-3;
		nslv+=String.fromCharCode(n);
	}
	if (firstPartHrefOnly == true) {
		document.write("<a class=\"email\" href=\"" + nslv + addToHref + "\">");
	} else {
		document.write("<a class=\"email\" href=\"" + nslv + addToHref + "\">"+nslvShow+"</a>");
	}
}

/*
 * Bookmark the current page
 * title = bookmark title
 * url = bookmark url
 */
function arctBookmarkIt(title,url) {
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if (window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if (document.all)// ie
		window.external.AddFavorite(url, title);
}

/*
 * Set the page as the home page - Only works in IE
 * object = this
 * url = 'http://www.karkoli.com'
 */
function arctSetAsHomepage(object, url) {
	if (document.all) { // ie
		document.body.style.behavior='url(#default#homepage)';
		document.body.setHomePage(url);
	}
}

/*
 * function get elements by class name ... simiar to getElementsByTagName
 * leave container arg out, and will default to document.
 */
function getElementsByClassName(className, container) {
  if (!container) {
  	container = document;
  }
  if (container.all) {
  	var all = container.all;
  } else {
  	var all = container.getElementsByTagName('*');
  }
  var arr = [] ;
  for(var k=0;k<all.length;k++) {
    if (all[k].className == className) {
      arr[arr.length] = all[k];
     }
  }
  return arr;
}

/*
 * Closes the main menu if scripts are enabled. Else leave
 * the menu open, so it is accessible to other users.
 * Note: this could be done in jQuery, but the menu needs to close
 * as soon as the menu is loaded, so jQuery is not an option here.
 */
function closeMainMenu() {
	var mainmenu = document.getElementById('main-menu');
	var aUls = getElementsByClassName("m-m-ulelement1", mainmenu);
	for (i=0; i<aUls.length; ++i) {
		aUls[i].style.display = "none";
		aUls[i].style.position = "absolute";
		aUls[i].style.top = "1em";
	}
	var aUls = getElementsByClassName("m-m-ulelement2", mainmenu);
	for (i=0; i<aUls.length; ++i) {
		aUls[i].style.display = "none";
	}
	var aUls = getElementsByClassName("m-m-ulelement3", mainmenu);
	for (i=0; i<aUls.length; ++i) {
		aUls[i].style.display = "none";
	}
}

/*
 * Closes any element by ID
 */
function hideElementById(elId) {
	var el = document.getElementById(elId);
	el.style.display = "none";
}
