var ICOUNT =0;

var A_IMAGEENLARGE = new Array();

function ImageEnlarge(){
	A_IMAGEENLARGE.push(this);
	this.number = ICOUNT++;
	this.primaryImageSource = "";
	this.primaryImageHeight = "";
	this.primaryImageWidth = "";
	this.secondaryImageSource = "";
	this.secondaryImageHeight = "";
	this.secondaryImageWidth = "";

	this.setPrimaryImage = function(imgSrc, h, w){
		this.primaryImageSource = imgSrc;
		this.primaryImageHeight = h;
		this.primaryImageWidth = w;	
	}
	
	this.setSecondaryImage = function(imgSrc, h, w){
		this.secondaryImageSource = imgSrc;
		this.secondaryImageHeight = h;
		this.secondaryImageWidth = w;	
	}
	
	
	this.build = function(){
		document.write("<div id='divmain" + this.number + "' style='position:relative; border-width:0px; height:" + this.primaryImageHeight + "; width:" + this.primaryImageWidth +"; z-index:10;'>");
			document.write("<img src='" + this.primaryImageSource + "' height=" + this.primaryImageHeight + " width=" + this.primaryImageWidth + " style=''/>");
			
			document.write("<div style='position:absolute; top:0px; left:0px; z-index:30;'>");
				document.write("<input id='btnSelect" + this.number + "' type='button' value='+'");
				document.write(" onclick='opencloseImageEnlarge(" + this.number + "); return false;'");
				document.write(" style='border:1px solid black; background-color:white; padding:1px; margin:0px; height:20px; width:20px;'/>");
			document.write("</div>");
		
			document.write("<div id='divSecondary" + this.number + "' style='position:absolute; top:0px; left:0px; z-index:20; display:none;");
				document.write(" height:" + this.secondaryImageHeight + "; width:" + this.secondaryImageWidth +"; background-color:white;"); 
				document.write("'>");
					document.write("<img src='" + this.secondaryImageSource + "' height=" + this.secondaryImageHeight + " width=" + this.secondaryImageWidth + " style=''/>");
			document.write("</div>");
		
		document.write("</div>");
		
	}
	
	this.openclose = function(){
		var btn = document.getElementById("btnSelect" + this.number);
		var div = document.getElementById("divSecondary" + this.number);
		if(btn.value == "+"){
			btn.value = "-";
			div.style.display = "";
		}
		else {
			btn.value = "+";
			div.style.display = "none";
		
		}
	}

}

function opencloseImageEnlarge(num){
	A_IMAGEENLARGE[num].openclose();
}
