function callUserFunc(func) {
	func();
}

/**
 * This functions is to debug variables.
 * NB! Only works with browsers that have a console, usualy firefox with firebug
 * @param {Mixed} value
 */
function debug(value) {
	if (Browser.get() == "firefox" && typeof console == "object" && console && console.log) 
	{
		console.debug(value);
	}
	else 
	{
		//alert(value);
	}
}


getUrlName = function(str) {
	str = str.toLowerCase();
	;
	str = str.replace(/ /g, '-');
	str = str.replace(/ä/g, 'a');
	str = str.replace(/ö/g, 'o');
	str = str.replace(/õ/g, 'o');
	str = str.replace(/ü/g, 'u');
	str = str.replace(/\\/g, '/');
	str = str.replace(/'|\(|\)|\?|,|;|:|\.|>|<|&|"|\s/g, "");
	return str;
}
function blank() {

}

function redirect(link) {
	go(link);
}

function BrowserDetect() {
	this.init = function() {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent) ||
		this.searchVersion(navigator.appVersion) ||
		"an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	}
	this.get = function() {
		this.init();
		return (this.browser.toLowerCase())
	}
	
	this.getVersion = function() {
		this.init();
		var ver = this.version.toString();
		return ver.toLowerCase();
	}
	
	this.searchString = function(data) {
		for (var i = 0; i < data.length; i++) 
		{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) 
			{
				if (dataString.indexOf(data[i].subString) != -1) 
					return data[i].identity;
			}
			else if (dataProp) 
				return data[i].identity;
		}
	}
	this.searchVersion = function(dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) 
			return;
		return parseFloat(dataString.substring(index + this.versionSearchString.length + 1));
	}
	this.dataBrowser = [
	{
		string: navigator.userAgent,
		subString: "OmniWeb",
		versionSearch: "OmniWeb/",
		identity: "OmniWeb"
	}, 
	{
		string: navigator.vendor,
		subString: "Apple",
		identity: "Safari"
	}, 
	{
		prop: window.opera,
		identity: "Opera"
	}, 
	{
		string: navigator.vendor,
		subString: "iCab",
		identity: "iCab"
	}, 
	{
		string: navigator.vendor,
		subString: "KDE",
		identity: "Konqueror"
	}, 
	{
		string: navigator.userAgent,
		subString: "Firefox",
		identity: "Firefox"
	}, 
	{
		string: navigator.vendor,
		subString: "Camino",
		identity: "Camino"
	}, 
	{ // for newer Netscapes (6+)
		string: navigator.userAgent,
		subString: "Netscape",
		identity: "Netscape"
	}, 
	{
		string: navigator.userAgent,
		subString: "MSIE",
		identity: "Explorer",
		versionSearch: "MSIE"
	}, 
	{
		string: navigator.userAgent,
		subString: "Gecko",
		identity: "Mozilla",
		versionSearch: "rv"
	}, 
	{ // for older Netscapes (4-)
		string: navigator.userAgent,
		subString: "Mozilla",
		identity: "Netscape",
		versionSearch: "Mozilla"
	}];
	this.dataOS = [
	{
		string: navigator.platform,
		subString: "Win",
		identity: "Windows"
	}, 
	{
		string: navigator.platform,
		subString: "Mac",
		identity: "Mac"
	}, 
	{
		string: navigator.platform,
		subString: "Linux",
		identity: "Linux"
	}];
}

var Browser = new BrowserDetect();


function popUpCenter(address, title, menubar, resize, scroll, width, height) {
	var top = (window.screen.width / 2) - (width / 2);
	var left = (window.screen.height / 2) - (height / 2);
	var pop = "height=" + height + ", width=" + width + ",status=no,menubar=" + menubar + ",resizable=" + resize + ",left=" + left + ",top=" + top + ",screenX=" + left + ",screenY=" + top + ",scrollbars=" + scroll;
	popupaken = window.open(address, title, pop);
	popupaken.focus();
}

