$img_prfx = '';
if (location.href.indexOf('swf-mac')) {
	$img_prfx = 'multimedia/';
} else if (location.href.indexOf('virtualserialport') ||
	   location.href.indexOf('serialportsplitter') ||
	   location.href.indexOf('mobile-serial-port') ||
	   location.href.indexOf('virtual-rs232') ||
	   location.href.indexOf('serial-port-utilities') ||
	   location.href.indexOf('com-port-monitoring')) {
	$img_prfx = 'serial-port/';
} else if (location.href.indexOf('mykeylogger') ||
	   location.href.indexOf('security')) {
	$img_prfx = 'security/';
} else if (location.href.indexOf('java-library')) {
	$img_prfx = 'java-library/';
}

function addFavorite()
{
	var title = document.title;
	var url = document.location;
	if (window.sidebar)  // Mozilla Firefox Bookmark
	{
		window.sidebar.addPanel(title, url, "");
	}
	else if(window.external)  // IE Favorite
	{
		window.external.AddFavorite(url, title);
	}
}
function openScreenshot(screen, width, height) {
	if(location.href.indexOf('.html') >= 0) {
		l_href = location.href.substr(0, location.href.indexOf('.html'));
		l_href += '/';
	}
	else if(location.href.indexOf('.php') >= 0)
	{
		l_href = location.href.substr(0, location.href.indexOf('.php'));
		l_href += '/';

		if(l_href.indexOf('keylogger-features/') >= 0)
		{
			l_href = l_href.replace('keylogger-features/', '');
		}
	}
	else {
		l_href = location.href;

		if(l_href.indexOf('#') >= 0) {
			var reg = /[^\/]*$/;
			l_href = l_href.replace(reg, '');
		}

		if(l_href.indexOf('products') >= 0  || l_href.indexOf('mykeylogger') >= 0) {
			var reg = /[^\/]*\/$/;
			l_href = l_href.replace(reg, '');
		} else {
			if(l_href.lastIndexOf('/') < (l_href.length - 1)) {
				l_href += '/';
			}
		}
	}

	if(l_href.indexOf('/fr/') >= 0 || l_href.indexOf('/de/') >= 0) {
		l_href = l_href.replace('fr/', '');
		l_href = l_href.replace('de/', '');
	}

	window.open(l_href+'screenshot/'+screen+".html", 'screenshot', 'status=no,menubar=no,scrollbars=no,titlebar=no,toolbar=no,resizable=no,width='+ width +',height='+ height +'');
}

function openLiceneseInfo(id) {
	if(location.href.indexOf('.html') >= 0) {
		l_href = location.href.substr(0, location.href.indexOf('.html'));
		l_href += '/';
	}
	else if(location.href.indexOf('.php') >= 0)
	{
		l_href = location.href.substr(0, location.href.indexOf('.php'));
		l_href += '/';

		if(l_href.indexOf('keylogger-features/') >= 0)
		{
			l_href = l_href.replace('keylogger-features/', '');
		}
	}
	else {
		l_href = location.href;

		if(l_href.indexOf('#') >= 0) {
			var reg = /[^\/]*$/;
			l_href = l_href.replace(reg, '');
		}

		if(l_href.indexOf('products') >= 0  || l_href.indexOf('mykeylogger') >= 0) {
			var reg = /[^\/]*\/$/;
			l_href = l_href.replace(reg, '');
		} else {
			if(l_href.lastIndexOf('/') < (l_href.length - 1)) {
				l_href += '/';
			}
		}
	}

	if(l_href.indexOf('/fr/') >= 0 || l_href.indexOf('/de/') >= 0) {
		l_href = l_href.replace('fr/', '');
		l_href = l_href.replace('de/', '');
	}

	window.open(l_href+'license/'+id+'.html', 'license', 'status=no,menubar=no,scrollbars=yes,titlebar=no,toolbar=no,resizable=yes,width=600,height=500');
}

function openChangeLog(nick, lang) {
	if(location.href.indexOf('.html') >= 0) {
		l_href = location.href.substr(0, location.href.indexOf('.html'));

		l_href += '/';
	}
	else if(location.href.indexOf('.php') >= 0)
	{
		l_href = location.href.substr(0, location.href.indexOf('.php'));
		l_href += '/';

		if(l_href.indexOf('keylogger-features/') >= 0)
		{
			l_href = l_href.replace('keylogger-features/', '');
		}
	}
	else {
		l_href = location.href;

		if(l_href.indexOf('#') >= 0) {
			var reg = /[^\/]*$/;
			l_href = l_href.replace(reg, '');
		}

		if(l_href.indexOf('products') >= 0  || l_href.indexOf('mykeylogger') >= 0) {
			var reg = /[^\/]*\/$/;
			l_href = l_href.replace(reg, '');
		} else {
			if(l_href.lastIndexOf('/') < (l_href.length - 1)) {
				l_href += '/';
			}
		}
	}

	if(l_href.indexOf('/fr/') >= 0 || l_href.indexOf('/de/') >= 0) {
		l_href = l_href.replace('fr/', '');
		l_href = l_href.replace('de/', '');
	}

	window.open(l_href+'change_log/'/*+ (lang ? lang+'/' : '')*/ + nick +'.html', 'changelog', 'status=no,menubar=no,scrollbars=yes,titlebar=no,toolbar=no,resizable=yes,width=600,height=500');
}

function openPopUp(page_name, width, height) {
	window.open('/det_list/' + page_name, 'detection_list', 'status=no,menubar=no,scrollbars=yes,titlebar=no,toolbar=no,resizable=yes,width=' + width + ',height='+ height);
}