  var pnary  = new Array();
  var urlary = new Array();
  var availableTags = new Array();

/*****************************************************************************************/

jQuery(document).ready(function() {


   $("tbody tr:nth-child(even)").addClass("alt");

   if ( typeof readCookie  == 'function') { if(!readCookie("ACCES_HQsAA")) { $(".HQ").removeClass("answeredalready");}}


   $('a.divToggle.hid,a.PressToggle.hid,a.NewsToggle.hid').append('<img style=\"position:absolute;top:1px;\" src=\"/images/less.png\" width=14 height=11>');
   $('a.divToggle:not(.hid),a.PressToggle:not(.hid),a.NewsToggle:not(.hid)').append('<img style=\"position:absolute;top:2px;\" src=\"/images/more.png\" width=14 height=11>');

   $('a.divToggle').click(tdiv);
   $('a.divToggle').pulse({textColors:["#048","#8CF"]},750);

   $('a.NewsToggle').click(tn);
   $('a.NewsToggle').pulse({textColors:["#048","#8CF"]},750);

   $('a.PressToggle').click(tp);
   $('a.PressToggle').pulse({textColors:["#048","#8CF"]},750);

   $('img[src*="/cb/"]').width(700);

   $(".caro").jCarouselLite({
       btnNext: ".cbnext",
       btnPrev: ".cbprev",
       auto:3000,
       visible:1,
       hoverPause:true,
       speed  :300}
   );

   $(".cbnext,.cbprev").hover(function() {
                                          $(this).addClass("cbhover");
                                         },function(){
                                                      $(this).removeClass("cbhover");
                                                     }
   );



});



function AIO_Split(data, pn, url, col)
{var i;var pn=new Array();var c;

  for(i=0;i<data.length;i++)
  {
    pn[i]=data[i][col];
    c = pn[i].indexOf("=");
    pnary[i] =pn[i].substr(0,c);
    urlary[i]=pn[i].substr(c+1,pn[i].length-c);

  }
}

/* Usage:
 *  jQuery CSV
 *  jQuery.csv()(csvtext)               returns an array of arrays representing the CSV text.
 *  jQuery.csv("\t")(tsvtext)           uses Tab as a delimiter (comma is the default)
 *  jQuery.csv("\t", "'")(tsvtext)      uses a single quote as the quote character instead of double quotes
 *  jQuery.csv("\t", "'\"")(tsvtext)    uses single & double quotes as the quote character
 *  jQuery.get(csvfile, function(data) { array = jQuery.csv()(data); });
 */


jQuery.extend({
    csv: function(delim, quote, linedelim) {
        delim = typeof delim == "string" ? new RegExp( "[" + (delim || ","   ) + "]" ) : typeof delim == "undefined" ? ","    : delim;
        quote = typeof quote == "string" ? new RegExp("^[" + (quote || '"'   ) + "]" ) : typeof quote == "undefined" ? '"'    : quote;
        lined = typeof lined == "string" ? new RegExp( "[" + (lined || "\r\n") + "]+") : typeof lined == "undefined" ? "\r\n" : lined;

        function splitline (v) {
            // Split the line using the delimitor
            var arr  = v.split(delim),
                out = [], q;
            for (var i=0, l=arr.length; i<l; i++) {
                if (q = arr[i].match(quote)) {
                    for (j=i; j<l; j++) {
                        if (arr[j].charAt(arr[j].length-1) == q[0]) { break; }
                    }
                    var s = arr.slice(i,j+1).join(delim);
                    out.push(s.substr(1,s.length-2));
                    i = j;
                }
                else { out.push(arr[i]); }
            }

            return out;
        }

        return function(text) {
            var lines = text.split(lined);
            for (var i=0, l=lines.length; i<l; i++) {
                lines[i] = splitline(lines[i]);
            }
            return lines;
        };
    }
});



