/*

-
- Concept, design and implementation by
- Futurecom interactive AG
- P.O. Box
- 8037 Zurich
- Switzerland
- http://www.futurecom.ch
-
- NMC: dec
- NMD: bur
- ITS: ufe
-

*/
/* ************************************************************************** */
/* common javascript for www.ksw.ch */
/* ************************************************************************** */
function objMenu(_id,_lyr) {
	this.id = _id;
	this.lyr = _lyr;
	this.blnLock = false;

	this.showMenu = function () {

		//start combobox
		if(document.all) changeComboState('hidden');
		//end combobox

		this.blnLock = true;
		if(actLyr != null && actLyr != this.lyr){
			document.getElementById(actLyr + 'MainNav').className = null;
			document.getElementById(actLyr).style.visibility = 'hidden';
		}
		document.getElementById(this.lyr + 'MainNav').className = 'active';
		document.getElementById(this.lyr).style.visibility = 'visible';
		actLyr = this.lyr;
	}
	
	this.hideMenu = function () {
		this.blnLock = false;
		this.timeout = window.setTimeout(this.id + '.doHideMenu();',300);
		//start combobox
		if(document.all) comboInterval = window.setInterval("changeComboState('visible');", 300);
		//end combobox
	}
	
	this.doHideMenu = function () {
		if(!this.blnLock){
			//set main pont active
			document.getElementById(this.lyr + 'MainNav').className = null;
			document.getElementById(this.lyr).style.visibility = 'hidden';
		}
	}

}
		
var actLyr = null;
	
function init(){
	mPatienten = new objMenu('mPatienten','lyrPatienten');
	mBesucher = new objMenu('mBesucher','lyrBesucher');
	mAerzte = new objMenu('mAerzte','lyrAerzte');
	mStellen = new objMenu('mStellen','lyrStellen');
	mMedien = new objMenu('mMedien','lyrMedien');

	repositionBatch();
}

/* ---- */

function popup_Image_size(intResourceID,intWidth,intHeight)
{
	window.open('/ResourceImage.aspx?raid=' + intResourceID,'Bild','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,width=' + intWidth + ',height=' + intHeight);
}

/* ------------------------------------------------------------------------- */
window.onresize = repositionBatch;

function repositionBatch() {
	w = document.documentElement.clientWidth;
	if(w < 933 + 25) offset = w - 260;
	else offset = 725;	//normal
	if(document.getElementById('batch'))
		document.getElementById('batch').style.left = offset.toString() + "px";
}



function openPrintView()
{
    //opencontentwin("usetemplate-print/","_blank","width=800,resizable=yes,scrollbars=yes");
    opencontentwin(this.location.href + "/usetemplate-print/","_blank","width=500,resizable=yes,scrollbars=yes");
    
    //opencontentwin("http://ksw.dev.futurecom.ch/desktopdefault.aspx/tabid-14/21_read-143/usetemplate-print/","_blank","width=800,resizable=yes,scrollbars=yes");
    
    
    
}

/* ------------------------------------------------------------------------- */

//start combobox
comboInterval = -1;
changeComboState = function (s) {
	window.clearInterval(comboInterval);
	selCollection = document.getElementsByTagName("select");
	for(var i = 0; i < selCollection.length; i++) {
		selCollection[i].style.visibility = s;
	}
}
//end combobox
