/*
* Carousel Slideshow script- © Ger Versluis 2003
* Permission granted to DynamicDrive.com to feature script
* This notice must stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
*/

	var Car_Image_Width=150;
	var Car_Image_Height=200;
	var Car_Border=true;		// true or false
	var Car_Border_Color="white";
	var Car_Speed=2;
	var Car_Direction=true;		// true or false
	var Car_NoOfSides=12;		// must be 4, 6, 8 or 12


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@HEATHER@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//This is where you change the number pictures to cycle on the main page, the way I have
//this set up is to add a picture just copy a line and add it at the bottom, changing
//the c number towards the beginning to the next number in line, and dont forget to
//add the picture to the IMAGES folder as c#.jpg.
//
//For example, the next line/image to add would be:
// "images/c13.jpg","http://www.aaportraits.com/preview"
//
//THE VERY LAST LINE MUST END WITH THE ); INSTEAD OF COMMA
//AND ALL OTHER LINES MUST END WITH A COMMA
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	Car_Image_Sources=new Array(
		"images/c1.jpg","http://www.aaportraits.com/welcome",
		"images/c2.jpg","http://www.aaportraits.com/welcome",
		"images/c3.jpg","http://www.aaportraits.com/welcome",
		"images/c4.jpg","http://www.aaportraits.com/welcome",
		"images/c5.jpg","http://www.aaportraits.com/welcome",
		"images/c6.jpg","http://www.aaportraits.com/welcome",
		"images/c7.jpg","http://www.aaportraits.com/welcome",
		"images/c8.jpg","http://www.aaportraits.com/welcome",
		"images/c9.jpg","http://www.aaportraits.com/welcome",
		"images/c10.jpg","http://www.aaportraits.com/welcome",
	"images/c11.jpg","http://www.aaportraits.com/preview" ,
	"images/c12.jpg","http://www.aaportraits.com/preview" ,
	"images/c13.jpg","http://www.aaportraits.com/preview" ,
	"images/c14.jpg","http://www.aaportraits.com/preview" ,
	"images/c15.jpg","http://www.aaportraits.com/preview" ,
	"images/c16.jpg","http://www.aaportraits.com/preview" ,
	"images/c17.jpg","http://www.aaportraits.com/preview" ,
	"images/c18.jpg","http://www.aaportraits.com/preview" ,
	"images/c19.jpg","http://www.aaportraits.com/preview" ,
	"images/c20.jpg","http://www.aaportraits.com/preview" ,
	"images/c21.jpg","http://www.aaportraits.com/preview" ,
	"images/c22.jpg","http://www.aaportraits.com/preview" ,
	"images/c23.jpg","http://www.aaportraits.com/preview" ,
	"images/c24.jpg","http://www.aaportraits.com/preview" ,
	"images/c25.jpg","http://www.aaportraits.com/preview" ,
	"images/c26.jpg","http://www.aaportraits.com/preview" ,
	"images/c27.jpg","http://www.aaportraits.com/preview" ,
	"images/c28.jpg","http://www.aaportraits.com/preview" ,
	"images/c29.jpg","http://www.aaportraits.com/preview" ,
	"images/c30.jpg","http://www.aaportraits.com/preview" ,
	"images/c31.jpg","http://www.aaportraits.com/preview" ,
	"images/c32.jpg","http://www.aaportraits.com/preview" ,
	"images/c33.jpg","http://www.aaportraits.com/preview");


//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

/***************** DO NOT EDIT BELOW **********************************/
	CW_I=new Array(Car_NoOfSides/2+1);
	C_ClcW=new Array(Car_NoOfSides/2);
	C_Coef=new Array(3*Math.PI/2,0,3*Math.PI/2,11*Math.PI/6,Math.PI/6,3*Math.PI/2,7*Math.PI/4,0,Math.PI/4,3*Math.PI/2,5*Math.PI/3,11*Math.PI/6,0,Math.PI/6,Math.PI/3);
	var C_CoefOf=Car_NoOfSides==4?0:Car_NoOfSides==6?2:Car_NoOfSides==8?5:9;
	C_Pre_Img=new Array(Car_Image_Sources.length);
	var C_Angle=Car_Direction?Math.PI/(Car_NoOfSides/2):0,C_CrImg=Car_NoOfSides,C_MaxW,C_TotalW,C_Stppd=false,i,C_LeftOffset,C_HalfNo=Car_NoOfSides/2;

