function info() { if(document.getElementById('info').style.visibility != 'visible'){ document.getElementById('info').style.visibility = 'visible';}
else {document.getElementById('info').style.visibility = 'hidden';}
if(document.getElementById('showinfo').style.display != 'none'){ document.getElementById('showinfo').style.display = 'none'; document.getElementById('hideinfo').style.display = 'inline';}
else {document.getElementById('showinfo').style.display = 'inline'; document.getElementById('hideinfo').style.display = 'none';}
}
function zoom() { if(document.getElementById('zoom').style.display != 'inline'){ document.getElementById('zoom').style.display = 'inline'; document.getElementById('zoomaway').style.display = 'inline';}
else {document.getElementById('zoom').style.display = 'none';}
}
function zoom2() { if(document.getElementById('zoom2').style.display != 'inline'){ document.getElementById('zoom2').style.display = 'inline'; document.getElementById('zoomaway').style.display = 'inline';}
else {document.getElementById('zoom2').style.display = 'none';}
}

function jrp() { document.getElementById('info').style.visibility = 'hidden'; document.getElementById('zoom').style.display = 'none'; document.getElementById('showinfo').style.display = 'inline'; document.getElementById('hideinfo').style.display = 'none'; slides.goto_slide(0); slides2.goto_slide(0); slidesbig.goto_slide(0); slides2big.goto_slide(0);}
function zoomaway() { if(document.getElementById('zoom').style.display = 'inline'){ document.getElementById('zoom').style.display = 'none'; document.getElementById('zoomaway').style.display = 'none';}
if(document.getElementById('zoom2').style.display = 'inline'){ document.getElementById('zoom2').style.display = 'none'; document.getElementById('zoomaway').style.display = 'none';}
}
function nextpair() { slides.next(); slides2.next(); slidesbig.next(); slides2big.next();}
function previouspair() { slides.previous(); slides2.previous(); slidesbig.previous(); slides2big.previous();}
function slide(src,text,textb,target,attr) { this.src = src; this.text = text; this.textb = textb; this.target = target; this.attr = attr; if (document.images) { this.image = new Image();}
this.loaded = false; this.load = function() { if (!document.images) { return;}
if (!this.loaded) { this.image.src = this.src; this.loaded = true;}
}
this.hotlink = function() { var mywindow; if (!this.link) return; if (this.target) { if (this.attr) { mywindow = window.open(this.link, this.target, this.attr);} else { mywindow = window.open(this.link, this.target);}
if (mywindow && mywindow.focus) mywindow.focus();} else { location.href = this.link;}
}
}
function slideshow( slideshowname ) { this.name = slideshowname; this.repeat = false; this.prefetch = 3; this.image; this.textid; this.textidb; this.textarea; this.timeout = 3000; this.slides = new Array(); this.current = 0; this.timeoutid = 0; this.add_slide = function(slide) { var i = this.slides.length; if (this.prefetch == -1) { slide.load();}
this.slides[i] = slide;}
this.play = function(timeout) { this.pause(); if (timeout) { this.timeout = timeout;}
if (typeof this.slides[ this.current ].timeout != 'undefined') { timeout = this.slides[ this.current ].timeout;} else { timeout = this.timeout;}
this.timeoutid = setTimeout( this.name + ".loop()", timeout);}
this.pause = function() { if (this.timeoutid != 0) { clearTimeout(this.timeoutid); this.timeoutid = 0;}
}
this.update = function() { if (! this.valid_image()) { return;}
if (typeof this.pre_update_hook == 'function') { this.pre_update_hook();}
var slide = this.slides[ this.current ]; var dofilter = false; if (this.image &&
typeof this.image.filters != 'undefined' &&
typeof this.image.filters[0] != 'undefined') { dofilter = true;}
slide.load(); if (dofilter) { if (slide.filter &&
this.image.style &&
this.image.style.filter) { this.image.style.filter = slide.filter;}
this.image.filters[0].Apply();}
this.image.src = slide.image.src; if (dofilter) { this.image.filters[0].Play();}
this.display_text(); this.display_textb(); if (typeof this.post_update_hook == 'function') { this.post_update_hook();}
if (this.prefetch > 0) { var next, prev, count; next = this.current; prev = this.current; count = 0; do { if (++next >= this.slides.length) next = 0; if (--prev < 0) prev = this.slides.length - 1; this.slides[next].load();} while (++count < this.prefetch);}
}
this.goto_slide = function(n) { if (n == -1) { n = this.slides.length - 1;}
if (n < this.slides.length && n >= 0) { this.current = n;}
this.update();}
this.next = function() { if (this.slides[ this.current ].last == true) {this.update}
else if (this.current < this.slides.length - 1) { this.current++;} else if (this.repeat) { this.current = 0;}
this.update();}
this.previous = function() { if (this.slides[ this.current ].first == true) {this.update}
else if (this.current > 0) { this.current--;} else if (this.repeat) { this.current = this.slides.length - 1;}
this.update();}
this.get_text = function() { return(this.slides[ this.current ].text);}
this.get_textb = function() { return(this.slides[ this.current ].textb);}
this.display_text = function(text) { if (!text) { text = this.slides[ this.current ].text;}
if (this.textarea && typeof this.textarea.value != 'undefined') { this.textarea.value = text;}
if (this.textid) { r = this.getElementById(this.textid); if (!r) { return false;}
if (typeof r.innerHTML == 'undefined') { return false;}
r.innerHTML = text;}
}
this.display_textb = function(textb) { if (!textb) { textb = this.slides[ this.current ].textb;}
if (this.textareab && typeof this.textareab.value != 'undefined') { this.textareab.value = textb;}
if (this.textidb) { r = this.getElementById(this.textidb); if (!r) { return false;}
if (typeof r.innerHTML == 'undefined') { return false;}
r.innerHTML = textb;}
}
this.noscript = function() { $html = "\n"; for (i=0; i < this.slides.length; i++) { slide = this.slides[i]; $html += '<P>'; if (slide.link) { $html += '<a href="' + slide.link + '">';}
$html += '<img src="' + slide.src + '" ALT="slideshow image">'; if (slide.link) { $html += "<\/a>";}
if (slide.text) { $html += "<BR>\n" + slide.text;}
$html += "<\/P>" + "\n\n";}
$html = $html.replace(/\&/g, "&amp;" ); $html = $html.replace(/</g, "&lt;" ); $html = $html.replace(/>/g, "&gt;" ); return('<pre>' + $html + '</pre>');}
this.loop = function() { if (this.current < this.slides.length - 1) { next_slide = this.slides[this.current + 1]; if (next_slide.image.complete == null || next_slide.image.complete) { this.next();}
} else { this.next();}
this.play( );}
this.valid_image = function() { if (!this.image)
{ return false;}
else { return true;}
}
this.getElementById = function(element_id) { if (document.getElementById) { return document.getElementById(element_id);}
else if (document.all) { return document.all[element_id];}
else if (document.layers) { return document.layers[element_id];} else { return undefined;}
}
}



function toggle(div_id) {
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-150;//150 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-150;//150 is half popup's width
	popUpDiv.style.left = window_width + 'px';
}

function popup(windowname) {
	
	toggle('blanket');
	toggle(windowname);		
}
