// Open a window at a given position on the screen [cybage-08/28]

function openPositionedWindow(url, name, width, height, x, y, status, scrollbars, moreProperties, openerName) {
   
   // ie 4.5 and 5.0 mac - windows are 2 pixels too short; if a statusbar is used, the window will be an additional 15 pixels short
   var agent = navigator.userAgent.toLowerCase();
   if (agent.indexOf("mac") != -1 && agent.indexOf("msie") != -1 && (agent.indexOf("msie 4") != -1 || agent.indexOf("msie 5.0") != -1) ) {
      height += (status) ? 17 : 2;
   }

   // Adjust width if scrollbars are used (pc places scrollbars inside the content area; mac outside) 
   width += (scrollbars != '' && scrollbars != null && agent.indexOf("mac") == -1) ? 16 : 0;

   var properties = 'width=' + width + ',height=' + height + ',screenX=' + x + ',screenY=' + y + ',left=' + x + ',top=' + y + ((status) ? ',status' : '') + ',scrollbars' + ((scrollbars) ? '' : '=no') + ((moreProperties) ? ',' + moreProperties : '');
   var reference = openWindow(url, name, properties, openerName);
   
   // resize window in ie if we can resize in ns; very messy
   // commented out because openPositionedWindow() doesn't set the resizable attribute
   // left in for reference
   /*if (resizable && agent.indexOf("msie") != -1) {
      if (agent.indexOf("mac") != -1) {
         height += (status) ? 15 : 2;
         if (parseFloat(navigator.appVersion) > 5) width -= 11;
      }
      else {
         height += (status) ? 49 : 31;
         width += 13;
      }
      setTimeout('if (reference != null && !reference.closed) reference.resizeTo(' + width + ',' + height + ');', 150);
   }*/

   return reference;
}

// Core utility function that actually creates the window and gives focus to it [cybage-08/28]

function openWindow(url, name, properties, openerName) {

   // ie4.x pc can't give focus to windows containing documents from a different domain
   // in this case, initially load a local interstisial page to allow focussing before loading final url
   var agent = navigator.userAgent.toLowerCase();
   if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) == 4 && agent.indexOf("msie 5") == -1 && agent.indexOf("msie5") == -1 && agent.indexOf("win") != -1 && url.indexOf('http://') == 0) {
      winReference = window.open('about:blank', name, properties);
      
      setTimeout('if (winReference && !winReference.closed) winReference.location.replace("' + url + '")', 300);
   }
   else {
      winReference = window.open(url, name, properties);
   }

   // ie doesn't like giving focus immediately (to new window in 4.5 on mac; to existing ones in 5 on pc)
   setTimeout('if (winReference && !winReference.closed) winReference.focus()', 200);
   
   if (openerName) self.name = openerName;
   return winReference;
}

// Open a full-chrome (all GUI elements) window [cybage-08/28]

// This is like using a target="_blank" in a normal link but allows focussing the window
function openFullChromeWindow(url, name, openerName) {
   return openWindow(url, name, 'directories,location,menubar,resizable,scrollbars,status,toolbar');
}
// Cybage :- For image Scorller function start...............................................................
function send_url(click_url)
{ 
  var abc;
  abc = new Number(click_url);
  abc1=abc.toString();
  arr = abc1.split(".");
  if(arr[1] == 1)
  {
   document.wizard_form.action ='guided_search.php';
   document.wizard_form.prod_lvl1.value=arr[0];
   submit_step1_form(arr[0]);
  }
  else if(arr[1] == 2)
  {
    document.wizard_form.action ='guided_search.php';
    document.wizard_form.prod_lvl2.value=arr[0];
    submit_step1_form(arr[0]);
  }
  else if(arr[1] == 3)
  {
    document.wizard_form.action ='guided_search.php';
    document.wizard_form.prod_lvl3.value=arr[0];
    submit_step1_form(arr[0]);
  }
  else if(arr[1] == 4)
  {
   document.wizard_form.action ='std_alp.php';
   document.wizard_form.cat_lvl1.value=arr[0];
   submit_step1_form(arr[0]);	
  }
 }
function send_url1(click_url)
{
  window.location.href = click_url;	
}

