function PostcodeFieldChecks(val)
{
	var unicode = event.charCode ? event.charCode : event.keyCode;
	if ((unicode == 37) || (unicode == 39) || (unicode == 46) || (unicode == 16) || (unicode == 36) || (unicode == 45) || (unicode == 17) || (unicode == 35))
		return true;
	if ((unicode >= 65 && unicode <= 90) || (unicode >= 48 && unicode <= 57) || (unicode == 8 || unicode == 9) || (unicode >= 96 && unicode <= 105))
		return true;
	return false;
}

function PostcodeFieldCleanUp(val)
{
	var val2 = '';
	for (var t = 0; t < val.length; t++)
	{
		var c = val.substr(t, 1);
		if ((c >= '0') && (c <= '9')) val2 = val2.concat(c);
		if ((c >= 'a') && (c <= 'z')) val2 = val2.concat(c);
		if ((c >= 'A') && (c <= 'Z')) val2 = val2.concat(c);
	}
	val2 = val2.toUpperCase();
	return val2;
}

function EnterPressed(objEvent, LinkToClick)
{

    if ((objEvent.which && objEvent.which == 13) || (objEvent.keyCode && objEvent.keyCode == 13)) {
        document.getElementById(LinkToClick).click();
        return false;
    } else {
        return true;
    }
} 

function CheckActie()
{
    window.open('Aktie.aspx','popwin','');
}

function OnCallbackEval(result,context) 
{
    eval(result);
}

function getIEVersionNumber() {
    var ua = navigator.userAgent;
    var MSIEOffset = ua.indexOf("MSIE ");
    
    if (MSIEOffset == -1) {
        return 0;
    } else {
        return parseFloat(ua.substring(MSIEOffset + 5, ua.indexOf(";", MSIEOffset)));
    }
}

function onError(message, context) {
   alert("An unhandled exception has occurred:\n"+message);
   history.go(0);
}


initPage = function() {
	var _input = document.getElementById("search-inp");
	if (_input)
	{
		_input.onfocus = function()
		{
			if (this.className.indexOf("focus") == -1) this.className += " focus";
			this.value = "";
		}
	}
}

function qHovers() {
	var _qHolder = document.getElementById("questions");
	if (_qHolder)
	{
		var _lis = _qHolder.getElementsByTagName("li");
		for (i =0; i<_lis.length; i++)
		{
			_lis[i].onmouseover = function()
			{
				if (this.className.indexOf("hover") == -1)
				{
					this.className += " hover";
				}
			}
			_lis[i].onmouseout = function()
			{
				this.className = this.className.replace("hover", "");
			}
		}
		var _links = _qHolder.getElementsByTagName("a");
		for (i =0; i< _links.length; i++)
		{
			if (_links[i].className.indexOf("question") != -1)
			{
				_links[i].onclick = function()
				{
					if (this.parentNode.parentNode.parentNode.parentNode.className.indexOf("open") == -1)
					{
						this.parentNode.parentNode.parentNode.parentNode.className += " open";
					}
					else
					{
						this.parentNode.parentNode.parentNode.parentNode.className = this.parentNode.parentNode.parentNode.parentNode.className.replace("open", "");
					}
					return false;
				}
			}
		}
	}
}

function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}

if (window.addEventListener)	{
//	window.addEventListener("load", initPage, false);
	window.addEventListener("load", qHovers, false);
}
else if (window.attachEvent) {
	window.attachEvent("onload", qHovers);
}
