var interval = 30000;
var random_display = 0;

var imageNum = 0;



imageArray = new Array();
textArray = new Array();
hrefArray = new Array();
textFeatureArray = new Array();

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/cavity_painting_preview.jpg");
textArray[imageNum] = "Layers contain depth, color and specular";
textFeatureArray[imageNum] = "Layers contain depth, color and specular. You can disable or enable any of these channels, put effects on them";
hrefArray[imageNum++] = "http://forums.polyloop.net/imagehosting/94147c17b2e448e7.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/PaintInUVPlane_preview.jpg");
textArray[imageNum] = "2D and 3D painting";
textFeatureArray[imageNum] = "Paint over UV as easy as paint over 3D-modes. Almost all tools work in uv-plane and in 3D.";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/PaintInUVPlane.jpg";


imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/SeamlessPainting_preview.jpg");
textArray[imageNum] = "Seamless painting";
textFeatureArray[imageNum] = "Paint seamlessly over uv-plane. It is easy to use 3D-Coat to create seampless textures and paint bump.";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/SeamlessPainting.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/NewPensPreview_preview.jpg");
textArray[imageNum] = "Multichannel pens";
textFeatureArray[imageNum] = "Every pen has many channels - color/depth/specular and eraser.";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/NewPensPreview.jpg";


imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/GradientFillingTypes_preview.jpg");
textArray[imageNum] = "Fill with gradient";
textFeatureArray[imageNum] = "Fill areas with gradient fading";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/GradientFillingTypes.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/SphericalGradientFilling_preview.jpg");
textArray[imageNum] = "Spherical filling";
textFeatureArray[imageNum] = "Fill areas with spherical gradient";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/SphericalGradientFilling.jpg";


imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/HSV-Preview_preview.jpg");
textArray[imageNum] = "Image correction";
textFeatureArray[imageNum] = "Image correction filters with realtime preview in 3D";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/HSV-Preview.jpg";


imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/Masking_demo_preview.jpg");
textArray[imageNum] = "Layers masking";
textFeatureArray[imageNum] = "Mask one layer with other one";
hrefArray[imageNum++] = "http://www.3d-brush.com/pics/Masking_demo.jpg";




imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/Ornament_preview.jpg");
textArray[imageNum] = "Paint patterns";
textFeatureArray[imageNum] = "Painting patters, putting images along splines";
hrefArray[imageNum++] = "files/Tut3/Ornament.htm";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/DefineKey_preview.jpg");
textArray[imageNum] = "Customize interface";
textFeatureArray[imageNum] = "You can define hotkey for any action in easy way";
hrefArray[imageNum++] = "http://www.3d-coat.com/files/Tut4/DefineKey.htm";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/HardCurve_preview.jpg");
textArray[imageNum] = "Closed curves";
textFeatureArray[imageNum] = "Possibility to draw closed curves and curves with sharp edge-points";
hrefArray[imageNum++] = "http://www.3d-coat.com/files/Tut6/HardCurve.htm";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/ManyArrows_preview.jpg");
textArray[imageNum] = "Arrows";
textFeatureArray[imageNum] = "Possibility to draw a huge variety of arrows";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/ManyArrows.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/PaintCavity_preview.jpg");
textArray[imageNum] = "Cavity painting";
textFeatureArray[imageNum] = "Paint on cavity, use many different conditions for painting";
hrefArray[imageNum++] = "http://www.3d-coat.com/files/Tut5/PaintCavity.htm";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/MaterialPreview_preview.jpg");
textArray[imageNum] = "Realtime preview";
textFeatureArray[imageNum] = "Realtime preview of complex materials";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/MaterialPreview.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/newexport_preview.jpg");
textArray[imageNum] = "Export morphs";
textFeatureArray[imageNum] = "Possibility to export separate layers as morphs";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/newexport.jpg";





imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/Sculpt_Hippo_preview.jpg");
textArray[imageNum] = "Sculpting";
textFeatureArray[imageNum] = "You can sculpt from sphere as it is shown here.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/Sculpt_Hippo.gif";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/DirectManipulation_preview.jpg");
textArray[imageNum] = "Direct manipulation";
textFeatureArray[imageNum] = "You can fix several points on the surface and drag another point like you can see it in the video.";
hrefArray[imageNum++] = "http://www.3d-brush.com/files/video/Holders2.wmv"; 

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/LocalScale_preview.jpg");
textArray[imageNum] = "Change of proportions";
textFeatureArray[imageNum] = "With gradient allocation is easy to change proportions of parts of a body.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/LocalScale2.gif";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/01-Fractals_preview.jpg");
textArray[imageNum] = "Filling of areas with fractals and materials";
textFeatureArray[imageNum] = "It is possible to fill areas with fractals or with the use of material, consisting of layers of depth, color and specular.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/01-Fractals.jpg"; 

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/02-Volumetric_preview.jpg");
textArray[imageNum] = "Filling with fractals and volumetric textures";
textFeatureArray[imageNum] = "There are many types of fractals which as a matter of fact are volumetric textures.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/02-Volumetric.jpg"; 




imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/03-Print-text_preview.jpg");
textArray[imageNum] = "Drawing of the text on the image";
textFeatureArray[imageNum] = "You can put the text on a surface of an object. The text is put along a spline, you can even write the text around of all object.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/03-Print-text.jpg"; 

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/04-Paint-with-contours_preview.jpg");
textArray[imageNum] = "Drawing with a contour";
textFeatureArray[imageNum] = "You can draw not only with a pen, but also with a contour, a rectangular or an ellipse.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/04-Paint-with-contours.jpg"; 





imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/06-Gradients_preview.jpg");
textArray[imageNum] = "Filling of color with a gradient";
textFeatureArray[imageNum] = "It is possible to fill the closed areas with imposing a gradient of colors.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/06-Gradients.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/07-Comples-shapes_preview.jpg");
textArray[imageNum] = "Stacking of longitudinal forms";
textFeatureArray[imageNum] = "It is possible to put the certain longitudinal form at drawing with a pen or at imposing a spline.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/07-Comples-shapes.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/08-Transform-demo_preview.jpg");
textArray[imageNum] = "Transformation of a parts of surface";
textFeatureArray[imageNum] = "You can allocate any part of a surface and transform it free, like in the Photoshop by pressing CTRL+T.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/08-Transform-demo.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/09-CloneToolIn3D_preview.jpg");
textArray[imageNum] = "Cloning of the image in 3D";
textFeatureArray[imageNum] = "Parts of a surface can be cloned like in the Photoshop but in 3D.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/09-CloneToolIn3D.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/10-mirroring_preview.jpg");
textArray[imageNum] = "Mirror cloning";
textFeatureArray[imageNum] = "It is possible to clone sites not only parallel transformation, but also with mirror symmetry.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/10-mirroring.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/11-inversion_preview.jpg");
textArray[imageNum] = "Inverse cloning";
textFeatureArray[imageNum] = "It is possible to clone with inversion relative to a point. Also it is possible to clone with turn.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/11-inversion.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/12-Clone_symm_new_preview.jpg");
textArray[imageNum] = "Symmetric copying";
textFeatureArray[imageNum] = "If you have textured only one side of model, you can simply transfer details from  one side of models to another, drawing with pen.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/12-Clone_symm_new.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/13-EditPen_preview.jpg");
textArray[imageNum] = "Use of multilayered pens";
textFeatureArray[imageNum] = "Each pen contains color, a transparency, depth, specular, and a mask of deleting.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/13-EditPen.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/14-EditProjectionWithLayers_preview.jpg");
textArray[imageNum] = "Editing of a projection with layers";
textFeatureArray[imageNum] = "You can edit a current projection in the external editor in view of layers.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/14-EditProjectionWithLayers.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/15-EditTextureWithLayers_preview.jpg");
textArray[imageNum] = "Editing of a texture with layers";
textFeatureArray[imageNum] = "It is possible to edit a texture of your model in the external editor in view of layers.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/15-EditTextureWithLayers.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/16-CreatePenFrom3D_preview.jpg");
textArray[imageNum] = "Creation of pens from 3D - objects";
textFeatureArray[imageNum] = "It is possible to create pens not only from pictures, but also from 3D objects.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/16-CreatePenFrom3D.jpg";