/**
 * jQuery.pulse
 * Copyright (c) 2008 James Padolsey - jp(at)qd9(dot)co.uk | http://james.padolsey.com / http://enhance.qd-creative.co.uk
 * Dual licensed under MIT and GPL.
 * Date: 05/11/08
 *
 * @projectDescription Applies a continual pulse to any element specified
 * http://enhance.qd-creative.co.uk/demos/pulse/
 * Tested successfully with jQuery 1.2.6. On FF 2/3, IE 6/7, Opera 9.5 and Safari 3. on Windows XP.
 *
 * @author James Padolsey
 * @version 1.11
 *
 * @id jQuery.pulse
 * @id jQuery.recover
 * @id jQuery.fn.pulse
 * @id jQuery.fn.recover
 */
(function($){

    $.fn.recover = function() {
        /* Empty inline styles - i.e. set element back to previous state */
        /* Note, the recovery might not work properly if you had inline styles set before pulse initiation */
        return this.each(function(){$(this).stop().css({backgroundColor:'',color:'',borderLeftColor:'',borderRightColor:'',borderTopColor:'',borderBottomColor:'',opacity:1});});
    }
    $.fn.pulse = function(options){
        var defaultOptions = {
            textColors: [],
            backgroundColors: [],
            borderColors: [],
            opacityPulse: true,
            opacityRange: [],
            speed: 1000,
            duration: false,
            runLength: false
        }, o = $.extend(defaultOptions,options);
        /* Validate custom options */
        if(o.textColors.length===1||o.backgroundColors.length===1||o.borderColors.length===1) {return false;}
        /* Begin: */
        return this.each(function(){
            var $t = $(this), pulseCount=1, pulseLimit = (o.runLength&&o.runLength>0) ? o.runLength*largestArrayLength([o.textColors.length,o.backgroundColors.length,o.borderColors.length,o.opacityRange.length]) : false;
            clearTimeout(recover);
            if(o.duration) {
                setTimeout(recover,o.duration);
            }
            function nudgePulse(textColorIndex,bgColorIndex,borderColorIndex,opacityIndex) {
                if(pulseLimit&&pulseCount===pulseLimit) {
                    return $t.recover();
                }
                pulseCount++;
                /* Initiate color change - on callback continue */
                return $t.animate(getColorsAtIndex(textColorIndex,bgColorIndex,borderColorIndex,opacityIndex),o.speed,function(){
                    /* Callback of each step */
                    nudgePulse(
                        getNextIndex(o.textColors,textColorIndex),
                        getNextIndex(o.backgroundColors,bgColorIndex),
                        getNextIndex(o.borderColors,borderColorIndex),
                        getNextIndex(o.opacityRange,opacityIndex)
                    );
                });
            }
            /* Set CSS to first step (no animation) */
            $t.css(getColorsAtIndex(0,0,0,0));
            /* Then animate to second step */
            nudgePulse(1,1,1,1);
            function getColorsAtIndex(textColorIndex,bgColorIndex,borderColorIndex,opacityIndex) {
                /* Prepare animation object - get's all property names/values from passed indexes */
                var params = {};
                if(o.backgroundColors.length) {
                    params['backgroundColor'] = o.backgroundColors[bgColorIndex];
                }
                if(o.textColors.length) {
                    params['color'] = o.textColors[textColorIndex];
                }
                if(o.borderColors.length) {
                    params['borderLeftColor'] = o.borderColors[borderColorIndex];
                    params['borderRightColor'] = o.borderColors[borderColorIndex];
                    params['borderTopColor'] = o.borderColors[borderColorIndex];
                    params['borderBottomColor'] = o.borderColors[borderColorIndex];
                }
                if(o.opacityPulse&&o.opacityRange.length) {
                    params['opacity'] = o.opacityRange[opacityIndex];
                }
                return params;
            }
            function getNextIndex(property,currentIndex) {
                if (property.length>currentIndex+1) {return currentIndex+1;}
                else {return 0;}
            }
            function largestArrayLength(arrayOfArrays) {
                return Math.max.apply( Math, arrayOfArrays );
            }
            function recover() {
                $t.recover();
            }
        });
    }
})(jQuery);

