function UnHide( eThis ){    
  if( eThis.className == 'FS_sc' ){
      eThis.className = 'FS_sc_active'
      eThis.parentNode.parentNode.parentNode.className = '';
  }else{
      eThis.className = 'FS_sc'
      eThis.parentNode.parentNode.parentNode.className = 'FS_cl';
  }
  return false;
}
function folder( eThis ){      
  if( eThis.className == 'FS_item_active' ){
      eThis.className = 'FS_item_inactive'
  }else{
      eThis.className = 'FS_item_active'
  }
  return false;
}

function Unselect( eThis ){  
  tmp = document.getElementById('ddcontainer');  
  if( eThis.className == 'btn_select_close' ){
      tmp.className = 'ddopen'
      eThis.className = 'btn_select_open'
  }else{
      eThis.className = 'btn_select_close'
      tmp.className = 'ddclose'
  }
  return false;
}
function ddHide(t){  
  tmp_btn = document.getElementById('FS_btn_select');  
  tmp_dd = document.getElementById('FS_ddcontainer');  

  if( tmp_dd.className == 'FS_ddopen' ){
      tmp_btn.className = 'FS_btn_select_close';
      tmp_dd.className = 'FS_ddclose';
      document.request.newsLink.value = t; 
  }else{
      tmp_dd.className = 'FS_ddopen';
      tmp_btn.className = 'FS_btn_select_open';
  }
  return false;
}

function changeTmplName (e,elName) {  
   document.getElementById(elName).value = e.value; 
   return true;
}

function openPopup(newUrl){
	winobj=open(newUrl,"popup","width=400,height=300,left=20,top=20,scrollbars=1,location=0,menubar=0,resizable=1");
	winobj.focus();
}

function openHelp(newUrl){
	winobj=open(newUrl,"help","width=980,height=640,left=60,top=60,scrollbars=1,location=0,menubar=0,resizable=1");
	winobj.focus();
}

function displayDropdown( eThis ){  
  var tmp = document.getElementById('FS_ddbox');  
  if( eThis.className == 'FS_btn_dropdown_close' ){
      tmp.className = 'FS_ddopen'
      eThis.className = 'FS_btn_dropdown_open'
  }else{
      eThis.className = 'FS_btn_dropdown_close'
      tmp.className = 'FS_ddclose'
  }
  return false;
}
function hideDropdown(){  
  tmp_btn = document.getElementById('FS_btn_dropdown');  
  tmp_dd = document.getElementById('FS_ddbox');  

  if( tmp_dd.className == 'FS_ddopen' ){
      tmp_btn.className = 'FS_btn_dropdown_close';
      tmp_dd.className = 'FS_ddclose';
  }else{
      tmp_dd.className = 'FS_ddopen';
      tmp_btn.className = 'FS_btn_dropdown_open';
  }
  return false;
}

function displayPopup( eThis ){  
  var tmp = document.getElementById( eThis );  
  if( tmp.className == 'popupbox_close' ){
      tmp.className = 'popupbox_open'
  }else{
      tmp.className = 'popupbox_close'
  }
  return false;
}
function hidePopup( eThis ){  
  var tmp = document.getElementById( eThis );  
  if( tmp.className == 'popupbox_close' ){
      tmp.className = 'popupbox_open'
  }else{
      tmp.className = 'popupbox_close'
  }
  return false;
}


var timeId;
var isDOM=document.getElementById //DOM1 browser (MSIE 5+, Netscape 6, Opera 5+)
var isOpera=isOpera5=window.opera && isDOM //Opera 5+
var isOpera6=isOpera && window.print //Opera 6+
var isOpera7=isOpera && document.readyState //Opera 7+
var isMSIE=document.all && document.all.item && !isOpera //Microsoft Internet Explorer 4+
var isMSIE5=isDOM && isMSIE //MSIE 5+
var isNetscape4=document.layers //Netscape 4.*
var isMozilla=isDOM && navigator.appName=="Netscape" //Mozilla или Netscape 6.*}

function openDescriptionWindow( url, width, height, event ) {
	//printProperties(e);
	//return false;
    var frameS = '<iframe src="' + url + '" width="' + width + '" height="' + height + '" name="DescriptionIframe" id="DescriptionIframe"></iframe>';
    document.all['DescriptionContainer'].innerHTML = frameS;
    // move to position relative to click
    document.all['DescriptionContainer'].style.left = '' + getX( width, event ) + 'px';
    document.all['DescriptionContainer'].style.top = '' + getY( height, event ) + 'px';    
    // make it visible
    document.all['DescriptionContainer'].style.visibility = 'visible';
    return false;
}

function getX( width, event ) {
	var x = 2;
	var windowWidth = window.document.body.clientWidth;
	var columnWidth = Math.round( windowWidth/3 );
	var columnNumber = 1;
	for( var i=0; i<3; i++ ) {
		if ( event.clientX < columnWidth ) {
			columnNumber = i+1;
			break;
		}
		columnWidth += columnWidth;
	}
	switch (columnNumber) {
		case 1:
			if (isMSIE5) { x = event.offsetX; } else { x = event.pageX; }         
			break;
		case 2:
         if (isMSIE5) { x = event.offsetX - Math.round(width/2); } else { x = event.pageX - Math.round(width/2); }			
			if ( x<2 ) x=2;
			break;		
		case 3:
         if (isMSIE5) { x = event.offsetX - width; } else { x = event.pageX - width; } 			
			if ( x<2 ) x=2;
			break;
		default:
         if (isMSIE5) { x = event.offsetX; } else { x = event.pageX; }  			
	}
	return x;
}

function getY( height, event ) {
	var y = 2;
	var windowHeight = window.document.body.clientHeight;
	var rowHeight = Math.round( windowHeight/2 );
	if( event.clientY > rowHeight ) {      
		if (isMSIE5) { y = event.offsetY - height; } else { y = event.pageY - height; }
		if( y<2 ) y=2;
	} else {
      if (isMSIE5) { y = event.offsetY; } else { y = event.pageY; }
	}
	return y;
}

function closeDescriptionWindow() {
    document.all['DescriptionContainer'].style.visibility = 'hidden';    
}

function reloadParentWindow() {
    closeDescriptionWindow();
    window.location.reload();
}

function printProperties( obj ) {
	var s = '';
	for( var i in obj ) {
		s += i + '=' + obj[i] + '<br>\n';
	}
	var w = window.open();
	w.document.open();
	w.document.write(s);
	w.document.close();
}
   function closeFrame(){
		if ( ( window.parent ) && (window.parent.closeDescriptionWindow) ) {
			window.parent.closeDescriptionWindow();
		}	
	}

	function reloadParent(){
		if ( ( window.parent ) && (window.parent.reloadParentWindow) ) {
			window.parent.reloadParentWindow();
		}	
	}
