<!--
// menu
function freezetext()
{
if ( freeze.style.posTop <1000 ) {
freeze.style.posTop=document.body.scrollTop+120;
}
else {
freeze.style.posTop=document.body.scrollTop+100;
}
}

// InputPlaceholder
function InputPlaceholder (input, value, cssFilled, cssEmpty)
{
var thisCopy = this
this.Input = input
this.Value = value
this.SaveOriginal = (input.value == value)
this.CssFilled = cssFilled
this.CssEmpty = cssEmpty
this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
this.setupEvent (this.Input, 'blur', function() {return thisCopy.onBlur()})
this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()})
if (input.value == '') this.onBlur();
return this
}
InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
if (elem.attachEvent)
{
elem.attachEvent ('on' + eventType, handler)
}
if (elem.addEventListener)
{
elem.addEventListener (eventType, handler, false)
}
}
InputPlaceholder.prototype.onFocus = function()
{
if (!this.SaveOriginal && this.Input.value == this.Value)
{
this.Input.value = ''
}
else
{
this.Input.className = ''
}
}
InputPlaceholder.prototype.onKeyDown = function()
{
this.Input.className = ''
}
InputPlaceholder.prototype.onBlur = function()
{
if (this.Input.value == '' || this.Input.value == this.Value)
{
this.Input.value = this.Value
this.Input.className = this.CssEmpty
}
else
{
this.Input.className = this.CssFilled
}
}


// browser less than 4.x redirect
var isNav, isIE
if (parseInt(navigator.appVersion) >=4) {
	if (navigator.appName == "Netscape") {
		isNav = true
	}
	else {
		isIE = true
	}
}

// browser check
function checkBrowser(){
        this.ver=navigator.appVersion
        this.dom=document.getElementById?1:0
        this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
        this.ie4=(document.all && !this.dom)?1:0;
        this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
        this.ns4=(document.layers && !this.dom)?1:0;
        this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
        return this
}
bw=new checkBrowser()
var speed=50
var loop, timer
function makeObj(obj,nest){
    nest=(!nest) ? '':'document.'+nest+'.'
        this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
        this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
        this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
        this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
        this.up=goUp;this.down=goDown;
        this.moveIt=moveIt; this.x; this.y;
    this.obj = obj + "Object"
    eval(this.obj + "=this")
    return this
}

//Navigator Window Resizing fix
FormResubmitGlobalControl = "";
function netscapeFix() {
	if (innerWidth != origWidth || innerHeight != origHeight) {
		if (FormResubmitGlobalControl != "" && (location.href.indexOf("?") < 0)) {
			submitForm(FormResubmitGlobalControl);
		} else {
			window.location.reload();
		}
	}
}

if (document.layers) {
	origWidth = innerWidth;
	origHeight = innerHeight;
	window.onresize = netscapeFix;
}



//show date

function showDate(flag)
{
if (flag==1 && (SU=='app' || SU=='adm')) 
{
document.write('prev'.link(location.pathname+'?Navigate&To=Prev'));
document.write(' :: ' + 'edit'.link(location.pathname+'?EditDocument') + ' :: ');
if (SU=='adm') document.write('delete'.link(location.pathname+'?DeleteDocument') + ' :: ');
document.write('next'.link(location.pathname+'?Navigate&To=Next'));
return;
}
date = new Date();
var monArr = new Array ('января', 'февраля', 'марта', 'апреля', 'мая', 'июня', 'июля', 'августа', 'сентября', 'октября', 'ноября', 'декабря');
var wdayArr = new Array ('','','','','','','');
var ye = ' ' + date.getYear();
document.write( wdayArr[date.getDay()] + '&nbsp;&nbsp;&nbsp;' + date.getDate() + ' ' + monArr[date.getMonth()] + ' 20' + ye.substring(ye.length-2,ye.length) + ' года' );
};


//podpisi pod risunkami
var offsetfrommouse=[15,-5]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
var displayduration=12; //duration in seconds image should remain visible. 0 for always.
var currentimageheight = 160;	// maximum image size.

if (document.getElementById || document.all){
	document.write('<div id="trailimageid">');
	document.write('</div>');
}

