//Functions from html templates
function onHover(element,name){
	
};
function resizeStub(){
	var stubImg = document.getElementById("stubImg");
	var mainDiv = document.getElementById("main");
	var height = parseInt(mainDiv.offsetHeight);
	if(height<500){
		stubImg.setAttribute('height',500-height);
	}else{
		stubImg.setAttribute('height',1);
	}
};
function outHover(element,name){

};
// End Functions from html templates
function navigate(url){
	window.location = url;
};
function navigateHiddenUrl(hiddenId,inputId){
	var hidden = document.getElementById(hiddenId);
	var input = document.getElementById(inputId);
	var strUrl = hidden.value.toString()+input.value.toString();
	window.location=strUrl;
};
var SHOW_IMAGE_ID = "show_image_id";
function showImg(src,element){
	var img = document.createElement("img");
	img.setAttribute("id",SHOW_IMAGE_ID);
	img.setAttribute("style",'z-index:10000;float:left;');
	img.src = src;
	element.appendChild(img);
};
function hideImg(){
	var el = document.getElementById(SHOW_IMAGE_ID);
	var parent = el.parentNode;
	parent.removeChild(el);
};


function showTree(selected){
	var parent = selected.parent();
	var tag = parent.get(0);
	if(tag){
	var tagName = tag.tagName;
	if(tagName=="DIV"){
		parent.show();
		showTree(parent);
	}
	}
}
function onLoad(){
	document.getElementById('tutCounter').innerHTML='<a href="http://catalog.tut.by/"><img src="http://catalog.tut.by/images/catalog-tut.gif" border=0 width=88 height=31 alt="������� TUT.BY"></a>';
	document.getElementById('belBizCount').innerHTML='<a href="http://catalog.bel.biz/from.php?66142"><img src="http://catalog.bel.biz/ban/topbelbiz.gif" width="88" height="31" border="0" alt="������� ������ ������ �� BEL.BIZ"></a>';
}
function findParent(src,nodeName){
	var parent = src.parentNode;
	while(parent.tagName!=nodeName){
		parent = parent.parentNode;
	}
	return parent;
}

function toggleFieldSet(check){
	var fieldSet = findParent(check,'FIELDSET');
	if(check.checked){
		jQuery(fieldSet).removeClass('disabled');
		jQuery(fieldSet).find('.cost-group input').each(function(i){
			this.removeAttribute('disabled');
		});
	}else{
		jQuery(fieldSet).addClass('disabled');
		jQuery(fieldSet).find('.cost-group input').each(function(i){
			this.setAttribute('disabled','true');
		});
	}
}
