
function printContent(printPageUrl) {
	var pW = openWindow(printPageUrl, 'print', 650, 550, 1, 1, 1);
	pW.focus();
}


// ----------------------------------------  tabs Rdw  nav ------------------------------//
	
	
function topheaderHover(id, baseSrc, tabHover) {
	document.getElementById(id).src = baseSrc + 'sel_' + tabHover + '.gif';
}

function printHover(baseSrc, tabHover) {
	document.getElementById('printHeader').src = baseSrc + tabHover + '.gif';
}

function hasOptions(obj){
	if(obj!=null && obj.options!=null){
		return true;
	}return false;
}


function moveOptionUp(obj){
	if(!hasOptions(obj)){
		return;
	}
	
	for(i=0;i<obj.options.length;i++){
		if(obj.options[i].selected){
			if(i != 0 && !obj.options[i-1].selected){
				swapOptions(obj,i,i-1);obj.options[i-1].selected = true;
			}
		}
	}
}

function moveOptionDown(obj){
	if(!hasOptions(obj)){
		return;
	}
	
	for(i=obj.options.length-1;i>=0;i--){
		if(obj.options[i].selected){
			if(i !=(obj.options.length-1) && ! obj.options[i+1].selected){
				swapOptions(obj,i,i+1);obj.options[i+1].selected = true;
			}
		}
	}
}

function swapOptions(obj,i,j){
	var o = obj.options;
	var i_selected = o[i].selected;
	var j_selected = o[j].selected;
	var temp = new Option(o[i].text, o[i].value, o[i].defaultSelected, o[i].selected);
	var temp2= new Option(o[j].text, o[j].value, o[j].defaultSelected, o[j].selected);
	o[i] = temp2;
	o[j] = temp;
	o[i].selected = j_selected;
	o[j].selected = i_selected;
}

function storeInHidden(selectBox, hidden){
	var strHiddenValue = "";
	for(var i=0;i<selectBox.options.length;i++){
		strHiddenValue += selectBox.options[i].value;
		strHiddenValue += ";";
	}
	
	hidden.value = strHiddenValue;
}


function removeListItem(selectBox, itemValue){
	for(var i=0;i<selectBox.options.length;i++){
		if(selectBox.options[i].value == itemValue){
			selectBox.remove(i);
		}
	}
	selectBox.size = selectBox.options.length;
}

function addListeItem(checkBox, itemValue, itemText, selectBoxId, hidden){
	var selectBox = document.getElementById(selectBoxId);

	if(checkBox.checked){
		optn = document.createElement("OPTION");
		optn.value = itemValue;
		optn.text = itemText;
		selectBox.options.add(optn);
		selectBox.size = selectBox.options.length;
	} else {
		removeListItem(selectBox, itemValue);
	}
	
	// fill the hiddenInput type that stores the id's
	storeInHidden(selectBox, hidden);
}

// handles a press on the "enter"-key as a click on the submit button of the searchbox
function handleReturn(button) { 
	if (event.keyCode == 13){ 
		event.cancelBubble = true; 
		event.returnValue = false; 
		document.getElementById(button).click();
	} 
} 


