// JavaScript Document


var returnleft = null;
var returnwidth = null;
var counter = 0;
var lastcounter = 0;
var pe = null;
var peLeft = null;
var peRight = null;


function imgSwap(oImg)
{
   var strOver  = "_on"    // image to be used with mouse over
   var strOff = "_off"     // normal image
   var strImg = oImg.src
   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
}
function ChangePhoto (oldimg, newimg) {

   document.images[oldimg].src=newimg;

}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function overBar(barleft, barwidth){
	new Effect.Morph(
		"nav_bar",
		{style: 'left:' +barleft+'px; width: ' +barwidth+'px;', duration: 0.5});
}

function returnBar(returnleft, returnwidth){
	new Effect.Morph(
		"nav_bar",
		{style: 'left:' +returnleft+'px; width: ' +returnwidth+'px;', duration: 0.5});
}
function imgBWColor(oImg)
{

	
   var strOver  = "&fltr[]=sep|50|a8b393"    // image to be used with mouse over
   var strOff = "&fltr[]"     // normal image
   var strImg = oImg.src

   if (strImg.indexOf(strOver) != -1) 
      oImg.src = strImg.replace(strOver,strOff)
   else
      oImg.src = strImg.replace(strOff,strOver)
	
}

function moveRight() {
						 new Effect.MoveBy('fish_wide', 0, -55,{duration:.5});
						 
		
}
 
function moveLeft() {
						 new Effect.MoveBy('fish_wide', 0, 55,{duration:.5});	
						/* wherexmain = Element.cumulativeOffset($('wrapper'))[0];
						 wherexholder = Element.cumulativeOffset($('fish_holder'))[0];
						 wherexwide = Element.cumulativeOffset($('fish_wide'))[0];
						 wherex = (wherexholder) - (wherexmain);
						 
						 if (wherex < 0) pe.stop();*/


}
function sideWays(newcounter,maxwidth)
{


	oldcounter = counter;
	newcounter = newcounter;
	//alert ("oldcounter: "+oldcounter);
	//alert ("newcounter: "+newcounter);
	//alert ("lastcounter: "+lastcounter);
	
	if (newcounter > lastcounter) {
						if (pe) pe.stop();
pe = new PeriodicalExecuter(moveRight, .1);
	lastcounter = newcounter;
	}
	else if (lastcounter > newcounter) {
						if (pe) pe.stop();
pe = new PeriodicalExecuter(moveLeft, .1);
	lastcounter = newcounter;
	}
 }
 

 
function getThumbs(num,address) {
if (pe) pe.stop();
new Ajax.Updater("portfolio_thumbs_wide",'portfolio_thumbs.php?address='+address+'&num='+num,{delay:4,evalScripts:'true'	});
/*new Effect.BlindUp("portfolio_thumbs",{
afterFinish: function() {
new Ajax.Updater("portfolio_thumbs",'portfolio_thumbs.php?address='+address+'&num='+num,{
afterFinish: function() { 
new Effect.Appear("portfolio_thumbs"); 
						  }	
									});
						  }
									});

										*/																																																	 
                                  }
		 
function slideThumbs(direction) {

if (direction == "left")
new Effect.MoveBy("portfolio_thumbs_wide",0,300);
if (direction == "right")
new Effect.MoveBy("portfolio_thumbs_wide",0,-300);

}
	
																			 
				 
				 																										
