function togglePriceListTab(tabNum) {
	for (var i = 1; i <= 100; i++) {
		var captionDiv = document.getElementById("tabCaption_" + i);
		if (captionDiv) {
			var tabDiv = document.getElementById("tab_" + i);
			if (i == tabNum) {
				captionDiv.className = "active-tab";
				tabDiv.style.display = "block";
			}
			else {
				captionDiv.className = "inactive-tab";
				tabDiv.style.display = "none";
			}
		}
		else {
			break;
		}
	}
}

function loadPriceList(url, tabNum) {
	var xmlhttp = null;
	if (window.XMLHttpRequest) {// Firefox, Opera, IE7
		xmlhttp = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {// IE6, IE5
		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xmlhttp != null) {
		xmlhttp.onreadystatechange = function() { onPriceListLoaded(xmlhttp, tabNum); };
		xmlhttp.open("GET", url, true);
		xmlhttp.send(null);
	}
	else {
		// browser does not support XMLHTTP
	}
}

function onPriceListLoaded(xmlhttp, tabNum) {
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200) {
			document.getElementById('tab_' + tabNum).innerHTML = xmlhttp.responseText;
		}
		else {
			document.getElementById('tab_' + tabNum).innerHTML = "failed to load pricelist";
		}
	}
}
function ExtractKeywordFromReferer() {
var r = document.referrer, t = "", q, keyword = "";
if (r.indexOf("google.") != -1)     t = "q";
if (r.indexOf("msn.") != -1)        t = "q";
if (r.indexOf("live.") != -1)       t = "q";
if (r.indexOf("yahoo.") != -1)      t = "p";
if (r.indexOf("altavista.") != -1)  t = "q";
if (r.indexOf("aol.") != -1)        t = "query";
if (r.indexOf("ask.") != -1)        t = "q";
if (r.indexOf("eniro.") != -1)      t = "search_word";
if (t.length && ((q = r.indexOf("?" + t + "=")) != -1 || (q = r.indexOf("&" + t + "=")) != -1)) {
keyword = r.substring(q + 2 + t.length).split("&")[0];
}
else {
var a,b,c,d;
if ((a = r.indexOf("://")) != -1) {
t = r.substring(a + 3);
a = t.indexOf("/");
b = t.indexOf("?");
c = t.indexOf(":");
d = t.indexOf("#");
a = imin(imin(a, b), imin(c, d));
if (a == -1) {
keyword = t;
}
else {
keyword = t.substring(0, a);
}
if (keyword.toLowerCase().indexOf('www.') == 0) {
keyword = keyword.substring(4);
}
}
}
return keyword;
}
function FixMyUrl(obj)
{
var ref = document.location.toString().substring(7); // remove http
if(ref.substring(0,3) == 'www')
ref=ref.substring(4);
var end = ref.indexOf(".");
if(end == -1) end = 10;
ref = ref.substring(0,end);
obj.href += "-"+ref;
var kw = ExtractKeywordFromReferer();
if(kw != "") obj.href += "&utm_term=" + encodeURIComponent(kw);
obj.href += "&utm_medium=seo&utm_campaign=exp&utm_source=se";
return true;
}

var ref = encodeURIComponent(document.referrer);
var rnd = new String(Math.random()).substr(2, 3);
var url = '/cntr' + rnd + '.gif?url=' + ref + '&rnd=' + (new String(Math.random()).substring (2, 11));
var im = new Image();
im.setAttribute('src', url);

