top_pop_enable_hide = true;
dn18413 = "Розница:<br>вт, ср, чт, пт, сб - круглосуточно<br>пн - с 10:00<br>вс - до 20:00<br>";
dn18414 = "Розница:<br>вт, ср, чт, пт - круглосуточно<br>пн - с 10:00<br>сб - до 22:00<br>вс - 10:00 – 19:00";
fselect_vis='sortby_sel';
fselect_vis = new Array();
fimg_vis =  new Array();

function hide_fake_selects(e) {
	trg = (e.srcElement)? e.srcElement : e.target;
	if (trg.className != 'inputr')
	{
		for (i=0; i<fselect_vis.length; i++)
		if (document.getElementById(fselect_vis[i]))
		{
			document.getElementById(fselect_vis[i]).style.display='none';
			fimg_vis[i].src='/i/main1/select.png';
		}
	}
	if (trg.className=='st_input1' && document.getElementById(trg.id+"_sel"))
	{
		trg.readOnly=true;
		fselect_vis[fselect_vis.length]=trg.id+"_sel"; document.getElementById(trg.id+"_sel").style.display='block';
	}
	if (trg.className.indexOf('hm')!=0)
	{
		headerMenuPopHide();
	}
	if (trg.id != 'search_fi' && document.getElementById('search_fi').value=='')
		document.getElementById('search_fi').value='Поиск по сайту';
}

function show_hide_fselect(fid, elSt) {
	fselect_vis[fselect_vis.length]=fid;
	document.getElementById(fid).style.display=(document.getElementById(fid).style.display!='none')? 'none' : 'block';
	elSt.src=(elSt.src.indexOf('cl')==-1)? '/i/main1/select_cl.png' : '/i/main1/select.png';
	fimg_vis[fimg_vis.length] = elSt;
}
function showHideTopPop(id, show)
{
	if (show == undefined || show == null)
	{
		show = 1;
	}

	p = document.getElementById(id);
	partner = document.getElementById('partner_li');
	pn = p.parentNode;
	w = pn.offsetWidth;

	p.style.width = w+8+'px';
	pos = getAbsolutePos(pn);
	
	if (show)
	{
		top_pop_enable_hide = false;
	}
	
	if (show && p.style.display == 'none')
	{
		p.style.display = '';
		p.style.left = pos.x+'px';
		partner.className = 'popOn';
		
		if ($is.IE6)
		{
		
//	document.getElementById('search_category').style.display = 'none';
		}
	}
	else if (!show)
	{
		top_pop_enable_hide = true;
		setTimeout('showHideTopPop_call(p,partner);',500);
		
		/*
		p.style.display = 'none';
		partner.className = '';
		
		if ($is.IE6)
		{
			//document.getElementById('search_category').style.display = '';
		}
		*/
	}
}
function showHideTopPop_call(p,partner)
{
	if (!top_pop_enable_hide)
	{
		return false;
	}
	p.style.display = 'none';
	partner.className = '';
	
	if ($is.IE6)
	{
		//document.getElementById('search_category').style.display = '';
	}
}

change_city_fixed_pos = false;
function showChangeCity(eThis)
{
	cs = document.getElementById('city_select');
	
	if (eThis == null || eThis == undefined)
	{
		eThis = 0;
	}
	
	if (!eThis)
	{
		change_city_fixed_pos = true;
		cs.style.display = '';
		cs.style.left = Math.round( (screen.width/2) - (cs.offsetWidth/2))+"px";
		cs.style.top = '120px';
	}
	else
	{
		change_city_fixed_pos = false;
		pos = getAbsolutePos(eThis);
		cs.style.display = '';
		cs.style.left = pos.x+eThis.offsetWidth+10+'px';
		cs.style.top = pos.y+'px';
	}
}
function fixedChangeCity()
{
	if (!change_city_fixed_pos) return false;
	
	cs = document.getElementById('city_select');
	if (cs.style.display != 'none')
	{
		cs.style.top = document.body.scrollTop+120+'px';
		setTimeout('fixedChangeCity()',200);
	}
}
function hideChangeCity()
{
	cs = document.getElementById('city_select');
	cs.style.display = 'none';
}


function changeCity(city_id)
{
	if (document.getElementById('cart_updater1')) {document.getElementById('cart_updater1').src='/cat2.php?setprice='+city_id;}
	else {document.getElementById('cart_updater').src='/cat2.php?setprice='+city_id;}
	hideChangeCity();
}