function showLoading(ID, camel) {
	var src = '../../files/graphics/loading.gif';
	if (camel) 
	{
		var src = 'gfx/loading.gif';
	}
	$(ID).innerHTML = '<img src="' + src + '" alt="" />';
}


var Typing = new function() {
	this.typingInAction = false;
	this.callFunction = false;
	this.callFunctionParams = new Array();
	this.inputID = false;
	this.inputValue = false;
	this.keyPressed = function(ID, callFunction) {
		this.callFunction = callFunction;
		this.callFunctionParams = cutDownArray(2, this.keyPressed.arguments.length);
		this.inputID = ID;
		this.inputValue = $(ID).value;
		
		if (this.typingInAction == false) 
		{
			this.typingInAction = true;
			setTimeout("Typing.isTypingInAction()", 850);
		}
	}
	
	this.isTypingInAction = function(ignoreCallAgain) {
		var val = $(this.inputID).value;
		if (val == this.inputValue) 
		{
			this.typingInAction = false;
			this.callFunction(val);
		}
		else 
		{
			setTimeout("Typing.isTypingInAction()", 850);
		}
	}
}




function filterTable(string, _id, cellNr, voidHidden) {
	var table = document.getElementById(_id);
	var ele;
	var nr = 0;
	var displayRows = new Array();
	if (string.indexOf(',') >= 0) 
	{
		var sp = string.split(',');
		for (var r = 1; r < table.rows.length; r++) 
		{
			if (voidHidden) 
			{
				if (table.rows[r].style.display != 'none') 
				{
					table.rows[r].style.display = '';
				}
			}
			else 
			{
				table.rows[r].style.display = '';
			}
		}
		for (var r = 1; r < table.rows.length; r++) 
		{
			nr++;
			ele = table.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g, "");
			if (sp.length == 2) 
			{
				if ((sp[0] && ele.toLowerCase().indexOf(sp[0]) >= 0) || (sp[1] && ele.toLowerCase().indexOf(sp[1]) >= 0)) 
				{
					if (voidHidden) 
					{
						if (table.rows[r].style.display != 'none') 
						{
							table.rows[r].style.display = '';
						}
					}
					else 
					{
						table.rows[r].style.display = '';
					}
				}
				else 
				{
					table.rows[r].style.display = 'none';
				}
			}
			if (sp.length == 3) 
			{
				if ((sp[0] && ele.toLowerCase().indexOf(sp[0]) >= 0) || (sp[1] && ele.toLowerCase().indexOf(sp[1]) >= 0) || (sp[2] && ele.toLowerCase().indexOf(sp[2]) >= 0)) 
				{
					if (voidHidden) 
					{
						if (table.rows[r].style.display != 'none') 
						{
							table.rows[r].style.display = '';
						}
					}
					else 
					{
						table.rows[r].style.display = '';
					}
				}
				else 
				{
					table.rows[r].style.display = 'none';
				}
			}
			if (sp.length == 4) 
			{
				if ((sp[0] && ele.toLowerCase().indexOf(sp[0]) >= 0) || (sp[1] && ele.toLowerCase().indexOf(sp[1]) >= 0) || (sp[2] && ele.toLowerCase().indexOf(sp[2]) >= 0) || (sp[3] && ele.toLowerCase().indexOf(sp[3]) >= 0)) 
				{
					if (voidHidden) 
					{
						if (table.rows[r].style.display != 'none') 
						{
							table.rows[r].style.display = '';
						}
					}
					else 
					{
						table.rows[r].style.display = '';
					}
				}
				else 
				{
					table.rows[r].style.display = 'none';
				}
			}
			if (sp.length == 5) 
			{
				if ((sp[0] && ele.toLowerCase().indexOf(sp[0]) >= 0) || (sp[1] && ele.toLowerCase().indexOf(sp[1]) >= 0) || (sp[2] && ele.toLowerCase().indexOf(sp[2]) >= 0) || (sp[3] && ele.toLowerCase().indexOf(sp[3]) >= 0) || (sp[4] && ele.toLowerCase().indexOf(sp[4]) >= 0)) 
				{
					if (voidHidden) 
					{
						if (table.rows[r].style.display != 'none') 
						{
							table.rows[r].style.display = '';
						}
					}
					else 
					{
						table.rows[r].style.display = '';
					}
				}
				else 
				{
					table.rows[r].style.display = 'none';
				}
			}
		}
	}
	else 
	{
		if (string.length >= 3 || string.length == 4 || string.length == 6 || string.length == 8 || string.length == 10 || string.length == 12 || string.length == 0) 
		{
			for (var r = 1; r < table.rows.length; r++) 
			{
				ele = table.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g, "");
				if (ele.toLowerCase().indexOf(string) >= 0) 
				{
					if (voidHidden) 
					{
						if (table.rows[r].style.display != 'none') 
						{
							table.rows[r].style.display = '';
						}
					}
					else 
					{
						table.rows[r].style.display = '';
					}
				}
				else 
				{
					table.rows[r].style.display = 'none';
				}
			}
		}
	}
}

