function CheckIfClicked() {
    vNumClick++;
    if (vNumClick > 1) {
       // alert('caught the double click - ignore this');
	return false;
    }
    return true;
}

function CloseClick () {
    if (CheckIfClicked() == false) {
	return false;
    }
    self.close();


}



function activateSelection (aArray, aName) {
for (var i = 0; i < aArray.length; i++) {
	var b = getStyleObject(aArray[i]);
	if (aArray[i] == aName) {	
		b.fontWeight = 'bold';
	} else {
		b.fontWeight = 'normal';
	}
}
}
function initTextweight () {
	for (var i = 0; i < MyBar.length; i++) {
		var b = getStyleObject(MyBar[i]);
			b.fontWeight = "normal";
	}
}

function getStyleObject(objectId) {
    if(document.getElementById && document.getElementById(objectId)) {
	return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
	return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
	return document.layers[objectId];
    } else {
	return false;
    }
}

function moveObject(objectId, newXCoordinate, newYCoordinate) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.left = newXCoordinate;
	return true;
    } else {return false;}
}

function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if(styleObject) {
	styleObject.visibility = newVisibility;
	return true;
    } else {
	return false;
    }
}
function hideAllPopups () {
 for (var i = 0; i < Layers.length; i++) {
	changeObjectVisibility(Layers[i], 'hidden')
 }
}

function hideAllPopupsExceptMe (aName) {
 for (var i = 0; i < Layers.length; i++) {
		if (Layers[i] != aName) { 
			changeObjectVisibility(Layers[i], 'hidden')
		}
 }
 window.currentlyVisiblePopup = aName;
}

function hideCurrentPopup() {
    if(window.currentlyVisiblePopup) {
	changeObjectVisibility(window.currentlyVisiblePopup, 'hidden');
	window.currentlyVisiblePopup = false;
    }
} 

function showPopup (targetObjectId, eventObj) {
	var noX = 0;
	for (var i = 0; i < Layers.length; i++) {
		if (Layers[i] == targetObjectId) { 
			noX = 1;
		}
	} 
	initTextweight ();
    if(eventObj) {
		if (window.currentlyVisiblePopup == targetObjectId)	{
			hideCurrentPopup();
		} else {
			if (targetObjectId == "User" || targetObjectId == "WF" || targetObjectId == "Portal") {
			} else {
				hideCurrentPopup();
			};
			eventObj.cancelBubble = true;
			if (noX == 1) {
				var newXCoordinate = 0;
			} else {
				var newXCoordinate = (eventObj.pageX)?eventObj.pageX + xOffset:eventObj.x + xOffset + ((document.body.scrollLeft)?document.body.scrollLeft:0);
			}
			moveObject(targetObjectId, newXCoordinate, yOffset);
			if( changeObjectVisibility(targetObjectId, 'visible') ) {
			    window.currentlyVisiblePopup = targetObjectId;
			    return true;
			} else {
			return false;
			}
		}
    } else {
	return false;
    }
}

function showPopupRelV (targetObjectId, eventObj, xCo) {
    if(eventObj) {
		if (window.currentlyVisiblePopup == targetObjectId)
			{hideCurrentPopup();} else 
			{	hideCurrentPopup();
				eventObj.cancelBubble = true;
				var newXCoordinate = xCo;
				moveObject(targetObjectId, newXCoordinate, yOffset);
				if( changeObjectVisibility(targetObjectId, 'visible') ) {
			    window.currentlyVisiblePopup = targetObjectId;
			    return true;
			} else {
		    return false;
			}
		}
    } else {
	return false;
    }
}

function openNewWindow(mypage,mytitle) {
	newWindow = window.open(mypage,mytitle,'width=730,height=410,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=1,resizable=0');
	newWindow.window.focus();
}
function openContactUsWindow(mypage,mytitle) {
	contactusWindow = window.open(mypage, mytitle,'width=550,height=620,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1');
	contactusWindow.window.focus();
}

function openGlossaryWindow(mypage,mytitle) {
	contactusWindow = window.open(mypage, mytitle,'width=800,height=600,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=1');
	contactusWindow.window.focus();
}


function BrowserCheck() {
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.version = navigator.appVersion
	this.v = parseInt(this.version)
	this.ns = (this.b=="ns" && this.v>=3)
	this.ns3 = (this.b=="ns" && this.v==3)
	this.ns4 = (this.b=="ns" && this.v==4)
	this.ns5 = (this.b=="ns" && this.v==5)
	this.ie = (this.b=="ie" && this.v>=4)
	this.ie4 = (this.version.indexOf('MSIE 4')>0)
	this.ie5 = (this.version.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
    var p = navigator.userAgent;
    if (p.indexOf("Mac")!=(-1)) { this.os = "mac" }
    else if (p.indexOf("X11")!=(-1)) { this.os = "X11" }
    else { this.os = "pc" };
}

function RefreshFrames() {
	top.location.href="/";
}


function IsInvalidSearchword(formelement) {
	if (formelement.value != '' && !(formelement.value.match(/^(\s){0,}[\u0080-\u4E00-\u9FFF\u30A0-\u30FE\u3040-\u309F\w\+\-_!\?§üöäÜÖÄß€:,.;']{2,}\*?(\s(AND\s|OR\s|and\s|or\s)?[\u0080-\u4E00-\u9FFF\u30A0-\u30FE\u3040-\u309F\w\+\-_!\?§üöäÜÖÄß€:,.;']{2,}\*?)*(\s){0,}$/) )) {
		alert('Please ensure that your search string contains at least two or more characters and digits followed by an optional wildcard *. You can combine more then one of this searchstrings by blanks and/or the logical operators AND/OR. Allowed special characters are: + - _ § € ! ? \' . , ; :');
		formelement.focus();
		return (true);
	} else {
		return (false);
	}
};

function SearchwordValidate(form) {
	if (IsInvalidSearchword(form.searchword)) {
	return false; } else {
	return true;
	}
};
				
function SearchwordValidateLBNRW(form) {
	if (IsInvalidSearchword(form.searchword)) {
	return false; } else {
	return true;
	}
};					

function onLoginForm() {
    var formDOMObj = document.frmSend;
    if (formDOMObj.username.value == "" )
		alert("Please provide your user name")
    else if (formDOMObj.password.value == "" )
		alert("Please provide your password")
    else
        return true;
    return false;
}

