// Copyright 2004 Kary Wall
var toggle = false
var Img
var objID = -1
var pid
var thumbcount = 0
var pos = 0
var objImgArray = new Array()
var mc
//-------------------------------------------------------------------------
function Init(){
	Img = document.images.karboviewer
	//mc = document.viewer

		        		

	
}
//-------------------------------------------------------------------------
function objImage(strFileName, strName, strDesc, strCat){

	//custom object to hold image details for easy access
	//set objects props and add to objImgArray collection
	//Is called from the CreateImgObject() function below

	this.name = strName
	this.desc = strDesc
	this.strCat = strCat
	this.strFileName = strFileName
	this.type ="Type = Karbo's Image Object"
	this.ID = objID ++
	objImgArray[objID] = this
	
}
//-------------------------------------------------------------------------
function nextObjImg(dir){

  //determine and load next/prev image from image object
  //supress errors just in case

  try{ 

    if(dir=="next" && pos<objImgArray.length){
	pos++}
    else if (pos>0)
	{pos--}


     if(pos<objImgArray.length && pos>-1){
	var tmp = objImgArray[pos]
	ShowImage("Images/" + tmp.strFileName, tmp.name, tmp.desc, pos)
       }

  }
  catch(er){} 

  

}
//-------------------------------------------------------------------------
function CreateImgObject(strFileName, strName, strDesc, strCat){
   //this function creates a new instance of the image object 
   try{
	var objLocalImg = new objImage(strFileName, strName, strDesc, strCat)
	thumbcount ++
      }
    catch(er){}
}
//-------------------------------------------------------------------------
function ShowImage(imgpath, strname, strdesc, intid){

// Load image into viewer, keeptrack of (pos)ition 
// If thumb is not loaded yet when clicked, suppress the error

  pos = intid

  try{
	//Img.src =  imgpath
	
	mc.SetVariable("nextMovie", imgpath)		//1-01-05
     }

  catch(er){Img.src =  imgpath}

  pid = imgpath
  document.all.strCurrName.innerHTML = strname


}
//-------------------------------------------------------------------------
function loading(args){
//add code below for using a "loading" message while the image loads
//alert(args)


}
//-------------------------------------------------------------------------
function tmsg(msg, args){

/* loads before the loading img is created, needs to be fixed 

	window.status = msg	

   try{
	if(msg!=='')
		{document.images.loading.src="images/loading.gif";
		 //intID = setInterval("loading(args)", 2000)
		}
	else
		{document.images.loading.src="images/clear.gif";
		//clearInterval(intID)
		}
      }
      catch(er){}
*/ 

}
//-------------------------------------------------------------------------
function OrderPrint(){
	//not used
	location.href = "cart.asp?PID=" + pid


}
//-------------------------------------------------------------------------
function ipid(){

return pid

}
//-------------------------------------------------------------------------
function ExpandImage(pth){

	//wish I new why this function is here and why I wrote it

	big = document.images.BigImg

	toggle=!toggle

	if(toggle){
	
	big.src = pth
	big.style.width = 500
	big.style.height = 320
	big.style.position = "Absolute"
	big.style.zorder = 3
	
	}else{

	big.src = "images/clear.gif"
	big.width = 0
	big.height = 0

	}


}
//-------------------------------------------------------------------------
function ShowFirst(args, isFlash){

		        		
		if(isFlash){	
			
		mc.SetVariable("nextMovie", args)}

		else
	
		{document.images.karboviewer.src = args}
 

}

//-------------------------------------------------------------------------
