//////////////////////////////////////////////////////////////
//                      JavaScript                          //
//               copyright 2001 fred lauriello              //
//		             all rights reserved                    //
//////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////
//                      browser check                       //
//////////////////////////////////////////////////////////////
function checkBrowser(){
  	this.ver    = navigator.appVersion;
   	this.dom    = document.getElementById?1:0
   	this.ie5    = (this.ver.indexOf("MSIE 5") > -1 &&  this.dom)?1:0; 
   	this.ie4    = (document.all                    && !this.dom)?1:0;
	this.ns4    = (document.layers                 && !this.dom)?1:0;
   	this.ns5    = (this.dom && parseInt(this.ver)>=5)?1:0;
   	this.is_4up = (this.ie5||this.ie4||this.ns4||this.ns5); 
	this.is_5up = (this.ie5||this.ns5); 
    this.ie     = (this.ie4||this.ie5);
}
//////////////////////////////////////////////////////////////
//                  Find Element in the Document            //
//////////////////////////////////////////////////////////////
	function _ID(n, d) { 
		if (typeof n != 'string')return(n); 
		if(!d)d = document; 
  		if (d.getElementById?1:0)return(d.getElementById(n));   
  		var x , i;  
  		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 =   _ID(n, d.layers[i].document);
  		return x;
	}
//////////////////////////////////////////////////////////////
//          Find Element & Style in the Document            //
//////////////////////////////////////////////////////////////
function _getStyle(element){
  var obj = _ID(element);
     return (obj)?(document.layers)?obj:obj.style:false;
}
 //////////////////////////////////////////////////////////////
//          Constructors                                     //
//////////////////////////////////////////////////////////////
 function _buildKey(key,ref){
   this.key      = key;
   this.ref      = ref;
 }

 function _buildpages(main,p1,fact,quote) {
  this.main  = main;
  this.p1    = p1;
  this.fact  = fact;
  this.quote = quote;

}

//////////////////////////////////////////////////////////////
//                     Utilities                            //
//////////////////////////////////////////////////////////////

function changeBG(color){
return
  if (location != top.location){
    top.document.body.style.backgroundColor = color;
   // (top.frames[0].location.pathname.indexOf("index.htm") > -1)?"#014478":"#FFFFFF";
 }

}

  
function notNumber(inputStr){
 
  for (var i = 0 ; i < inputStr.length; i++){
     var oneChar = inputStr.substring(i , i + 1) 
	    if (oneChar < "0" || oneChar > "9") return true;
     }
  return false;
}



function preLoad(images){
 var j, i = 0, d = document;

  if(d.images){ 
     if(!d._newImage)d._newImage = new Array(); // create on first use
	   
	  for (j = d._newImage.length;  i < images.length; j++){  
	    d._newImage[j]=new Image; 
	    d._newImage[j].src=images[i++];
     }
   }
}

//////////////////////////////////////////////////////////////
//                      browser globals                     //
//////////////////////////////////////////////////////////////
var _curDefault;
var _br    = new checkBrowser();
var _timer = 0;
//////////////////////////////////////////////////////////////
	/*
if (document.layers) {origWidth = innerWidth; origHeight = innerHeight;}

function reDo() {
   if (innerWidth != origWidth || innerHeight != origHeight) 
     location.reload();
   }
if (document.layers) onresize = reDo;
*/
//////////////////////////////////////////////////////////////
//                      site specific                       //
//////////////////////////////////////////////////////////////

function turnPage(locOff,locOn){
  _getStyle(locOff).visibility = "hidden";
  _getStyle(locOn).visibility = "visible";
}


function liteDrop(loc){
  menuOff();
   _getStyle(loc).visibility = "visible"; 
return
}


function unDoDrop() { 
  var  x, a = document._hide;
   for(var i=0; a && i < a.length && (x = a[i] ) && x.oSrc; i++) 
     x.src = x.oSrc;
}

function doDrop() { 
  var  j=0, x, arg = doDrop.arguments; 
	document._hide = new Array; 
	
	for(var i=0; i < (arg.length - 2); i += 3 )
      if ( (x= _ID( arg[i] ) ) !=null ){  
	     document._hide[ j++ ] = x; 
	     if(!x.oSrc) 
		    x.oSrc=x.src; 
		 x.src=arg[ i + 2 ];
	   }
}


////////////////////////////////////////////////////////////////////////////
//                                                                       //  
//                   display window                                      //  
//                                                                        //
///////////////////////////////////////////////////////////////////////////
var _popWindow
function popup(imagename){
var imgW = "20px",imgH="30px"
   
   if (_popWindow && !_popWindow.closed) _popWindow.window.close();
   
   _popWindow = window.open("/popup_page.cfm?image="+ imagename ,"_newWindow",
    "status,width= " + imgW + ",height=" + imgH + ",top=240,left=240" );

 
}




var _newWindow

function makeWin(title, imgName, imgW, imgH) {

   if (_newWindow && !_newWindow.closed) _newWindow.window.close();

  _newWindow = window.open("","_newWindow",
    "status,width= " + imgW + ",height=" + imgH + ",top=240,left=240" );
 
 var Content  = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'
     Content += '<html><head><title> ' + title + ' </title>'
	 Content += '<script language="JavaScript" type="text/javascript">'
	 Content += 'function click(){if (event.button==2) alert("If you would like us to help you obtain copies of this artwork send e-mail to marian@marianhirsch.com")}' 
	 Content += 'document.onmousedown=click'
	 Content += '</script>'
	 Content += '</head><body bgcolor="#ffffff" >' 
     Content += '<DIV STYLE="position:absolute;top:0px;left:0px;">'
	 Content += '<IMG SRC="images/' + imgName  + ' "WIDTH="' + imgW + '" HEIGHT="' + imgH + '"> '
     Content += '</DIV></body></html>'  

     _newWindow.document.write(Content);
     _newWindow.document.close();
     //_newWindow.document.focus();
}  



//function click() 
 //{
 // return
 //if (event.button==2)
 // {alert("If you would like us to help you obtain copies of this artwork send e-mail to \n  \n marian@marianhirsch.com")
 // }
// }
 
//document.onmousedown=click

 
var eventCounter = 0;
var maxEvents = 50; // set this to be the max number of normal alert messages.
var msg = "If you would like us to help you obtain copies of this artwork send e-mail to \n  \n marian@marianhirsch.com";

if(document.layers) window.captureEvents(Event.MOUSEDOWN);

function no_click(e){
if (navigator.appName == 'Netscape' && ( e.which == 2 || e.which == 3))
{
   if (++eventCounter >= maxEvents)
     prompt(msg,"");
   else
     alert(msg);
   return false; // this works!
}
if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3))
{
   if (++eventCounter >= maxEvents)
     prompt(msg,"");
   else
     alert(msg);
   event.returnValue=false; // this does not really work... (it should - bug in IE?)
   return false; // this is just here for show - it does nothing in IE.
}
}
 window.onmousedown=no_click;
 document.onmousedown=no_click;



