var ImageScroller = function(_imageScrollerParentDivID, _imageScrollerChildDivID) {
   _imageScrollerParentDivID = getElem(_imageScrollerParentDivID); 
   _imageScrollerChildDivID = getElem(_imageScrollerChildDivID); 
   var prImagePaths = new Array(); 
   var prImageAltText = new Array(); 
   var prImageClicks = new Array(); 
   var prImageDescription = new Array(); 
   var iNumOfThumbsShown = 7; 
   var iNumOfImages; 
   
   var bAutoScroll = 0; 
   //0=false, 1=true
   var iAutoScrollDelay = 2000; 
   var bAutoScrollDirection = 1; 
   //0=back, 1=forward
   var bAutoReverse = 1; 
   //0=false, 1=true
   var iScrollType = 1; 
   //0=horizontal, 1=vertical
   var bEnableThumbBorder = 0; 
   //0=no, 1=yes
   var bEnableCurrentCount = 0; 
   //0=no, 1=yes
   var bEnableThumbDescription = 0; 
   //0=no, 1=yes
   var bClickOpenType = 0; 
   //0=same window, 1=new window
   var iImageScrollAmount = 6;
   //number of images to scroll
   var iImageShowAmount = 6;
   //number of images to show scroll images.
   
   var objCounterDiv = ""; 
   var objDescriptionDiv = ""; 
   var iSmoothSlideInterval = 5; 
   var iSmoothSlideAmount = 14; 
   var moveTimer; 
   var noImageBorder = 0;
   var Imagemargin =0;
   var slot_count = 0;
   var total_slots =0;
   var last_slot =0;
   
   this.THUMB_HEIGHT = 90; 
   this.THUMB_WIDTH = 65; 
   this.THUMB_PADDING = 0;
   this.THUMB_MARGIN = 10; //puja
   
   var CURRENT_THUMB_INDEX = 1; 
   
   var NEW_REVERSE_OFFSET = 0; 
   var MAX_REVERSE_OFFSET = 0; 
   var NEW_FORWARD_OFFSET = 0; 
   var IS_SCROLLING = false; 
   var LEFT_SCROLL=0;
   //* BEGIN FUNCTIONS *//
   this.setNumOfImageToScroll = function(_NumOfImagesToScroll) {
        iImageScrollAmount = parseInt(_NumOfImagesToScroll);
   };
   this.enableThumbnailDescription = function(_descriptionDivID) {
      bEnableThumbDescription = 1; 
      objDescriptionDiv = _descriptionDivID; 
      }; 
   this.setScrollType = function(_iType) {
      if (_iType == 0) {
         iScrollType = 0; 
         }
      else {
         iScrollType = 1; 
         }
      }; 
   this.setScrollSpeed = function(_iSpeed) {
      if (_iSpeed > 0 || _iSpeed < 1000) {
         iSmoothSlideInterval = _iSpeed; 
         }
      else {
         iSmoothSlideInterval = 7; 
         }
      }; 
   this.setScrollAmount = function(_iAmount) {
      if (_iAmount > 0 || _iAmount < 1000) {
         iSmoothSlideAmount = _iAmount; 
         }
      else {
         iSmoothSlideAmount = 7; 
         }
      }; 
   this.setClickOpenType = function(_openType) {
      if (_openType == 0 || _openType == 1) {
         bClickOpenType = _openType; 
         }
      }; 
   this.enableCurrentCount = function(_counterDivID) {
      bEnableCurrentCount = 1; 
      objCounterDiv = _counterDivID; 
      }; 
   this.enableThumbBorder = function(_boolean) {
      bEnableThumbBorder = _boolean; 
      }; 
   this.setThumbsShown = function(_newNumOfThumbsShown) {
      iNumOfThumbsShown = parseInt(_newNumOfThumbsShown); 
      }; 
   this.addThumbnail = function(_thumbnailURL, _fullClickURL, _thumbnailAlt, _thumbnailDescription) {
      prImagePaths[prImagePaths.length] = _thumbnailURL; 
      prImageClicks[prImageClicks.length] = _fullClickURL; 
      prImageAltText[prImageAltText.length] = _thumbnailAlt; 
      prImageDescription[prImageDescription.length] = _thumbnailDescription;
      }; 
   this.setThumbnailHeight = function(_newThumbHeight) {
      this.THUMB_HEIGHT = _newThumbHeight; 
      }; 
   this.getThumbnailHeight = function() {
      return this.THUMB_HEIGHT; 
      }; 
   this.setThumbnailWidth = function(_newThumbWidth) {
      this.THUMB_WIDTH = _newThumbWidth; 
      }; 
   this.getThumbnailWidth = function() {
      return this.THUMB_WIDTH; 
      }; 
   this.setThumbnailPadding = function(_newThumbPadding) {
      this.THUMB_PADDING = _newThumbPadding; 
      }; 
   this.getThumbnailPadding = function() {
      return THUMB_PADDING; 
      };
   this.setThumbnailMargin = function(_newThumbMargin) {
      this.THUMB_MARGIN = _newThumbMargin; 
      }; 
   this.getThumbnailMargin = function() {
      return THUMB_MARGIN;  
      }; 
   this.getCurrentThumbIndex = function() {
      return CURRENT_THUMB_INDEX; 
      }; 
   this.getThumbnailCount = function() {
      return iNumOfImages; 
      }; 
   this.renderScroller = function() {
    iNumOfImages = prImagePaths.length;
    
      if (iNumOfThumbsShown > iNumOfImages) {
         iNumOfThumbsShown = iNumOfImages; 
         }
	  MAX_REVERSE_OFFSET = 0 - (iNumOfImages) * (this.THUMB_WIDTH); 
			
      if (this.THUMB_PADDING > 0) {
         MAX_REVERSE_OFFSET = MAX_REVERSE_OFFSET - (iNumOfImages * this.THUMB_PADDING + (iNumOfImages*4)); 
         }
	  if (this.THUMB_MARGIN > 0) {
         MAX_REVERSE_OFFSET = MAX_REVERSE_OFFSET - ((iNumOfImages) * this.THUMB_MARGIN *2); 
         }
      if (bEnableThumbBorder == 1) {
         MAX_REVERSE_OFFSET = MAX_REVERSE_OFFSET - (iNumOfImages * 2); 
         }
	  
       if (iScrollType == 0) {   //modified by cybage...
         _imageScrollerParentDivID.style.width = (this.THUMB_WIDTH * iNumOfThumbsShown) + (iNumOfThumbsShown * (this.THUMB_PADDING * 2)) + (iNumOfThumbsShown * (this.THUMB_MARGIN *2)) + "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerParentDivID.style.width = (parseInt(_imageScrollerParentDivID.style.width) + (iNumOfThumbsShown * 2)) + "px"; 
            }
         _imageScrollerParentDivID.style.height = this.THUMB_HEIGHT + (this.THUMB_PADDING * 4) + (this.THUMB_MARGIN * 2) + "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerParentDivID.style.height = (parseInt(_imageScrollerParentDivID.style.height) + 2) + "px"; 
            }
         _imageScrollerChildDivID.style.width = (this.THUMB_WIDTH * iNumOfImages) + noImageBorder + (iNumOfImages * (this.THUMB_PADDING * 4)) + (iNumOfImages * (this.THUMB_MARGIN *2))  + "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerChildDivID.style.width = (parseInt(_imageScrollerChildDivID.style.width) + (iNumOfImages * 2)) + "px"; 
            }
         }
      else if (iScrollType == 1) {
         _imageScrollerParentDivID.style.width = (this.THUMB_WIDTH) + ((this.THUMB_PADDING * 2) + (this.THUMB_MARGIN * 2) ) + "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerParentDivID.style.width = (parseInt(_imageScrollerParentDivID.style.width) + (2)) + "px"; 
            }
         _imageScrollerParentDivID.style.height = (this.THUMB_HEIGHT * iNumOfThumbsShown) + (iNumOfThumbsShown * (this.THUMB_PADDING * 2)) + (iNumOfThumbsShown * (this.THUMB_MARGIN * 2))+ "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerParentDivID.style.height = (parseInt(_imageScrollerParentDivID.style.height) + (iNumOfThumbsShown * 2)) + "px"; 
            }
         _imageScrollerChildDivID.style.width = (this.THUMB_WIDTH) + (this.THUMB_PADDING * 2) + (this.THUMB_MARGIN * 2) + (this.hspace) + "px"; 
         if (bEnableThumbBorder == 1) {
            _imageScrollerChildDivID.style.width = (parseInt(_imageScrollerChildDivID.style.width) + 2) + "px"; 
            }
         }
       
	   
      //*** [Begin] Image Cacheing code ***//
      var oHref;
      var oImage;
      var oDiv;
      var var1,over_text;
      var str,image_url;
      oHref = document.createElement("a");
      oImage = document.createElement("img");
      oDiv = document.createElement("div");
		
      for (i = 0; i < iNumOfImages; i++) {
		str = prImageClicks[i];
		str1=str.toString();
		arr = str1.split("-");
		over_text = prImageAltText[i];
   		if(prImagePaths[i] == 'noImage')
		{
		  oDiv = document.createElement("div");
                    version=0;
                    if (navigator.appVersion.indexOf("MSIE")!=-1){
                     temp=navigator.appVersion.split("MSIE");
                     version=parseFloat(temp[1]);
                     if (version>6) //NON IE browser will return 0                       
                       oDiv.className = 'emptyThumbnailDivnew2';

                    }
                    else
                     oDiv.className = 'emptyThumbnailDivnew2';

                    oDiv.style.cssFloat=oDiv.style.styleFloat='left';	
		  oDiv.style.width=this.THUMB_WIDTH+"px";
		  oDiv.style.height=this.THUMB_HEIGHT+"px";
		  oDiv.style.paddingRight=this.THUMB_MARGIN+'px';
		  oDiv.style.paddingLeft=this.THUMB_MARGIN+'px';
		  if (navigator.appName == "Microsoft Internet Explorer") {
		       oDiv.style.cursor = "hand";
    	  } else {  // is mozilla/netscape
         	   oDiv.style.cursor = "pointer";
    	  }
	  oDiv1 = document.createElement("div");
	  oDiv1.className = 'emptyThumbnailDivnew1';
	  oDiv1.style.width=this.THUMB_WIDTH+"px";
	  oDiv1.style.height=this.THUMB_HEIGHT+"px";
	  if (navigator.appName == "Microsoft Internet Explorer") {
	       oDiv1.style.cursor = "hand";
    	  } else {  // is mozilla/netscape
           	   oDiv1.style.cursor = "pointer";
    	  }
	  oDiv1.innerHTML = prImageAltText[i];
	  oDiv.appendChild(oDiv1);
		
	  var1 = prImageClicks[i];
	  if(arr[0] != 0)
	  {
		 oDiv.onclick = (function(var1) {
		 return function(){ send_url(var1) }
		})(var1);
	  }
	  else{
	      var2 = arr[1];
		  oDiv.onclick = (function(var2) {
		  return function(){ send_url1(var2); }
		})(var2);
	  }
	  _imageScrollerChildDivID.appendChild(oDiv);
		  
	}
	else{
        	   oHref = document.createElement("a");
	    if(arr[0] != 0){
	          oHref.href = "javascript:send_url("+prImageClicks[i]+")"; }
	    else{
	          oHref.href = arr[1]; }
        	          oHref.title = prImageAltText[i];
	          if (bClickOpenType == 1) {
        	          oHref.target = "_blank";
        	          }
    	   oDiv = document.createElement("div");
	   oDiv.style.cssFloat=oDiv.style.styleFloat='left';
	   oDiv.style.border='1px solid #FFFFFF';
	   oDiv.style.width=this.THUMB_WIDTH+"px";
	   oDiv.style.height=this.THUMB_HEIGHT+"px";
	   oDiv.style.paddingRight=this.THUMB_MARGIN+'px';
	   oDiv.style.paddingLeft=this.THUMB_MARGIN+'px';
         	   oImage = document.createElement("img");
            oImage.src = prImagePaths[i];
            oImage.alt = prImageAltText[i];
            oImage.border = 0;
            oImage.width = this.THUMB_WIDTH;
            oImage.height = this.THUMB_HEIGHT; 	   	            
            oHref.appendChild(oImage);
  	   oDiv.appendChild(oHref);
           _imageScrollerChildDivID.appendChild(oDiv); 
	}
      } //for loop end.
	  
      //*** [End]   Image Cacheing code ***//
      if (bEnableCurrentCount == 1) {
         addAnEvent(window, "load", this.updateCurrentCount); 
         }
      if (bEnableThumbDescription == 1) {
         addAnEvent(window, "load", this.updateCurrentDescription); 
         }
      }; 
   this.scrollUp = function() {
      _origOffset = parseInt(_imageScrollerChildDivID.style.top); 
      _currentOffset = parseInt(_imageScrollerChildDivID.style.top); 
      _newOffset = _currentOffset - (this.THUMB_HEIGHT * iImageScrollAmount); 
      if (this.THUMB_PADDING > 0) {
         _newOffset = _newOffset - (2 * this.THUMB_PADDING); 
         }
      if (bEnableThumbBorder == 1) {
         _newOffset = _newOffset - 4; 
         }
      if (IS_SCROLLING == false && _newOffset >= MAX_REVERSE_OFFSET) {
         NEW_FORWARD_OFFSET = _newOffset; 
         moveScrollerUp(); 
         }
      }; 
   this.scrollDown = function() {
      _origOffset = parseInt(_imageScrollerChildDivID.style.top); 
      _currentOffset = parseInt(_imageScrollerChildDivID.style.top); 
      _newOffset = _currentOffset + (this.THUMB_HEIGHT * iImageScrollAmount); 
      if (this.THUMB_PADDING > 0) {
         _newOffset = _newOffset + (2 * this.THUMB_PADDING); 
         }
      if (bEnableThumbBorder == 1) {
         _newOffset = _newOffset + 4; 
         }
      if (_newOffset <= 0) {
         if(_currentOffset > (_origOffset - this.THUMB_HEIGHT)) {
            if (IS_SCROLLING == false && _newOffset >= MAX_REVERSE_OFFSET) {
               NEW_REVERSE_OFFSET = _newOffset; 
               moveScrollerDown(); 
               }
            }
         }
      }; 
   this.scrollTop = function() {
      if (IS_SCROLLING == false) {
         NEW_FORWARD_OFFSET = ( - 1 * (iNumOfImages - iNumOfThumbsShown) * this.THUMB_HEIGHT); 
         CURRENT_THUMB_INDEX = iNumOfImages - iNumOfThumbsShown; 
         moveScrollerUp(); 
         }
      }; 
   this.scrollBottom = function() {
      if (IS_SCROLLING == false) {
         NEW_REVERSE_OFFSET = 0; 
         CURRENT_THUMB_INDEX = iNumOfImages - iNumOfThumbsShown; 
         moveScrollerDown(); 
         }
      }; 
   this.scrollReverse = function() { 
    LEFT_SCROLL=0;
    last_slot=0;
    obj2 = document.getElementById('nextButton');
    obj2.disabled=false;
    _origOffset = parseInt(_imageScrollerChildDivID.style.left); 
    _currentOffset = parseInt(_imageScrollerChildDivID.style.left);
    total_slots = Math.ceil(iNumOfImages/iImageShowAmount);
	if(iNumOfImages%iImageShowAmount != 0){
		if(slot_count == (total_slots-1))
		{
		   last_slot = iNumOfImages%iImageShowAmount;
		   if(last_slot)
				iImageScrollAmount = last_slot-1 ;
		   else
		   iImageScrollAmount=iImageShowAmount;
		 }
		 else
		  iImageScrollAmount=iImageShowAmount;
	}
	else
	{
		if(slot_count == (total_slots-1))
		 iImageScrollAmount=iImageShowAmount-1; 
		
		else
		 iImageScrollAmount=iImageShowAmount;
    }
     
    if(slot_count < 0)
       slot_count=0;
     _newOffset = _currentOffset + (this.THUMB_WIDTH * iImageScrollAmount); 
	  
     if (this.THUMB_PADDING > 0) {
       _newOffset = _newOffset + (this.THUMB_PADDING * (2 * iImageScrollAmount)); 
        }
       if (this.THUMB_MARGIN > 0) {
		_newOffset = _newOffset + (2 * this.THUMB_MARGIN * iImageScrollAmount); 
	    }
       if (bEnableThumbBorder == 1) {
          _newOffset = _newOffset + (2 * iImageScrollAmount);  
        }
       if (_newOffset <= 0) {
         if(_currentOffset > (_origOffset - (this.THUMB_WIDTH * iImageScrollAmount))) {
            if (IS_SCROLLING == false) {
			   slot_count = slot_count-1;
               NEW_REVERSE_OFFSET = _newOffset; 
               moveScrollerRight(); 
               }
            }
         }
      }; 
   this.scrollForward = function() 
   {
      last_slot=0;
     _origOffset = parseInt(_imageScrollerChildDivID.style.left); 
     _currentOffset = parseInt(_imageScrollerChildDivID.style.left);
     total_slots = Math.ceil(iNumOfImages/iImageShowAmount);
     if (IS_SCROLLING == false && LEFT_SCROLL==0)
         slot_count = slot_count+1;
		 
     if(iNumOfImages%iImageShowAmount != 0)
     {
      if(slot_count == (total_slots-1))
      {
	last_slot = iNumOfImages%iImageShowAmount;
	if(last_slot){
		 iImageScrollAmount = last_slot-1;
	}
	else{
		 iImageScrollAmount=iImageShowAmount;
		 LEFT_SCROLL=1;
	}
      }
      else
      {
	if(total_slots==1)
	{
	  LEFT_SCROLL=1;
	  last_slot = iNumOfImages%iImageShowAmount;
	}
	else
	 iImageScrollAmount=iImageShowAmount;
      }
     }
     else
     {
       if(total_slots==1)
       {
        LEFT_SCROLL=1;
        last_slot = iNumOfImages%iImageShowAmount;
       }	     
       else if(slot_count == (total_slots-1))
       {
	  iImageScrollAmount=iImageShowAmount-1; 
       }
       else if(slot_count == (total_slots)){
	 iImageScrollAmount=iImageShowAmount;
	// LEFT_SCROLL=1;
       }
       else 
       {
		if(total_slots==1)
		{
		  LEFT_SCROLL=1;
		  last_slot = iNumOfImages%iImageShowAmount;
		}
		else
		  iImageScrollAmount=iImageShowAmount;
       }
     }
     _newOffset = _currentOffset - (this.THUMB_WIDTH * iImageScrollAmount); 
     if (this.THUMB_PADDING > 0) {
           _newOffset = _newOffset - ((2 * iImageScrollAmount) * this.THUMB_PADDING); 
        }
        if (bEnableThumbBorder == 1) {
          _newOffset = _newOffset - (2 * iImageScrollAmount); 
        }         
      
        if (this.THUMB_MARGIN > 0) {
		    _newOffset = _newOffset - (2 * this.THUMB_MARGIN * iImageScrollAmount); 
        }
     
        if (IS_SCROLLING == false && _newOffset >= MAX_REVERSE_OFFSET && LEFT_SCROLL==0) {// 
         NEW_FORWARD_OFFSET = _newOffset; 									
         moveScrollerLeft(); 
        }
			
      }; 
   this.scrollEnd = function() {
      if (IS_SCROLLING == false) {
         NEW_FORWARD_OFFSET = MAX_REVERSE_OFFSET; 
         CURRENT_THUMB_INDEX = iNumOfImages - iNumOfThumbsShown; 
         moveScrollerLeft(); 
         }
      }; 
   this.scrollBegin = function() {
      if (IS_SCROLLING == false) {
         NEW_REVERSE_OFFSET = 0; 
         CURRENT_THUMB_INDEX = 2; 
         moveScrollerRight(); 
         }
      }; 
   this.updateCurrentDescription = function() {
      getElem(objDescriptionDiv).innerHTML = prImageDescription[CURRENT_THUMB_INDEX - 1]; 
      }; 
   this.updateCurrentCount = function() {
      getElem(objCounterDiv).innerHTML = CURRENT_THUMB_INDEX + "/" + iNumOfImages; 
      }; 
   function moveScrollerUp() {
      _ElementObj = _imageScrollerChildDivID; 
      _currentOffset = parseInt(_ElementObj.style.top); 
      if (_currentOffset > NEW_FORWARD_OFFSET && (_currentOffset - iSmoothSlideAmount) >= NEW_FORWARD_OFFSET) {
         _ElementObj.style.top = _currentOffset - iSmoothSlideAmount + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerUp, iSmoothSlideInterval); 
         }
      else if (_currentOffset > NEW_FORWARD_OFFSET) {
         _ElementObj.style.top = _currentOffset - 1 + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerUp, iSmoothSlideInterval); 
         }
      else {
         IS_SCROLLING = false; 
         CURRENT_THUMB_INDEX++; 
         window.clearTimeout(moveTimer); 
         if (bEnableThumbDescription == 1) {
            getElem(objDescriptionDiv).innerHTML = prImageDescription[CURRENT_THUMB_INDEX - 1]; 
            }
         if (bEnableCurrentCount == 1) {
            getElem(objCounterDiv).innerHTML = CURRENT_THUMB_INDEX + "/" + iNumOfImages; 
            }
         }
      }; 
   function moveScrollerDown() {
      _ElementObj = _imageScrollerChildDivID; 
      _currentOffset = parseInt(_ElementObj.style.top); 
      if (_currentOffset < NEW_REVERSE_OFFSET && (_currentOffset + iSmoothSlideAmount) <= NEW_REVERSE_OFFSET) {
         _ElementObj.style.top = _currentOffset + iSmoothSlideAmount + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerDown, iSmoothSlideInterval); 
         }
      else if (_currentOffset < NEW_REVERSE_OFFSET) {
         _ElementObj.style.top = _currentOffset + 1 + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerDown, iSmoothSlideInterval); 
         }
      else {
         IS_SCROLLING = false; 
         CURRENT_THUMB_INDEX--; 
         window.clearTimeout(moveTimer); 
         if (bEnableThumbDescription == 1) {
            getElem(objDescriptionDiv).innerHTML = prImageDescription[CURRENT_THUMB_INDEX - 1]; 
            }
         if (bEnableCurrentCount == 1) {
            getElem(objCounterDiv).innerHTML = CURRENT_THUMB_INDEX + "/" + iNumOfImages; 
            }
         }
      }; 
   function moveScrollerRight() {
      _ElementObj = _imageScrollerChildDivID; 
      _currentOffset = parseInt(_ElementObj.style.left); 
      if (_currentOffset < NEW_REVERSE_OFFSET && (_currentOffset + iSmoothSlideAmount) <= NEW_REVERSE_OFFSET) {
         _ElementObj.style.left = _currentOffset + iSmoothSlideAmount + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerRight, iSmoothSlideInterval); 
         }
      else if (_currentOffset < NEW_REVERSE_OFFSET) {
         _ElementObj.style.left = _currentOffset + 1 + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerRight, iSmoothSlideInterval); 
         }
      else {
         IS_SCROLLING = false; 
         CURRENT_THUMB_INDEX--; 
         window.clearTimeout(moveTimer); 
         if (bEnableThumbDescription == 1) {
            getElem(objDescriptionDiv).innerHTML = prImageDescription[CURRENT_THUMB_INDEX - 1]; 
            }
         if (bEnableCurrentCount == 1) {
            getElem(objCounterDiv).innerHTML = CURRENT_THUMB_INDEX + "/" + iNumOfImages; 
            }
         }
      }; 
   function moveScrollerLeft() {
      _ElementObj = _imageScrollerChildDivID; 
	  _currentOffset = parseInt(_ElementObj.style.left); 
	  if (_currentOffset > NEW_FORWARD_OFFSET && (_currentOffset - iSmoothSlideAmount) >= NEW_FORWARD_OFFSET) {
		 _ElementObj.style.left = _currentOffset - iSmoothSlideAmount  + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerLeft, iSmoothSlideInterval); 
       }
      else if (_currentOffset > NEW_FORWARD_OFFSET) {						
         _ElementObj.style.left = _currentOffset - 1 + "px"; 
         IS_SCROLLING = true; 
         moveTimer = window.setTimeout(moveScrollerLeft, iSmoothSlideInterval); 
       }
      else {	
			if(last_slot)
			{
			 LEFT_SCROLL=1;
			 obj2 = document.getElementById('nextButton');
			 obj2.disabled=true;								
			}
			else
			{
		      if(slot_count == (total_slots-2) && (iNumOfImages%iImageShowAmount)==1)
              {
				LEFT_SCROLL=1;
                obj2 = document.getElementById('nextButton');
  				obj2.disabled=true;																				  
			  }
			  else if(slot_count == (total_slots-1) && (iNumOfImages%iImageShowAmount)==0)
			  {
				LEFT_SCROLL=1;
                obj2 = document.getElementById('nextButton');
  				obj2.disabled=true;																				  
			  }
			}
            IS_SCROLLING = false; 
            CURRENT_THUMB_INDEX++; 
            window.clearTimeout(moveTimer); 
            if (bEnableThumbDescription == 1) {
              getElem(objDescriptionDiv).innerHTML = prImageDescription[CURRENT_THUMB_INDEX - 1]; 
            }
            if (bEnableCurrentCount == 1) {
              getElem(objCounterDiv).innerHTML = CURRENT_THUMB_INDEX + "/" + iNumOfImages; 
            }
        }
   }; 
   function addAnEvent(_obj, _eventName, _functionName) {
      if (window.addEventListener) {
         _obj.addEventListener(_eventName, _functionName, false); 
         }
      else {
         _obj.attachEvent("on" + _eventName, _functionName); 
         }
      }; 
   function getElem(_elemID) {
      return document.getElementById(_elemID); 
      }; 
   };
   

// Cybage :- For image scroller functions end ...............................................................