var dimages=new Array();
var synop=new Array();
var name=new Array();
var url=new Array();
var numImages=3;

dimages[0]=new Image();
dimages[0].src="pfimg/plumbgreenicon.jpg";
synop[0] = "Plumbing and Heating Installations is a growing business which required our services to creat both a public web site, as well as a private administration section with extensive applications for customer database management and control.";
name[0] = "Plumbing and Heating Installations";
url[0] = "http://www.plumbgreen.co.uk";

dimages[1]=new Image();
dimages[1].src="pfimg/cpricon.jpg";
synop[1] = "CPR is a recruitment company which required the ability to update and edit the content of specific parts of the site on a daily basis. <br /><br /> To help them achieve this, Jg Web Design constructed a user friendly content management system which allowed the content of the site to be changed and updated at anytime with ease.";
name[1] = "CPR Recruitment";
url[1] = "http://www.cprrecruitment.co.uk";

dimages[2]=new Image();
dimages[2].src="pfimg/superbowlicon.jpg";
synop[2] = "Doncaster Superbowl is part of a large business group who already had a corporate logo. Their web site was designed around the existing logo and colour scheme. <br /><br /> In addition to the public site, a private administration application was developed with the ability to manage customer databases, mailing lists and job appliactions, as mailing applications to send E-Newsletters to customers on a monthly basis.";
name[2] = "Doncaster Superbowl";
url[2] = "http://www.doncastersuperbowl.co.uk";

dimages[3]=new Image();
dimages[3].src="pfimg/.jpg";
synop[3] = "";
name[3] = "";
url[3] = "";

dimages[4]=new Image();
dimages[4].src="pfimg/.jpg";
synop[4] = "";
name[4] = "";
url[4] = "";

dimages[5]=new Image();
dimages[5].src="pfimg/.jpg";
synop[5] = "";
name[5] = "";
url[5] = "";

var curImage=0;
function swapPicture(way)
{
  if (document.images)
  {
    var nextImage=curImage+way;
    if (nextImage>=numImages)
      nextImage=0;
	if (nextImage<0)
      nextImage=numImages-1;  
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.myImage)
        target=document.images.myImage;
      if (document.all && document.getElementById("myImage"))
        target=document.getElementById("myImage");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
		changeOpac(0, "myImage");		
        target.src=dimages[nextImage].src;
		document.getElementById("galleryText").innerHTML = "<h3>"+name[nextImage]+"</h3><p>"+synop[nextImage]+"</p>";
		// add something like this in for different links. var href = dhref[nextImage]; 
        curImage=nextImage;
		opacity("myImage",0, 100, 500);
      }
    }
  } 
}

function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}
