function showHideMenu(MenuId){
	if(currLeftMenu!=MenuId){
		if(currLeftMenu>0)
			document.getElementById('item'+currLeftMenu).className="leftNavTitleOff";
		document.getElementById('item'+MenuId).className="leftNavTitleOn";
		currLeftMenu=MenuId;
	} else {
		document.getElementById('item'+currLeftMenu).className="leftNavTitleOff";
		currLeftMenu=0;		
	}
}
function showUpgradeFlash(vToHide, vToShow){
	document.getElementById(vToHide).style.display='none';
	document.getElementById(vToShow).style.display='block';
}
function showFlash(vDivId, vFlashObj){
	vFlashObj.addParam("allowScriptAccess","sameDomain");
	vFlashObj.write(vDivId);		
}

function showmain(obj){
	temp = obj.src;
	temp1 = document.getElementById('mainImg').src;
	document.getElementById('mainImg').src = temp;
	obj.src = temp1;
}

/**
* SlideShow
*/

// Script: slideshow
// version: 0.1.0
// Copyright Ryan Florence (http://ryanflorence.com)
// License: MIT Style

; (function() {

    // shared vars / functions

    var transitions = {}
  , defaults =
    { transition: 'none'
    , duration: 500
    , delay: 4000
    , firstIndex: 0
    , autostart: false
    , onShow: function() { }
    , onShowComplete: function() { }
    , reset: function(element, style) {
        element.setAttribute('style', style || '')
        element.style.left = 0
        element.style.top = 0
    }
    }

    function merge(oldObj, newObj) {
        for (i in oldObj)
            if (oldObj.hasOwnProperty(i) && !newObj[i])
            newObj[i] = oldObj[i]
        return newObj
    }

    // Slideshow function

    var Slideshow = this.Slideshow = function(element, options) {

        var slides = element.children
    , transitioning = false
    , timer = null
    , styles = []
    , publick =
      { paused: true
      , options: merge(defaults, options || {})
      }

        publick.show = function(index, options) {

            if (transitioning)
                return

            index = getIndex(index)

            if (publick.index === index)
                return

            options = merge(publick.options, options || {})

            var previous = slides[publick.index]
      , next = slides[index]
      , oldStyle = previous.getAttribute('style')
      , wasPlaying = !publick.paused

            if (wasPlaying)
                publick.pause()

            transitioning = true
            options.reset(next, styles[index])
            next.style.display = ''
            previous.style.zIndex = 1

            var params =
    { previous: { index: publick.index, element: previous }
    , next: { index: index, element: next }
    , duration: options.duration
    , element: element
    }

            options.onShow(params)

            transitions[options.transition](
      { previous: previous
      , next: next
      , duration: options.duration
      , element: element
      })

            publick.index = index
            publick.element = slides[index]

            setTimeout(function() {
                transitioning = false
                previous.style.display = 'none'
                options.onShowComplete(params)
                if (wasPlaying)
                    publick.play()
            }, options.duration)

            return publick
        }

        publick.play = function(delay) {
            if (delay)
                publick.options.delay = delay

            publick.paused = false

            timer = setInterval(function() {
                publick.show('next')
            }, publick.options.delay)
            return publick
        }

        publick.pause = function() {
            clearInterval(timer)
            publick.paused = true
            return publick
        }

        function getIndex(arg) {
            if (!isNaN(arg)) return arg;

            if (arg === 'next')
                return (publick.index === slides.length - 1) ? 0 : publick.index + 1

            if (arg === 'previous') {
                return (publick.index === 0) ? slides.length - 1 : publick.index - 1
            }
        }

        // initialize

        for (var i = 0; i < slides.length; i++) {
            if (options.firstIndex !== i)
                slides[i].style.display = 'none'
            styles.push(slides[i].getAttribute('style'))
        }

        publick.index = publick.options.firstIndex
        publick.element = slides[0]

        if (publick.options.autostart)
            publick.play()

        return publick
    }

    // Slideshow function methods

    Slideshow.defineDefaults = function(newDefaults) {
        defaults = merge(defaults, newDefaults)
    }

    Slideshow.defineTransition = function(name, fn) {
        transitions[name] = fn
    }

    Slideshow.defineTransitions = function(params) {
        for (i in params)
            if (params.hasOwnProperty(i))
            Slideshow.defineTransition(i, params[i])
    }

    // define a transition

    Slideshow.defineTransition('none', function(params) {
        params.previous.style.display = 'none'
    })

}).call(jQuery);

(function($) {


    $.fn.slideshow = function(options) {

        var instance = this.data('slideshow')

        if (instance) {
            var args = [].slice.call(arguments, 0)
            if (args.length === 0)
                return instance
            instance[args.shift()].apply(instance, args)
            return this
        }

        return this.each(function(index, element) {
            var $element = $(element)
            options.onShow = function(params) {
                $element.trigger('slideshowShow', [params])
            }
            options.onShowComplete = function(params) {
                $element.trigger('slideshowShowComplete', [params])
            }
            $element.data('slideshow', $.Slideshow(element, options))
        })

    }

    // opacity transitions

    $.Slideshow.defineTransitions({
        fade: function(params) {
            $(params.previous).fadeOut(params.duration);
            return this;
        },

        'cross-fade': function(params) {
            var half = params.duration / 2;
            $(params.previous).fadeOut(half);
            $(params.next).hide().fadeIn(half);
            return this;
        },

        'fade-through-background': function(params) {
            var half = params.duration / 2,
			next = $(params.next).hide();

            $(params.previous).fadeOut(half);
            setTimeout(function() {
                next.fadeIn(half);
            });
            return this;
        },

        flash: function(params) {
            $(params.previous).hide();
            $(params.next).hide().fadeIn(params.duration);
            return this;
        }

    });

    // sliding transitions

    (function() {

        function getStyles(direction) {
            return {
                property: (direction == 'left' || direction == 'right') ? 'left' : 'top',
                inverted: (direction == 'left' || direction == 'up') ? 1 : -1
            };
        }

        function go(type, styles, params) {
            var animation = {},
			next = $(params.next),
			previous = $(params.previous);

            if (type == 'blind') {
                next.css('z-index', 2);
            }

            if (type != 'slide') {
                next.css(styles.property, (100 * styles.inverted) + '%')
                animation[styles.property] = 0 + '%';
                next.animate(animation, params.duration);
            }

            if (type != 'blind') {
                animation[styles.property] = -(100 * styles.inverted) + '%';
                previous.animate(animation, params.duration);
            }
        }

        $.each(['left', 'right', 'up', 'down'], function(index, direction) {

            var blindName = 'blind-' + direction,
		    slideName = 'slide-' + direction;

            $.each([
			['push-' + direction, (function() {
			    var styles = getStyles(direction);
			    return function(params) {
			        go('push', styles, params);
			        return this;
			    }
			} ())],
			[blindName, (function() {
			    var styles = getStyles(direction);
			    return function(params) {
			        go('blind', styles, params);
			        return this;
			    }
			} ())],
			[slideName, (function() {
			    var styles = getStyles(direction);
			    return function(params) {
			        go('slide', styles, params);
			        return this;
			    }
			} ())],
			[blindName + 'Fade', function(params) {
			    return this.fade(params)[blindName](params);
			} ]
		], function(index, transition) {
		    $.Slideshow.defineTransition(transition[0], transition[1]);
		});
        });

    })();


})(jQuery);

