
// DIALOG INITIALIZE AND MANAGE
function qubadialogSetup(which) {
			  var dialogId 	=	xGetElementById(which);
			  var whichBar = which+"Bar";
			  // CODE TO CENTER THE DIALOG

				var placeX =  	Math.round((xClientWidth() - xWidth(dialogId))/2);
				var placeY = 	Math.round((xClientHeight() - xHeight(dialogId))/2);
				if (placeX < 10) {placeX = 50}

				xSlideTo(dialogId, Math.round(placeX), 50, 500);

//				xSlideTo(dialogId, Math.round(placeX), Math.round(placeY), 500);

				xDisplay(dialogId, 'block');
//				alert(xWidth(dialogId)); alert(xHeight(dialogId)); alert(xClientWidth()); alert(xClientHeight());
			 xEnableDrag(whichBar, qubadialogStart, qubadialogDrag, qubadialogDragEnd); 
}

// DIALOG PRE-DRAG HANDLE
function qubadialogStart(ele, mx, my, which) {
			  var whichDialog = xGetElementById(ele.id.substring(0, ele.id.length - 3));
//			  AlphaCandyOn(whichDialog);
}

function qubadialogDrag(ele, mdx, mdy, which) {
			  var whichDialog = ele.id.substring(0, ele.id.length - 3);
			  xMoveTo(whichDialog, xLeft(whichDialog) + mdx, xTop(whichDialog) + mdy);
}

function qubadialogDragEnd(ele, mdx, mdy, which) {
			  var whichDialog = xGetElementById(ele.id.substring(0, ele.id.length - 3));
//  			  AlphaCandyOff(whichDialog);
}


function togglePane(trigger, target) {
		myTrigger = 	xGetElementById(trigger);
		myTarget = 	xGetElementById(target);
		if (myTarget.style.display == "none") {
				myTarget.style.display = "block";
//				myTrigger.className = "selected";
				myTrigger.title = "ausblenden";
		}
		else {
				myTarget.style.display = "none";
//				myTrigger.className = "";
				myTrigger.title = "einblenden";
		}
}



