function MM_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 MM_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=MM_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 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]; 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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function mmLoadMenus() {
  if (window.mm_menu_0506184943_0) return;
  window.mm_menu_0506184943_0 = new Menu("root",132,17,"Arial, Helvetica, sans-serif",11,"#cccccc","#ffffff","#3e455a","#5c6378","left","middle",3,0,200,-5,7,true,true,true,0,true,true);
  mm_menu_0506184943_0.addMenuItem("Ordering&nbsp;Information","location='ordering.html'");
  mm_menu_0506184943_0.addMenuItem("Portfolio&nbsp;Submissions","location='submissions.html'");
  mm_menu_0506184943_0.addMenuItem("Gallery&nbsp;Rentals","location='private.html'");
  mm_menu_0506184943_0.addMenuItem("Commissions","location='commissions.html'");
  mm_menu_0506184943_0.addMenuItem("About","location='about.html'");
   mm_menu_0506184943_0.fontWeight="bold";
   mm_menu_0506184943_0.hideOnMouseOut=true;
   mm_menu_0506184943_0.menuBorder=0;
   mm_menu_0506184943_0.menuLiteBgColor='#ffffff';
   mm_menu_0506184943_0.menuBorderBgColor='#555555';
   mm_menu_0506184943_0.bgColor='#555555';

  mm_menu_0506184943_0.writeMenus();
} // mmLoadMenus()

function mapOpen(href)
{
window.name='main';
window.open(href,'Map','height=424, width=790, scrollbars=no'); 
return false;
}

function searcherValidate()
{
	if(document.searcher.search.value == 'Enter Artist or Gallery Name' ||
	   document.searcher.search.value == ''){ 
	   	return false; 
	} else { 
		return true;
	}
}

var DHTML = (document.getElementById || document.all || document.layers);

function getObj(name)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
  }
  else if (document.layers)
  {
   	this.obj = document.layers[name];
   	this.style = document.layers[name];
  }
}
        function showLayer(layerName, shadowLayerName, event)
        {
            if (DHTML)
            {
                var targetElement = new getObj(layerName);
                var shadowElement = new getObj(shadowLayerName);
                //var dimensions    = getMousePosition;
                targetElement.style.top        = shadowElement.style.top;
                targetElement.style.left       = shadowElement.style.left;
                targetElement.style.visibility = 'visible';
            }
        }


        function hideLayer(layerName)
        {
            if (DHTML) 
            {
                var targetElement = new getObj(layerName);
                targetElement.style.visibility = 'hidden';
            }
       }
       
// The following code is used to support the small popups that
// give the full description of an event when the user move the
// mouse over it.

// Developer's note:
// I (Benoit Maisonny <benoit@synclude.com>) tested this code with Mozilla 0.8.1 (on Linux),
// with IE5.5 SP1 (on WinNT4) and with Netscape Communicator 4.74 (on Linux).
// Netscape 6.0 and 6.01 seem to have a bug related to the visibility attribute.
// I suppose it will be corrected as soon as they release a new version, based on
// a more recent Mozilla source code.
// I'm not able to test this javascript code with IE4. It'd be glad to know if it works.

NS4 = (document.layers) ? 1 : 0;
IE4 = (document.all) ? 1 : 0;
W3C = (document.getElementById) ? 1 : 0;	
// W3C stands for the W3C standard, implemented in Mozilla (and Netscape 6) and IE5

// Function show(evt, name)
//	evt is a pointer to the Event object passed when the event occurs
//	name is the ID attribute of the element to show
function show ( evt, name ) {
  if (IE4) {
    evt = window.event;  //is it necessary?
  }

  var currentX,		//mouse position on X axis
      currentY,		//mouse position on X axis
      x,		//layer target position on X axis
      y,		//layer target position on Y axis
      docWidth,		//width of current frame
      docHeight,	//height of current frame
      layerWidth,	//width of popup layer
      layerHeight,	//height of popup layer
      ele;		//points to the popup element

  // First let's initialize our variables
  if ( W3C ) {
    ele = document.getElementById(name);
    currentX = evt.clientX,
    currentY = evt.clientY;
    docWidth = document.width;
    docHeight = document.height;
    layerWidth = ele.style.width;
    layerHeight = ele.style.height;

  } else if ( NS4 ) {
    ele = document.layers[name];
    currentX = evt.pageX,
    currentY = evt.pageY;
    docWidth = document.width;
    docHeight = document.height;
    layerWidth = ele.clip.width;
    layerHeight = ele.clip.height;

  } else {	// meant for IE4
    ele = document.all[name];
    currentX = evt.clientX,
    currentY = evt.clientY;
    docHeight = document.body.offsetHeight;
    docWidth = document.body.offsetWidth;
    //var layerWidth = document.all[name].offsetWidth;
    // for some reason, this doesn't seem to work... so set it to 200
    layerWidth = 200;
    layerHeight = ele.offsetHeight;
  }

  // Then we calculate the popup element's new position
  if ( ( currentX + layerWidth ) > docWidth ) {
    x = ( currentX - layerWidth );
  }
  else {
    x = currentX;
  }
  if ( ( currentY + layerHeight ) >= docHeight ) {
     y = ( currentY - layerHeight - 20 );
  }
  else {
    y = currentY;
  }
  if ( IE4 ) {
    x += document.body.scrollLeft;
    y += document.body.scrollTop;
  } else if ( NS4)  {
  } else {
    x += window.pageXOffset;
    y += window.pageYOffset;
  }
// (for debugging purpose) 
/*alert("docWidth " + docWidth + ", docHeight " + docHeight + 
	  "\nlayerWidth " + layerWidth + ", layerHeight " + layerHeight + 
	  "\ncurrentX " + currentX + ", currentY " + currentY + 
	  "\nx " + parseInt (x) + ", y " + parseInt (y) );
	  */
	  
  if( x > 550){
  	x = 350;
  }	else if( x < 215 && x > 125){
  	x = 216;
  } else if( x < 325 && x > 235){
  	x = 325;
  }

  // Finally, we set its position and visibility
  if ( NS4 ) {
    //ele.xpos = parseInt ( x );
    ele.left = parseInt ( x );
    //ele.ypos = parseInt ( y );
    ele.top = parseInt ( y );
    ele.visibility = "show";
  } else {  // IE4 & W3C
    ele.style.left       = parseInt ( x );
    ele.style.top        = parseInt ( y );
    ele.style.visibility = "visible";
    //alert(ele.style.left + " " + ele.style.top);
  }
}

function hide ( name ) {
  if (W3C) {
    document.getElementById(name).style.visibility = "hidden";
  } else if (NS4) {
    document.layers[name].visibility = "hide";
  } else {
    document.all[name].style.visibility = "hidden";
  }
}

function unhide ( name ) {
  if (W3C) {
    document.getElementById(name).style.visibility = "visible";
  } else if (NS4) {
    document.layers[name].visibility = "show";
  } else {
    document.all[name].style.visibility = "visible";
  }
}

