function _contour(x, y, num){
	var contour = document.getElementById('contour');
	var cnv = document.getElementById('contour_line');
	var panel = document.getElementById('contour_panel');
	
	var flag = contour.childNodes[1];
	flag.style.width = "10px";
	flag.style.height = "19px";
	flag.style.position = "absolute";
	flag.style.left = x + 5 + "px";
	flag.style.top = y - 13 + "px";
	flag.style.zIndex = 2;	
	
	var extra = Math.ceil(contour.firstChild.height / 3);
	
	var x_all = contour.childNodes[0].width + 50;
	var y_all = contour.childNodes[0].height - extra;	

	if(document.getElementById('ob_buil')){
		var spanes = document.getElementById('ob_buil').getElementsByTagName('SPAN');
		for (var i = 0; i < spanes.length; i++) spanes[i].style.display = 'none';
		
		var linkes = document.getElementById('ob_buil').getElementsByTagName('A');
		for (i = 0; i < linkes.length; i++) linkes[i].style.color = '#0066ff';
		
		var sm = document.getElementById('num-' + num);
		sm.getElementsByTagName('SPAN')[0].style.display = 'block';
		for (i = 0; i < sm.getElementsByTagName('A').length; i++) sm.getElementsByTagName('A')[i].style.color = '#f26532';
	}
	else{
		y_all += extra / 2;
	}

	panel.style.display = "none";
	panel.style.left = x_all + "px";
	panel.style.top = y_all + "px";
	
	cnv.style.display = "none";
	cnv.style.left =  x_all + "px"
	cnv.style.top = y_all - 1 + "px";
	cnv.innerHTML = '';
	var jg = new jsGraphics(cnv);
	jg.setStroke(1);		
	jg.setColor('#aa3281');
	jg.drawLine(0, 0, x - x_all + 5, y - y_all + 5);
	jg.paint();
	
	setTimeout(function(){
		var content = document.getElementById('contour_panel').firstChild.childNodes;
		for(var i = 0; i < content.length; i++) if(content[i].tagName == "DL") content[i].style.display = "none";
		panel.style.display = "block";
		//content[num - 1].style.display = "block";
		document.getElementById('dl-'+num).style.display = "block";
		cnv.style.display = "block";
	}, 200);	
}

function _contour_lite(x, y, num){
	var contour = document.getElementById('contour');
	
	var flag = contour.childNodes[1];
	flag.style.width = "10px";
	flag.style.height = "19px";
	flag.style.position = "absolute";
	flag.style.left = x + 5 + "px";
	flag.style.top = y - 13 + "px";
	flag.style.zIndex = 2;	
}

function _g_activ(lang){
	if ( lang=='en' ){
		word_1 = "Unroll";
		word_2 = "Roll";
	}else{
		word_1 = "Развернуть все";
		word_2 = "Свернуть все";
	}
	var gallery = document.getElementById("gallery").getElementsByTagName("DL");
	var loswickeln = document.getElementById("loswickeln");
	
	if(loswickeln.lastChild.style.textDecoration == "" || loswickeln.lastChild.style.textDecoration == "none"){
		for(i = 0; i < gallery.length; i++){
			if(gallery[i].lastChild.tagName == "DD"){
				gallery[i].lastChild.style.display = "none";
			}
			//alert(gallery[i].firstChild);
			var dives = gallery[i].firstChild.firstChild;
			dives.firstChild.src = "/images/().gif";
			dives.lastChild.style.color = "#0066ff";
			dives.lastChild.style.textDecoration = "underline";
		}
		
		loswickeln.firstChild.src = "/images/().gif";
		loswickeln.lastChild.style.color = "#0066ff";
		loswickeln.lastChild.style.textDecoration = "underline";
		loswickeln.lastChild.innerHTML = word_1;
	}
	else{
		for(i = 0; i < gallery.length; i++){
			if(gallery[i].lastChild.tagName == "DD"){
				gallery[i].lastChild.style.display = "block";
			}
			var dives = gallery[i].firstChild.firstChild;
			dives.firstChild.src = "/images/)(.gif";
			dives.lastChild.style.color = "#f26532";
			dives.lastChild.style.textDecoration = "none";
		}
		
		loswickeln.firstChild.src = "/images/)(.gif";
		loswickeln.lastChild.style.color = "#f26532";
		loswickeln.lastChild.style.textDecoration = "none";
		loswickeln.lastChild.innerHTML = word_2;
	}
}

function _g(param){
	var div = param.parentNode.childNodes;
	var tages = param.parentNode.parentNode.parentNode.childNodes;

	if(div[1].style.textDecoration == "underline"){
		div[0].src = "/images/)(.gif";
		div[1].style.color = "#f26532";
		div[1].style.textDecoration = "none";
		for(i = 0; i < tages.length; i++){
			if(tages[i].tagName == "DD"){
				tages[i].style.display = "block";
			}
		}
	}
	else{
		div[0].src = "/images/().gif";
		div[1].style.color = "#0066ff";
		div[1].style.textDecoration = "underline";
		for(i = 0; i < tages.length; i++){
			if(tages[i].tagName == "DD"){
				tages[i].style.display = "none";
			}
		}
	}
}

function _t(param){
	param.firstChild.style.display = "block";
}

function _n(param){
	param.firstChild.style.display = "none";
}

