RandomImages = 4;
FirstPart = '<img src="../images/home_mainpic_';
LastPart = '.jpg" width="691" height="240" border="0" />';

function randomImage() 
{
	var r = Math.ceil(Math.random() * RandomImages);
	document.write(FirstPart + r + LastPart);
}


var fadeThumbs={}
	
	fadeThumbs.baseopacity=0.1 
	fadeThumbs.increment=0.2 
	
	document.write('<style type="text/css">\n') 
	document.write('.fadeThumbs{filter:progid:DXImageTransform.Microsoft.alpha(opacity='+fadeThumbs.baseopacity*100+'); -moz-opacity:'+fadeThumbs.baseopacity+'; opacity:'+fadeThumbs.baseopacity+';}\n')
	document.write('</style>')
	
	fadeThumbs.setopacity=function(obj, value){ 
		var targetobject=obj
		if (targetobject && targetobject.filters && targetobject.filters[0]){
			if (typeof targetobject.filters[0].opacity=="number") 
				targetobject.filters[0].opacity=value*100
			else //IE 5.5
				targetobject.style.filter="alpha(opacity="+value*100+")"
			}
		else if (targetobject && typeof targetobject.style.MozOpacity!="undefined")
			targetobject.style.MozOpacity=value
		else if (targetobject && typeof targetobject.style.opacity!="undefined")
			targetobject.style.opacity=value
		targetobject.currentopacity=value
	}
	
	fadeThumbs.fadeupdown=function(obj, direction){
		var targetobject=obj
		var fadeamount=(direction=="fadeup")? this.increment : -this.increment
		if (targetobject && (direction=="fadeup" && targetobject.currentopacity<1 || direction=="fadedown" && targetobject.currentopacity>this.baseopacity)){
			this.setopacity(obj, targetobject.currentopacity+fadeamount)
			window["opacityfader"+obj._fadeorder]=setTimeout(function(){fadeThumbs.fadeupdown(obj, direction)}, 50)
		}
	}
	
	fadeThumbs.clearTimer=function(obj){
	if (typeof window["opacityfader"+obj._fadeorder]!="undefined")
		clearTimeout(window["opacityfader"+obj._fadeorder])
	}
	
	fadeThumbs.isContained=function(m, e){
		var e=window.event || e
		var c=e.relatedTarget || ((e.type=="mouseover")? e.fromElement : e.toElement)
		while (c && c!=m)try {c=c.parentNode} catch(e){c=m}
		if (c==m)
			return true
		else
			return false
	}
	
	fadeThumbs.fadeinterface=function(obj, e, direction){
		if (!this.isContained(obj, e)){
			fadeThumbs.clearTimer(obj)
			fadeThumbs.fadeupdown(obj, direction)
		}
	}
	
	fadeThumbs.collectElementbyClass=function(classname){
		var classnameRE=new RegExp("(^|\\s+)"+classname+"($|\\s+)", "i")
		var pieces=[]
		var alltags=document.all? document.all : document.getElementsByTagName("*")
		for (var i=0; i<alltags.length; i++){
			if (typeof alltags[i].className=="string" && alltags[i].className.search(classnameRE)!=-1)
				pieces[pieces.length]=alltags[i]
		}
		return pieces
	}
	
	fadeThumbs.init=function(){
		var targetobjects=this.collectElementbyClass("fadeThumbs")
		for (var i=0; i<targetobjects.length; i++){
			targetobjects[i]._fadeorder=i
			this.setopacity(targetobjects[i], this.baseopacity)
			targetobjects[i].onmouseover=function(e){fadeThumbs.fadeinterface(this, e, "fadeup")}
			targetobjects[i].onmouseout=function(e){fadeThumbs.fadeinterface(this, e, "fadedown")}
		}
	}
