var sUserAgent = navigator.userAgent.toLowerCase();
var isIE = document.all?true:false;
var isNS4 = document.layers?true:false;
var isOp = (sUserAgent.indexOf('opera')!=-1)?true:false;

var isMoz = (sUserAgent.indexOf('mozilla/5')!=-1 && sUserAgent.indexOf('opera')==-1 && sUserAgent.indexOf('msie')==-1)?true:false;

function showPic (whichpic) { 
	if (document.getElementById) {
		document.getElementById('placeholder').src = whichpic.href;
		document.getElementById('placeholder').src.height = whichpic.height;
		document.getElementById('placeholder').src.width = whichpic.width;
		if (whichpic.title) {
			document.getElementById('placeholder').title = whichpic.title ;
			document.getElementById('imageTitle').childNodes[0].nodeValue = whichpic.title;
		} else {
			document.getElementById('placeholder').title = whichpic.childNodes[0].nodeValue;
			document.getElementById('imageTitle').childNodes[0].nodeValue = whichpic.childNodes[0].nodeValue;
		}
		return false;
	} else {
		return true;
	}
}
 
function goSetHeight(where) {
  if (parent == window) return;
  else parent.setIframeHeight(where);
}

function openImageWindow(url) {
	var      x = screen.availwidth;
	var      y = screen.availheight;
	myImage = new Image() 
	var newUrl = url.href.replace('_400','_800');
	myImage.src = newUrl;
	
	var  width = parseInt( myImage.width  + (myImage.width  * .15) );
	
	var picheight = myImage.height + (myImage.height * .2);
	if (picheight>y) {
			h = y - 40;
		} else {
			h = picheight;
		}
	var height = parseInt( h);
	
	var    top = 1;
	var   left = 1;
	var title = myImage.title;
	var sOps = 'width=' +width+ ', height=' +height+ ', left=' +left+
		', top=' +top+ ', scrollbars=yes,resize=no,resizable=yes,menubar=no,toolbar=no,directories=no';
		
	window.open(newUrl, title, sOps );
}

function PopupWindow_showPopup(anchorname){this.getXYPosition(anchorname);this.x += this.offsetX;this.y += this.offsetY;if(!this.populated &&(this.contents != "")){this.populated = true;this.refresh();}if(this.divName != null){if(this.use_gebi){document.getElementById(this.divName).style.left = this.x + "px";document.getElementById(this.divName).style.top = this.y + "px";document.getElementById(this.divName).style.visibility = "visible";}else if(this.use_css){document.all[this.divName].style.left = this.x;document.all[this.divName].style.top = this.y;document.all[this.divName].style.visibility = "visible";}else if(this.use_layers){document.layers[this.divName].left = this.x;document.layers[this.divName].top = this.y;document.layers[this.divName].visibility = "visible";}}else{if(this.popupWindow == null || this.popupWindow.closed){if(this.x<0){this.x=0;}if(this.y<0){this.y=0;}if(screen && screen.availHeight){if((this.y + this.height) > screen.availHeight){this.y = screen.availHeight - this.height;}}if(screen && screen.availWidth){if((this.x + this.width) > screen.availWidth){this.x = screen.availWidth - this.width;}}var avoidAboutBlank = window.opera ||( document.layers && !navigator.mimeTypes['*']) || navigator.vendor == 'KDE' ||( document.childNodes && !document.all && !navigator.taintEnabled);this.popupWindow = window.open(avoidAboutBlank?"":"about:blank","window_"+anchorname,this.windowProperties+",width="+this.width+",height="+this.height+",screenX="+this.x+",left="+this.x+",screenY="+this.y+",top="+this.y+"");}this.refresh();}}

function openWindow(url) {
	// read resolution and set variables
	var  addr = url.href.replace('_400','_800');
	var      x = screen.width;
	var      y = screen.height;
	var  width = parseInt( addr.width  + (addr.width  * .1) );
	var height = parseInt( addr.height + (addr.height * .1) );
	var    top = 1;
	var   left = 1;
	var title = addr.title;
	var sOps = 'width=' +width+ ', height=' +height+ ', left=' +left+
		', top=' +top+ ', scrollbars=yes,resize=no,resizable=no,menubar=no,toolbar=no,directories=no';
	window.open(addr, title, sOps );
}


function pop(oAnchor,sWindow,sProps){
	var sUrl = '';
	if(oAnchor.getAttribute) sUrl = oAnchor.getAttribute('href');
	if(sUrl=='' && isIE) sUrl = window.event.srcElement.getAttribute('href');
	if(sUrl=='') sUrl = oAnchor.href;
	var sWindowName = sWindow?sWindow:'_blank';
	if(!sProps) sProps = 'width=490,height=300,x=340,y=75,left=340,top=75,scrollbars,resizable';
	if(sUrl) var oPopup = window.open(sUrl,sWindowName,sProps);
	// An Opera bug returns too early if you focus the window, so we don't focus it in that browser.
	// Only a noticable defect (in that browser) if a window is already open and hidden behind another window.
	if(oPopup && !isOp) oPopup.focus();
	// If popup was created successfully, cancel link in calling window.
	// Acts as regular link in browser that has popup blocking enabled.
	return (oPopup)?false:true;
}


