function compareProducts(id) {
	var elID='compareCheckbox_'+id;
	var elObject=document.getElementById(elID);
	var cookieContent=getCookie('compare');

	if (elObject.checked==true) {
		if (cookieContent==null) {
			cookieContent=','+id+',';
		} else {
			cookieContent=cookieContent+','+id+',';
		}
	} else {
		cookieContent=cookieContent.replace(','+id+',', '');
	}
	//alert(cookieContent);
	setCookie('compare', cookieContent, '', '/');

	var cmp_string=cookieContent.slice(1, -1);
	cmp_string=cmp_string.replace(/,,/g, ',');

	if (cmp_string.length==0) {
		cmp_array_count=0;
	} else {
		cmp_array=cmp_string.split(",");
		cmp_array_count=cmp_array.length;
	}
	var cmp_count=document.getElementById('cmp_count');
	cmp_count.innerHTML='('+cmp_array_count+')';
}

function uncheckProducts() {
	deleteCookie('compare', '/');
	var cmp_count=document.getElementById('cmp_count');
	cmp_count.innerHTML='(0)';
}

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
function setCookie(name, value, expires, path, domain, secure) {
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name) {
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1) {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    } else {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1) {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

/**
 * Deletes the specified cookie.
 *
 * name      name of the cookie
 * [path]    path of the cookie (must be same as path used to create cookie)
 * [domain]  domain of the cookie (must be same as domain used to create cookie)
 */
function deleteCookie(name, path, domain) {
    //if (getCookie(name)) {
        document.cookie = name + "=" +
            ((path) ? "; path=" + path : "") +
            ((domain) ? "; domain=" + domain : "") +
            "; expires=Thu, 01-Jan-70 00:00:01 GMT";
    //}
}
// z(ne)viditelneni prvku
function showElement(name1, name2) {
	var obj1 = document.getElementById(name1);
	var obj2 = document.getElementById(name2);
	obj1.style.display = 'block';
	obj2.style.display = 'none';

	setCookie('flat-selector', name1, '', '/');

	var obj3 = document.getElementById('set-flash');
	var obj4 = document.getElementById('set-table');

	if (name1=='flash') {
		obj3.className='sel-tab';
		obj4.className='tab-sel';
	} else {
		obj4.className='sel-tab';
		obj3.className='tab-sel';
	}
}