//------------------Remove Hide Class for cufon------------------//
$(function() {
$('body').removeClass('jqueryhide');
});
//------------------Hover Fade------------------//
$(function() {
    $(".rollover").css({ 'opacity': '0' });

    $('.btn_get_quote, ').hover(
	function() {
		$(this).find('.rollover').stop().fadeTo(600, 1);
	},
	function() {
		$(this).find('.rollover').stop().fadeTo(500, 0);
	}
    )


});



//------------------Tool Tip------------------//
$(function () {
  $('.bullet_img').each(function () {
    // options
    var distance = 10;
    var time = 50;
    var hideDelay = 50;

    var hideDelayTimer = null;

    // tracker
    var beingShown = false;
    var shown = false;
    
    var trigger = $('.trigger', this);
    var popup = $('.imgHover', this).css('opacity', 0);

    // set the mouseover and mouseout on both element
    $([trigger.get(0), popup.get(0)]).mouseover(function () {
      // stops the hide event if we move from the trigger to the popup element
      if (hideDelayTimer) clearTimeout(hideDelayTimer);

      // don't trigger the animation again if we're being shown, or already visible
      if (beingShown || shown) {
        return;
      } else {
        beingShown = true;

        // reset position of popup box
        popup.css({
          top: 319,
          left: 80,
          display: 'block' // brings the popup back in to view
        })

        // (we're using chaining on the popup) now animate it's opacity and position
        .animate({
          right: '-=' + distance + 'px',
          opacity: 1
        }, time, 'swing', function() {
          // once the animation is complete, set the tracker variables
          beingShown = false;
          shown = true;
        });
      }
    }).mouseout(function () {
      // reset the timer if we get fired again - avoids double animations
      if (hideDelayTimer) clearTimeout(hideDelayTimer);
      
      // store the timer so that it can be cleared in the mouseover if required
      hideDelayTimer = setTimeout(function () {
        hideDelayTimer = null;
        popup.animate({
          right: '-=' + distance + 'px',
          opacity: 0
        }, time, 'swing', function () {
          // once the animate is complete, set the tracker variables
          shown = false;
          // hide the popup entirely after the effect (opacity alone doesn't do the job)
          popup.css('display', 'none');
        });
      }, hideDelay);
    });
  });
});