function valign_menu_buttons()
{
	els = document.getElementById('header_menu').getElementsByTagName('A');
	for (i=0; i<els.length; i++)
	{
		el = els[i];
		if (el.className == 'hmLink')
		{
			ph = el.parentNode.offsetHeight;
			h = el.offsetHeight;
			el.style.height = ph+'px';
			im = el.getElementsByTagName('IMG')[0];
			pad = (((ph-h)/2)+1);
			im.style.marginTop = pad+'px';
			//alert(pad);
		}
	}
}



function dojoInit()
{
	/*
	var node = document.createElement('div');
	node.innerHTML = dojo.byId('addGoodsFromCatalogPane').innerHTML;
	dojo.byId('addGoodsFromCatalogDock').appendChild(node);
	var tmp = new dojox.layout.FloatingPane({
		title: "Редактирование резерва",
		dockable: false,
		maxable: false,
		closable: true,
		resizable: false
	},node);
	tmp.startup();

	// Close event
	dojo.connect(tmp, 'close',
		function()
		{
			var xhrArgs =
			{
				url: "/services/gateway.php",
				handleAs: "text",
				load: function(data, ioargs)
				{
					//targetNode.innerHTML = "XHR returned HTTP status: " + ioargs.xhr.status;
				},
				error: function(error, ioargs)
				{
					//targetNode.innerHTML = "An unexpected error occurred: " + error;
				},
				content:
				{
					t: new Date().getTime(),
					method: "system.params.remove",
					params: "name:addGoodsFromCatalog;"
				}
			}
				
			dojo.xhrGet(xhrArgs);
			return false;
		}
	);
	*/
}







var s_text="Название или артикул"
function searchFieldFocus(eThis)
{
	if (eThis.value == s_text)
	{
		eThis.value = '';
	}
	
	eThis.className = 'sFieldActive';
}
function searchFieldBlur(eThis)
{
	if (eThis.value == '' || eThis.value == s_text)
	{
		eThis.value = s_text;
		eThis.className = 'sField';
	}
}

function searchFieldOnChange(eThis)
{
	if (eThis.value == '' || eThis.value == s_text)
	{
		eThis.value = s_text;
		eThis.className = 'sField';
	}
	else
	{
		eThis.className = 'sFieldActive';
	}
}

function categoryFieldFocus(eThis)
{
	eThis.className = 'sCategoryActive';
return true;
}

function categoryFieldBlur(eThis)
{
	if (eThis.value == 0)
	{
		eThis.className = 'sCategory';
	}
	else
	{
		
	}
}


function submit_login(e)
{ 		
	if (e.keyCode == 13)
	{
		if (document.getElementById('login_form1'))
		{
			document.getElementById('login_form1').submit();
		}
		else
		{
		document.getElementById('login_form').submit();
		}
	}
}
function submit_search(e)
{
	if (e.keyCode == 13)
	{
		location = '/search.php?r='+document.getElementById('search_category').value+'&q='+document.getElementById('search_input').value;
		
		//document.getElementById('header_searcH_form').submit();
		return false;
	}
}
await_helptip1 = 0
function htShow(eThis)
{
	

	if (await_helptip1 == 25)
	{
	
		await_helptip1 = 1;
		
		setTimeout(function() {eThis.style.display='block';}, 500);
		
		return true;
	}
	else
	{
	
	
			
		await_helptip = 0;
		
		

		temp_hellp1=setTimeout(function() {eThis.style.display='block';}, 500);
	
	
	}
}
pt_enable_hide = true;	

function htHide(eThis)
{
	

	
		ht_enable_hide = true;
		
		
		if (typeof(temp_hellp1) != 'undefined' && temp_hellp1 != null)
		{
			clearTimeout(temp_hellp1);
		}
		
			setTimeout(function() {htHideTimer(eThis);},900);
		
	
}

function htHideTimer(eThis)
{
	if (!ht_enable_hide)
	{
		return false;
	}
		
	
	eThis.style.display = 'none';	
	is_popup1=0;
}

function show_hidden_filter_rows(filter_id, eThis, row_prefix)
{
	fil = document.getElementById(filter_id);
	elements = fil.getElementsByTagName('DIV');
	eval("var expr = /"+row_prefix+"/;");
	for(i=0; i<elements.length; i++)
	{
		el = elements[i];
		if (el.id.match(expr))
		{
			el.style.display = '';
		}
	}
	eThis.parentNode.style.display = 'none';
}



