
function showback(){
	if(document.getElementById("layer"))
		{
			var arrayPageSize = getPageSize();
			/*var height = document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.scrollHeight;*/
			document.getElementById("layer").style.height = arrayPageSize[1]+'px';
			
			if(navigator.appName == "Microsoft Internet Explorer")  document.getElementById("layer").style.width = arrayPageSize[0]+'px';
			
			
			//alert(height);
		}	
	}

window.onresize=showback;

function openvac(idm){
	if(document.getElementById(idm).className=='vacancy vcopen'){
		document.getElementById(idm).className='vacancy';
		}
	else if(document.getElementById(idm).className=='vacancy'){
		document.getElementById(idm).className='vacancy vcopen';
		}
	}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function showlive(){
	if(document.getElementById('layer').className=='livepudiv')
		document.getElementById('layer').className = 'livepudiv lpdopen';
	else if(document.getElementById('layer').className=='livepudiv lpdopen')
		document.getElementById('layer').className = 'livepudiv';	
	}

// Return next sibling exclude text nodes.
function nextObject (object) {
	do {
		object = object.nextSibling;
	} while (object && object.nodeType != 1);

	return object;
}
Object.prototype.nextObject = function () {
	var n = this;

	do {
		n = n.nextSibling;
	} while (n && n.nodeType != 1);

	return n;
}
// Return previous sibling exclude text nodes.
function previousObject (object) {
	do {
		object = object.previousSibling;
	} while (object && object.nodeType != 1);

	return object;
}
Object.prototype.previousObject = function () {
	var p = this;

	do {
		p = p.previousSibling;
	} while (p && p.nodeType != 1);

	return p;
}

function like_yandex(){
	if(document.getElementById('like_yandex'))
	{
		frm = document.getElementById('like_yandex');
		txt = frm.getElementsByTagName('LABEL')[0];
		inp = frm.getElementsByTagName('INPUT')[0];
		txt.style.cursor = 'text';
		if(inp.value) txt.style.display = "none";
		txt.onclick = getLabel;
		inp.onblur = backToLabel;
	}	
}

function like_yandex2(){
	if(document.getElementById('like_yandex2'))
	{
		frm2 = document.getElementById('like_yandex2');
		txt2 = frm2.getElementsByTagName('LABEL')[0];
		inp2 = frm2.getElementsByTagName('INPUT')[0];
		txt2.style.cursor = 'text';
		if(inp2.value) txt2.style.display = "none";
		txt2.onclick = getLabel;
		inp2.onblur = backToLabell2;	
	}
}

function getLabel(){	
		this.style.display = 'none';
		nextObject(this).focus();
	}
	
function backToLabel(){
	if ( !inp.value ) {
	 txt.style.display = 'block';
	}
}

function backToLabell2(){
	if ( !inp2.value ) {
	 txt2.style.display = 'block';
	}
}

/*****/
var 	tname ;
function whichElement(e) {
	var targ;
	if (!e) var e = window.event;
	if (e.target) targ = e.target;
	else if (e.srcElement) targ = e.srcElement;
	if (targ.nodeType == 3) // defeat Safari bug
		targ = targ.parentNode;
		tname = targ.tagName;
	if(document.getElementById('select_type2')) {
		if ( tname != 'SPAN' ) {
			if ( tname != 'INPUT' ) {
				select_list.style.display = 'none' ;
			}
		}
	}
		/*if ( tname != 'INPUT' ) {
			select_list.style.display = 'none' ;
		}*/
		//alert(tname);
}
/******/
function pseudoSelect() {
	var node = document.getElementById('select_type2');
	var default_select = document.getElementById('select_type');
	node.style.display = 'block' ;
	default_select.style.display = 'none' ;
			
			arr = node.getElementsByTagName('SPAN')[0];

			arr.onclick = document.getElementById('selected').onclick = open_select_list;
			arr.onmouseover = hover_style ;
			arr.onmouseout = out_style ;
			
			select_list = node.getElementsByTagName('UL')[0];
			var list_item = select_list.getElementsByTagName('LI');
				for ( var j = 0 ; j < list_item.length ; j++ ) {
					list_item[j].onclick = get_value;
					list_item[j].onmouseover = hover_style ;
					list_item[j].onmouseout = out_style ;
				}
			
		}
function open_select_list() {
	select_list.style.display = ( select_list.style.display == 'block' ) ? 'none' : 'block' ;
	//alert('1');
}
function close_item() {
	this.style.display = 'none';
}

function get_value() {
	document.getElementById('selected').value = this.firstChild.nodeValue;
	document.getElementById('SECTION_ID').value = this.id;
	document.select_type.submit();
	select_list.style.display = 'none';
}

function hover_style() {
	this.className += ' ie6over';
}
function out_style() {
	this.className = this.className.replace(new RegExp(" ie6over\\b"), "");
}
/*******/
var W3CDOM = (document.createElement && document.getElementsByTagName);

function init () {
	if (!W3CDOM) return;
	like_yandex();
	like_yandex2();
	showback();
}
var W3C = (document.createElement && document.getElementsByTagName);
if ( window.addEventListener ) {
	window.addEventListener('load',init,false);
}
else {
	window.attachEvent('onload',init);
}
/*****************/