function filterTableSmall(string, _id, cellNr, voidHidden) {
	var table = document.getElementById(_id);
	if (!string) 
	{
		string = "";
	}
	var string = string.toString();
	string = string.toLowerCase();
	var ele;
	var nr = 0;
	var displayRows = new Array();
	for (var r = 0; r < table.rows.length; r++) 
	{
		ele = table.rows[r].cells[cellNr].innerHTML.replace(/<[^>]+>/g, "");
		if (ele.toLowerCase().indexOf(string) >= 0) 
		{
			if (voidHidden) 
			{
				if (table.rows[r].style.display != 'none') 
				{
					table.rows[r].style.display = '';
				}
			}
			else 
			{
				table.rows[r].style.display = '';
			}
			
		}
		else 
		{
			table.rows[r].style.display = 'none';
		}
	}
}

function toggleDisplay(btnID, elementID, hideStr, showStr) {
	if (!hideStr) 
	{
		hideStr = 'Peida';
	}
	if (!showStr) 
	{
		showStr = 'N�ita';
	}
	var btn = $(btnID);
	if (btn.title == 'show') 
	{
		if ($(elementID).style.display) 
		{
			$(elementID).style.display = 'inline';
		}
		else 
		{
			$(elementID).style.visibility = 'visible';
			$(elementID).style.position = 'static';
		}
		
		$(btnID).value = hideStr;
		$(btnID).title = 'hide';
	}
	else 
	{
		if ($(elementID).style.display) 
		{
			$(elementID).style.display = 'none';
		}
		else 
		{
			$(elementID).style.visibility = 'hidden';
			$(elementID).style.position = 'absolute';
		}
		$(btnID).value = showStr;
		$(btnID).title = 'show';
	}
}

function toggleFieldSetDisplay(btnID, elementID, hideStr, showStr) {
	if (!hideStr) 
	{
		hideStr = 'Peida';
	}
	if (!showStr) 
	{
		showStr = 'N�ita';
	}
	var btn = $(btnID);
	if (btn.title == 'show') 
	{
		Effect.SlideDown(elementID, {duration: 0.5})
		
		$(btnID).value = hideStr;
		$(btnID).title = 'hide';
	}
	else 
	{
		Effect.SlideUp(elementID, {duration: 0.5})
		$(btnID).value = showStr;
		$(btnID).title = 'show';
	}
}

function resizeWindow(W, H, setBiggestIfScreenSizeAllowes, voidSetToCenter) {
	if (__VOIDRESIZEWINDOW == true) 
	{
		return false;
	}
	var W = W.toString();
	var H = H.toString();
	if (W.indexOf('%') > 0) 
	{
		W = W.substring(0, (W.length - 1));
		W = ((W * screen.width) / 100) - 25;
	}
	if (H.indexOf('%') > 0) 
	{
		H = H.substring(0, (H.length - 1));
		H = ((H * screen.width) / 100) - 75;
	}
	var SW = screen.width;
	var SH = screen.height;
	if (setBiggestIfScreenSizeAllowes == true && (SW > W && SH > H)) 
	{
		H = (SH - 25);
		W = (SW - 70);
	}
	else 
	{
		if (H.toString().substr(1, 6) == 'object') 
		{
			H = $(H).offsetHeight;
		}
		if (W > SW) 
		{
			W = SW - 25;
		}
		if (H > SH) 
		{
			H = SH - 75;
		}
	}
	window.resizeTo(W, H);
	if (voidSetToCenter != true) 
	{
		var left = Math.round(SW / 2) - Math.round(W / 2);
		var top = Math.round(SH / 2) - Math.round(H / 2);
		window.moveTo(left, top);
	}
}