/* The below code extends the animate function so that it works with color animations */
/* By John Resig */
(function(jQuery){
jQuery.each(['backgroundColor','borderBottomColor','borderLeftColor','borderRightColor','borderTopColor','color','outlineColor'],function(i,attr){jQuery.fx.step[attr]=function(fx){if(fx.state==0){fx.start=getColor(fx.elem,attr);fx.end=getRGB(fx.end)}fx.elem.style[attr]="rgb("+[Math.max(Math.min(parseInt((fx.pos*(fx.end[0]-fx.start[0]))+fx.start[0]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[1]-fx.start[1]))+fx.start[1]),255),0),Math.max(Math.min(parseInt((fx.pos*(fx.end[2]-fx.start[2]))+fx.start[2]),255),0)].join(",")+")"}});
function getRGB(color){var result;if(color&&color.constructor==Array&&color.length==3)return color;if(result=/rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)){return[parseInt(result[1]),parseInt(result[2]),parseInt(result[3])]}if(result=/rgb\(\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*,\s*([0-9]+(?:\.[0-9]+)?)\%\s*\)/.exec(color)){return[parseFloat(result[1])*2.55,parseFloat(result[2])*2.55,parseFloat(result[3])*2.55]}if(result=/#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color)){return[parseInt(result[1],16),parseInt(result[2],16),parseInt(result[3],16)]}if(result=/#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color)){return[parseInt(result[1]+result[1],16),parseInt(result[2]+result[2],16),parseInt(result[3]+result[3],16)]}return colors[jQuery.trim(color).toLowerCase()]}
function getColor(elem,attr){var color;do{color=jQuery.curCSS(elem,attr);if(color!=''&&color!='transparent'||jQuery.nodeName(elem,"body")){break}attr="backgroundColor"}while(elem=elem.parentNode);return getRGB(color)};
var colors={aqua:[0,255,255],azure:[240,255,255],beige:[245,245,220],black:[0,0,0],blue:[0,0,255],brown:[165,42,42],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgrey:[169,169,169],darkgreen:[0,100,0],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkviolet:[148,0,211],fuchsia:[255,0,255],gold:[255,215,0],green:[0,128,0],indigo:[75,0,130],khaki:[240,230,140],lightblue:[173,216,230],lightcyan:[224,255,255],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightyellow:[255,255,224],lime:[0,255,0],magenta:[255,0,255],maroon:[128,0,0],navy:[0,0,128],olive:[128,128,0],orange:[255,165,0],pink:[255,192,203],purple:[128,0,128],violet:[128,0,128],red:[255,0,0],silver:[192,192,192],white:[255,255,255],yellow:[255,255,0]};
})(jQuery);

/**************************/
function nALL(){
   $('.nBUS,.nIO').fadeTo("slow",1);
}
function nIO(){
   $('.nIO').fadeTo("slow",1);
   $('.nBUS').fadeTo("slow",.2);
}
function nBUS(){
   $('.nBUS').fadeTo("slow",1);
   $('.nIO').fadeTo("slow",.2);
}

function tn(){
   $('#AllNews').slideToggle(2000);
   $('.NewsToggle').slideToggle(2000);

   return false;
}

function tp(){
   $('#AllPress').slideToggle(2000);
   $('.PressToggle').slideToggle(2000);

   return false;
}

function tdiv(){
   $('.divToggle').slideToggle(2000);
   return false;
}

function viewPic(img)
{
    picfile = new Image();
    picfile.src =(img);
    fileCheck(img);
}

function fileCheck(img)
{
    if( (picfile.width!=0) && (picfile.height!=0) )
    {
        makeWindow(img);
    }
    else
    {
        funzione="fileCheck('"+img+"')";
        intervallo=setTimeout(funzione,50);
    }
}

