function findBlur(t)
{
	if (t.value=='') t.value='поиск...';
}
function findFocus(t)
{
	t.value='';
}




function SetOpacity(object,opacityPct)
{
  object.style.filter = 'alpha(opacity=' + opacityPct + ')';
  object.style.MozOpacity = opacityPct/100;
  object.style.opacity = opacityPct/100;
}
function ChangeOpacity(id,msDuration,msStart,fromO,toO)
{
  var element=document.getElementById(id);
  var opacity = element.style.opacity * 100;
  var msNow = (new Date()).getTime();
  opacity = fromO + (toO - fromO) * (msNow - msStart) / msDuration;
  if (opacity<0) 
    SetOpacity(element,0)
  else if (opacity>100)
    SetOpacity(element,100)
  else
  {
    SetOpacity(element,opacity);
    element.timer = window.setTimeout("ChangeOpacity('" + id + "'," + msDuration + "," + msStart + "," + fromO + "," + toO + ")",1);
  }
}
function FadeIn(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",0,100)",1);
}
function FadeOut(id)
{
  var element=document.getElementById(id);
  if (element.timer) window.clearTimeout(element.timer); 
  var startMS = (new Date()).getTime();
  element.timer = window.setTimeout("ChangeOpacity('" + id + "',1000," + startMS + ",100,0)",1);
}
function FadeInImage(foregroundID,newImage,backgroundID)
{
  var foreground=document.getElementById(foregroundID);
  if (backgroundID)
  {
    var background=document.getElementById(backgroundID);
    if (background)
    {
      background.style.backgroundImage = 'url(' + foreground.src + ')';
      background.style.backgroundRepeat = 'no-repeat';
    }
  }
  SetOpacity(foreground,0);
  foreground.src = newImage;
  if (foreground.timer) window.clearTimeout(foreground.timer); 
  var startMS = (new Date()).getTime();
  foreground.timer = window.setTimeout("ChangeOpacity('" + foregroundID + "',1000," + startMS + ",0,100)",10);
}

var nI=1;
var nt1=0;
var nt2=0;
var t;
var i=0;
var NCh=0;
function changebackgroundstart(n)
{
	NCh=n;	
	var dt=new Date();
	var cts=200;
	i++;
	//document.getElementById('idInn').innerHTML=i+' '+nt1+' '+nt2;
	if (nt1==0)
	{	
		nt1=dt.getTime();
		t=setTimeout("changebackgroundstart("+n+")", cts);	
	} else
	{
		nt2=dt.getTime();
		if ((nt2-nt1)>1000)
		{ 
			//document.getElementById('idInn').innerHTML=i+' '+nt1+' '+nt2;
			//alert();
			nt1=0;
			nt2=0;
			window.clearTimeout(t);
			changebackground(n);
		} else 
		{
			t=setTimeout("changebackgroundstart("+n+")", cts);		
		}
	}
}

function changebackgroundClear()
{
	//document.getElementById('bgContSE').style.backgroundImage = 'url(image/head1.jpg)';
	return false;
}

function changebackground(n)
{
	if (document.all('bgContSE')!=null)
	{	
		flagCh=false;
		if (nI!=n)
		{
			nI=n;
			//FadeInImage('bgContSE','image/head'+n+'.jpg','bgContSE');
 			//FadeInImage('bgContSE','image/head'+n+'.jpg','bgContSE');
			document.getElementById('bgContSE').style.backgroundImage = 'url(image/head'+n+'.jpg)';
		}
		NCh=0;
	}
	return false;
}

function gotoUrl(u)
{
	window.location.href=u;	
}


function calcHeight()
{
	var the_height=document.getElementById('cfrm').contentWindow.document.body.scrollHeight;
	document.getElementById('cfrm').height=the_height;

	var NS4 = (navigator.appName.indexOf("Netscape")>=0 && parseFloat(navigator.appVersion) >= 4 && parseFloat(navigator.appVersion) < 5)? true : false;

	var prel;
	if (prel=document.getElementById('cfrm').contentWindow.document.getElementById('preloader'))
	{
		prel.style.visibility='visible';
		prel.style.top='-300px';
	}
	var cwin;
	if (cwin=document.getElementById('cfrm').contentWindow.document.getElementById('contentw'))
	{
		cwin.style.visibility='visible';
	}
}


function openifr(s)
{
	document.getElementById('cfrm').src='content_reader.php?pagelink='+s;	
}
function aprint(id)
{
	 window.open('print-'+id+'.html','aprint'+id,'resizable,scrollbars=yes,width=800,height=600');
}
function page_print(id)
{
	 window.open('page_print-'+id+'.html','page_print'+id,'resizable,scrollbars=yes,width=800,height=600');
}
