function browser_class()
{
	var b=navigator.appName
	this.b=(b=="Netscape")?"ns":(b=="Microsoft Internet Explorer")?"ie":b
	av=navigator.appVersion
	this.opera = (navigator.userAgent.indexOf('Opera') != -1)?1:0
	this.ns4 = (document.layers && !this.dom)?1:0
	this.ns6 = (document.getElementById && !document.all && this.b == 'ns')?1:0
	
	this.ie = (document.all)?1:0
	this.ie4 = (document.all && !this.dom && !this.opera)?1:0
	this.ie5 = (document.all && document.getElementById)?1:0
	this.ie5mac = (navigator.userAgent.indexOf('MSIE 5') != -1 && navigator.userAgent.indexOf('Mac') != -1)
	this.ie55 = (this.ie&&av.indexOf('MSIE 5.5')>0)?1:0
	//this.ie55up = this.ie55 || this.ie6
	this.ie55up = (this.ie&&(parseFloat(av.substr(av.indexOf('MSIE')+5))>=5.5))?1:0
	this.ie6 = (this.ie&&av.indexOf('MSIE 6.0')>0)?1:0
	this.ie6up = (this.ie&&(parseFloat(av.substr(av.indexOf('MSIE')+5))>=6))?1:0
	
	this.dom = (document.getElementById)?1:0
	this.w3cdom = (!this.ie5mac && document.getElementsByTagName && document.createElement)?1:0
	this.newBrNotIE = (!this.ie && document.getElementById)?1:0
}
br = new browser_class()


function findObj(e,frame) {
	if (typeof(e)!='string') return e
	var d
	if (frame) d = typeof(frame)=='object' ? frame.document : eval(frame+'.document')
	else d = window.document
	if (document.getElementById) { e = d.getElementById(e) }
	else if (document.all) { e = d.all[e] }
	else { e = null }
	return e
}


function imgOverOutSimple_class()
{
	this.targImg
	this.settings =
	{
		over: '_over',
		out: '_out',
		isOutImg: false
	}
	
	this.findImg = function(obj,type)
	{
		if (type=='child')
		{
			for (var i=0; obj.childNodes.length > i; i++)
			{
				if (obj.childNodes[i].nodeType==1 && obj.childNodes[i].tagName=='IMG')
				{
					return obj.childNodes[i]
				}
			}
		}
	}
	
	this.over = function(obj,type)
	{
		if (type=='child')
		{
			if (!obj.imgOverOut_type)
			{
				obj.imgOverOut_type = type
			}
			if (!obj.targ_img)
			{
				obj.targ_img = this.findImg(obj,type)
			}
			this.targImg = obj.targ_img
		}
		else
		{
			this.targImg = obj
		}
		var curr = this.targImg.src
		if (!this.targImg.out_src)
		{
			if (this.settings.isOutImg) this.targImg.out_src = curr.substring(0,curr.length-4) + this.settings.out + curr.substring(curr.length-4)
			else this.targImg.out_src = this.targImg.src
		}
		if (!this.targImg.over_src)
		{
			this.targImg.over_src = curr.substring(0,curr.length-4) + this.settings.over + curr.substring(curr.length-4)
		}
		this.targImg.src = this.targImg.over_src
		if (!obj.onmouseout) obj.onmouseout = this.out
	}
	
	this.out = function(e)
	{
		var obj = eventTarget(e)
		if (obj.imgOverOut_type && obj.imgOverOut_type=='child')
		{
			if (obj.targ_img.out_src) obj.targ_img.src = obj.targ_img.out_src
		}
		else
		{
			if (obj.out_src) obj.src = obj.out_src
		}
	}
}
var imgS = new imgOverOutSimple_class()

function manipulatingObjProp_class()
{
	var support = false
	var targProp = {name:'className',value:'over',sep:' ',plus:false,conditions:{leave:'first active'}}
	this.config = function(propName,propSep,plus,cond)
	{
		if (propName!==0) targProp.name = propName
		if (propSep!==0) targProp.sep = propSep
		if (plus!==0) targProp.plus = plus
		if (cond)
		{
			if (cond.leave!==undefined) targProp.conditions.leave = cond.leave
		}
	}
	
	this.change = function(srcElem,prop,howFindTarget,taskName,plus,conditions)
	{
		var propName, propValue, targElem, t
		if (!support) return;
		if (!(srcElem = findObj(srcElem))) return
		if (!(targElem = findTargElem(srcElem,howFindTarget))) return
		if (prop===0)
		{
			propName = targProp.name
			propValue = targProp.value
		}
		else
		{
			if (prop.length==1)
			{
				propName = targProp.name
				propValue = prop[0]
			}
			else
			{
				propName = prop[1]
				propValue = prop[0]
			}
		}
		if (!targElem['MOPname'+taskName]) targElem['MOPname'+taskName] = propName
		if (!targElem['MOPvalue'+taskName]) targElem['MOPvalue'+taskName] = targElem[propName]
		if (plus===0) plus = targProp.plus
		if (targElem[propName]===undefined)
		{
			targElem[propName] = propValue
			return
		}
		if (plus)
		{
			targElem[propName] += targProp.sep + propValue
		}
		else
		{
			if (conditions)
			{
				if (conditions.leave===undefined) conditions.leave = targProp.conditions.leave
			}
			else conditions = targProp.conditions
			if (conditions.leave && conditions.leave!=='')
			{
				targElem[propName] = strPalikti(targElem[propName],conditions.leave,targProp.sep) + targProp.sep + propValue
			}
			else targElem[propName] = propValue
		}
	}
	
	this.reset = function(srcElem,howFindTarget,taskName)
	{
		if (!support) return;
		if (!(srcElem = findObj(srcElem))) return
		if (!(targElem = findTargElem(srcElem,howFindTarget))) return
		targElem[targElem['MOPname'+taskName]] = targElem['MOPvalue'+taskName]
	}
	
	function findTargElem(e,howFind)
	{
		var elem
		if (howFind)
		{
			if (howFind==1) elem = e
			if (howFind==2) elem = e.parentNode.parentNode
			if (howFind==3) elem = dom_nextSiblingElem(e)
		}
		else elem = e
		return elem
	}
	
	function checkSupport()
	{
		if (br.dom) support = true
		else support = false
	}
	checkSupport()
}


function CSSfilesForBrowser_class()
{
	this.assignToDoc = function()
	{
		var currBr = br.ie ? 'ie' : br.ns6 ? 'moz' : null
		if (currBr=='moz')
		{
			var dss = document.styleSheets
			for (var i=0; i<dss.length; i++)
			{
				if (dss[i].title!='browserDependent') continue
				var reg_exp = /_ie(\.css$)/
				if (dss[i].href.search(reg_exp) > -1)
				{
					var new_href = dss[i].href.replace(/_ie(\.css$)/, '_moz$1')
					document.styleSheets[i].disabled = true
					document.write('<link title="browserDependent" href="'+new_href+'" rel="stylesheet" type="text/css" />')
				}
			}
		}
	}

}


function arrSearch(arr,value)
{
	for (var i=0; i<arr.length; i++)
	{
		if (arr[i]==value) return true
	}
	return false
}


function setBGxy(e,x,y)
{
	if (e=findObj(e))
	{
		e.style.backgroundPosition = x+'px '+y+'px'
		return true
	}
	else return false
}