function makeWindow(img)
{
    ht = picfile.height + 20;
    wd = picfile.width + 20;

    var args= "height=" + ht + ",innerHeight=" + ht;
    args += ",width=" + wd + ",innerWidth=" + wd;
    if (window.screen)
    {
        var avht = screen.availHeight;
        var avwd = screen.availWidth;
        var xcen = (avwd - wd) / 2;
        var ycen = (avht - ht) / 2;
        args += ",left=" + xcen + ",screenX=" + xcen;
        args += ",top=" + ycen + ",screenY=" + ycen + ",resizable=yes";
    }
    return window.open(img, '', args);
}

var locus;

function Right(Str, Ct)
{
        var I = Str.length;
        if ( Ct > I )
                return Str
        ;
        return Str.substr(I - Ct, Ct);
}


function DoMail(dest)
{
        dest += "@";
        document.location.assign("mailto:" + dest +  "accesio.com");
//      alert("mailto:" + dest +  "accesio.com");
}

function MM_setLocus(l)
{
  var x;
  if(l)
    locus=l;
  if ((x = MM_findObj('here')) != null)
    x.src = '/images/' + locus + '.gif'
  ;
}
function MM_loadImages()
{ //v3.0
  if(document.images)
    if(!document.MM_p)
      document.MM_p = new Array()
  ;
  if(!document.zeroes)
      document.zeroes = new Array()
  ;
    var i, j = document.MM_p.length, k = document.zeroes.length, x, a = MM_loadImages.arguments;
    for(i = 0; i < a.length; i++)
        if ((x = MM_findObj(a[i])) != null)
        {
          document.zeroes[k++] = a[i];
          x.baseImg = '/images/' + a[i] + '_plain.gif';
          x.downImg = '/images/' + a[i] + '_down.gif';

          if(document.images)
          {

            document.MM_p[j] = new Image;
            document.MM_p[j++].src = x.baseImg;
            document.MM_p[j] = new Image;
            document.MM_p[j++].src = x.downImg;
          }
          x.how = 0;
          x.src = x.baseImg;
        }
}

function MM_findObj(n, d)
{
  var p, i, x;
  if(!d)
    d = document;
  if((p = n.indexOf("?")) > 0 && parent.frames.length)
  {
    d = parent.frames[n.substring(p+1)].document;
    n = n.substring(0, p);
  }
  if(!(x = d[n]) && d.all)
    x = d.all[n];
  for(i = 0; !x && i < d.forms.length; i++)
    x = d.forms[i][n];
  for(i = 0; !x && d.layers && i < d.layers.length; i++)
    x = MM_findObj(n,d.layers[i].document);
  return x;
}
function MM_swapImg(who, how)
{
  var x;
  if ((x = MM_findObj(who)) != null)
  {
    if (how != 0)
    {
      x.how = 1;
      x.src = x.downImg;
    }
    else
    {
      x.how = 0;
      x.src = x.baseImg;
    }
  }
//  else
//    alert('cannot find ' + who);
}

function MM_reZero()
{
  var i, k = document.zeroes.length;
  for(i = 0; i < k; i++)
    if ((x = MM_findObj(document.zeroes[i])) != null)
      MM_swapImg(document.zeroes[i], x.how)
  ;
}

function selectDesc() {
  document.getElementById("tab1").className = document.getElementById("tab1").className.replace(/n/i,"y");
  document.getElementById("tab2").className = document.getElementById("tab2").className.replace(/y/i,"n");
  document.getElementById("tab3").className = document.getElementById("tab3").className.replace(/y/i,"n");
  document.getElementById("a1").className = document.getElementById("a1").className.replace(/n/i,"y");
  document.getElementById("a2").className = document.getElementById("a2").className.replace(/y/i,"n");
  document.getElementById("a3").className = document.getElementById("a3").className.replace(/y/i,"n");
  document.getElementById("a4").className = document.getElementById("a4").className.replace(/y/i,"n");
  document.getElementById("tab4").className = document.getElementById("tab4").className.replace(/y/i,"n");

  document.getElementById("DescriptionText").style.display = 'block';
  document.getElementById("SpecificationsText").style.display = 'none';
  document.getElementById("OrderingInfoText").style.display = 'none';
  document.getElementById("DownloadsText").style.display = 'none';
}

