//functions for turnon and off images

//Current active image

var activeimage = ""


function hilteImage(imagename,flag){

	if(document.images[imagename] == null)
		return;

	if( !flag && (imagename == activeimage))
		return;
		
	var imagefilename = "";
	var imgpath = ""
	var imgext = "";

	longimagefilename = document.images[imagename].src;
	
	//alert(longimagefilename);
	
	iloc = longimagefilename.lastIndexOf("/");
	if(iloc != -1){		
		imagefilename = longimagefilename.substring(iloc+1,longimagefilename.length);
		imgpath = longimagefilename.substring(0,iloc+1);
	}else{
		imagefilename = longimagefilename.substring(0,longimagefilename.length);
	}
	
	ploc = imagefilename.lastIndexOf(".");
	if(ploc !=0 ){
		imgext = imagefilename.substring(ploc+1, imagefilename.length)
		imagefilename = imagefilename.substring(0,ploc)
	}

	iloc = imagefilename.lastIndexOf("-active");
	if(iloc != -1)
		imagefilename = imagefilename.substring(0,iloc);//imagefilename.length-3);

	if(flag)
		if( imgext == "")
			document.images[imagename].src = imgpath + imagefilename + "-active";
		else
			document.images[imagename].src = imgpath + imagefilename + "-active."+imgext;
	else
		if( imgext == "")
			document.images[imagename].src = imgpath + imagefilename;
		else
			document.images[imagename].src = imgpath + imagefilename + "."+imgext;

	//alert(document.images[imagename].src);

}


function setActiveImage(imagename){
	activeimage = imagename;
	
	//alert(document.images.length);
	
	for(i=0;i<document.images.length;i++){	
		//alert(document.images[i].name + " : " + document.images[i].src);
		if(document.images[i].name != ""){		
			if( document.images[i].name != imagename )
				hilteImage(document.images[i].name, false);
			else
				hilteImage(document.images[i].name, true);
		}
	}	
}

function Message(msg){
	msgwin = parent.textframe;
	msgwin.document.open();
	msgwin.document.writeln('<html><title>message</title><body>');
	msgwin.document.writeln('<b><center>' + msg + '</center></b>');
	msgwin.document.writeln('</body></html>');
	msgwin.document.close();
}