//------------------Fancy Box------------------//
/*
* FancyBox - simple jQuery plugin for fancy image zooming
* Examples and documentation at: http://chadly.net/post/2009/01/29/Lightbox-for-YouTube-Videos.aspx
* Version: 1.0.0 (29/04/2008)
* Copyright (c) 2008 Janis Skarnelis
* Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
* Requires: jQuery v1.2.1 or later
*/
(function($) {
    var opts = {},
		imgPreloader = new Image, imgTypes = ['png', 'jpg', 'jpeg', 'gif'],
		loadingTimer, loadingFrame = 1;

    $.fn.fancybox = function(settings) {
        opts.settings = $.extend({}, $.fn.fancybox.defaults, settings);

        $.fn.fancybox.init();

        return this.each(function() {
            var $this = $(this);
            var o = $.metadata ? $.extend({}, opts.settings, $this.metadata()) : opts.settings;

            $this.unbind('click').click(function() {
                $.fn.fancybox.start(this, o); return false;
            });
        });
    };

    $.fn.fancybox.start = function(el, o) {
        if (opts.animating) return false;

        if (o.overlayShow) {
            $("#fancy_wrap").prepend('<div id="fancy_overlay"></div>');
            $("#fancy_overlay").css({ 'width': $(window).width(), 'height': $(document).height(), 'opacity': o.overlayOpacity });

            if ($.browser.msie) {
                $("#fancy_wrap").prepend('<iframe id="fancy_bigIframe" scrolling="no" frameborder="0"></iframe>');
                $("#fancy_bigIframe").css({ 'width': $(window).width(), 'height': $(document).height(), 'opacity': 0 });
            }

            $("#fancy_overlay").click($.fn.fancybox.close);
        }

        opts.itemArray = [];
        opts.itemNum = 0;

        if (jQuery.isFunction(o.itemLoadCallback)) {
            o.itemLoadCallback.apply(this, [opts]);

            var c = $(el).children("img:first").length ? $(el).children("img:first") : $(el);
            var tmp = { 'width': c.width(), 'height': c.height(), 'pos': $.fn.fancybox.getPosition(c) }

            for (var i = 0; i < opts.itemArray.length; i++) {
                opts.itemArray[i].o = $.extend({}, o, opts.itemArray[i].o);

                if (o.zoomSpeedIn > 0 || o.zoomSpeedOut > 0) {
                    opts.itemArray[i].orig = tmp;
                }
            }

        } else {
            if (!el.rel || el.rel == '') {
                var item = { url: el.href, title: el.title, o: o };

                if (o.zoomSpeedIn > 0 || o.zoomSpeedOut > 0) {
                    var c = $(el).children("img:first").length ? $(el).children("img:first") : $(el);
                    item.orig = { 'width': c.width(), 'height': c.height(), 'pos': $.fn.fancybox.getPosition(c) }
                }

                opts.itemArray.push(item);

            } else {
                var arr = $("a[rel=" + el.rel + "]").get();

                for (var i = 0; i < arr.length; i++) {
                    var tmp = $.metadata ? $.extend({}, o, $(arr[i]).metadata()) : o;
                    var item = { url: arr[i].href, title: arr[i].title, o: tmp };

                    if (o.zoomSpeedIn > 0 || o.zoomSpeedOut > 0) {
                        var c = $(arr[i]).children("img:first").length ? $(arr[i]).children("img:first") : $(el);

                        item.orig = { 'width': c.width(), 'height': c.height(), 'pos': $.fn.fancybox.getPosition(c) }
                    }

                    if (arr[i].href == el.href) opts.itemNum = i;

                    opts.itemArray.push(item);
                }
            }
        }

        $.fn.fancybox.changeItem(opts.itemNum);
    };

    $.fn.fancybox.changeItem = function(n) {
        $.fn.fancybox.showLoading();

        opts.itemNum = n;

        $("#fancy_nav").empty();
        $("#fancy_outer").stop();
        $("#fancy_title").hide();
        $(document).unbind("keydown");

        imgRegExp = imgTypes.join('|');
        imgRegExp = new RegExp('\.' + imgRegExp + '$', 'i');

        var url = opts.itemArray[n].url;

        if (url.match(/#/)) {
            var target = window.location.href.split('#')[0]; target = url.replace(target, '');

            $.fn.fancybox.showItem('<div id="fancy_div">' + $(target).html() + '</div>');

            $("#fancy_loading").hide();

        } else if (url.match(imgRegExp)) {
            $(imgPreloader).unbind('load').bind('load', function() {
                $("#fancy_loading").hide();

                opts.itemArray[n].o.frameWidth = imgPreloader.width;
                opts.itemArray[n].o.frameHeight = imgPreloader.height;

                $.fn.fancybox.showItem('<img id="fancy_img" src="' + imgPreloader.src + '" />');

            }).attr('src', url + '?rand=' + Math.floor(Math.random() * 999999999));

        } else if (url.match(/youtube\.com\/watch/i)) {
            var vidId = url.split('v=')[1].split('&')[0];
            var vidSrc = "http://www.youtube.com/v/" + vidId + "&hl=en&fs=1&autoplay=1&rel=0";
            var flashvars = {};
            var params = {};
            params.wmode = "transparent";
            params.allowFullScreen = "true";
            params.allowscriptaccess = "always";
            var attributes = {};

            $.fn.fancybox.showItem('<div id="fancy_video">No video available</div>');
            swfobject.embedSWF(vidSrc, "fancy_video", opts.itemArray[n].o.frameWidth, opts.itemArray[n].o.frameHeight, "9.0.0", false, flashvars, params, attributes);
            $("#fancy_loading").hide();

        } else {
            $.fn.fancybox.showItem('<iframe id="fancy_frame" onload="$.fn.fancybox.showIframe()" name="fancy_iframe' + Math.round(Math.random() * 1000) + '" frameborder="0" hspace="0" src="' + url + '"></iframe>');
        }
    };

    $.fn.fancybox.showIframe = function() {
        $("#fancy_loading").hide();
        $("#fancy_frame").show();
    };

    $.fn.fancybox.showItem = function(val) {
        $.fn.fancybox.preloadNeighborImages();

        var viewportPos = $.fn.fancybox.getViewport();
        var itemSize = $.fn.fancybox.getMaxSize(viewportPos[0] - 50, viewportPos[1] - 100, opts.itemArray[opts.itemNum].o.frameWidth, opts.itemArray[opts.itemNum].o.frameHeight);

        var itemLeft = viewportPos[2] + Math.round((viewportPos[0] - itemSize[0]) / 2) - 20;
        var itemTop = viewportPos[3] + Math.round((viewportPos[1] - itemSize[1]) / 2) - 40;

        var itemOpts = {
            'left': itemLeft,
            'top': itemTop,
            'width': itemSize[0] + 'px',
            'height': itemSize[1] + 'px'
        }

        if (opts.active) {
            $('#fancy_content').fadeOut("normal", function() {
                $("#fancy_content").empty();

                $("#fancy_outer").animate(itemOpts, "normal", function() {
                    $("#fancy_content").append($(val)).fadeIn("normal");
                    $.fn.fancybox.updateDetails();
                });
            });

        } else {
            opts.active = true;

            $("#fancy_content").empty();

            if ($("#fancy_content").is(":animated")) {
                console.info('animated!');
            }

            if (opts.itemArray[opts.itemNum].o.zoomSpeedIn > 0) {
                opts.animating = true;
                itemOpts.opacity = "show";

                $("#fancy_outer").css({
                    'top': opts.itemArray[opts.itemNum].orig.pos.top - 18,
                    'left': opts.itemArray[opts.itemNum].orig.pos.left - 18,
                    'height': opts.itemArray[opts.itemNum].orig.height,
                    'width': opts.itemArray[opts.itemNum].orig.width
                });

                $("#fancy_content").append($(val)).show();

                $("#fancy_outer").animate(itemOpts, opts.itemArray[opts.itemNum].o.zoomSpeedIn, function() {
                    opts.animating = false;
                    $.fn.fancybox.updateDetails();
                });

            } else {
                $("#fancy_content").append($(val)).show();
                $("#fancy_outer").css(itemOpts).show();
                $.fn.fancybox.updateDetails();
            }
        }
    };

    $.fn.fancybox.updateDetails = function() {
        $("#fancy_bg,#fancy_close").show();

        if (opts.itemArray[opts.itemNum].title !== undefined && opts.itemArray[opts.itemNum].title !== '') {
            $('#fancy_title div').html(opts.itemArray[opts.itemNum].title);
            $('#fancy_title').show();
        }

        if (opts.itemArray[opts.itemNum].o.hideOnContentClick) {
            $("#fancy_content").click($.fn.fancybox.close);
        } else {
            $("#fancy_content").unbind('click');
        }

        if (opts.itemNum != 0) {
            $("#fancy_nav").append('<a id="fancy_left" href="javascript:;"></a>');

            $('#fancy_left').click(function() {
                $.fn.fancybox.changeItem(opts.itemNum - 1); return false;
            });
        }

        if (opts.itemNum != (opts.itemArray.length - 1)) {
            $("#fancy_nav").append('<a id="fancy_right" href="javascript:;"></a>');

            $('#fancy_right').click(function() {
                $.fn.fancybox.changeItem(opts.itemNum + 1); return false;
            });
        }

        $(document).keydown(function(event) {
            if (event.keyCode == 27) {
                $.fn.fancybox.close();

            } else if (event.keyCode == 37 && opts.itemNum != 0) {
                $.fn.fancybox.changeItem(opts.itemNum - 1);

            } else if (event.keyCode == 39 && opts.itemNum != (opts.itemArray.length - 1)) {
                $.fn.fancybox.changeItem(opts.itemNum + 1);
            }
        });
    };

    $.fn.fancybox.preloadNeighborImages = function() {
        if ((opts.itemArray.length - 1) > opts.itemNum) {
            preloadNextImage = new Image();
            preloadNextImage.src = opts.itemArray[opts.itemNum + 1].url;
        }

        if (opts.itemNum > 0) {
            preloadPrevImage = new Image();
            preloadPrevImage.src = opts.itemArray[opts.itemNum - 1].url;
        }
    };

    $.fn.fancybox.close = function() {
        if (opts.animating) return false;

        $(imgPreloader).unbind('load');
        $(document).unbind("keydown");

        $("#fancy_loading,#fancy_title,#fancy_close,#fancy_bg").hide();

        $("#fancy_nav").empty();

        opts.active = false;

        if (opts.itemArray[opts.itemNum].o.zoomSpeedOut > 0) {
            var itemOpts = {
                'top': opts.itemArray[opts.itemNum].orig.pos.top - 18,
                'left': opts.itemArray[opts.itemNum].orig.pos.left - 18,
                'height': opts.itemArray[opts.itemNum].orig.height,
                'width': opts.itemArray[opts.itemNum].orig.width,
                'opacity': 'hide'
            };

            opts.animating = true;

            $("#fancy_outer").animate(itemOpts, opts.itemArray[opts.itemNum].o.zoomSpeedOut, function() {
                $("#fancy_content").hide().empty();
                $("#fancy_overlay,#fancy_bigIframe").remove();
                opts.animating = false;
            });

        } else {
            $("#fancy_outer").hide();
            $("#fancy_content").hide().empty();
            $("#fancy_overlay,#fancy_bigIframe").fadeOut("fast").remove();
        }
    };

    $.fn.fancybox.showLoading = function() {
        clearInterval(loadingTimer);

        var pos = $.fn.fancybox.getViewport();

        $("#fancy_loading").css({ 'left': ((pos[0] - 40) / 2 + pos[2]), 'top': ((pos[1] - 40) / 2 + pos[3]) }).show();
        $("#fancy_loading").bind('click', $.fn.fancybox.close);

        loadingTimer = setInterval($.fn.fancybox.animateLoading, 66);
    };

    $.fn.fancybox.animateLoading = function(el, o) {
        if (!$("#fancy_loading").is(':visible')) {
            clearInterval(loadingTimer);
            return;
        }

        $("#fancy_loading > div").css('top', (loadingFrame * -40) + 'px');

        loadingFrame = (loadingFrame + 1) % 12;
    };

    $.fn.fancybox.init = function() {
        if (!$('#fancy_wrap').length) {
            $('<div id="fancy_wrap"><div id="fancy_loading"><div></div></div><div id="fancy_outer"><div id="fancy_inner"><div id="fancy_nav"></div><div id="fancy_close"></div><div id="fancy_content"></div><div id="fancy_title"></div></div></div></div>').appendTo("body");
            $('<div id="fancy_bg"><div class="fancy_bg fancy_bg_n"></div><div class="fancy_bg fancy_bg_ne"></div><div class="fancy_bg fancy_bg_e"></div><div class="fancy_bg fancy_bg_se"></div><div class="fancy_bg fancy_bg_s"></div><div class="fancy_bg fancy_bg_sw"></div><div class="fancy_bg fancy_bg_w"></div><div class="fancy_bg fancy_bg_nw"></div></div>').prependTo("#fancy_inner");

            $('<table cellspacing="0" cellpadding="0" border="0"><tr><td id="fancy_title_left"></td><td id="fancy_title_main"><div></div></td><td id="fancy_title_right"></td></tr></table>').appendTo('#fancy_title');
        }

        if ($.browser.msie) {
            $("#fancy_inner").prepend('<iframe id="fancy_freeIframe" scrolling="no" frameborder="0"></iframe>');
        }

        if (jQuery.fn.pngFix) $(document).pngFix();

        $("#fancy_close").click($.fn.fancybox.close);
    };

    $.fn.fancybox.getPosition = function(el) {
        var pos = el.offset();

        pos.top += $.fn.fancybox.num(el, 'paddingTop');
        pos.top += $.fn.fancybox.num(el, 'borderTopWidth');

        pos.left += $.fn.fancybox.num(el, 'paddingLeft');
        pos.left += $.fn.fancybox.num(el, 'borderLeftWidth');

        return pos;
    };

    $.fn.fancybox.num = function(el, prop) {
        return parseInt($.curCSS(el.jquery ? el[0] : el, prop, true)) || 0;
    };

    $.fn.fancybox.getPageScroll = function() {
        var xScroll, yScroll;

        if (self.pageYOffset) {
            yScroll = self.pageYOffset;
            xScroll = self.pageXOffset;
        } else if (document.documentElement && document.documentElement.scrollTop) {
            yScroll = document.documentElement.scrollTop;
            xScroll = document.documentElement.scrollLeft;
        } else if (document.body) {
            yScroll = document.body.scrollTop;
            xScroll = document.body.scrollLeft;
        }

        return [xScroll, yScroll];
    };

    $.fn.fancybox.getViewport = function() {
        var scroll = $.fn.fancybox.getPageScroll();

        return [$(window).width(), $(window).height(), scroll[0], scroll[1]];
    };

    $.fn.fancybox.getMaxSize = function(maxWidth, maxHeight, imageWidth, imageHeight) {
        var r = Math.min(Math.min(maxWidth, imageWidth) / imageWidth, Math.min(maxHeight, imageHeight) / imageHeight);

        return [Math.round(r * imageWidth), Math.round(r * imageHeight)];
    };

    $.fn.fancybox.defaults = {
        hideOnContentClick: false,
        zoomSpeedIn: 500,
        zoomSpeedOut: 500,
        frameWidth: 1024,
        frameHeight: 600,
        overlayShow: false,
        overlayOpacity: 0.5,
        itemLoadCallback: null
    };

})(jQuery);



///*---------------------------fade 2----------------------------
$(function() {

    $(".rollover").css({ 'opacity': '0' });

    $('.V2_learnmore_header li, .voip_map1, .voip_map2, .voip_map3 ').hover(
	function() {
		$(this).find('.rollover').stop().fadeTo(500, 1);
	},
	function() {
		$(this).find('.rollover').stop().fadeTo(500, 0);
	}
    )
    
}); 







/* Copyright (c) 2006 Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
*
* $LastChangedDate: 2007-12-20 09:02:08 -0600 (Thu, 20 Dec 2007) $
* $Rev: 4265 $
*
* Version: 3.0
* 
* Requires: $ 1.2.2+
*/

(function($) {

    $.event.special.mousewheel = {
        setup: function() {
            var handler = $.event.special.mousewheel.handler;

            // Fix pageX, pageY, clientX and clientY for mozilla
            if ($.browser.mozilla)
                $(this).bind('mousemove.mousewheel', function(event) {
                    $.data(this, 'mwcursorposdata', {
                        pageX: event.pageX,
                        pageY: event.pageY,
                        clientX: event.clientX,
                        clientY: event.clientY
                    });
                });

            if (this.addEventListener)
                this.addEventListener(($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
            else
                this.onmousewheel = handler;
        },

        teardown: function() {
            var handler = $.event.special.mousewheel.handler;

            $(this).unbind('mousemove.mousewheel');

            if (this.removeEventListener)
                this.removeEventListener(($.browser.mozilla ? 'DOMMouseScroll' : 'mousewheel'), handler, false);
            else
                this.onmousewheel = function() { };

            $.removeData(this, 'mwcursorposdata');
        },

        handler: function(event) {
            var args = Array.prototype.slice.call(arguments, 1);

            event = $.event.fix(event || window.event);
            // Get correct pageX, pageY, clientX and clientY for mozilla
            $.extend(event, $.data(this, 'mwcursorposdata') || {});
            var delta = 0, returnValue = true;

            if (event.wheelDelta) delta = event.wheelDelta / 120;
            if (event.detail) delta = -event.detail / 3;
            //		if ( $.browser.opera  ) delta = -event.wheelDelta;

            event.data = event.data || {};
            event.type = "mousewheel";

            // Add delta to the front of the arguments
            args.unshift(delta);
            // Add event to the front of the arguments
            args.unshift(event);

            return $.event.handle.apply(this, args);
        }
    };

    $.fn.extend({
        mousewheel: function(fn) {
            return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
        },

        unmousewheel: function(fn) {
            return this.unbind("mousewheel", fn);
        }
    });

})(jQuery);












/* Copyright (c) 2009 Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* 
* See http://kelvinluck.com/assets/jquery/jScrollPane/
* $Id: jScrollPane.js 90 2010-01-25 03:52:10Z kelvin.luck $
*/

/**
* Replace the vertical scroll bars on any matched elements with a fancy
* styleable (via CSS) version. With JS disabled the elements will
* gracefully degrade to the browsers own implementation of overflow:auto.
* If the mousewheel plugin has been included on the page then the scrollable areas will also
* respond to the mouse wheel.
*
* @example jQuery(".scroll-pane").jScrollPane();
*
* @name jScrollPane
* @type jQuery
* @param Object	settings	hash with options, described below.
*								scrollbarWidth	-	The width of the generated scrollbar in pixels
*								scrollbarMargin	-	The amount of space to leave on the side of the scrollbar in pixels
*								wheelSpeed		-	The speed the pane will scroll in response to the mouse wheel in pixels
*								showArrows		-	Whether to display arrows for the user to scroll with
*								arrowSize		-	The height of the arrow buttons if showArrows=true
*								animateTo		-	Whether to animate when calling scrollTo and scrollBy
*								dragMinHeight	-	The minimum height to allow the drag bar to be
*								dragMaxHeight	-	The maximum height to allow the drag bar to be
*								animateInterval	-	The interval in milliseconds to update an animating scrollPane (default 100)
*								animateStep		-	The amount to divide the remaining scroll distance by when animating (default 3)
*								maintainPosition-	Whether you want the contents of the scroll pane to maintain it's position when you re-initialise it - so it doesn't scroll as you add more content (default true)
*								tabIndex		-	The tabindex for this jScrollPane to control when it is tabbed to when navigating via keyboard (default 0)
*								enableKeyboardNavigation - Whether to allow keyboard scrolling of this jScrollPane when it is focused (default true)
*								animateToInternalLinks - Whether the move to an internal link (e.g. when it's focused by tabbing or by a hash change in the URL) should be animated or instant (default false)
*								scrollbarOnLeft	-	Display the scrollbar on the left side?  (needs stylesheet changes, see examples.html)
*								reinitialiseOnImageLoad - Whether the jScrollPane should automatically re-initialise itself when any contained images are loaded (default false)
*								topCapHeight	-	The height of the "cap" area between the top of the jScrollPane and the top of the track/ buttons
*								bottomCapHeight	-	The height of the "cap" area between the bottom of the jScrollPane and the bottom of the track/ buttons
*								observeHash		-	Whether jScrollPane should attempt to automagically scroll to the correct place when an anchor inside the scrollpane is linked to (default true)
* @return jQuery
* @cat Plugins/jScrollPane
* @author Kelvin Luck (kelvin AT kelvinluck DOT com || http://www.kelvinluck.com)
*/

(function($) {

    $.jScrollPane = {
        active: []
    };
    $.fn.jScrollPane = function(settings) {
        settings = $.extend({}, $.fn.jScrollPane.defaults, settings);

        var rf = function() { return false; };

        return this.each(
		function() {
		    var $this = $(this);
		    var paneEle = this;
		    var currentScrollPosition = 0;
		    var paneWidth;
		    var paneHeight;
		    var trackHeight;
		    var trackOffset = settings.topCapHeight;
		    var $container;

		    if ($(this).parent().is('.jScrollPaneContainer')) {
		        $container = $(this).parent();
		        currentScrollPosition = settings.maintainPosition ? $this.position().top : 0;
		        var $c = $(this).parent();
		        paneWidth = $c.innerWidth();
		        paneHeight = $c.outerHeight();
		        $('>.jScrollPaneTrack, >.jScrollArrowUp, >.jScrollArrowDown, >.jScrollCap', $c).remove();
		        $this.css({ 'top': 0 });
		    } else {
		        $this.data('originalStyleTag', $this.attr('style'));
		        // Switch the element's overflow to hidden to ensure we get the size of the element without the scrollbars [http://plugins.jquery.com/node/1208]
		        $this.css('overflow', 'hidden');
		        this.originalPadding = $this.css('paddingTop') + ' ' + $this.css('paddingRight') + ' ' + $this.css('paddingBottom') + ' ' + $this.css('paddingLeft');
		        this.originalSidePaddingTotal = (parseInt($this.css('paddingLeft')) || 0) + (parseInt($this.css('paddingRight')) || 0);
		        paneWidth = $this.innerWidth();
		        paneHeight = $this.innerHeight();
		        $container = $('<div></div>')
					.attr({ 'className': 'jScrollPaneContainer' })
					.css(
						{
						    'height': paneHeight + 'px',
						    'width': paneWidth + 'px'
						}
					);
		        if (settings.enableKeyboardNavigation) {
		            $container.attr(
						'tabindex',
						settings.tabIndex
					);
		        }
		        $this.wrap($container);
		        $container = $this.parent();
		        // deal with text size changes (if the jquery.em plugin is included)
		        // and re-initialise the scrollPane so the track maintains the
		        // correct size
		        $(document).bind(
					'emchange',
					function(e, cur, prev) {
					    $this.jScrollPane(settings);
					}
				);

		    }
		    trackHeight = paneHeight;

		    if (settings.reinitialiseOnImageLoad) {
		        // code inspired by jquery.onImagesLoad: http://plugins.jquery.com/project/onImagesLoad
		        // except we re-initialise the scroll pane when each image loads so that the scroll pane is always up to size...
		        // TODO: Do I even need to store it in $.data? Is a local variable here the same since I don't pass the reinitialiseOnImageLoad when I re-initialise?
		        var $imagesToLoad = $.data(paneEle, 'jScrollPaneImagesToLoad') || $('img', $this);
		        var loadedImages = [];

		        if ($imagesToLoad.length) {
		            $imagesToLoad.each(function(i, val) {
		                $(this).bind('load readystatechange', function() {
		                    if ($.inArray(i, loadedImages) == -1) { //don't double count images
		                        loadedImages.push(val); //keep a record of images we've seen
		                        $imagesToLoad = $.grep($imagesToLoad, function(n, i) {
		                            return n != val;
		                        });
		                        $.data(paneEle, 'jScrollPaneImagesToLoad', $imagesToLoad);
		                        var s2 = $.extend(settings, { reinitialiseOnImageLoad: false });
		                        $this.jScrollPane(s2); // re-initialise
		                    }
		                }).each(function(i, val) {
		                    if (this.complete || this.complete === undefined) {
		                        //needed for potential cached images
		                        this.src = this.src;
		                    }
		                });
		            });
		        };
		    }

		    var p = this.originalSidePaddingTotal;
		    var realPaneWidth = paneWidth - settings.scrollbarWidth - settings.scrollbarMargin - p;

		    var cssToApply = {
		        'height': 'auto',
		        'width': realPaneWidth + 'px'
		    }

		    if (settings.scrollbarOnLeft) {
		        cssToApply.paddingLeft = settings.scrollbarMargin + settings.scrollbarWidth + 'px';
		    } else {
		        cssToApply.paddingRight = settings.scrollbarMargin + 'px';
		    }

		    $this.css(cssToApply);

		    var contentHeight = $this.outerHeight();
		    var percentInView = paneHeight / contentHeight;

		    var isScrollable = percentInView < .99;
		    $container[isScrollable ? 'addClass' : 'removeClass']('jScrollPaneScrollable');

		    if (isScrollable) {
		        $container.append(
					$('<div></div>').addClass('jScrollCap jScrollCapTop').css({ height: settings.topCapHeight }),
					$('<div></div>').attr({ 'className': 'jScrollPaneTrack' }).css({ 'width': settings.scrollbarWidth + 'px' }).append(
						$('<div></div>').attr({ 'className': 'jScrollPaneDrag' }).css({ 'width': settings.scrollbarWidth + 'px' }).append(
							$('<div></div>').attr({ 'className': 'jScrollPaneDragTop' }).css({ 'width': settings.scrollbarWidth + 'px' }),
							$('<div></div>').attr({ 'className': 'jScrollPaneDragBottom' }).css({ 'width': settings.scrollbarWidth + 'px' })
						)
					),
					$('<div></div>').addClass('jScrollCap jScrollCapBottom').css({ height: settings.bottomCapHeight })
				);

		        var $track = $('>.jScrollPaneTrack', $container);
		        var $drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);


		        var currentArrowDirection;
		        var currentArrowTimerArr = []; // Array is used to store timers since they can stack up when dealing with keyboard events. This ensures all timers are cleaned up in the end, preventing an acceleration bug.
		        var currentArrowInc;
		        var whileArrowButtonDown = function() {
		            if (currentArrowInc > 4 || currentArrowInc % 4 == 0) {
		                positionDrag(dragPosition + currentArrowDirection * mouseWheelMultiplier);
		            }
		            currentArrowInc++;
		        };

		        if (settings.enableKeyboardNavigation) {
		            $container.bind(
						'keydown.jscrollpane',
						function(e) {
						    switch (e.keyCode) {
						        case 38: //up
						            currentArrowDirection = -1;
						            currentArrowInc = 0;
						            whileArrowButtonDown();
						            currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100);
						            return false;
						        case 40: //down
						            currentArrowDirection = 1;
						            currentArrowInc = 0;
						            whileArrowButtonDown();
						            currentArrowTimerArr[currentArrowTimerArr.length] = setInterval(whileArrowButtonDown, 100);
						            return false;
						        case 33: // page up
						        case 34: // page down
						            // TODO
						            return false;
						        default:
						    }
						}
					).bind(
						'keyup.jscrollpane',
						function(e) {
						    if (e.keyCode == 38 || e.keyCode == 40) {
						        for (var i = 0; i < currentArrowTimerArr.length; i++) {
						            clearInterval(currentArrowTimerArr[i]);
						        }
						        return false;
						    }
						}
					);
		        }

		        if (settings.showArrows) {

		            var currentArrowButton;
		            var currentArrowInterval;

		            var onArrowMouseUp = function(event) {
		                $('html').unbind('mouseup', onArrowMouseUp);
		                currentArrowButton.removeClass('jScrollActiveArrowButton');
		                clearInterval(currentArrowInterval);
		            };
		            var onArrowMouseDown = function() {
		                $('html').bind('mouseup', onArrowMouseUp);
		                currentArrowButton.addClass('jScrollActiveArrowButton');
		                currentArrowInc = 0;
		                whileArrowButtonDown();
		                currentArrowInterval = setInterval(whileArrowButtonDown, 100);
		            };
		            $container
						.append(
							$('<a></a>')
								.attr(
									{
									    'href': 'javascript:;',
									    'className': 'jScrollArrowUp',
									    'tabindex': -1
									}
								)
								.css(
									{
									    'width': settings.scrollbarWidth + 'px',
									    'top': settings.topCapHeight + 'px'
									}
								)
								.html('Scroll up')
								.bind('mousedown', function() {
								    currentArrowButton = $(this);
								    currentArrowDirection = -1;
								    onArrowMouseDown();
								    this.blur();
								    return false;
								})
								.bind('click', rf),
							$('<a></a>')
								.attr(
									{
									    'href': 'javascript:;',
									    'className': 'jScrollArrowDown',
									    'tabindex': -1
									}
								)
								.css(
									{
									    'width': settings.scrollbarWidth + 'px',
									    'bottom': settings.bottomCapHeight + 'px'
									}
								)
								.html('Scroll down')
								.bind('mousedown', function() {
								    currentArrowButton = $(this);
								    currentArrowDirection = 1;
								    onArrowMouseDown();
								    this.blur();
								    return false;
								})
								.bind('click', rf)
						);
		            var $upArrow = $('>.jScrollArrowUp', $container);
		            var $downArrow = $('>.jScrollArrowDown', $container);
		        }

		        if (settings.arrowSize) {
		            trackHeight = paneHeight - settings.arrowSize - settings.arrowSize;
		            trackOffset += settings.arrowSize;
		        } else if ($upArrow) {
		            var topArrowHeight = $upArrow.height();
		            settings.arrowSize = topArrowHeight;
		            trackHeight = paneHeight - topArrowHeight - $downArrow.height();
		            trackOffset += topArrowHeight;
		        }
		        trackHeight -= settings.topCapHeight + settings.bottomCapHeight;
		        $track.css({ 'height': trackHeight + 'px', top: trackOffset + 'px' })

		        var $pane = $(this).css({ 'position': 'absolute', 'overflow': 'visible' });

		        var currentOffset;
		        var maxY;
		        var mouseWheelMultiplier;
		        // store this in a seperate variable so we can keep track more accurately than just updating the css property..
		        var dragPosition = 0;
		        var dragMiddle = percentInView * paneHeight / 2;

		        // pos function borrowed from tooltip plugin and adapted...
		        var getPos = function(event, c) {
		            var p = c == 'X' ? 'Left' : 'Top';
		            return event['page' + c] || (event['client' + c] + (document.documentElement['scroll' + p] || document.body['scroll' + p])) || 0;
		        };

		        var ignoreNativeDrag = function() { return false; };

		        var initDrag = function() {
		            ceaseAnimation();
		            currentOffset = $drag.offset(false);
		            currentOffset.top -= dragPosition;
		            maxY = trackHeight - $drag[0].offsetHeight;
		            mouseWheelMultiplier = 2 * settings.wheelSpeed * maxY / contentHeight;
		        };

		        var onStartDrag = function(event) {
		            initDrag();
		            dragMiddle = getPos(event, 'Y') - dragPosition - currentOffset.top;
		            $('html').bind('mouseup', onStopDrag).bind('mousemove', updateScroll);
		            if ($.browser.msie) {
		                $('html').bind('dragstart', ignoreNativeDrag).bind('selectstart', ignoreNativeDrag);
		            }
		            return false;
		        };
		        var onStopDrag = function() {
		            $('html').unbind('mouseup', onStopDrag).unbind('mousemove', updateScroll);
		            dragMiddle = percentInView * paneHeight / 2;
		            if ($.browser.msie) {
		                $('html').unbind('dragstart', ignoreNativeDrag).unbind('selectstart', ignoreNativeDrag);
		            }
		        };
		        var positionDrag = function(destY) {
		            $container.scrollTop(0);
		            destY = destY < 0 ? 0 : (destY > maxY ? maxY : destY);
		            dragPosition = destY;
		            $drag.css({ 'top': destY + 'px' });
		            var p = destY / maxY;
		            $this.data('jScrollPanePosition', (paneHeight - contentHeight) * -p);
		            $pane.css({ 'top': ((paneHeight - contentHeight) * p) + 'px' });
		            $this.trigger('scroll');
		            if (settings.showArrows) {
		                $upArrow[destY == 0 ? 'addClass' : 'removeClass']('disabled');
		                $downArrow[destY == maxY ? 'addClass' : 'removeClass']('disabled');
		            }
		        };
		        var updateScroll = function(e) {
		            positionDrag(getPos(e, 'Y') - currentOffset.top - dragMiddle);
		        };

		        var dragH = Math.max(Math.min(percentInView * (paneHeight - settings.arrowSize * 2), settings.dragMaxHeight), settings.dragMinHeight);

		        $drag.css(
					{ 'height': dragH + 'px' }
				).bind('mousedown', onStartDrag);

		        var trackScrollInterval;
		        var trackScrollInc;
		        var trackScrollMousePos;
		        var doTrackScroll = function() {
		            if (trackScrollInc > 8 || trackScrollInc % 4 == 0) {
		                positionDrag((dragPosition - ((dragPosition - trackScrollMousePos) / 2)));
		            }
		            trackScrollInc++;
		        };
		        var onStopTrackClick = function() {
		            clearInterval(trackScrollInterval);
		            $('html').unbind('mouseup', onStopTrackClick).unbind('mousemove', onTrackMouseMove);
		        };
		        var onTrackMouseMove = function(event) {
		            trackScrollMousePos = getPos(event, 'Y') - currentOffset.top - dragMiddle;
		        };
		        var onTrackClick = function(event) {
		            initDrag();
		            onTrackMouseMove(event);
		            trackScrollInc = 0;
		            $('html').bind('mouseup', onStopTrackClick).bind('mousemove', onTrackMouseMove);
		            trackScrollInterval = setInterval(doTrackScroll, 100);
		            doTrackScroll();
		            return false;
		        };

		        $track.bind('mousedown', onTrackClick);

		        $container.bind(
					'mousewheel',
					function(event, delta) {
					    delta = delta || (event.wheelDelta ? event.wheelDelta / 120 : (event.detail) ?
-event.detail / 3 : 0);
					    initDrag();
					    ceaseAnimation();
					    var d = dragPosition;
					    positionDrag(dragPosition - delta * mouseWheelMultiplier);
					    var dragOccured = d != dragPosition;
					    return !dragOccured;
					}
				);

		        var _animateToPosition;
		        var _animateToInterval;
		        function animateToPosition() {
		            var diff = (_animateToPosition - dragPosition) / settings.animateStep;
		            if (diff > 1 || diff < -1) {
		                positionDrag(dragPosition + diff);
		            } else {
		                positionDrag(_animateToPosition);
		                ceaseAnimation();
		            }
		        }
		        var ceaseAnimation = function() {
		            if (_animateToInterval) {
		                clearInterval(_animateToInterval);
		                delete _animateToPosition;
		            }
		        };
		        var scrollTo = function(pos, preventAni) {
		            if (typeof pos == "string") {
		                // Legal hash values aren't necessarily legal jQuery selectors so we need to catch any
		                // errors from the lookup...
		                try {
		                    $e = $(pos, $this);
		                } catch (err) {
		                    return;
		                }
		                if (!$e.length) return;
		                pos = $e.offset().top - $this.offset().top;
		            }
		            ceaseAnimation();
		            var maxScroll = contentHeight - paneHeight;
		            pos = pos > maxScroll ? maxScroll : pos;
		            $this.data('jScrollPaneMaxScroll', maxScroll);
		            var destDragPosition = pos / maxScroll * maxY;
		            if (preventAni || !settings.animateTo) {
		                positionDrag(destDragPosition);
		            } else {
		                $container.scrollTop(0);
		                _animateToPosition = destDragPosition;
		                _animateToInterval = setInterval(animateToPosition, settings.animateInterval);
		            }
		        };
		        $this[0].scrollTo = scrollTo;

		        $this[0].scrollBy = function(delta) {
		            var currentPos = -parseInt($pane.css('top')) || 0;
		            scrollTo(currentPos + delta);
		        };

		        initDrag();

		        scrollTo(-currentScrollPosition, true);

		        // Deal with it when the user tabs to a link or form element within this scrollpane
		        $('*', this).bind(
					'focus',
					function(event) {
					    var $e = $(this);

					    // loop through parents adding the offset top of any elements that are relatively positioned between
					    // the focused element and the jScrollPaneContainer so we can get the true distance from the top
					    // of the focused element to the top of the scrollpane...
					    var eleTop = 0;

					    while ($e[0] != $this[0]) {
					        eleTop += $e.position().top;
					        $e = $e.offsetParent();
					    }

					    var viewportTop = -parseInt($pane.css('top')) || 0;
					    var maxVisibleEleTop = viewportTop + paneHeight;
					    var eleInView = eleTop > viewportTop && eleTop < maxVisibleEleTop;
					    if (!eleInView) {
					        var destPos = eleTop - settings.scrollbarMargin;
					        if (eleTop > viewportTop) { // element is below viewport - scroll so it is at bottom.
					            destPos += $(this).height() + 15 + settings.scrollbarMargin - paneHeight;
					        }
					        scrollTo(destPos);
					    }
					}
				)


		        if (settings.observeHash) {
		            if (location.hash && location.hash.length > 1) {
		                setTimeout(function() {
		                    scrollTo(location.hash);
		                }, $.browser.safari ? 100 : 0);
		            }

		            // use event delegation to listen for all clicks on links and hijack them if they are links to
		            // anchors within our content...
		            $(document).bind('click', function(e) {
		                $target = $(e.target);
		                if ($target.is('a')) {
		                    var h = $target.attr('href');
		                    if (h && h.substr(0, 1) == '#' && h.length > 1) {
		                        setTimeout(function() {
		                            scrollTo(h, !settings.animateToInternalLinks);
		                        }, $.browser.safari ? 100 : 0);
		                    }
		                }
		            });
		        }

		        // Deal with dragging and selecting text to make the scrollpane scroll...
		        function onSelectScrollMouseDown(e) {
		            $(document).bind('mousemove.jScrollPaneDragging', onTextSelectionScrollMouseMove);
		            $(document).bind('mouseup.jScrollPaneDragging', onSelectScrollMouseUp);

		        }

		        var textDragDistanceAway;
		        var textSelectionInterval;

		        function onTextSelectionInterval() {
		            direction = textDragDistanceAway < 0 ? -1 : 1;
		            $this[0].scrollBy(textDragDistanceAway / 2);
		        }

		        function clearTextSelectionInterval() {
		            if (textSelectionInterval) {
		                clearInterval(textSelectionInterval);
		                textSelectionInterval = undefined;
		            }
		        }

		        function onTextSelectionScrollMouseMove(e) {
		            var offset = $this.parent().offset().top;
		            var maxOffset = offset + paneHeight;
		            var mouseOffset = getPos(e, 'Y');
		            textDragDistanceAway = mouseOffset < offset ? mouseOffset - offset : (mouseOffset > maxOffset ? mouseOffset - maxOffset : 0);
		            if (textDragDistanceAway == 0) {
		                clearTextSelectionInterval();
		            } else {
		                if (!textSelectionInterval) {
		                    textSelectionInterval = setInterval(onTextSelectionInterval, 100);
		                }
		            }
		        }

		        function onSelectScrollMouseUp(e) {
		            $(document)
					  .unbind('mousemove.jScrollPaneDragging')
					  .unbind('mouseup.jScrollPaneDragging');
		            clearTextSelectionInterval();
		        }

		        $container.bind('mousedown.jScrollPane', onSelectScrollMouseDown);


		        $.jScrollPane.active.push($this[0]);

		    } else {
		        $this.css(
					{
					    'height': paneHeight + 'px',
					    'width': paneWidth - this.originalSidePaddingTotal + 'px',
					    'padding': this.originalPadding
					}
				);
		        $this[0].scrollTo = $this[0].scrollBy = function() { };
		        // clean up listeners
		        $this.parent().unbind('mousewheel').unbind('mousedown.jScrollPane').unbind('keydown.jscrollpane').unbind('keyup.jscrollpane');
		    }

		}
	)
    };

    $.fn.jScrollPaneRemove = function() {
        $(this).each(function() {
            $this = $(this);
            var $c = $this.parent();
            if ($c.is('.jScrollPaneContainer')) {
                $this.css(
				{
				    'top': '',
				    'height': '',
				    'width': '',
				    'padding': '',
				    'overflow': '',
				    'position': ''
				}
			);
                $this.attr('style', $this.data('originalStyleTag'));
                $c.after($this).remove();
            }
        });
    }

    $.fn.jScrollPane.defaults = {
        scrollbarWidth: 21,
        scrollbarMargin: 5,
        wheelSpeed: 18,
        showArrows: true,
        arrowSize: 0,
        animateTo: false,
        dragMinHeight: 1,
        dragMaxHeight: 99999,
        animateInterval: 100,
        animateStep: 3,
        maintainPosition: true,
        scrollbarOnLeft: true,
        reinitialiseOnImageLoad: false,
        tabIndex: 0,
        enableKeyboardNavigation: true,
        animateToInternalLinks: false,
        topCapHeight: 0,
        bottomCapHeight: 0,
        observeHash: true
    };

    // clean up the scrollTo expandos
    $(window)
	.bind('unload', function() {
	    var els = $.jScrollPane.active;
	    for (var i = 0; i < els.length; i++) {
	        els[i].scrollTo = els[i].scrollBy = null;
	    }
	}
);

})(jQuery);



$(function() {

    ////rotation speed and timer
    // var speed = 10000;
    // var run = setInterval('rotate()', speed);

    //grab the width and calculate left value
    var item_width = $('#slides li').outerWidth();
    var left_value = item_width * (-1);

    //move the last item before first item, just in case user click prev button
    $('#slides li:first').before($('#slides li:last'));

    //set the default item to the correct position 
    $('#slides ul').css({ 'left': left_value });

    //if user clicked on prev button
    $('#prev').click(function() {

        //get the right position            
        var left_indent = parseInt($('#slides ul').css('left')) + item_width;

        //slide the item            
        $('#slides ul:not(:animated)').animate({ 'left': left_indent }, 500, function() {

            //move the last item and put it as first item            	
            $('#slides li:first').before($('#slides li:last'));

            //set the default item to correct position
            $('#slides ul').css({ 'left': left_value });

        });

        //cancel the link behavior            
        return false;

    });


    //if user clicked on next button
    $('#next').click(function() {

        //get the right position
        var left_indent = parseInt($('#slides ul').css('left')) - item_width;

        //slide the item
        $('#slides ul:not(:animated)').animate({ 'left': left_indent }, 500, function() {

            //move the first item and put it as last item
            $('#slides li:last').after($('#slides li:first'));

            //set the default item to correct position
            $('#slides ul').css({ 'left': left_value });

        });

        //cancel the link behavior
        return false;

    });

    //if mouse hover, pause the auto rotation, otherwise rotate it
    //    $('#slides').hover(

    //		function() {
    //		    clearInterval(run);
    //		},
    //		function() {
    //		    run = setInterval('rotate()', speed);
    //		}
    //	);

});

//a simple function to click next link
//a timer will call this function, and the rotation will begin :)  
//function rotate() {
//    $('#next').click();
//}
$(function() {
    $('.btn_contactus a').click(function() {
    $.scrollTo('.formwrap', 1000);
    return false;
    });
   
});




/**
* jQuery.ScrollTo
* Copyright (c) 2007-2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Dual licensed under MIT and GPL.
* Date: 9/11/2008
*
* @projectDescription Easy element scrolling using jQuery.
* http://flesler.blogspot.com/2007/10/jqueryscrollto.html
* Tested with jQuery 1.2.6. On FF 2/3, IE 6/7, Opera 9.2/5 and Safari 3. on Windows.
*
* @author Ariel Flesler
* @version 1.4
*
* @id jQuery.scrollTo
* @id jQuery.fn.scrollTo
* @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
*	  The different options for target are:
*		- A number position (will be applied to all axes).
*		- A string position ('44', '100px', '+=90', etc ) will be applied to all axes
*		- A jQuery/DOM element ( logically, child of the element to scroll )
*		- A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
*		- A hash { top:x, left:y }, x and y can be any kind of number/string like above.
* @param {Number} duration The OVERALL length of the animation, this argument can be the settings object instead.
* @param {Object,Function} settings Optional set of settings or the onAfter callback.
*	 @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
*	 @option {Number} duration The OVERALL length of the animation.
*	 @option {String} easing The easing method for the animation.
*	 @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
*	 @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
*	 @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
*	 @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
*	 @option {Function} onAfter Function to be called after the scrolling ends. 
*	 @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
* @return {jQuery} Returns the same jQuery object, for chaining.
*
* @desc Scroll to a fixed position
* @example $('div').scrollTo( 340 );
*
* @desc Scroll relatively to the actual position
* @example $('div').scrollTo( '+=340px', { axis:'y' } );
*
* @dec Scroll using a selector (relative to the scrolled element)
* @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
*
* @ Scroll to a DOM element (same for jQuery object)
* @example var second_child = document.getElementById('container').firstChild.nextSibling;
*			$('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
*				alert('scrolled!!');																   
*			}});
*
* @desc Scroll on both axes, to different values
* @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
*/
; (function($) {

    var $scrollTo = $.scrollTo = function(target, duration, settings) {
        $(window).scrollTo(target, duration, settings);
    };

    $scrollTo.defaults = {
        axis: 'y',
        duration: 1
    };

    // Returns the element that needs to be animated to scroll the window.
    // Kept for backwards compatibility (specially for localScroll & serialScroll)
    $scrollTo.window = function(scope) {
        return $(window).scrollable();
    };

    // Hack, hack, hack... stay away!
    // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
    $.fn.scrollable = function() {
        return this.map(function() {
            // Just store it, we might need it
            var win = this.parentWindow || this.defaultView,
            // If it's a document, get its iframe or the window if it's THE document
				elem = this.nodeName == '#document' ? win.frameElement || win : this,
            // Get the corresponding document
				doc = elem.contentDocument || (elem.contentWindow || elem).document,
				isWin = elem.setInterval;

            return elem.nodeName == 'IFRAME' || isWin && $.browser.safari ? doc.body
				: isWin ? doc.documentElement
				: this;
        });
    };

    $.fn.scrollTo = function(target, duration, settings) {
        if (typeof duration == 'object') {
            settings = duration;
            duration = 0;
        }
        if (typeof settings == 'function')
            settings = { onAfter: settings };

        settings = $.extend({}, $scrollTo.defaults, settings);
        // Speed is still recognized for backwards compatibility
        duration = duration || settings.speed || settings.duration;
        // Make sure the settings are given right
        settings.queue = settings.queue && settings.axis.length > 1;

        if (settings.queue)
        // Let's keep the overall duration
            duration /= 2;
        settings.offset = both(settings.offset);
        settings.over = both(settings.over);

        return this.scrollable().each(function() {
            var elem = this,
				$elem = $(elem),
				targ = target, toff, attr = {},
				win = $elem.is('html,body');

            switch (typeof targ) {
                // A number will pass the regex 
                case 'number':
                case 'string':
                    if (/^([+-]=)?\d+(px)?$/.test(targ)) {
                        targ = both(targ);
                        // We are done
                        break;
                    }
                    // Relative selector, no break!
                    targ = $(targ, this);
                case 'object':
                    // DOMElement / jQuery
                    if (targ.is || targ.style)
                    // Get the real position of the target 
                        toff = (targ = $(targ)).offset();
            }
            $.each(settings.axis.split(''), function(i, axis) {
                var Pos = axis == 'x' ? 'Left' : 'Top',
					pos = Pos.toLowerCase(),
					key = 'scroll' + Pos,
					old = elem[key],
					Dim = axis == 'x' ? 'Width' : 'Height',
					dim = Dim.toLowerCase();

                if (toff) {// jQuery / DOMElement
                    attr[key] = toff[pos] + (win ? 0 : old - $elem.offset()[pos]);

                    // If it's a dom element, reduce the margin
                    if (settings.margin) {
                        attr[key] -= parseInt(targ.css('margin' + Pos)) || 0;
                        attr[key] -= parseInt(targ.css('border' + Pos + 'Width')) || 0;
                    }

                    attr[key] += settings.offset[pos] || 0;

                    if (settings.over[pos])
                    // Scroll to a fraction of its width/height
                        attr[key] += targ[dim]() * settings.over[pos];
                } else
                    attr[key] = targ[pos];

                // Number or 'number'
                if (/^\d+$/.test(attr[key]))
                // Check the limits
                    attr[key] = attr[key] <= 0 ? 0 : Math.min(attr[key], max(Dim));

                // Queueing axes
                if (!i && settings.queue) {
                    // Don't waste time animating, if there's no need.
                    if (old != attr[key])
                    // Intermediate animation
                        animate(settings.onAfterFirst);
                    // Don't animate this axis again in the next iteration.
                    delete attr[key];
                }
            });
            animate(settings.onAfter);

            function animate(callback) {
                $elem.animate(attr, duration, settings.easing, callback && function() {
                    callback.call(this, target, settings);
                });
            };
            function max(Dim) {
                var attr = 'scroll' + Dim,
					doc = elem.ownerDocument;

                return win
						? Math.max(doc.documentElement[attr], doc.body[attr])
						: elem[attr];
            };
        }).end();
    };

    function both(val) {
        return typeof val == 'object' ? val : { top: val, left: val };
    };

})(jQuery);

//------------------- OPEN NEW WINDOW -------------------//
var newWindow = null;

function closeWin() {
    if (newWindow != null) {
        if (!newWindow.closed)
            newWindow.close();
    }
}

function popUpWin(url, type, strWidth, strHeight) {
    closeWin();
    if (type == "fullScreen") {
        strWidth = screen.availWidth - 10;
        strHeight = screen.availHeight - 160;
    }
    var tools = "";
    if (type == "standard" || type == "fullScreen") tools = "resizable=no,toolbar=no,location=no,scroll=yes,scrollbars=yes,menubar=no,width=" + strWidth + ",height=" + strHeight + ",top=0,left=0";
    if (type == "console") tools = "resizable=no,toolbar=no,location=no,directories=no,status=no,scroll=no,scrollbars=no,menubar=no,width=" + strWidth + ",height=" + strHeight + ",left=0,top=0";
    newWindow = window.open(url, 'newWin', tools);
    newWindow.focus();
}
