var activeImg = ""
var prev_img_org = ""
var prev_obj = ""
var prev_div_id = ""
var prev_img_id = ""
arrObj = new Array()

function BrowserSystemCheck() {
	var brwtype = navigator.appName
	if (brwtype=="Netscape") this.brwtype = "ns"
	else if (brwtype=="Microsoft Internet Explorer") this.brwtype = "ie"
	else this.brwtype = brwtype
	this.brwvers = navigator.appVersion
	this.brwversion = parseInt(this.brwvers)
			
	this.ns = (this.brwtype=="ns" && this.brwversion>=4)
	this.ns4 = (this.brwtype=="ns" && this.brwversion==4)
	this.ns5 = (this.brwtype=="ns" && this.brwversion==5)
	this.ie = (this.brwtype=="ie" && this.brwversion>=4)
	this.ie4 = (this.brwvers.indexOf('MSIE 4')>0)
	this.ie5 = (this.brwvers.indexOf('MSIE 5')>0)
	this.min = (this.ns||this.ie)
	
	this.winos = (this.brwvers.lastIndexOf('Win')!= -1)
	this.macos = (this.brwvers.lastIndexOf('Win') == -1)
	this.macosie = this.macos && this.ie
	this.macosns = this.macos && this.ns
	this.winosie = this.winos && this.ie
	this.winosns = this.winos && this.ns
}

function Img(obj,div_id,img_id,img_org,img_active,img_over)
{
	this.obj = obj
	this.div_id = div_id
	this.img_id = img_id
	this.img_org = img_org
	this.img_active = img_active 
	this.img_over = img_over
	
	arrObj[arrObj.length] = this.obj
	
	this.onClick = onClick
	this.hideOld = hideOld
	this.mouseOver = mouseOver
	this.mouseOut = mouseOut
}

//
function onClick(){
		if(this.img_id != activeImg && activeImg != ""){
			eval(prev_obj + ".hideOld()")
		}
			
		activeImg = this.img_id	
		imgObj = this.img_active
		prev_obj = this.obj
			if (document.images){	
				if (is.ns) eval('document.images["'+this.img_id+'"].src = '+imgObj+'.src')
				else document.images[this.img_id].src = eval(imgObj+".src")
			}
		prev_obj = this.obj
		prev_img_org = this.img_org	
		prev_img_id = this.img_id
		prev_div_id = this.div_id
}	

//changes the previous active image to original
function hideOld(){
		imgObj = prev_img_org
		if (document.images) {	
			if (is.ns) eval('document.images["'+prev_img_id+'"].src = '+imgObj+'.src')
			else document.images[prev_img_id].src = eval(imgObj+".src")
		}
}

//change image on mouseover
function mouseOver(){
	//alert(this.img_id)
	if(this.img_id != activeImg){
		imgObj = this.img_over
		if (document.images) {	
			if (is.ns) eval('document.images["'+this.img_id+'"].src = '+imgObj+'.src')
			else document.images[this.img_id].src = eval(imgObj+".src")
		}
	}
}

//change image on mouseout
function mouseOut(){
	if(this.img_id != activeImg){
		imgObj = this.img_org
		if (document.images) {	
			if (is.ns) eval('document.images["'+this.img_id+'"].src = '+imgObj+'.src')
			else document.images[this.img_id].src = eval(imgObj+".src")
		}
	}
}

//Sets all images to original
function hideit(){
	if(prev_obj != ""){
		activeImg = ""
		eval(prev_obj + ".hideOld()")
	}
}

//Preloads images
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
	}
}
