// Frame Menu Image mouseovers 
function changeImages() {
	if (document.images) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

DynAPI.setLibraryPath('lib/')
DynAPI.include('dynapi.api.*')
DynAPI.include('dynapi.ext.inline.js')
DynAPI.include('dynapi.event.*')
DynAPI.include('dynapi.util.thread.js')
DynAPI.include('dynapi.util.pathanim.js')

var midPos=0
var rightPos=0
DynAPI.onLoad = function() {

	setPositions();
	myLayer = new DynLayer()
	myLayer.setBgColor('#c0c0c0')
	this.document.addChild(myLayer)
	myLayer.setVisible(false)
}
function setPositions()	{

	DynAPI.document.findDimensions();
	var listener = new EventListener();
	listener.onpathstart = function(e) {
		status = "start";
	}
	listener.onpathrun = function(e) {
		var o = e.getSource();
		status = "play "+o.x+" "+o.y;
	}
	listener.onpathstop = function(e) {
		var o = e.getSource();
		status = "stop "+o.x+" "+o.y;
	}

	//mypopUp=DynAPI.document.all["imagePopup"];
	//mypopUp.moveTo(DynAPI.document.w/2 - 150,-400);
	//mypopUp.setVisible(false);
	//mypopUp.addEventListener(listener);
	//mypopUp.isVisible=false;
}
function popup()  {
	// parameter 1 = image filename
	// parameter 2 = true (horizontal) or false (vertical)
	// (optional) more of the same URL
	if (popup.arguments[1]==true)	{
		myWidth=400;
		myHeight=300;
	} else {
		myWidth=300;
		myHeight=400;
	}
	myLayer.moveTo(DynAPI.document.w/2 - (myWidth/2),-(myHeight));
	//mypopUp.moveTo(DynAPI.document.w/2 - (myWidth/2),-(myHeight));
	myLayer.setSize(myWidth,myHeight)

	var myImage=popup.arguments[0];
	if (popup.arguments.length>2)	{
		// if you have more of the same and another page
		var myNextPage=popup.arguments[2];
		theHTML='<a href="#" onclick="closePopup();return false;"><img src="images/' + myImage + '" border="0" height="' + myHeight + '" width="' + myWidth + '"></a><div align="center" style="position:relative;left:0px;top:-20px;background-color:#af7d40;color:white;width:' + myWidth + ';height:20;"><a class="morepics" href="' + myNextPage + '"><b>CLICK HERE FOR MORE VIEWS!</b></a></div>';
	} else {
		//theHTML='<a href="#" onclick="closePopup();return false;"><img src="http://www.arteffects.info/images/' + myImage + '" border="0" height="' + myHeight + '" width="' + myWidth + '"></a><div align="center" style="position:relative;left:0px;top:0px;background-color:#af7d40;color:white;width:' + myWidth + ';height:20;"><b>CLICK IMAGE TO CLOSE</b></div>';
		theHTML='<a href="#" onclick="closePopup();return false;"><img src="images/' + myImage + '" border="0" height="' + myHeight + '" width="' + myWidth + '"></a><div align="center" style="position:relative;left:0px;top:-20px;background-color:#af7d40;color:white;width:' + myWidth + ';height:20;"><b>CLICK IMAGE TO CLOSE</b></div>';
	}
	if (myLayer.isVisible==false)	{
	   	//myWindow = document.getElementById('imagePopup')
		//myWindow.innerHTML=theHTML;
		myLayer.setHTML(theHTML);
		myLayer.setVisible(true);
		//mypopUp.setVisible(true);
		sHeight = getScrollY();
		myLayer.slideTo(DynAPI.document.w/2 - (myWidth/2),parseInt(sHeight) + 40,10,20);
		//mypopUp.slideTo(DynAPI.document.w/2 - (myWidth/2),parseInt(sHeight) + 40,10,20);
		//mypopUp.isVisible=true;
		myLayer.isVisible=true;
	} else {
		closePopup();
		if(popup.arguments.length>2)	{
			popup(myImage,popup.arguments[1],popup.arguments[2]);
		} else {
			popup(myImage,popup.arguments[1]);
		}
	}
}
function closePopup()	{
//	mypopUp.setVisible(false);
//	mypopUp.moveTo(DynAPI.document.w/2 - (myWidth/2),-400);
//	mypopUp.isVisible=false;
	myLayer.setVisible(false);
	myLayer.moveTo(DynAPI.document.w/2 - (myWidth/2),-400);
	myLayer.isVisible=false;
}

//function getScrollXY() {
var scrOfX = 0, scrOfY = 0;
function getScrollY() {
  if( typeof( window.pageYOffset ) == 'number' ) {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    //DOM compliant
    scrOfY = document.body.scrollTop;
    scrOfX = document.body.scrollLeft;
  } else if( document.documentElement &&
      ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
    //IE6 standards compliant mode
    scrOfY = document.documentElement.scrollTop;
    scrOfX = document.documentElement.scrollLeft;
  }
  //return [ scrOfX, scrOfY ];
  return [ scrOfY ];
}


