if(typeof com == "undefined") var com = new Object();
com.howe = {};
com.howe.MainAnimation = {};
com.howe.SubAnimation = {};
com.howe.MainAnimation2 = {};
com.howe.SubAnimation2 = {};

// MainAnimation
com.howe.MainAnimation = function(swfFile, newDivId, width, height, version, bgColor) {
	this.newDivId = newDivId;
	this.images = Array();
	this.groups = Array();
	this.swf = new FlashObject(swfFile, newDivId, width, height, version, bgColor);
}
com.howe.MainAnimation.prototype = {
	bigAnimTitle:"",
	bigAnimSmallTitle:"",
	bigAnimLeftImage:"",
	bigAnimSlideShowInterval:"",
	addParam:function(param, value) {
		this.swf.addParam(param, value);
	},
	addVariable:function(varriable, value) {
		this.swf.addVariable(varriable, value);
	},
	addImage:function(file, title, description, bigImage) {
		bigImage = bigImage ? bigImage : "";
		this.images.push(
			{
				file:file,
				title:this.getRightTextFormat(title == "" ? "null" : title),
				description:this.getRightTextFormat(description == "" ? "null" : description),
				bigImage:bigImage != "" ? bigImage : " "
			}
		);
	},
	show:function(divId) {
		
		this.bigAnimRightImages = "";
		this.bigAnimRightTitles = "";
		this.bigAnimRightDescriptions = "";
		this.bigAnimBigImages = "";
		
		for(i=0; i<this.images.length; i++){
			this.bigAnimRightImages += this.images[i].file + (i == this.images.length-1 ? "" : "|||");
			this.bigAnimRightTitles += this.images[i].title + (i == this.images.length-1 ? "" : "|||");
			this.bigAnimRightDescriptions += this.images[i].description + (i == this.images.length-1 ? "" : "|||");
			this.bigAnimBigImages += this.images[i].bigImage + (i == this.images.length-1 ? "" : "|||");
		}
		this.swf.addVariable("title", this.getRightTextFormat(this.bigAnimTitle));
		this.swf.addVariable("smallText", this.getRightTextFormat(this.bigAnimSmallTitle));
		this.swf.addVariable("leftImage", this.bigAnimLeftImage);
		this.swf.addVariable("rightImages", this.bigAnimRightImages);
		this.swf.addVariable("rightImagesTitle", this.bigAnimRightTitles);
		this.swf.addVariable("rightImagesDescriptions", this.bigAnimRightDescriptions);
		this.swf.addVariable("bigImages", this.bigAnimBigImages);
		this.swf.addVariable("interval", this.bigAnimSlideShowInterval);
		this.swf.write(divId);
		
	},
	getRightTextFormat:function(text) {
		text = text.replace("&amp;", "<amp>");
		text = text.replace("&amp", "<amp>");
		text = text.replace("&", "<amp>");
		text = text.replace("+", "<plus>");	
		return text;
	},
	changeImage:function(subAnimationImages, picURL, index) {		
		var elem = document.getElementById(this.newDivId);
		if(!elem) {
			alert("Missing mainAnimation !!!");
		} else {			
			elem.changeRightImage(subAnimationImages[index].bigImage, subAnimationImages[index].newWindowImage, subAnimationImages[index].title, subAnimationImages[index].description);
		}
	},
	addGroup:function(group) {
		this.groups.push(group);
	},
	showWithGroups:function(divId) {
		
		this.titles = "";
		this.smallTitles = "";
		this.leftImages = "";
		this.bigAnimRightImages = "";
		this.bigAnimRightTitles = "";
		this.bigAnimRightDescriptions = "";
		
		for(i=0; i<this.groups.length; i++) {
			var group = this.groups[i];
			var numberOfImages = group.numberOfImages();
			this.titles += this.getRightTextFormat(group.title) + (i == this.groups.length-1 ? "" : "|||");
			this.smallTitles += this.getRightTextFormat(group.smallTitle) + (i == this.groups.length-1 ? "" : "|||");
			this.leftImages += group.leftImage + (i == this.groups.length-1 ? "" : "|||");
			for(j=0; j<numberOfImages; j++) {
				this.bigAnimRightImages += group.getImage(j).file + (j == numberOfImages-1 ? "" : "|||"); 
				this.bigAnimRightTitles += group.getImage(j).title + (j == numberOfImages-1 ? "" : "|||"); 
				this.bigAnimRightDescriptions += group.getImage(j).description + (j == numberOfImages-1 ? "" : "|||"); 
			}
			this.bigAnimRightImages += (i == this.groups.length-1 ? "" : "^^^");
			this.bigAnimRightTitles += (i == this.groups.length-1 ? "" : "^^^");
			this.bigAnimRightDescriptions += (i == this.groups.length-1 ? "" : "^^^");
		}
		
		this.swf.addParam("menu","false");
		this.swf.addParam("wmode", "transparent");
		this.swf.addVariable("titles", this.titles);
		this.swf.addVariable("smallTitles", this.smallTitles);
		this.swf.addVariable("leftImages", this.leftImages);
		this.swf.addVariable("rightImages", this.bigAnimRightImages);
		this.swf.addVariable("rightImagesTitle", this.bigAnimRightTitles);
		this.swf.addVariable("rightImagesDescriptions", this.bigAnimRightDescriptions);
		this.swf.addVariable("interval", this.bigAnimSlideShowInterval);
		this.swf.write(divId);
	}
}
// MainAnimationGroup
com.howe.MainAnimationGroup = function() {
	this.images = Array();
}
com.howe.MainAnimationGroup.prototype = {
	title:"",
	smallTitle:"",
	leftImage:"",
	addImage:function(file, title, description) {		
		this.images.push(
			{
				file:file,
				title:this.getRightTextFormat(title == "" ? "null" : title),
				description:this.getRightTextFormat(description == "" ? "null" : description)
			}
		);
	},
	numberOfImages:function() {
		return this.images.length;
	},
	getImage:function(index) {
		return this.images[index];
	},
	getRightTextFormat:function(text) {
		text = text.replace("&amp;", "<amp>");
		text = text.replace("&amp", "<amp>");
		text = text.replace("&", "<amp>");
		text = text.replace("+", "<plus>");	
		return text;
	}
}
// SubAnimation
com.howe.SubAnimation = function(swfFile, newDivId, width, height, version, bgColor) {
	this.images = Array();
	this.swf = new FlashObject(swfFile, newDivId, width, height, version, bgColor);
}
com.howe.SubAnimation.prototype = {
	tooltipText:"",
	getRightTextFormat:function(text) {
		text = text.replace("&amp;", "<amp>");
		text = text.replace("&amp", "<amp>");
		text = text.replace("&", "<amp>");
		text = text.replace("+", "<plus>");	
		return text;
	},
	addParam:function(param, value) {
		this.swf.addParam(param, value);
	},
	addImage:function(thumb, bigImage, newWindowImage, title, description) {
		this.images.push(
			{
				thumb:thumb,
				bigImage:bigImage,
				newWindowImage:this.getRightTextFormat(newWindowImage),
				title:this.getRightTextFormat(title),
				description:this.getRightTextFormat(description)
			}
		);
	},
	show:function(divId) {
		
		this.smallAnimImages = "";
		
		for(i=0; i<this.images.length; i++){
			this.smallAnimImages += this.images[i].thumb + (i == this.images.length-1 ? "" : "|||");
		}
		
		this.swf.addVariable("tooltipText", this.getRightTextFormat(this.tooltipText));
		this.swf.addVariable("images", this.smallAnimImages);
		this.swf.write(divId);
	}
}

