function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

window.onload = prepareSearchFields;

function prepareSearchFields() {
    //check that the browser is capable of executing the script
    if(!document.getElementById) return false; 
    //find our input field and assign it to a variable for easy referencing
    var searchField = document.getElementById("mailfield");
    //find the default value of the search field
    var defaultValue = searchField.defaultValue;
    
    searchField.onfocus = function() {
	if(searchField.value == defaultValue) {
	    searchField.value = "";
	}
    }
    
    searchField.onblur = function() {
	if(searchField.value == "") {
	    searchField.value = defaultValue;
	}
    }
}



function fm(el_id)
{
    obj1	= document.getElementById("fi_"+el_id);
    obj1.style.display = (obj1.style.display == "none") ? "block" : "none";
    Set_Cookie(el_id, obj1.style.display, 30);
    img	= document.images["img_file_"+el_id];
    img.src = (obj1.style.display == "none") ? "/images/button_expand.gif" : "/images/button_min.gif";
//    img_alt = (obj1.style.display == "none") ? "header=[&nbsp;&nbsp;<nobr>Свернуть</nobr>] body=[] delay=[1500]" : "header=[&nbsp;&nbsp;<nobr>Развернуть</nobr>] body=[] delay=[1500]"; img.setAttribute("title", img_alt);
}


function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}


function browseIt()
{
    this.ver = navigator.appVersion.toLowerCase();
    this.verNum = parseInt(this.ver);
    this.agent = navigator.userAgent.toLowerCase();
    this.dom = (document.getElementById ? 1 : 0);
    this.opera = (this.agent.indexOf("opera") > -1 && this.dom ? 1 : 0);
    this.opera7 = (this.opera && this.verNum >= 7);
    this.opera9 = (this.opera && this.verNum >= 9);
    this.ie = (this.ver.indexOf("msie") > -1 && this.dom && !this.opera ? 1 : 0);
    this.ieVer = 0;
    if (this.ie) {
	var pos = this.ver.indexOf("msie");
	if (pos != -1)
	    this.ieVer = parseFloat(this.ver.substr(pos + 5));
    }
    this.ie6 = (this.ie && (this.ieVer >= 6));
    this.ie6only = (this.ie && (this.ieVer >= 6) && (this.ieVer < 7));
    this.ie7 = (this.ie && (this.ieVer >= 7));
    this.macOS = (this.agent.indexOf("mac") > -1);
    this.mac = (this.macOS && this.verNum >= 7 ? 1 : 0);
    this.moz = (this.agent.indexOf("gecko") > -1);
    this.ns6 = (this.dom && this.agent.indexOf("netscape") > -1 && this.verNum >= 5 ? 1 : 0);
    this.ff = (this.agent.indexOf("firefox") > -1);
    this.b = (this.ie || this.ns6 || this.opera7 || this.mac || this.moz || this.dom);

    return this;
}

//var px = window.opera ? "" : "px";
var b = new browseIt();

