/*-- Boza :: 2001.05.03. :: Ver: 1.0 --*/

function changeImage(ImgSrc, ImgId, ImgCont)
{
	var ns4 = (document.layers)?true:false
	if (document.images)
	{
		ChgScr = ""
		if (ns4 && ImgCont)ChgScr += 'document.' + ImgCont + '.'
		ChgScr += 'document.images["' + ImgId + '"].src = "' + ImgSrc + '"'
		eval(ChgScr)
	}
}

function Flip(MnuNum, MnuFirst, MnuLast, DifSep, Container)
{ 
	var ns4 = (document.layers)?true:false
	ChgStr = 'gr'
	if (DifSep){ChgStrL= ChgStr + "l"; ChgStrR= ChgStr + "r"}else{ChgStrL= ChgStr; ChgStrR= ChgStr}
	SepStr = ''; SepStrLeft = ''; SepStrRight = ''
	if (document.images) {
		if (ns4 && Container) PreImgSrc = "document." + Container + '.'
		else PreImgSrc = ""
		PreImgSrc += "document.images['"
		PostImgSrc = "'].src"

		SrcStr = eval(PreImgSrc + "Btn"+ MnuNum + PostImgSrc)
		if (MnuNum -1 >= MnuFirst)SepStrLeft = eval(PreImgSrc + "Sep"+ (MnuNum-1) + PostImgSrc)
		if (MnuNum < MnuLast)SepStrRight = eval(PreImgSrc + "Sep"+ MnuNum + PostImgSrc)

		while(SrcStr.indexOf('\\') >= 0) SrcStr = SrcStr.replace('\\', '/')
		while(SepStrLeft.indexOf('\\') >= 0) SepStrLeft = SepStrLeft.replace('\\', '/')
		while(SepStrRight.indexOf('\\') >= 0) SepStrRight = SepStrRight.replace('\\', '/')
		if (SrcStr.substring(SrcStr.length - 6,SrcStr.length - 4).toLowerCase() != 'gr')
		{
			SrcStr = SrcStr.substring(0, SrcStr.length - 4) + ChgStr + SrcStr.substr(SrcStr.length - 4)
			ToGray = true
			if (SepStrLeft)SepStrLeft = SepStrLeft.substring(0, SepStrLeft.length - 4) + ChgStrL + SepStrLeft.substr(SepStrLeft.length - 4)
			if (SepStrRight)SepStrRight = SepStrRight.substring(0, SepStrRight.length - 4) + ChgStrR + SepStrRight.substr(SepStrRight.length - 4)
		}else{
			SrcStr = SrcStr.substring(0, SrcStr.length - (ChgStr.length + 4)) + SrcStr.substr(SrcStr.length - 4)
			ToGray = false
			if (SepStrLeft)SepStrLeft = SepStrLeft.substring(0, SepStrLeft.length - (ChgStrL.length + 4)) + SepStrLeft.substr(SepStrLeft.length - 4)
			if (SepStrRight)SepStrRight = SepStrRight.substring(0, SepStrRight.length - (ChgStrR.length + 4)) + SepStrRight.substr(SepStrRight.length - 4)
		}
		if (SepStrLeft) changeImage(SepStrLeft,"Sep" + (MnuNum - 1), Container)
		if (SepStrRight) changeImage(SepStrRight,"Sep" + MnuNum, Container)
		changeImage(SrcStr,"Btn" + MnuNum, Container)
	}
}

function Preload()
{
	anArray=Preload.arguments
	if (!document.Prelodeds)document.Prelodeds = new Array()
	if (anArray && document.images)
	{
		for (i=document.Prelodeds.length; i<anArray.length; i++)
		{
			document.Prelodeds[i] = new Image
			document.Prelodeds[i].src = anArray[i]
		}
	}
}
