var siteIsLoad=false;
var productQTYInTRCatalogList=3;
var productWidthInCatalogList=175;
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function onLoadFunc(isOnLoad)
{
	if(isOnLoad)
	{
		siteIsLoad=true;
	}
	if(!isOnLoad)
	{
//		setEventsOnInputGreyDescr('#000','#b1b1b1');
	}
//	correctSizeElForIE6();
}

function onResizeFunc()
{
	catalogListChange();
	correctSizeElForIE6();
	change_size_table();
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function changeHeightBannerIE6()
{
	if(Prototype.Browser.IE6)
	{
		var leftA=$('bannerLeftAngel');
		if(leftA)
		{
			var rightA=$('bannerRightAngel');
			var inner2=$(leftA.parentNode);
//			alert(inner2.getHeight());
			
			
			
			leftA.style.height=(inner2.getHeight()-57)+'px';
			rightA.style.height=(inner2.getHeight()-57)+'px';
			
			leftA.style.top=(Math.round((inner2.getHeight()/2-(inner2.getHeight()-57)/2)/2)*2)+'px'
			rightA.style.top=(Math.round((inner2.getHeight()/2-(inner2.getHeight()-57)/2)/2)*2)+'px'
	
			leftA.style.visibility='visible';
			rightA.style.visibility='visible';

		}
	}
	
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function changeMarkVertMenu(caller,isOnOver)
{
	var parentCaller=$(caller.parentNode);
	var imgMarkOff=parentCaller.select('img.markOff')[0];
	var imgMarkOn=parentCaller.select('img.markOn')[0];
	
	if(isOnOver)
	{
		if(imgMarkOff)
			imgMarkOff.style.visibility='hidden';
		if(imgMarkOn)
			imgMarkOn.style.visibility='visible';
	}else{
		if(imgMarkOff)
			imgMarkOff.style.visibility='visible';
		if(imgMarkOn)
			imgMarkOn.style.visibility='hidden';
	}
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function catalogListChange()
{
	var divCatalogList=$$('table.general tr td.contentMain div.catalogList');
	if(!divCatalogList)
		return false;
	else
		divCatalogList=divCatalogList[0];
	
	if(!divCatalogList)
		return false;
	
//	var widthCatalogList=divCatalogList.getWidth();
	var widthCatalogList=$('tapeMeasure').getWidth()-447;
//	alert($('tapeMeasure').getWidth());
	var newProductQTYInTRCatalogList=Math.floor(widthCatalogList/productWidthInCatalogList);

	if (productQTYInTRCatalogList!=newProductQTYInTRCatalogList)
	{
		var tableCatalogList=divCatalogList.select('table');

		if(!tableCatalogList)
			return false;
		else
			tableCatalogList=tableCatalogList[0];

		if(!tableCatalogList)
			return false;

		var TDCatalogList=divCatalogList.select('td');
		var TRCatalogList=divCatalogList.select('tr');
		var QtyTDCatalogList=TDCatalogList.length;
		var QtyTRCatalogList=TRCatalogList.length;

		if(!QtyTDCatalogList)
			return false;

		var newTable=document.createElement('table');
		var newTbody=document.createElement('tbody');

		newTable.appendChild(newTbody);

		var newTr;
		var newTd;
		for(var i=0;i<QtyTDCatalogList;i++)
		{
			if(i%newProductQTYInTRCatalogList==0)
			{
				newTr=document.createElement('tr');
				newTbody.appendChild(newTr);
			}
			newTd=TDCatalogList[i].cloneNode(true);
			newTd.style.width=Math.round(100/newProductQTYInTRCatalogList)+'%';
			newTr.appendChild(newTd);
		}
		tableCatalogList.parentNode.insertBefore(newTable,tableCatalogList);

		tableCatalogList.parentNode.removeChild(tableCatalogList);
		productQTYInTRCatalogList=newProductQTYInTRCatalogList;
	}
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function listImagesInDescrCatalog(caller)
{
	caller=$(caller);
	var mediumImg=$('mediumImg');
	var linkMediumImg=mediumImg.up('a');

	var callerSrc=caller.src;
	var newLink=str_replace('/smallest/','/orig/',callerSrc);
	callerSrc=str_replace('/smallest/','/medium/',callerSrc);

	linkMediumImg.href=newLink;
	mediumImg.src=callerSrc;

	show_hide_inline($(caller.parentNode).select('img.hideBlock')[0]);
	show_hide_inline(caller);
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function add_favorite(a) {
	  title=document.title;
  		url=document.location;
	  try {
	    // Internet Explorer
	    // antiantivir
	    eval("window.external.AddFa-vorite(url,title)".replace(/-/g,''));
	  }
	  catch (e) {
	    try {
	      // Mozilla
	      window.sidebar.addPanel(title, url, "");
	    }
	    catch (e) {
	      // Opera
	      if (typeof(opera)=="object") {
	        a.rel = "sidebar";
	        a.title = title;
	        a.url = url;
	        return true;
	      }
	      else {
	        // Unknown
	        alert('Нажмите Ctrl-D чтобы добавить страницу в закладки');
	      }
	    }
	  }
	  return false;
	}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
function change_size_table()
{

	if(Prototype.Browser.IE)
	{
		var height_div_head=$('head_div').getHeight();
		var height_div_content=$$('div.contentMainInner')[0].getHeight();
		var div_left_column=$('leftColumn');
		
		var new_height=height_div_content-30-40-height_div_head-36;
		div_left_column.style.height=(new_height)+'px';
	
		if(new_height>div_left_column.getHeight())
			div_left_column.style.height=(new_height)+'px';

	}
}
//ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
