detectBrowser();

// create pop-up window
var popupWindow
function createNew (URL, w, h) {
	if (!popupWindow || popupWindow.closed) {
		popupWindow = window.open(URL,"edit",'HEIGHT='+h+',WIDTH='+w+',scrollbars=1,resizeable=1,toolbar=0,location=0,menubar=0')
	} else{
		//bring existing subwindow to the front
		popupWindow.focus()
	}
}
// load image into portfolio
function loadImage (i)
{
  var obj = MM_findObj("image" + i);
  var tobj;
  var j;
  if (obj) {
    obj.style.visibility = 'visible';
  }
  
  for (j = 0; j < imageTotal; j++) {
    if (j != i) {
	  if (tobj = MM_findObj("image" + j)) {
	    tobj.style.visibility = 'hidden';
	  }
	}
  }
}
// draw div tags for images when they load
function imageShow (i)
{
//###  alert('processing image: ' + i);
  
  var t = 0;
  var l = 0;
  w = image[i].width;
  h = image[i].height;
  
  l = 300 - (w / 2);
  t = 300 - (h / 2);
  
  document.write('<DIV ID="image' + i + '" STYLE="position:absolute; top:' + t + '; left:' + l + '; visibility:' + ((i==imageDefault) ? 'visible' : 'hidden') + '">');
  document.write('<IMG SRC="images/' + imagePrefix + i + '.jpg" ALT="" BORDER="">');
  document.write('</DIV>');
}
function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}
function MM_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];
  if(!x && d.getElementById) x=d.getElementById(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=MM_findObj(n,d.layers[i].document);
  return x;
}
function P7AniMagic(el, x, y, a, b, c, s) { //v2.5 PVII
 var g, elo=el, f="", m=false, d="";
 x=parseInt(x);
 y=parseInt(y);
 
 var t = 'g.p7Magic = setTimeout("P7AniMagic(\''+elo+'\','; 
 
 if ((g=MM_findObj(el))!=null) {
   d= (document.layers) ? g : g.style;
 } else {
   return;
 }
 
 if (parseInt(s)>0) {
   eval(t+x+','+y+','+a+','+b+','+c+',0)",' + s+')');
   return;
 }
 
 var xx = (parseInt(d.left)) ? parseInt(d.left) : 0;
 var yy = (parseInt(d.top)) ? parseInt(d.top) : 0;
 
 if (parseInt(c)==1) {
   x+=xx;
   y+=yy;
   m=true;
   c=0;
 }
 else if (c==2) {m=false;clearTimeout(g.p7Magic);}
 
 else {
   var i=parseInt(a);
   if (eval(g.moved)){clearTimeout(g.p7Magic);}
   if (xx<x){xx+=i;m=true;if(xx>x){xx=x;}}
   if (xx>x){xx-=i;m=true;if(xx<x){xx=x;}}
   if (yy<y){yy+=i;m=true;if(yy>y){yy=y;}}
   if (yy>y){yy-=i;m=true;if(yy<y){yy=y;}}
 }
 
 if (m) {
   if ((navigator.appName=="Netscape") && parseInt(navigator.appVersion)>4){
     xx+="px";yy+="px";
   }
  
   d.left=xx;d.top=yy;g.moved=true;
   if(g.focus)g.focus();
   eval(t+x+','+y+','+a+','+b+','+c+',0)",'+b+')');
 } else {g.moved=false;}
}
// find out what browser we are dealing with
// from the Portable Browser Sniffer (developer.netscape.com)
function detectBrowser()
{
	var element = null;
	navigator.OS		= '';
	navigator.version	= 0;
	navigator.org		= '';
	navigator.family	= '';
	var platform;
	if (typeof(window.navigator.platform) != 'undefined')
	{
		platform = window.navigator.platform.toLowerCase();
		if (platform.indexOf('win') != -1)
			navigator.OS = 'win';
		else if (platform.indexOf('mac') != -1)
			navigator.OS = 'mac';
		else if (platform.indexOf('unix') != -1 || platform.indexOf('linux') != -1 || platform.indexOf('sun') != -1)
			navigator.OS = 'nix';
	}
	var i = 0;
	var ua = window.navigator.userAgent.toLowerCase();
	
	if (ua.indexOf('opera') != -1)
	{
		i = ua.indexOf('opera');
		navigator.family	= 'opera';
		navigator.org		= 'opera';
		navigator.version	= parseFloat('0' + ua.substr(i+6), 10);
	}
	else if ((i = ua.indexOf('msie')) != -1)
	{
		navigator.org		= 'microsoft';
		navigator.version	= parseFloat('0' + ua.substr(i+5), 10);
		
		if (navigator.version < 4)
			navigator.family = 'ie3';
		else
			navigator.family = 'ie4'
	}
	else if (typeof(window.controllers) != 'undefined' && typeof(window.locationbar) != 'undefined')
	{
		i = ua.lastIndexOf('/')
		navigator.version = parseFloat('0' + ua.substr(i+1), 10);
		navigator.family = 'gecko';
		if (ua.indexOf('netscape') != -1)
			navigator.org = 'netscape';
		else if (ua.indexOf('compuserve') != -1)
			navigator.org = 'compuserve';
		else
			navigator.org = 'mozilla';
	}
	else if ((ua.indexOf('mozilla') !=-1) && (ua.indexOf('spoofer')==-1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera')==-1)&& (ua.indexOf('webtv')==-1) && (ua.indexOf('hotjava')==-1))
	{
	    var is_major = parseFloat(navigator.appVersion);
    
		if (is_major < 4)
			navigator.version = is_major;
		else
		{
			i = ua.lastIndexOf('/')
			navigator.version = parseFloat('0' + ua.substr(i+1), 10);
		}
		navigator.org = 'netscape';
		navigator.family = 'nn' + parseInt(navigator.appVersion);
	}
	else if ((i = ua.indexOf('aol')) != -1 )
	{
		// aol
		navigator.family	= 'aol';
		navigator.org		= 'aol';
		navigator.version	= parseFloat('0' + ua.substr(i+4), 10);
	}
	navigator.DOMCORE1	= (typeof(document.getElementsByTagName) != 'undefined' && typeof(document.createElement) != 'undefined');
	navigator.DOMCORE2	= (navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined' && typeof(document.createElementNS) != 'undefined');
	navigator.DOMHTML	= (navigator.DOMCORE1 && typeof(document.getElementById) != 'undefined');
	navigator.DOMCSS1	= ( (navigator.family == 'gecko') || (navigator.family == 'ie4') );
	navigator.DOMCSS2   = false;
	if (navigator.DOMCORE1)
	{
		element = document.createElement('p');
		navigator.DOMCSS2 = (typeof(element.style) == 'object');
	}
	navigator.DOMEVENTS	= (typeof(document.createEvent) != 'undefined');
}
 