function selectSpec() {
  document.getElementById("tab1").className = document.getElementById("tab1").className.replace(/y/i,"n");
  document.getElementById("tab2").className = document.getElementById("tab2").className.replace(/n/i,"y");
  document.getElementById("tab3").className = document.getElementById("tab3").className.replace(/y/i,"n");
  document.getElementById("a1").className = document.getElementById("a1").className.replace(/y/i,"n");
  document.getElementById("a2").className = document.getElementById("a2").className.replace(/n/i,"y");
  document.getElementById("a3").className = document.getElementById("a3").className.replace(/y/i,"n");
  document.getElementById("a4").className = document.getElementById("a4").className.replace(/y/i,"n");
  document.getElementById("tab4").className = document.getElementById("tab4").className.replace(/y/i,"n");

  document.getElementById("DescriptionText").style.display = 'none';
  document.getElementById("SpecificationsText").style.display = 'block';
  document.getElementById("OrderingInfoText").style.display = 'none';
  document.getElementById("DownloadsText").style.display = 'none';
}

function selectInfo() {
  document.getElementById("tab1").className = document.getElementById("tab1").className.replace(/y/i,"n");
  document.getElementById("tab2").className = document.getElementById("tab2").className.replace(/y/i,"n");
  document.getElementById("tab3").className = document.getElementById("tab3").className.replace(/n/i,"y");
  document.getElementById("a1").className = document.getElementById("a1").className.replace(/y/i,"n");
  document.getElementById("a2").className = document.getElementById("a2").className.replace(/y/i,"n");
  document.getElementById("a3").className = document.getElementById("a3").className.replace(/n/i,"y");

  document.getElementById("a4").className = document.getElementById("a4").className.replace(/y/i,"n");
  document.getElementById("tab4").className = document.getElementById("tab4").className.replace(/y/i,"n");

  document.getElementById("DescriptionText").style.display = 'none';
  document.getElementById("SpecificationsText").style.display = 'none';
  document.getElementById("OrderingInfoText").style.display = 'block';
  document.getElementById("DownloadsText").style.display = 'none';
}

function selectDown() {
  document.getElementById("tab1").className = document.getElementById("tab1").className.replace(/y/i,"n");
  document.getElementById("tab2").className = document.getElementById("tab2").className.replace(/y/i,"n");
  document.getElementById("tab3").className = document.getElementById("tab3").className.replace(/y/i,"n");
  document.getElementById("tab4").className = document.getElementById("tab4").className.replace(/n/i,"y");
  document.getElementById("a1").className = document.getElementById("a1").className.replace(/y/i,"n");
  document.getElementById("a2").className = document.getElementById("a2").className.replace(/y/i,"n");
  document.getElementById("a3").className = document.getElementById("a3").className.replace(/y/i,"n");
  document.getElementById("a4").className = document.getElementById("a4").className.replace(/n/i,"y");

  document.getElementById("DescriptionText").style.display = 'none';
  document.getElementById("SpecificationsText").style.display = 'none';
  document.getElementById("OrderingInfoText").style.display = 'none';
  document.getElementById("DownloadsText").style.display = 'block';
}

function selectAll() {
  document.getElementById("DescriptionText").style.display = 'block';
  document.getElementById("SpecificationsText").style.display = 'block';
  document.getElementById("OrderingInfoText").style.display = 'block';
  document.getElementById("DownloadsText").style.display = 'block';
}


