/////////////////////////////////////////////////////////////////////////////
// JavaScript Library

/////////////////////////////////////////////////////////////////////////////
// Function definitions 

	function preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	
	function swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	
	function findObj(n, d) { //v4.01
	  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document);
	  if(!x && d.getElementById) x=d.getElementById(n); return x;
	}
	
	function swapImage() { //v3.0
	  var i,j=0,x,a=swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if (a[i+2]) { if ((x=findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }
	}
	
	function smallpop(sURL) {
	
		DoPopup(sURL, '', 500, 380, 1, 5, 0, 0, 'directories=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0');
		
	}
	
	function medpop(sURL) {
	
		DoPopup(sURL, '', 500, 573, 1, 5, 0, 0, 'directories=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0');
		
	}
	
	function largepop(sURL) {
	
		DoPopup(sURL, '', 516, 500, 1, 5, 0, 0, 'directories=0,menubar=0,resizable=1,scrollbars=1,status=0,titlebar=0');
		
	}
	
	function virtual_viewpop(sURL) {
	
		DoPopup(sURL, '', 640, 496, 1, 5, 0, 0, 'directories=0,menubar=0,resizable=1,scrollbars=0,status=0,titlebar=0');
		
	}

	// Popup window spawner
	function DoPopup(sURL, sName, iWidth, iHeight, iRelation, iPosition, x, y, sFeatures) {
	
		// If the URL is empty or just an anchor, exit the function
		if (sURL == "#" || sURL.length <= 0) {
			return;
		}

		var iScreenX = 0;
		var iScreenY = 0;
		var iOffsetLeft = 0;
		var iOffsetTop = 0;
		var bIE = false;
		
		if(navigator.userAgent.indexOf("MSIE") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.body.offsetWidth;
				iScreenY = document.body.offsetHeight;
				iOffsetLeft = window.screenLeft;
				iOffsetTop = window.screenTop;
				bIE = true;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else if(navigator.userAgent.indexOf("Safari") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.width;
				iScreenY = document.height;
				iOffsetLeft = window.screenX;
				iOffsetTop = window.screenY;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else if(navigator.userAgent.indexOf("Mozilla") >= 0) {
			if(iRelation == 0) {
				iScreenX = document.body.clientWidth;
				iScreenY = document.body.clientHeight;
				iOffsetLeft = window.screenX;
				iOffsetTop = window.screenY;
			} else {
				iScreenX = window.screen.width;
				iScreenY = window.screen.height;
			}
		} else {
			x = 10;
			y = 10;
		}
		
		if(x == 0 & y == 0) {
			switch(iPosition) {
				case 1: // topleft
					x = 0;
					y = 0;
					break;
					
				case 2: // topcenter
					x = (iScreenX - iWidth) / 2;
					y = 0;
					break;
					
				case 3: // topright
					x = iScreenX - (iWidth + 20);
					y = 0;
					break;
					
				case 4: // centerleft
					x = 0;
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 5: // center
					x = (iScreenX - iWidth) / 2;
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 6: // centerright
					x = iScreenX - (iWidth + 20);
					y = (iScreenY - iHeight) / 2;
					break;
					
				case 7: // bottomleft
					x = 0;
					y = iScreenY - (iHeight + 20);
					break;
					
				case 8: // bottomcenter
					x = (iScreenX - iWidth) / 2;
					y = iScreenY - (iHeight + 20);
					break;
					
				case 9: // bottomright
					x = iScreenX - (iWidth + 20);
					y = iScreenY - (iHeight + 20);
					break;
					
				default:
					x = 10;
					y = 10;
					break;
			}
			
			x = x + iOffsetLeft;
			y = y + iOffsetTop;
			
		}
		
		window.open(
				sURL, 
				sName, 
				"width=" + iWidth + ",height=" + iHeight + ",left=" + x + ",top=" + y + "," + sFeatures
			);
	}

// EOF
/////////////////////////////////////////////////////////////////////////////