function gettrailobj(){
if (document.getElementById)
return document.getElementById("trailimageid").style
else if (document.all)
return document.all.trailimagid.style
}

function gettrailobjnostyle(){
if (document.getElementById)
return document.getElementById("trailimageid")
else if (document.all)
return document.all.trailimagid
}


function truebody(){
return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function showtrail(imagename, imagenum, license, caption, showthumb, brand, imageid){
	//Only do this if the person wants it
	if(document.hoverForm.showComp.selectedIndex==0) {
		if (imageid > 0) {
			var width = getImageWidth(imageid);
			var height = getImageHeight(imageid);
		}
		//if (height > 0){
		//	currentimageheight = height;
		//}
		//alert(getImageHeight(imageid));
		//alert(currentimageheight);
		document.onmousemove=followmouse;
		newHTML = '<div style="padding: 5px; background-color: #FFF; border: 1px solid #888;">';
		
		if (showthumb > 0){
			newHTML = newHTML + '';
		}

		newHTML = newHTML + '<b>' + brand + '</b><br>';
	
		newHTML = newHTML + '<span>' + unescape(caption) + '</span>';
		
		newHTML = newHTML + '</div>';

		gettrailobjnostyle().innerHTML = newHTML;

		gettrailobj().visibility="visible";
	}
}


function hidetrail(){
	if(document.hoverForm.showComp.selectedIndex==0) {
		gettrailobj().visibility="hidden"
		document.onmousemove=""
		gettrailobj().left="-500px"
	}
}

function followmouse(e){

	var xcoord=offsetfrommouse[0]
	var ycoord=offsetfrommouse[1]

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(document.body.offsetHeight, window.innerHeight)

	//if (document.all){
	//	gettrailobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br>B = ' + truebody().clientHeight;
	//} else {
	//	gettrailobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br>D = ' + window.innerHeight;
	//}

	if (typeof e != "undefined"){
		if (docwidth - e.pageX < 300){
			xcoord = e.pageX - xcoord - 286; // Move to the left side of the cursor
		} else {
			xcoord += e.pageX;
		}
		if (docheight - e.pageY < (currentimageheight + 110)){
			ycoord += e.pageY - Math.max(0,(110 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
		} else {
			ycoord += e.pageY;
		}

	} else if (typeof window.event != "undefined"){
		if (docwidth - event.clientX < 300){
			xcoord = event.clientX + truebody().scrollLeft - xcoord - 286; // Move to the left side of the cursor
		} else {
			xcoord += truebody().scrollLeft+event.clientX
		}
		if (docheight - event.clientY < (currentimageheight + 110)){
			ycoord += event.clientY + truebody().scrollTop - Math.max(0,(110 + currentimageheight + event.clientY - docheight));
		} else {
			ycoord += truebody().scrollTop + event.clientY;
		}
	}

	var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
	var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)

	gettrailobj().left=xcoord+"px"
	gettrailobj().top=ycoord+"px"

}



var ns4 = 0;
var op5 = 0;

function getImageWidth(myImage) {
	var x, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.width;
	} else {
		return getElementWidth(myImage);
	}
	return -1;
}

function getImageHeight(myImage) {
	var y, obj;
	if (document.layers) {
		var img = getImage(myImage);
		return img.height;
	} else {
		return getElementHeight(myImage);
	}
	return -1;
}

function getElementHeight(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.height;
	} else {
  if(document.getElementById) {
  	var elem = document.getElementById(Elem);
  } else if (document.all){
  	var elem = document.all[Elem];
  }
  if (op5) { 
  	xPos = elem.style.pixelHeight;
  } else {
  	xPos = elem.offsetHeight;
  }
  return xPos;
	} 
}

function getElementWidth(Elem) {
	if (ns4) {
		var elem = getObjNN4(document, Elem);
		return elem.clip.width;
	} else {
  if(document.getElementById) {
  	var elem = document.getElementById(Elem);
  } else if (document.all){
  	var elem = document.all[Elem];
  }
  if (op5) {
  	xPos = elem.style.pixelWidth;
  } else {
  	xPos = elem.offsetWidth;
  }
  return xPos;
	}
}


//-->