function dotabs()
{
  document.write('<br clear="all">');
  document.write('<div id="seltab">');
  document.write('<li id="tab1" class="y"><a onfocus="this.hideFocus=true;" class="y" id="a1" href="javascript:void(0);"  onClick="javascript:selectDesc();">Description</a></li>');
  document.write('<li id="tab2" class="n"><a onfocus="this.hideFocus=true;" class="n" id="a2" href="javascript:void(0);"  onClick="javascript:selectSpec();">Specifications</a></li>');
  document.write('<li id="tab4" class="n"><a onfocus="this.hideFocus=true;" class="n" id="a4" href="javascript:void(0);"  onClick="javascript:selectDown();">Manuals / Software</a></li>');
  document.write('<li id="tab3" class="n"><a onfocus="this.hideFocus=true;" class="n" id="a3" href="javascript:void(0);"  onClick="javascript:selectInfo();">Ordering Information</a></li>');
  document.write('</div>');
}


var xPos,yPos;
var isNS = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4);
xPos = 0;
yPos = 0;

function magnify_pos() {
   if (document.images["CardImg"]) {
      imgElem = document.images["CardImg"];
      xPos = eval(imgElem).offsetLeft;
      tempEl = eval(imgElem).offsetParent;
      while (tempEl != null) {
         xPos += tempEl.offsetLeft;
         tempEl = tempEl.offsetParent;
      }  //  end while tempEl
      yPos = eval(imgElem).offsetTop;
      tempEl = eval(imgElem).offsetParent;
      while (tempEl != null) {
         yPos += tempEl.offsetTop;
         tempEl = tempEl.offsetParent;
      }  //  end while tempEl
   }  //  end if

}  //  end pos()

function showObject(object) {
   var lft,tp;
   if (document.images["CardImg"] && document.images["BigImage"]) {
      w1 = document.images["CardImg"].width;
      w2 = document.images["BigImage"].width;
      h1 = document.images["CardImg"].height;
      h2 = document.images["BigImage"].height;
      lft = xPos - (w2 - w1);
      tp = yPos - (h2 - h1);

      object.style.left = lft;
      object.style.top = tp;
      object.style.visibility = 'visible';
   }  //  end if
}

function hideObject(object) {
   object.style.visibility = 'hidden';
}

function Magnify_LoadImg() {
   if (document.images["BigImage"]) {
      magnify_pos();
      document.images["BigImage"].src = document.images["CardImg"].src;

      var Image1 = document.getElementById('CardImg');
      var MagImage = document.getElementById('MagImg');
      Mag.style.top = yPos + (Image1.height - MagImage.height);
      Mag.style.left = xPos + (Image1.width - MagImage.width);

      Mag.style.width = MagImage.width;
      Mag.style.visibility = 'visible';
   }  //  end if
}

/**
* jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
* @requires jQuery v1.2 or above
*
* http://gmarwaha.com/jquery/jcarousellite/
*
* Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Version: 1.0.1
* Note: Requires jquery 1.2 or above from version 1.0.1
*/