function showBigPicture(src) {
	if (src) 
	{
		Msg.load();
		src = src.replace('small_', 'big_');
		Ajax.hideLoad();
		Ajax.call("getBigPictureHtml", getPictureResult, src)
	}
	else 
	{
		alert("Picture not found")
	}
	
}

function getPictureResult(res) {
	Msg.hideLoad();
	Msg.pop(res['pic'], '', eval(res['width']) + 25, false, false, false, 'center');
}


function getFckEditorValue(frameName, alertONNotFound) {
	frameID = frameName + "___Frame";
	if ($(frameID)) 
	{
		if (FCKeditorAPI) 
		{
			return FCKeditorAPI.GetInstance(frameName).GetXHTML();
		}
		return "";
		firstFrame = $(frameID).contentWindow.document;
		secFrame = firstFrame.getElementById("xEditingArea");
		if (!secFrame.childNodes[0]) 
		{
			return '';
		}
		if (secFrame.childNodes[0].contentWindow) 
		{
			return secFrame.childNodes[0].contentWindow.document.body.innerHTML;
		}
		else 
		{
			return secFrame.childNodes[0].innerHTML;
		}
	}
	else 
	{
		return '';
	}
}

function cutDownArray(from, array) {
	var newArray = new Array();
	if (array.length >= from) 
	{
		nr = 0;
		for (i = from; i < array.length; i++) 
		{
			newArray[nr] = array[i];
			nr++;
		}
	}
	return newArray;
}

function go(link) {
	if (link == window.location) 
	{
		window.location.reload();
	}
	else 
	{
		/**
		 * Kui olen kasutanud ajaxit siis p�rast window.locaton suunamist ei uuenda firefox cache, seep�rast selline jura siin
		 */
		var f = document.createElement("form");
		f.setAttribute("method", "get");
		f.setAttribute("id", "form.go");
		
		var linkStr = link.toString();
		f.setAttribute("action", linkStr);
		linkStr = linkStr.replace("?", "");
		var sp = linkStr.split("&");
		if (sp.length > 0) 
		{
			for (i = 0; i < sp.length; i++) 
			{
				var val = sp[i];
				var sp2 = val.split("=");
				var input = document.createElement("input");
				input.setAttribute("type", "hidden");
				input.setAttribute("name", sp2[0]);
				input.setAttribute("value", sp2[1]);
				f.appendChild(input);
			}
		}
		$("tmpDiv").appendChild(f);
		f.submit();
		//window.location = link;
	}
}