// MainAnimation2
com.howe.MainAnimation2 = function(swfFile, newDivId, width, height, version, bgColor) {
	this.newDivId = newDivId;
	this.images = Array();
	this.groups = Array();
	this.swf = new FlashObject(swfFile, newDivId, width, height, version, bgColor);
}
com.howe.MainAnimation2.prototype = {
	popupURL:"",
	bigTitle:"",
	smallTitle:"",
	addParam:function(param, value) {
		this.swf.addParam(param, value);
	},
	addVariable:function(varriable, value) {
		this.swf.addVariable(varriable, value);
	},
	getRightTextFormat:function(text) {
		//text = text.replace("&amp;", "<amp>");
		//text = text.replace("&amp", "<amp>");
		//text = text.replace("&", "<amp>");
		//text = text.replace("+", "<plus>");	
		return text;
	},
	addGroup:function(group) {
		this.groups.push(group);
	},
	showWithGroups:function(divId) {
		
		this.titles = "";
		this.descriptions = "";
		this.leftImages = "";
		this.rightImages = "";
		this.bigRightImages = "";
		
		for(i=0; i<this.groups.length; i++) {
			var group = this.groups[i];
			this.titles += this.getRightTextFormat(group.title == "" ? " " : group.title) + (i == this.groups.length-1 ? "" : "|||");
			this.descriptions += this.getRightTextFormat(group.description == "" ? " " : group.description) + (i == this.groups.length-1 ? "" : "|||");
			this.leftImages += group.leftImage + (i == this.groups.length-1 ? "" : "|||");			
			this.rightImages += group.rightImage + (i == this.groups.length-1 ? "" : "|||");		
			this.bigRightImages += (group.bigRightImage == "" ? " " : group.bigRightImage) + (i == this.groups.length-1 ? "" : "|||");
		}
		
		this.swf.addParam("menu","false");
		this.swf.addParam("wmode", "transparent");
		this.swf.addVariable("bigTitle", this.getRightTextFormat(this.bigTitle));
		this.swf.addVariable("smallTitle", this.getRightTextFormat(this.smallTitle));
		this.swf.addVariable("titles", this.titles);
		this.swf.addVariable("descriptions", this.descriptions);
		this.swf.addVariable("leftImages", this.leftImages);
		this.swf.addVariable("rightImages", this.rightImages);
		this.swf.addVariable("bigRightImages", this.bigRightImages);		
		this.swf.addVariable("popupURL", this.popupURL);
		this.swf.write(divId);
	},
	changeGroup:function(newIndex) {
		var elem = document.getElementById(this.newDivId);
		if(!elem) {
			alert("Missing mainAnimation !!!");
		} else {			
			elem.changeGroup(newIndex);
		}
	}
}
// MainAnimationGroup2
com.howe.MainAnimationGroup2 = function(leftImage, rightImage, bigRightImage, thumb, title, description) {
	this.leftImage = leftImage;
	this.rightImage = rightImage;
	this.bigRightImage = bigRightImage;
	this.thumb = thumb;
	this.title = this.getRightTextFormat(title);
	this.description = this.getRightTextFormat(description);
}
com.howe.MainAnimationGroup2.prototype = {
	getRightTextFormat:function(text) {
		text = text.replace("&amp;", "<amp>");
		text = text.replace("&amp", "<amp>");
		text = text.replace("&", "<amp>");
		text = text.replace("+", "<plus>");	
		return text;
	}
}
// SubAnimation2
com.howe.SubAnimation2 = function(swfFile, newDivId, width, height, version, bgColor) {
	this.groups = Array();
	this.swf = new FlashObject(swfFile, newDivId, width, height, version, bgColor);
}
com.howe.SubAnimation2.prototype = {
	tooltipText:"",
	getRightTextFormat:function(text) {
		text = text.replace("&amp;", "<amp>");
		text = text.replace("&amp", "<amp>");
		text = text.replace("&", "<amp>");
		text = text.replace("+", "<plus>");	
		return text;
	},
	addParam:function(param, value) {
		this.swf.addParam(param, value);
	},
	addGroup:function(group) {
		this.groups.push(group);
	},
	show:function(divId) {
		
		this.smallAnimImages = "";
		
		for(i=0; i<this.groups.length; i++){
			this.smallAnimImages += this.groups[i].thumb + (i == this.groups.length-1 ? "" : "|||");
		}
		
		this.swf.addVariable("tooltipText", this.getRightTextFormat(this.tooltipText));
		this.swf.addVariable("images", this.smallAnimImages);
		this.swf.write(divId);
	}
}

// CLASSES
var MainAnimation = com.howe.MainAnimation;
var MainAnimationGroup = com.howe.MainAnimationGroup;
var SubAnimation = com.howe.SubAnimation;
var MainAnimation2 = com.howe.MainAnimation2;
var MainAnimationGroup2 = com.howe.MainAnimationGroup2;
var SubAnimation2 = com.howe.SubAnimation2;


function open2d3d() {
	var wnd2d3d;
	var url;
	url = '/Library/2D3Dhtml/index.html';
	wnd2d3d = window.open(url, 'wnd2d3d', 'width=500,height=500,menubar=0,toolbar=0,location=0,scrollbars=1,resizable=0,x=25,y=25');
	wnd2d3d.focus();
	//return false;
}

// Do the same as open2d3d()
function openPopup(url) {
 window.open(url, "popup_id", "scrollbars,resizable,width=500,height=600");
 return false;
}
