var screenW = screen.availWidth;
var screenH = screen.availHeight;
// Функция открытия нового окна
function WindowOpen (vUrl, vWidth, vHeight, vScroll, vResize) {
	var left = (screenW - vWidth) / 2;
	var top = (screenH - vHeight) / 2;
	if (!vScroll) vScroll = "no";
	if (!vResize) vResize = "no";
	wId = window.open (vUrl, "NewWin"+GetRand(), "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars="+vScroll+",resizable="+vResize+",left="+left+",top="+top+",width="+vWidth+",height="+vHeight);
	wId.focus ();
}

// Функция отображения изображения
function WOImage (url, vWidth, vHeight, title) {
	var left = ((screenW/2) - (vWidth/2));
	var top = ((screenH/2) - (vHeight/2));
	var windowmode="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left="+left+",top="+top+",width="+vWidth+",height="+vHeight;
	var winname = "NewWin"+GetRand();
	win = window.open('',winname,windowmode);	
	win.document.writeln('<html>');
	win.document.writeln('<head>');
	win.document.writeln('<title>' + title + '</title>');
	win.document.writeln('<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">');
	win.document.writeln('<A href="javascript:window.close()"><img src='+ url + ' border=0></a>');
	win.document.writeln('</body>');
	win.document.writeln('</html>');
	win.focus(); 
	return false;
}

// Функция случайного числа
function GetRand () {
	result = "";
	result = Math.random()+"1";
	result = result.split(".");
	return result[1];
}

function openCalculator () {
	var calculator = getStyleObject('calc', document);
	calculator.display="block";
}//Открыть калькулятор

function closeCalculator () {
	var calculator = getStyleObject('calc', document);
	calculator.display="none";
}//Закрыть калькулятор

function countCalculator () {
	if($("calc_value").value!=''){
		//начинаем калькуляцию
		var textstring=$("calc_from");
		var textstringto=$("calc_to");
		$("calc_result").innerHTML=$("calc_value").value + " " + textstring.options[textstring.selectedIndex].text + "<br>=";

		$("calc_price").innerHTML=((($("calc_value").value*$("calc_from").value)/$("calc_to").value).toFixed(2)) + " " + textstringto.options[textstringto.selectedIndex].text;
	}
	return false;
}//Закрыть калькулятор

function glossary_panel (panelname, link) {
	var panel=document.getElementById(panelname);
	if(panel.style.display=='none'){
		panel.style.display='block';
		link.className='gword-act';
	}else{
		panel.style.display='none';
		link.className='gword';
	}
	return false;
}
function vacancy_panel (panelname, link) {
	var panel=document.getElementById(panelname);
	if(panel.style.display=='none'){
		panel.style.display='block';
		link.className='vac-act';
	}else{
		panel.style.display='none';
		link.className='vac';
	}
	return false;
}