//Useful functions
function findPosY(obj) {
	var posTop = 0;
	while (obj.offsetParent) 
	{
		posTop += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return posTop;
}

function findPosX(obj) {
	var posLeft = 0;
	while (obj.offsetParent) 
	{
		posLeft += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return posLeft;
}

/**
 * Load dynamicly css and js file to document
 */
var File = new function() {
	this.load = function(fileName, wwwFiles, id) {
		var fileType = fileName.split(".");
		if (fileType[1]) 
		{
			fileType = fileType[1].toLowerCase();
			if (fileType == "css") 
			{
				this.loadCss(fileName, wwwFiles, id);
			}
			else if (fileType == "js") 
			{
				this.loadJs(fileName, wwwFiles, id);
			}
		}
		else 
		{
			this.loadCss(fileName + '.css', wwwFiles, id);
			this.loadJs(fileName + '.js', wwwFiles, id);
		}
	}
	this.loadCss = function(fileName, wwwFiles, id) {
		var file = document.createElement("link")
		if (wwwFiles == true) 
		{
			file.setAttribute('href', "WWW_files/css/" + fileName);
		}
		else 
		{
			file.setAttribute('href', "Cubik/CMS/css/" + fileName);
		}
		if (id) 
		{
			file.setAttribute("id", id);
		}
		file.setAttribute('rel', "stylesheet");
		file.setAttribute('type', "text/css");
		this.doLoad(file);
	}
	this.loadJs = function(fileName, content) {
		var file = document.createElement("script");
		file.setAttribute("type", "text/javascript")
		file.setAttribute("src", "Cubik/FrameWork/javascript/" + fileName)
		this.doLoad(file);
	}
	this.doLoad = function(file) {
		document.getElementsByTagName("head")[0].appendChild(file);
	}
	
	this.create = function(type, content) {
		if (type.toLowerCase() == "css") 
		{
			var file = document.createElement("link");
			file.setAttribute('type', "text/css");
			file.setAttribute('rel', "stylesheet");
		}
		else if (type.toLowerCase() == "js") 
		{
			var file = document.createElement("script")
			file.setAttribute("type", "text/javascript");
		}
		file.innerHTML = content;
		this.doLoad(file);
	}
}

function getWindowSize(getVar) {
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de && de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de && de.clientHeight) || document.body.clientHeight
	if (getVar) 
	{
		if (getVar.toLowerCase() == "w") 
		{
			return w;
		}
		if (getVar.toLowerCase() == "h") 
		{
			return h;
		}
	}
	arrayPageSize = new Array(w, h)
	return arrayPageSize;
}

function getBodySize(getVar) {
	var myWidth = 0, myHeight = 0;
	if (typeof(window.innerWidth) == 'number') 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	if (getVar) 
	{
		if (getVar.toLowerCase() == "w") 
		{
			return myWidth;
		}
		if (getVar.toLowerCase() == "h") 
		{
			return myHeight;
		}
	}
	var arrayPageSize = new Array(myWidth, myHeight)
	return arrayPageSize;
}

function getScrollXY() {
	var scrOfX = 0, scrOfY = 0;
	if (typeof(window.pageYOffset) == 'number') 
	{
		//Netscape compliant
		scrOfY = window.pageYOffset;
		scrOfX = window.pageXOffset;
	}
	else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 
	{
		//DOM compliant
		scrOfY = document.body.scrollTop;
		scrOfX = document.body.scrollLeft;
	}
	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
	{
		//IE6 standards compliant mode
		scrOfY = document.documentElement.scrollTop;
		scrOfX = document.documentElement.scrollLeft;
	}
	var arrayPageSize = new Array(scrOfX, scrOfY)
	return arrayPageSize;
}


function removeElement(id) {
	if (typeof id == "string") 
	{
		var el = $(id);
	}
	else 
	{
		var el = id;
	}
	if (el) 
		el.parentNode.removeChild(el);
}

function getTagName(id) {
	if (typeof id == "object") 
	{
		return id.tagName.toLowerCase();
	}
	else 
	{
		return $(id).tagName.toLowerCase();
	}
}

function getScrollBarSize(getVar) {
	if (document.body.offsetWidth > screen.width) 
	{
		x = 16;
	}
	else 
	{
		x = 0;
	}
	y = 16;
	if (getVar) 
	{
		if (getVar.toLowerCase() == "x") 
		{
			return x;
		}
		if (getVar.toLowerCase() == "y") 
		{
			return y;
		}
	}
	var sizes = new Array(x, y);
	return sizes;
}


function HttpClass() {
	this.items = new Array();
	this.get = function(name, formParam) {
		name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
		var regexS = "[\\?&]" + name + "=([^&#]*)";
		var regex = new RegExp(regexS);
		if (!formParam) 
		{
			var from = window.location.href;
		}
		else 
		{
			from = formParam.toString();
		}
		var results = regex.exec(from);
		if (results == null) 
		{
			return false;
		}
		else 
		{
			return results[1];
		}
		
	}
	
	this.count = function() {
		if (!url) 
		{
			var url = window.location.href;
		}
		url = from.toString();
		url = window.location.href;
		url = url.replace(/.*id */g, "");
		var count = 0;
		for (i = 0; i < url.length; i++) 
		{
			if (url.charAt(i) == "=") 
			{
				count++;
			}
		}
		return count;
	}
}

var Http = new HttpClass();

function TempHolder() {
	this.items = new Array();
	
	this.get = function(name) {
		if (this.items[name]) 
		{
			return this.items[name];
		}
		else 
		{
			if ($("child.tmp." + name)) 
			{
				return $("child.tmp." + name).innerHTML;
			}
			else 
			{
				return false;
			}
		}
	}
	
	this.set = function(name, value) {
		if (name && value && value != "undefined") 
		{
			this.items[name] = value;
			var div = document.createElement("div");
			div.setAttribute("id", "child.tmp." + name);
			div.innerHTML = value;
			$('tmpDiv').appendChild(div);
		}
	}
	
	
}

var Temp = new TempHolder();

function TimingClass() {
	//Stamp current time as start time and reset display textbox
	this.start = function(name) {
		my_current_timestamp = new Date();
		Temp.set("timing_" + name, my_current_timestamp.getTime());
	}
	
	//Stamp current time as stop time, compute elapsed time difference and display in textbox
	this.end = function(name, divID) {
		my_current_timestamp = new Date();
		endTime = my_current_timestamp.getTime();
		timeDifference = (endTime - Temp.get("timing_" + name)) / 1000;
		if (divID) 
		{
			if ($(divID)) 
			{
				$(divID).innerHTML = timeDifference;
			}
		}
		else 
		{
			alert(timeDifference)
		}
	}
}

var Timing = new TimingClass();


var Tabs = new function() {
	this.clickF = function(li) {
		$A($($(li).parentNode).childElements()).each(function(ul) {
			$A($(ul).childElements()).each(function(li) {
				li.parentNode.className = "";
				var number = li.parentNode.parentNode.id.replace("tabs_", "");
				;
				tabContentDiv = "tabContent_" + number + "." + li.parentNode.id.replace("tabTable.Li.", "");
				if ($(tabContentDiv)) 
				{
					$(tabContentDiv).className = "tabsContentDiv tabsContentDivHidden"
				}
			});
		});
		var number = li.parentNode.id.replace("tabs_", "");
		;
		tabContentDiv = "tabContent_" + number + "." + li.id.replace("tabTable.Li.", "");
		if ($(tabContentDiv)) 
		{
			$(tabContentDiv).className = "tabsContentDiv";
			if (Browser.get() == "explorer") 
			{
				//$(tabContentDiv).childNodes[0].style.display = "inline"
			}
			//$("displayedTabContent").innerHTML = $(tabContentDiv).innerHTML;
		}
		li.className = "selectedTab";
		//setActiveConten(this);
	}
	this.activate = function() {
		File.load("tabber.css", "cms");
		var arr = $A(document.getElementsByClassName('globalTabContainer'));
		arr.each(function(div) {
			ul = div.childNodes[0]
			$A($(ul).childElements()).each(function(li) {
				if (li.className != "last") 
					li.onclick = function() {
						Tabs.clickF(this)
					}
					
			});
		});
		var url = document.location.toString();
		var sp = url.split("#");
		if (sp[1] > 0) 
		{
			Tabs.clickF($("tabTable.Li.tab" + sp[1]))
		}
	}
}

 function addProductsToComparison() {
    	var inputs = Form.getInputs("form.addToComparsion");
    	var checkedProducts = []
    	inputs.each(function(El) {
			debug(El.value)
    		if (El && El.checked == true) 
    		{
    			checkedProducts.push(El.value);
    		}
    	});
    	var loc = window.location.toString();
    	var sp = loc.split("#")
    	var origUrl = sp[0];
    	window.location = BASE_URL+"?op=acmp&stay=1&pIDS=" + checkedProducts.join(",");
    }