/**
* Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
*
* The HTML markup that is used to build the carousel can be as simple as...
*
*  <div class="carousel">
*      <ul>
*          <li><img src="image/1.jpg" alt="1"></li>
*          <li><img src="image/2.jpg" alt="2"></li>
*          <li><img src="image/3.jpg" alt="3"></li>
*      </ul>
*  </div>
*
* As you can see, this snippet is nothing but a simple div containing an unordered list of images.
* You don't need any special "class" attribute, or a special "css" file for this plugin.
* I am using a class attribute just for the sake of explanation here.
*
* To navigate the elements of the carousel, you need some kind of navigation buttons.
* For example, you will need a "previous" button to go backward, and a "next" button to go forward.
* This need not be part of the carousel "div" itself. It can be any element in your page.
* Lets assume that the following elements in your document can be used as next, and prev buttons...
*
* <button class="prev">&lt;&lt;</button>
* <button class="next">&gt;&gt;</button>
*
* Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
* navigation buttons as options.
*
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev"
* });
*
* That's it, you would have now converted your raw div, into a magnificient carousel.
*
* There are quite a few other options that you can use to customize it though.
* Each will be explained with an example below.
*
* @param an options object - You can specify all the options shown below as an options object param.
*
* @option btnPrev, btnNext : string - no defaults
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev"
* });
* @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
*
* @option btnGo - array - no defaults
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      btnGo: [".0", ".1", ".2"]
* });
* @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
* the item number within the carousel, you can use this option. Just supply an array of selectors for each element
* in the carousel. The index of the array represents the index of the element. What i mean is, if the
* first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
* will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
* interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
* any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
* The best part is that, the tab will "slide" based on the provided effect. :-)
*
* @option mouseWheel : boolean - default is false
* @example
* $(".carousel").jCarouselLite({
*      mouseWheel: true
* });
* @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
* To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
* Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
* using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
* as well. They complement each other. To use both together, just supply the options required for both as shown below.
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      mouseWheel: true
* });
*
* @option auto : number - default is null, meaning autoscroll is disabled by default
* @example
* $(".carousel").jCarouselLite({
*      auto: 800,
*      speed: 500
* });
* @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
* The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
* Specify this value and magically your carousel will start auto scrolling.
*
* @option speed : number - 200 is default
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      speed: 800
* });
* @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
* different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
*
* @option easing : string - no easing effects by default.
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      easing: "bounceout"
* });
* @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
* the carousel will slide based on the provided easing effect.
*
* @option vertical : boolean - default is false
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      vertical: true
* });
* @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
* prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
* display horizontally. The next and prev items will slide the items from left-right in this case.
*
* @option circular : boolean - default is true
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      circular: false
* });
* @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
* element, you will automatically slide to the first element and vice versa. If you set circular to false, then
* if you click on the "next" button after you reach the last element, you will stay in the last element itself
* and similarly for "previous" button and first element.
*
* @option visible : number - default is 3
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      visible: 4
* });
* @desc This specifies the number of items visible at all times within the carousel. The default is 3.
* You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
* last item half visible. This gives you the effect of showing the user that there are more images to the right.
*
* @option start : number - default is 0
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      start: 2
* });
* @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
* has a start of 0, and so on.
*
* @option scrool : number - default is 1
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      scroll: 2
* });
* @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
* default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
* 2 items when you click the next or previous buttons.
*
* @option beforeStart, afterEnd : function - callbacks
* @example
* $(".carousel").jCarouselLite({
*      btnNext: ".next",
*      btnPrev: ".prev",
*      beforeStart: function(a) {
*          alert("Before animation starts:" + a);
*      },
*      afterEnd: function(a) {
*          alert("After animation ends:" + a);
*      }
* });
* @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
* register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
* are visible at the time of callback.
*
*
* @cat Plugins/Image Gallery
* @author Ganeshji Marwaha/ganeshread@gmail.com
*/

