// only works in IE5.5+ on a windows platform
function setHome(win) {
	var msg = "This feature is only available in Internet Explorer 5.5+ on a Windows platform.";
	var isSupported = false;
	if (document.all && navigator.platform.toLowerCase().indexOf("win") > -1) {
		var version = parseFloat(navigator.appVersion.substr(navigator.appVersion.toLowerCase().indexOf("msie ") + 5),10);
		if (version >= 5.5) {
			isSupported = true;
		}
	}
	if (!isSupported) {
		alert(msg);
		return;
	}
	if (win == null || win.location == null) {
		win = top;
	}
	document.body.style.behavior = 'url(#default#homepage)';
	document.body.sethomepage(win.location.href);
}

// only works in IE4+ on a windows platform
function addBookmark(winObjOrUrl, name) {
	var msg = "This feature is only available in Internet Explorer 4+ on a Windows platform.";
	var isSupported = false;
	if (document.all && navigator.platform.toLowerCase().indexOf("win") > -1) {
		var version = parseFloat(navigator.appVersion.substr(navigator.appVersion.toLowerCase().indexOf("msie ") + 5),10);
		if (version >= 4) {
			isSupported = true;
		}
	}
	if (!isSupported) {
		alert(msg);
		return;
	}
	var win = top;
	var url = win.location.href;
	if (winObjOrUrl != null) {
		if (typeof winObjOrUrl == "object" && winObjOrUrl.location != null) {
			win = winObjOrUrl;
			url = win.location.href;
		} else if (typeof winObjOrUrl == "string" && winObjOrUrl != "") {
			url = winObjOrUrl;
		}
	}
	if (typeof name != "string") {
		name = win.location.hostname;
		if (typeof winObjOrUrl == "string" && url == winObjOrUrl) {
			name = url;
		}
		else if (win.document.title != "") {
			name = win.document.title;
		}
	} 
	window.external.AddFavorite(win.location.href, name);
}

function togglePreviewPrint(winObj) {
	if (winObj == null) {
		winObj = window;
	}
	if (winObj != null && document.getElementById && typeof jslibScreenLinkTagId == "string" && typeof jslibPrintLinkTagId == "string") {
		var printLinkTag = winObj.document.getElementById(jslibPrintLinkTagId);
		var screenLinkTag = winObj.document.getElementById(jslibScreenLinkTagId);
		if (printLinkTag != null && screenLinkTag != null) {
			if (typeof winObj.previewMode != "boolean") {
				winObj.previewMode = false;
			}
			var printCss = printLinkTag.href;
			var screenCss = screenLinkTag.href;
			printLinkTag.href = screenCss;
			screenLinkTag.href = printCss;
			winObj.previewMode = !winObj.previewMode;
		}
	}
}

function printPage(printUrl, winObj) {
	if (typeof printUrl == "string" && printUrl != "") {
		location.href = printUrl;
		return;
	}
	if (winObj == null) {
		winObj = window;
	}
	if (winObj != null && winObj.print != null) {
		winObj.print();
	}
}

function getFeatures(width, height) {
	var w = 450;
	if (typeof width == "number" && !isNaN(width)) {
		w = width;
	}
	var h = 300;
	if (typeof height == "number" && !isNaN(height)) {
		h = height;
	}
	var x = screen.availWidth / 2 - w / 2;
	var y = screen.availHeight / 2 - h / 2;
	var features = "height=" + h + ",width=" + w;
	if (document.layers) {
		features += ",screenY=" + y + ",screenX=" + x;
	} else {
		features += ",top=" + y + ",left=" + x;
	}
	features += ",resizable=yes,scrollbars=yes";
	return features;
}

function openWin(url, name, width, height) {
	var features = getFeatures(width, height);
	var winObj = window.open(url, name, features);
	winObj.focus();
	return winObj;
}

//Denne funktion er en kopi af samme under jyskenetbank
function showHelp(e,url){
	
	var winObj = window.open(url, 'HelpPage', 'resizable,scrollbars,width=600,height=450');
	winObj.focus();
	return winObj;

}

// disse to funktioner bruges af redaktørsystemet
function openLink(strURL, newWindow) {
	if (typeof newWindow == "boolean" && newWindow) {
		openWin(strURL, 'NewWindow');
	} else {
		parent.location.href = strURL;
	}
}

function openImgWin(url,width,height){
	var title = "Jyske Bank - illustration";
	url = "/_jb/ASP/Apps/imgviewer.asp?url=" + escape(url) + "&title=" + escape(title);
	openWin(url,"ImageViewer",width,height);
}