function Carousel()
{
	if(document.getElementById)
	{
		for(i=0;i<Car_Image_Sources.length;i+=2)
		{
			C_Pre_Img[i]=new Image();
			C_Pre_Img[i].src=Car_Image_Sources[i];
		}
		C_MaxW=Car_Image_Width/Math.sin(Math.PI/Car_NoOfSides)+C_HalfNo+1;
		Car_Div=document.getElementById("Carousel");

		for(i=0;i<C_HalfNo;i++)
		{
			CW_I[i]=document.createElement("img");
			CW_I[i].alt="Hover to pause, Click to view pictures enlarged.";
			Car_Div.appendChild(CW_I[i]);	
			CW_I[i].style.position="absolute";
			CW_I[i].style.top=0+"px";
			CW_I[i].style.height=Car_Image_Height+"px";
			if(Car_Border)
			{
				CW_I[i].style.borderStyle="solid";
				CW_I[i].style.borderWidth=1+"px";
				CW_I[i].style.borderColor=Car_Border_Color;
			}
			CW_I[i].src=Car_Image_Sources[2*i];
			CW_I[i].lnk=Car_Image_Sources[2*i+1];
			CW_I[i].onclick=C_LdLnk;
			CW_I[i].onmouseover=C_Stp;
			CW_I[i].onmouseout=C_Rstrt;
		}
		CarImages();
	}
}

function CarImages()
{
	if(!C_Stppd)
	{
		C_TotalW=0;
		for(i=0;i<C_HalfNo;i++)
		{
			C_ClcW[i]=Math.round(Math.cos(Math.abs(C_Coef[C_CoefOf+i]+C_Angle))*Car_Image_Width);
			C_TotalW+=C_ClcW[i];
		}
		C_LeftOffset=(C_MaxW-C_TotalW)/2;

		for(i=0;i<C_HalfNo;i++)
		{
			CW_I[i].style.left=C_LeftOffset+"px";
			CW_I[i].style.width=C_ClcW[i]+"px";
			C_LeftOffset+=C_ClcW[i];
		}
		C_Angle+=Car_Speed/720*Math.PI*(Car_Direction?-1:1);

		if((Car_Direction&&C_Angle<=0)||(!Car_Direction&&C_Angle>=Math.PI/C_HalfNo))
		{
			if(C_CrImg==Car_Image_Sources.length)
			{
				C_CrImg=0;
			}
			if(Car_Direction)
			{
				CW_I[C_HalfNo]=CW_I[0];
				for(i=0;i<C_HalfNo;i++)CW_I[i]=CW_I[i+1];
				CW_I[C_HalfNo-1].src=Car_Image_Sources[C_CrImg];
				CW_I[C_HalfNo-1].lnk=Car_Image_Sources[C_CrImg+1];
			}
			else
			{
				for(i=C_HalfNo;i>0;i--)CW_I[i]=CW_I[i-1];
				CW_I[0]=CW_I[C_HalfNo];
				CW_I[0].src=Car_Image_Sources[C_CrImg];
				CW_I[0].lnk=Car_Image_Sources[C_CrImg+1];
			}
			C_Angle=Car_Direction?Math.PI/C_HalfNo:0;C_CrImg+=2;
		}
	}
	setTimeout("CarImages()",50);
}

function C_LdLnk()
{
	if(this.lnk)window.location.href=this.lnk;
}

function C_Stp()
{
	this.style.cursor=this.lnk?"pointer":"default";
	C_Stppd=true;
}

function C_Rstrt()
{
	C_Stppd=false;
}

//====================

function loadcust (form)
{

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@HEATHER@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
// =@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	var customers=new Array("9160000000","9166881944","9166012962");  //@@@@@@ Add all customers to display to this array with , separators

// =@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@END@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

	var numentered=form.custid.value;
	var confirmed=false;

	for(var x=0; x<customers.length; x++)
	{
		if(customers[x]==numentered) confirmed=true;			
	}

	form.custid.value="";	

	if(confirmed)
	{
		document.location= numentered + "/index.html";
	}
	else
	{
		alert("Your pictures are not ready at this time. Please feel free to contact us for an estimated time they can be viewed.");
	}
}

function handleoverride(e,form)
{
	var key=e.keyCode || e.which;
	if (key==13) 
	{
		loadcust(form);
	}
}