			function setPopUps (popups) {
					if (typeof (popups) !== 'object') return false;
					
						for (var p in popups) {
							if (popups[p].nodeType == 1 && popups[p].tagName == 'SPAN' && (popups[p].className == 'video' || popups[p].className == 'photo' || popups[p].className == 'comment')) {
								popups[p].onclick = showPopup;
							}
						}
				} 
					
				function getStyle(el,styleProp)
				{
					var x = document.getElementById(el);
					if (x.currentStyle)
						var y = x.currentStyle[styleProp];
					else if (window.getComputedStyle)
						var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
					return y;
				}

				
				function showPopup (e) {
					e = e ? e : window.event;
					x = y = null;
					
						if (typeof (e.pageX) == 'number') {
							x = e.pageX;
							y = e.pageY
						}else{
							x = e.clientX;
							y = e.clientY	
							x += document.documentElement.scrollLeft;
							y += document.documentElement.scrollTop;
						}
					
					popup.style.left = x-20 + 'px';
					popup.style.top = y+15 + 'px';

						if (this.className == 'comment') {
							popupContent.innerHTML = '<h3>Пользователи оставили '+this.innerHTML+' комментариев из них последний: </h3>' + document.getElementById(this.getAttribute ('popup')).innerHTML;
						}else if (this.className == 'photo') {	
							popupContent.innerHTML = '<p>Фоторепортаж из '+this.innerHTML+' изображений, последнии:</p>' + document.getElementById(this.getAttribute ('popup')).innerHTML;;
						}else if (this.className == 'video') {
							popupContent.innerHTML = '<p>публикация содержит видеоматериал</p>';
						}else{
							x = y = null;
							hidePopUp ();
							return false;
						}

					popup.style.display = 'block';
				}

				function hidePopUp () {
					popup.style.display = 'none';
				}

 			 	

				function verticalTabs (id, type) {
					var	tabsUl = document.getElementById(id),
						tabs = tabsUl.getElementsByTagName ('li');
						
						if (type == 'vertical') var heights = new Array ();
						
						for (var i in tabs) {
							if (tabs[i].tagName == 'LI') { 
								if (type == 'vertical') {
									if (tabs[i].currentStyle)
										heights[i] = parseInt (tabs[i].currentStyle['height']);
									else if (window.getComputedStyle)
										heights[i] = parseInt (document.defaultView.getComputedStyle(tabs[i],null).getPropertyValue('height'));
								}		
								
								tabs[i].onmouseover = function () {
									if (this.className == 'selected') return false;
									for (var k in tabs)	if (tabs[k].tagName == 'LI') tabs[k].className = '';
									
									var content = this.parentNode.nextSibling;
									content.innerHTML = this.innerHTML;
									
									this.className = 'selected';						
								}
							}	
						} 
						
						if (type == 'vertical') {
							var max = 0;
							
							for (var i in heights) {
								if (heights[i] > max)
									max = heights[i];
							}
							
							for (var i in tabs) {
								if (tabs[i].tagName == 'LI') { 
									tabs[i].style.height = max+'px';
								}
							}
						}
				}	

				
				
				function accordionPlay (id) {
					var	tabsUl = document.getElementById(id),
						tabs = tabsUl.getElementsByTagName ('li'),
						popups = tabsUl.getElementsByTagName ('span');
						setPopUps (popups);
						
						for (var i in tabs) {
							if (tabs[i].tagName == 'LI') { 
								//console.debug (tabs[i]);
								tabs[i].onclick = function () {

									for (var k in tabs)	if (tabs[k].tagName == 'LI') tabs[k].className = '';
									
									var pos = parseInt (this.getAttribute ('pos'))-1;
									tabs[pos].className = 'selected';				
								}
							}	
						} 						
				}
				
				function topMaterialsChange (id) {
					var div = document.getElementById(id),
						divChilds = div.childNodes,
						container = document.getElementById('top_materials_body');
						
						for (var child in divChilds) {
							if (divChilds[child].nodeType == 1 && divChilds[child].tagName == 'A') {
								divChilds[child].onmouseover = function () {
								
									for (var i in divChilds)
										if (divChilds[i].tagName == 'A') {
											divChilds[i].className = '';
										}	
										
									container.innerHTML = this.nextSibling.innerHTML;
									this.className = 'selected';
								}
							}	

						}
				}
				
				function photorepPlay (id) {

					var photorep = document.getElementById (id).getElementsByTagName('u')[0],
						photos = photorep.getElementsByTagName ('i'),
						photosLength = photos.length;
						
						for (var i =0; i < photosLength; i++) {					

							if (photos[i].tagName == 'I') {	
								photos[i].onmouseover = function () {
								var pos = parseInt(this.getAttribute ('pos'));
								var pl = photosLength+1;

									for (var k in photos) {
										if (photos[k].tagName == 'I' ) {											
											if (k < pos) {
												photos[k].style.zIndex = parseInt(parseInt(k)+1);
											}else if (k > pos){
												photos[k].style.zIndex = parseInt(parseInt(pl)-parseInt(k));
											}
										}	
									}
									
									this.style.zIndex = parseInt(photosLength+10);
								}
							}
						}

				}		

				function highLightMenu (id) {
					var menu = document.getElementById('spec_menu').getElementsByTagName ('a');
					
						for (var i in menu) {
							if (menu[i].tagName == 'A' && menu[i].className == '') {
								menu[i].onmouseover = function () {this.className = 'hover'}
								menu[i].onmouseout = function () {this.className = ''}
							}
						}				
				}
				
				function showSubPanelPopup (h, b) {
					var header = document.getElementById(h+'-header').className;
					var body = document.getElementById(b+'-body').className;
					document.getElementById(h+'-header').className = (header == h) ? h+' act' : h;
					document.getElementById(b+'-body').className = (body == b) ? b+' SubMenuPopUpOn' : b; 
				}


				/////////////////////////////////// Anton /////////////////////////////////////

				// фунция подмены контена пустого поля форимы на текст подписи к этому полю
				// написана для формы комментариев

				// form_field_name ( сюда передайм this , сюда текст подписи к форме ) так:
				// onfocus="form_field_name(this, 'Ваше имя')" onblur="form_field_name(this, 'Ваше имя')"
				// value форм и контент textarea изначально должен совпадать с тем, что передаётся в функцию
				 

				function form_field_name (field,name) {
					
					if (field.value == name)
					{
						field.value = '';
						field.style.color = 'black';

					} else {

						if (field.value=='') 
						{
							field.value = name; 
							field.style.color = 'gray';
						} else {
							field.style.color = 'black';
						}

					}

				}