function $(id) {
	return document.getElementById(id);
}

function detectIE6(){
  var browser = navigator.appName;
  if (browser == "Microsoft Internet Explorer"){
    var b_version = navigator.appVersion;
    var re = /\MSIE\s+(\d\.\d\b)/;
    var res = b_version.match(re);
    if (res[1] <= 6){
      return true;
    }
  }
  return false;
}

function write_color_word(word)
{
	for (var i=0; i<word.length; i++)
		document.write('<span onmouseover="changecolor(this);">'+word.charAt(i)+'</span>');
}

function changecolor(elem)
{
	var cc_red = Math.round(Math.random()*120) + 80;
	var cc_green = Math.round(Math.random()*120) + 80;
	var cc_blue = Math.round(Math.random()*120) + 80;

	elem.style.color = 'rgb('+cc_red+', '+cc_green+', '+cc_blue+')';
}

function designers_menu_arrowshow()
{
	$('designers_menu_arrow').style.display = 'block';
}

function designers_menu_show()
{
	$('designers_menu_arrow').style.display = 'block';
	$('designers_menu').style.display = 'block';
}

function designers_menu_hide()
{
	$('designers_menu_arrow').style.display = 'none';
	$('designers_menu').style.display = 'none';
}

function findPosX(obj) {
    var curleft = 0;
    if (obj.offsetParent) {
        while (1) {
            curleft+=obj.offsetLeft;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.x) {
        curleft+=obj.x;
    }
    return curleft;
}
 
function findPosY(obj) {
    var curtop = 0;
    if (obj.offsetParent) {
        while (1) {
            curtop+=obj.offsetTop;
            if (!obj.offsetParent) {
                break;
            }
            obj=obj.offsetParent;
        }
    } else if (obj.y) {
        curtop+=obj.y;
    }
    return curtop;
}

var timeOut;

function show_left_icon(obj, number)
{
	/*$('left_icon').style.backgroundImage = 'url(/data/images/brands/icons/'+number+'.gif)';
	$('left_icon').style.top = (findPosY(obj)-33)+'px';
	$('left_icon').style.left =(findPosX(obj)-110)+'px';
	$('left_icon').style.display = 'block';
	if (timeOut != undefined)
		clearTimeout(timeOut);*/
}

function hide_left_icon(obj, number)
{
	/*timeOut = setTimeout("$('left_icon').style.display = 'none';",300);*/
}


function text_by_count(count, text_one, text_few, text_many)
{
	if (count == 11 || count == 12 || count == 13 || count == 14)
		return text_many;
	if (count%10 == 1)
		return text_one;
	if (count%10 == 2 || count%10 == 3 || count%10 == 4)
		return text_few;
	return text_many;
}
