function setbg(e_who,e_color)
{
	//e_current.style.backgroundImage='url(templates/default/img/menu_left_bg2.gif)';
	//html_collection = window.document.getElementById( e_who );
	
	e_who.style.background = e_color;
	//alert( e_who.style.bgcolor );
}


function alphaimage( l_id, l_src )
{
//'78423759'
	var ver = navigator.appVersion;
	//l_img = window.document.getElementById(l_id);
	l_img = l_id;
	if (ver.indexOf("MSIE") != -1)
	{
		l_img.document.write( "<img src='./project/templates/site/img/blank.gif' style='filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="+l_src+");'>" );
		//-debug
		//l_img.setAttribute( 'src',   theme+'img/blank.gif' );
		//l_style = 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+theme+'img/index_LEFTUP_corner.png);';
		//alert( l_style );
//style="padding-top:35;padding-right:46; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src={theme}img/index_LEFTUP_corner.png);"
		//l_img.setAttribute( 'style', 'filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='+theme+'img/index_LEFTUP_corner.png);' );
	}else
	{
		//-debug
		l_img.document.write( "<img src='"+l_src+"'>" );
		//window.document.write( "<td valign='top' style='padding-top:35;padding-right:46;' background='{theme}img/index_LEFT_models.png'>" );
	}
}//end_ func_ alphaimg



/*function alphabackground( l_id, l_src )
{
	//l_img = window.document.getElementById(l_id);
	//l_img.setAttribute( 'background', l_src );
	//l_img.setAttribute( 'style', 'background-image:url(./project/templates/site/img/index_TOP_bg.png);' );
	//.document.write('zuzu')
}*/


function showhtmlelement( l_element_name )
{
	window.document.getElementById(l_element_name).style.visibility='visible';
}


function hidehtmlelement( l_element_name )
{
	window.document.getElementById(l_element_name).style.visibility='hidden';
}


function getgetvar(searchStr)
{
   start_var = 0;
   //while(1)
   for(i=0;i<100;i++)
   {
	//âûäèðàåò êóñîê ñòðîêè... ñíà÷àëî ñ 0 ýëåìåíòà äî êîíöà, ïîòîì ñ íàéäåííîãî è.ò.ä
	from_location = String(location).substring(start_var,String(location).length);
	start_var = String(from_location).indexOf(searchStr);
	if ( start_var==-1 )
	{
		return -1;
		break;
	}

	is_var = String(from_location).substring(start_var-1,start_var);
	if ( is_var=="&" || is_var=="?" )
	{
		start_value = from_location.indexOf(searchStr)+searchStr.length+1;

		end = (from_location.indexOf('&', start_value) == -1)
			? from_location.length
			: from_location.indexOf('&', start_value);

		return unescape( from_location.substring(start_value,end) );
	}


	start_var++;
   }//end_ while
}


function open_in_new_window(href,width,height)
{
	l_window = window.open(
		href,
		'',
		'width='+width+'px,height='+height+'px;toolbar=no,menubar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=yes');
}









//===================================
// ==== ÎÁÐÀÁÎÒÊÀ ÊÓÊÈÑÎÂ ==========
//===================================

function getCookieVal (offset)
{ 
	var endstr = document.cookie.indexOf (";", offset); 
	if (endstr == -1) 
	endstr = document.cookie.length; 
	return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name)
{ 
	//alert( document.cookie );
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = document.cookie.length; 
	var i = 0; 
//alert( document.cookie );
	while (i < clen)
	{ 
		var j = i + alen; 
		if (document.cookie.substring(i, j) == arg) 
		return getCookieVal (j); 
		i = document.cookie.indexOf(" ", i) + 1; 
		if (i == 0) break; 
	}//end_ while
	return null;
}



function SetCookie(name, value)
{ 
	var argv = SetCookie.arguments; 
	var argc = SetCookie.arguments.length; 
	var expires = (argc > 2) ? argv[2] : null; 
	var path = (argc > 3) ? argv[3] : null; 
	var domain = (argc > 4) ? argv[4] : null; 
	var secure = (argc > 5) ? argv[5] : false; 
	document.cookie = name + "=" + escape (value) + 
		((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + 
		((path == null) ? "" : ("; path=" + path)) + 
		((domain == null) ? "" : ("; domain=" + domain)) + 
		((secure == true) ? "; secure" : "");
}





function setCheckboxes( e_this, the_form, do_check )
{
	l_elements = document.forms[the_form].getElementsByTagName("input");


	for( i=0; i<l_elements.length; i++ )
	{
		l_element = l_elements[i];
		if ( (l_element.type=="checkbox") && (l_element!=e_this) )
		{
			l_element.checked = e_this.checked;
		}
	}
/*    var elts = (typeof(document.forms[the_form].elements['usual[]']) != 'undefined')
                  ? document.forms[the_form].elements['usual[]']
                  : (typeof(document.forms[the_form].elements['assembly[]']) != 'undefined')
          ? document.forms[the_form].elements['assembly[]']
	  : null;

	alert( elts );

    var elts_cnt  = (typeof(elts.length) != 'undefined')
                  ? elts.length
                  : 0;

    if (elts_cnt) {
        for (var i = 0; i < elts_cnt; i++) {
            elts[i].checked = do_check;
        } // end for
    } else {
        elts.checked        = do_check;
    } // end if... else

    return true;
	*/
} // end of the 'setCheckboxes()' function




function zzz(e)
{
	ie=document.all;
	//--debug
	l_window = parent.window.document.getElementById("carinfo");
	l_x = ie?window.event.clientX:e.clientX;
	l_y = ie?window.event.clientY:e.clientY;
	//+document.body.scrollLeft
	//730
	//642
	l_doc_width  = ie?document.body.offsetWidth:window.innerWidth;
	l_doc_height = ie?document.body.offsetHeight:window.innerHeight;
	l_if = l_doc_width - (l_x+560);
	if ( l_if<0 )
	{
		//--debug
		l_x = l_x + l_if;
	}
	l_if = l_doc_height - (l_y+560);
	if ( l_if<0 )
	{
		//--debug
		l_y = l_y + l_if;
	}


	l_x = l_x + document.body.scrollLeft;
	l_y = l_y + document.body.scrollTop;
	l_window.style.left = l_x-200;
	l_window.style.top  = l_y-100;
}

