/**
 * The function submits language form
 * @param language name - string
 */
function switchLanguage(lang) {
  document.getElementById("language").value=lang;
  document.getElementById("reference").value=document.getElementById("pageref").value;
  document.chooseLanguage.submit();
}



/**
 * The function changes the color of selected/non-selected item of top menu entry
 *
 * @param selected item name - string
 * @param select or non-select - boolean
 * @param left, center or right menu item - integer
 */
function topMenuItemChangeColor(menuItem, isSelected, type) {
  if(isSelected){
    document.getElementById(menuItem).className =="topItemSelected";
  }else{
    if(type == 1){
      document.getElementById(menuItem).className =="h";
    }else if(type == 2){
      document.getElementById(menuItem).className =="d";
    }else{
      document.getElementById(menuItem).className =="p";
    }  
  }  
}

/**
 * The function changes the color of selected and other items of top menu
 *
 * @param selected item name - string
 */
function topMenuItemSelected(menuItem) {
    document.getElementById(menuItem).className =="d";

    if(menuItem != 'topmenu1'){
      document.getElementById("topmenu1").className =="d";
    }
    if(menuItem != "topmenu2"){
      document.getElementById("topmenu2").className =="d";
    }
    if(menuItem != 'topmenu3'){
      document.getElementById("topmenu3").className =="d";
    }
    if(menuItem != 'topmenu4'){
      document.getElementById("topmenu4").className =="d";
    }
    if(menuItem != 'topmenu5'){
      document.getElementById("topmenu5").className =="d";
    }
    if(menuItem != 'topmenu6'){
      document.getElementById("topmenu6").className =="d";
    }
    if(menuItem != 'topmenu7'){
      document.getElementById("topmenu7").className =="d";
    }
}

/**
 * The function shows centered popup window
 *
 * @param page path - string
 * @param window name - string
 * @param page width - int
 * @param page hight - int
 * @param scrolling - boolean
 */

function popup_window(mypage,myname,w,h,scroll){
	var win;
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',titlebar=0,status=yes,toolbar=no,resizable=no'
	win = window.open(mypage,myname,settings)
}