(function($) {                                          // Compliant with jquery.noConflict()
    $.fn.jCarouselLite = function(o) {
        o = $.extend({
            btnPrev: null,
            btnNext: null,
            btnGo: null,
            mouseWheel: false,
            auto: null,

            speed: 200,
            easing: null,

            vertical: false,
            circular: true,
            visible: 3,
            start: 0,
            scroll: 1,

            beforeStart: null,
            afterEnd: null
        }, o || {});

        return this.each(function() {                           // Returns the element collection. Chainable.

            var running = false, animCss = o.vertical ? "top" : "left", sizeCss = o.vertical ? "height" : "width";
            var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;

            if (o.circular) {
                ul.prepend(tLi.slice(tl - v - 1 + 1).clone())
              .append(tLi.slice(0, v).clone());
                o.start += v;
            }

            var li = $("li", ul), itemLength = li.size(), curr = o.start;
            div.css("visibility", "visible");

            li.css({ overflow: "hidden", float: o.vertical ? "none" : "left" });
            ul.css({ margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1" });
            div.css({ overflow: "hidden", position: "relative", "z-index": "2", left: "0px" });

            var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
            var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
            var divSize = liSize * v;                           // size of entire div(total length for just the visible items)

            li.css({ width: li.width(), height: li.height() });
            ul.css(sizeCss, ulSize + "px").css(animCss, -(curr * liSize));

            div.css(sizeCss, divSize + "px");                     // Width of the DIV. length of visible images

            if (o.btnPrev) {
                $(o.btnPrev).click(function() {
                    return go(curr - o.scroll);
                });
                if (o.hoverPause) {
                    $(o.btnPrev).hover(function() { stopAuto(); }, function() { startAuto(); });
                }

            }
            if (o.btnNext) {
                $(o.btnNext).click(function() {
                    return go(curr + o.scroll);
                });
                if (o.hoverPause) {
                    $(o.btnNext).hover(function() { stopAuto(); }, function() { startAuto(); });
                }

            }
            if (o.btnGo)
                $.each(o.btnGo, function(i, val) {
                    $(val).click(function() {
                        return go(o.circular ? o.visible + i : i);
                    });
                });

            if (o.mouseWheel && div.mousewheel)
                div.mousewheel(function(e, d) {
                    return d > 0 ? go(curr - o.scroll) : go(curr + o.scroll);
                });

//            if (o.auto)
//                setInterval(function() {
//                    go(curr + o.scroll);
//                }, o.auto + o.speed);

            var autoInterval;

            function startAuto() {
                autoInterval = setInterval(function() {
                    go(curr + o.scroll);
                }, o.auto + o.speed);

            };

            function stopAuto() {

                clearInterval(autoInterval);

            };

            if (o.auto) {
                if (o.hoverPause) {
                    div.hover(function() { stopAuto(); }, function() { startAuto(); });
                }
                startAuto();
            };


            function vis() {
                return li.slice(curr).slice(0, v);
            };

            function go(to) {
                if (!running) {

                    if (o.beforeStart)
                        o.beforeStart.call(this, vis());

                    if (o.circular) {            // If circular we are in first or last, then goto the other end
                        if (to <= o.start - v - 1) {           // If first, then goto last
                            ul.css(animCss, -((itemLength - (v * 2)) * liSize) + "px");
                            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
                            curr = to == o.start - v - 1 ? itemLength - (v * 2) - 1 : itemLength - (v * 2) - o.scroll;
                        } else if (to >= itemLength - v + 1) { // If last, then goto first
                            ul.css(animCss, -((v) * liSize) + "px");
                            // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
                            curr = to == itemLength - v + 1 ? v + 1 : v + o.scroll;
                        } else curr = to;
                    } else {                    // If non-circular and to points to first or last, we just return.
                        if (to < 0 || to > itemLength - v) return;
                        else curr = to;
                    }                           // If neither overrides it, the curr will still be "to" and we can proceed.

                    running = true;

                    ul.animate(
                    animCss == "left" ? { left: -(curr * liSize)} : { top: -(curr * liSize) }, o.speed, o.easing,
                    function() {
                        if (o.afterEnd)
                            o.afterEnd.call(this, vis());
                        running = false;
                    }
                );
                    // Disable buttons when the carousel reaches the last/first, and enable when not
                    if (!o.circular) {
                        $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
                        $((curr - o.scroll < 0 && o.btnPrev)
                        ||
                       (curr + o.scroll > itemLength - v && o.btnNext)
                        ||
                       []
                     ).addClass("disabled");
                    }

                }
                return false;
            };
        });
    };

    function css(el, prop) {
        return parseInt($.css(el[0], prop)) || 0;
    };
    function width(el) {
        return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
    };
    function height(el) {
        return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
    };

})(jQuery);