imageArray[imageNum] = new imageItem("http://www.3d-coat.com/screenshots/17-PaintWithTexture_preview.jpg");
textArray[imageNum] = "Texture mapping of object";
textFeatureArray[imageNum] = "You can use a texture or a photo to impose it on object.";
hrefArray[imageNum++] = "http://www.3d-coat.com/screenshots/17-PaintWithTexture.jpg";
/*
imageArray[imageNum] = new imageItem("screenshots/18-GlobalLight_preview.jpg");
textArray[imageNum] = "Calculating of global illumination";
textFeatureArray[imageNum] = "Global illumination (occlusion) can be calculated and baked to texture.";
hrefArray[imageNum++] = "screenshots/18-GlobalLight.jpg";
*/


var totalImages = imageArray.length;

function imageItem(image_location) {
  this.image_item = new Image();
  this.image_item.src = image_location;
}

function get_ImageItemLocation(imageObj) {
  return(imageObj.image_item.src)
}




function getNextImage() { 
  imageNum= parseInt(imageNum);
  imageNum = imageNum+1;
	 if(imageNum > (totalImages-1)){
		  imageNum = 0;		
		}    
  setFeatureName(imageNum);
  var new_image = get_ImageItemLocation(imageArray[imageNum]);
  return(new_image);
}


function getFirstImage() { 
  if(getCookie('firstimageNum')){
    
    if(getCookie('currentimageNum')){
      imageNum= getCookie('currentimageNum');
      imageNum= parseInt(imageNum);
						if(getCookie('prevPageTitle') != document.title){						  
						  imageNum = imageNum + 1;
						} 
    }else
    {
      imageNum= getCookie('firstimageNum');
      imageNum= parseInt(imageNum);   
      imageNum = imageNum + 1;
				}  
  }else
  {
    imageNum = 0;
  }
  
  
  if(imageNum > (totalImages-1)){
		  imageNum = 0;		
		}
		setCookie('prevPageTitle', document.title);
   
  setFeatureName(imageNum);
  var new_image = get_ImageItemLocation(imageArray[imageNum]);
  return(new_image);
}


function getPrevImage() {
  imageNum= parseInt(imageNum);
  imageNum = imageNum-1;
  if(imageNum < 0){
		  imageNum = totalImages-1;		
		}
  setFeatureName(imageNum);
  var new_image = get_ImageItemLocation(imageArray[imageNum]);
  return(new_image);
} 

function prevImage(place) {
  var new_image = getPrevImage();
  document[place].src = new_image;  
}

function switchImage(place) {  
  var new_image = getNextImage();
  document[place].src = new_image;
  var recur_call = "switchImage('"+place+"')";
  timerID = setTimeout(recur_call, interval);
}

function firstImage(place) {
  var new_image = getFirstImage();
  document[place].src = new_image;
  var recur_call = "switchImage('"+place+"')";
  timerID = setTimeout(recur_call, interval);
}

function setFeatureName(imageNum){
    
    if(document.getElementById('featureBold').lastChild){
      document.getElementById('featureBold').lastChild.nodeValue = textArray[imageNum];
      document.getElementById('featureTextFont').lastChild.nodeValue = textFeatureArray[imageNum];
    }else
				{
				  var theText1 = document.createTextNode(textArray[imageNum]);
      document.getElementById('featureBold').appendChild(theText1);
      var theText2 = document.createTextNode(textFeatureArray[imageNum]);
      document.getElementById('featureTextFont').appendChild(theText2);
				}  
    document.getElementById('anchorID').setAttribute('href',hrefArray[imageNum]);
      
    setCookie('firstimageNum', imageNum,365,'','.3d-coat.com');
				setCookie('firstimageNum', imageNum,365,'','.www.3d-coat.com');
				
				setCookie('currentimageNum', imageNum);
				setCookie('currentimageNum', imageNum);
}
