<!--

function FrameClass () {
	this.Light1Is = 1;
	this.Light2Is = 1;
	this.Light3Is = 1;
	this.lightOn = new Image(42,14);
	this.lightOn.src = "img/lightOn.jpg";
	this.lightOff = new Image(42,14);
	this.lightOff.src = "img/light.jpg";
	this.frameOn = new Image(191,178);
	this.frameOn.src = "img/frameOn.jpg";
	this.frameOff = new Image(191,178);
	this.frameOff.src = "img/frame.jpg";
	this.pback = new Image(86,28);
	this.pback.src = "img/back.gif";
	this.pnext = new Image(86,28);
	this.pnext.src = "img/next.gif";
	this.black = new Image(86,28);
	this.black.src = "thumbnails/black.jpg";
	this.foto_window;
	
	this.page = 0;
	this.noImgs = 3;
	
	this.imgs = new Array();
	this.imgs[0] = "black.jpg";
	this.imgs[1] = "black.jpg";
	this.imgs[2] = "black.jpg";

	this.inicGallery = function() {
		this.imgs = new Array();
		this.noImgs = 0;
		this.page = 0;
	}	

	this.addPhoto = function(photo) {
		this.imgs[this.imgs.length] = photo;
		this.noImgs = this.imgs.length;
	}

	this.pageNext = function() {
	   if (this.page*3 < this.noImgs) {
		  if (this.page == 1) 
			document.backPage.src=this.pback.src;
		  if ((this.page == 0) && (this.noImgs > 3))
			document.nextPage.src=this.pnext.src;	
		  this.page++;

		  document.frame1.src= this.black.src;
		  document.frame2.src= this.black.src;
		  document.frame3.src= this.black.src;

		  document.frame1.src="thumbnails/" + this.imgs[(this.page*3)-3];
		  document.frame2.src="thumbnails/" + this.imgs[(this.page*3)-2];
		  document.frame3.src="thumbnails/" + this.imgs[(this.page*3)-1];
		};
		if (this.page*3 >= this.noImgs)
		  document.nextPage.src="img/black.gif";
	}

	this.pageBack = function() {
	   if (this.page > 1) {
		  if (this.page*3 >= this.noImgs)
			document.nextPage.src="img/next.gif";
		  this.page--;

		  document.frame1.src= this.black.src;
		  document.frame2.src= this.black.src;
		  document.frame3.src= this.black.src;
		  
		  document.frame1.src="thumbnails/" + this.imgs[(this.page*3)-3];
		  document.frame2.src="thumbnails/" + this.imgs[(this.page*3)-2];
		  document.frame3.src="thumbnails/" + this.imgs[(this.page*3)-1];
	   };
	   if (this.page == 1)
		  document.backPage.src="img/black.gif";
	}


	this.switchLights = function( frameNo ) {
	  if  (frameNo == 1) {
		 if (this.Light1Is == 1) {
			 document.light1.src=this.lightOff.src;
			 this.Light1Is = 2;
		} 
		 else {	 
			 document.light1.src=this.lightOn.src;
			 this.Light1Is = 1;
		}
	  }
	}

	// Crear nueva ventana para mostrar foto ampliada

	this.openImage = function( frameNo ) {
		var fotoName;
		var height = window.screen.height;
		var width = window.screen.width;
		
		if (width > 800) width=800;
		if (height > 600) height=600;
		var win_dimensions = "top=50, left=15, height=" + eval(height) + ", width=" + eval(width);
		var i;
		var timer = 0;
		
		if (frameNo==1)
			fotoName = this.imgs[(this.page*3)-3];
		if (frameNo==2)
			fotoName = this.imgs[(this.page*3)-2];
		if (frameNo==3)
			fotoName = this.imgs[(this.page*3)-1];
		
		this.foto_window = window.open("", "_blank", win_dimensions);
		this.foto_window.document.open("text/html", "replace");
		this.foto_window.document.writeln("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>");
		this.foto_window.document.writeln("<html><head><title>ANDREA BUSCHNER - PHOTOGRAPHER</title>");
		this.foto_window.document.writeln("<style type='text/css'><!--body {background-color : #000000; background-image : url(img/black.gif); background-repeat : repeat-x; background-position : top;}");
		this.foto_window.document.writeln("--></style>");
		this.foto_window.document.writeln("</head>");
		this.foto_window.document.writeln("<body leftmargin=0 topmargin=0 marginheight=0 marginwidth=0>");
		this.foto_window.document.writeln("<table cellpadding=0 cellspacing=0 width=100% height=100%>");
		this.foto_window.document.writeln("<tr><td width=20% height=20></td>");
		this.foto_window.document.writeln("    <td valign=top align=center width=550 height=20><img src='img/lightOn.jpg' width=42 height=14 border=0></td></tr>");
		this.foto_window.document.writeln("<tr><td width=20%></td>");
		this.foto_window.document.writeln("    <td><table cellpadding=0 cellspacing=0 width=550 height=550 background='img/fotosframe.jpg'>");
		this.foto_window.document.writeln("        <tr><td></td><td valign=middle align=center>");
		
		fotoName = "<img src=fotos/" + fotoName + " border=0>";
		this.foto_window.document.writeln(fotoName);
		this.foto_window.document.writeln("</td></tr></table></td></tr>");
		this.foto_window.document.writeln("<tr><td width=20%></td><td></td></tr>");
		this.foto_window.document.writeln("</table></BODY></HTML>");
		this.foto_window.document.close();
	}

	this.closeWindow = function() {
	  if ((this.foto_window != null) && (this.foto_window != "undefine"))
		this.foto_window.close();
	}

}

//-->
