﻿function AreaConfig(id, enableRequestUpdate) {
    this.Id = id; // Id of the element container.
    this.EnableRequestUpdate = enableRequestUpdate; // Enable updates from url parameters.

    this.Element = undefined; // Set automatically
    this.IsValid = undefined; // Set automatically
    this.InitConfig = undefined; // Set automatically

    this.Partner = undefined; // If not set Xpriser.BaseConfig.Partner is used
    this.Site = undefined; // If not set Xpriser.BaseConfig.Site is used
    this.CPath = undefined; // If not set Xpriser.BaseConfig.CPath is used
    this.Query = undefined; // If not set Xpriser.BaseConfig.Query is used
    this.QueryParameters = undefined; // If not set Xpriser.BaseConfig.QueryParameters is used
    this.ProductId = undefined; // If not set Xpriser.BaseConfig.ProductId is used
    this.Filter = undefined; // If not set Xpriser.BaseConfig.Filter is used
    this.Count = undefined; // If not set Xpriser.BaseConfig.Count is used
    this.Offset = undefined; // If not set Xpriser.BaseConfig.Offset is used
    this.Get = undefined; // If not set Xpriser.BaseConfig.Get is used
    this.Format = undefined; // If not set Xpriser.BaseConfig.Format is used
    this.ReturnUrl = undefined; // If not set Xpriser.BaseConfig.ReturnUrl is used
    this.ReturnUrlType = undefined; // Self, XPriser, Vendor - If not set Xpriser.BaseConfig.ReturnUrlType is used

    this.LoaderClassName = undefined; // ClassName is added to element while loading.

    this.OnUpdate = function(areaConfig) { };  // Called before updating a area.
    this.OnUpdated = function(areaConfig) { };  // Called after updating a area.
} // AreaConfig

/*
Xpriser.AreaArray=[]
Xpriser.RequestUrl=undefined
Xpriser.IntervalDelay=100 // Check hash update's delay
Xpriser.Version: 1
Xpriser.ReleasedDate=new Date()

Xpriser.UpdateCheck() // Internal method. Use start and stop methods - Check url changes and updates AreaConfig with EnableRequestUpdate=true
Xpriser.StartUpdateCheck() // Start checking url changes.
Xpriser.StopUpdateCheck() // Stop checking url changes.

Xpriser.UpdateArea(AreaConfig)
Xpriser.UpdateAreaConfig(AreaConfig)

Xpriser.Modules={}
Xpriser.InitModule(AreaConfig)

Xpriser.BaseConfig.Partner=undefined
Xpriser.BaseConfig.CPath=undefined
Xpriser.BaseConfig.Site=undefined
Xpriser.BaseConfig.Query=undefined
Xpriser.BaseConfig.ProductId=undefined
Xpriser.BaseConfig.Filter=undefined
Xpriser.BaseConfig.Count=undefined
Xpriser.BaseConfig.Offset=undefined
Xpriser.BaseConfig.Get=undefined
Xpriser.BaseConfig.Format="v1"
Xpriser.BaseConfig.ReturnUrl=undefined
Xpriser.BaseConfig.LoaderClassName="loader"

Xpriser.Image.Init(AreaConfig)
Xpriser.Image.MouseOver(event)
Xpriser.Image.MouseOut(event)

Xpriser.Search.Init(AreaConfig)
Xpriser.Search.Query(string)
Xpriser.Search.ButtonClick(event)
Xpriser.Search.InputKeypress(event)
Xpriser.Search.InputFocus()
Xpriser.Search.InputElement
Xpriser.Search.ButtonElement
*/

jQuery.noConflict();

var Xpriser = (function ($) {
    var RequestParameters = {};
    var AreaConfigPropertyMapping = { "Partner": "psid", "Site": "site", "CPath": "cpath", "Query": "q", "QueryParameters": "qp", "ProductId": "pid", "Filter": "f", "Count": "count", "Offset": "offset", "Get": "get", "Format": "format", "ReturnUrl": "url", "ReturnUrlType": "returnurltype" };
    var Xpriser = {
        AreaArray: [],
        BaseConfig: {
            Partner: undefined,
            CPath: undefined,
            Site: undefined,
            Query: undefined,
            QueryParameters: undefined,
            ProductId: undefined,
            Filter: undefined,
            Count: undefined,
            Offset: undefined,
            Get: undefined,
            Format: "v1",
            LoaderClassName: "loader",
            ReturnUrl: undefined, // Future functionality
            ReturnUrlType: undefined // Self, XPriser, Vendor
        },

        IntervalDelay: 100, // Check hash update's delay
        IntervalTimer: undefined, // Internal variable
        Version: 1, // Information variable
        ReleasedDate: new Date("2012-02-21T16:00:00"), // Information variable
        DebugElement: undefined, // Internal variable
        Modules: {},
        InitModules: function (areaConfig) {
            for (var key in Xpriser.Modules)
                if (typeof (Xpriser.Modules[key].Init) == 'function')
                    Xpriser.Modules[key].Init(areaConfig);
        },
        InitArea: function (areaConfig) {
            if (typeof (areaConfig) == 'object') {
                $().ready(
                    function () {
                        var id = areaConfig.Id;
                        if (id == undefined) areaConfig.Id = id = areaConfig.ElementId;
                        var element = $('#' + id);
                        if (element != null && element.length > 0) {
                            areaConfig.IsValid = true;
                            areaConfig.Element = element;

                            Xpriser.UpdateAreaConfig(areaConfig);

                            Xpriser.AreaArray[Xpriser.AreaArray.length] = areaConfig;
                            Xpriser.UpdateArea(areaConfig);
                            if (areaConfig.EnableRequestUpdate) Xpriser.StartUpdateCheck();
                        }
                    }
                );
            }
        },
        UpdateArea: function (areaConfig) {
            if (!Xpriser.RequestUrl) return;
            if (areaConfig.LoaderClassName) areaConfig.Element.addClass(areaConfig.LoaderClassName);
            if (typeof (areaConfig.OnUpdate) == 'function') areaConfig.OnUpdate(areaConfig);

            var reqData = {}; //  token: (new Date()).valueOf()
            for (var name in AreaConfigPropertyMapping)
                if (areaConfig[name] !== undefined)
                    reqData[AreaConfigPropertyMapping[name]] = areaConfig[name];
            $.ajax(
                {
                    type: "GET",
                    cache: true,
                    url: Xpriser.RequestUrl,
                    contentType: "application/json",
                    data: reqData,
                    dataType: "jsonp",
                    jsonpCallback: "jpcb",
                    success: function (data) {
                        if (data.d)
                            areaConfig.Element.html(data.d);
                        else if (data.Message && data.ExceptionType && data.StackTrace)
                            areaConfig.Element.html("<div>" + data.Message + "</div><div>" + data.ExceptionType + "</div><div><pre>" + data.StackTrace + "</pre></div>");
                        if (typeof (areaConfig.OnUpdated) == 'function') areaConfig.OnUpdated(areaConfig);
                        Xpriser.InitModules(areaConfig);
                        if (areaConfig.LoaderClassName) areaConfig.Element.removeClass(areaConfig.LoaderClassName);
                    },
                    error: function (data, msg) {
                        alert(msg);
                        var response = JSON.parse(data.responseText);
                        alert("Error:\n" + response);
                    }
                }
            );
        },
        UpdateAreaConfig: function (areaConfig) {
            if (typeof (areaConfig.InitConfig) == 'object') {
                for (var name in AreaConfigPropertyMapping)
                    areaConfig[name] = areaConfig.InitConfig[name];
            } else {
                areaConfig.InitConfig = {}
                for (var name in AreaConfigPropertyMapping)
                    areaConfig.InitConfig[name] = areaConfig[name];
            }

            if (areaConfig.EnableRequestUpdate) {
                for (var name in AreaConfigPropertyMapping) {
                    var value = $.getHashVar(AreaConfigPropertyMapping[name]);
                    if (typeof (value) != 'undefined') areaConfig[name] = value;
                }
            }

            for (var name in AreaConfigPropertyMapping)
                if (typeof (areaConfig[name]) == 'undefined')
                    areaConfig[name] = Xpriser.BaseConfig[name];
        },
        UpdateCheck: function () {
            if (window.location.hash != Xpriser.lastLocationHash) {
                if (typeof (Xpriser.lastLocationHash) == 'undefined') {
                    Xpriser.lastLocationHash = window.location.hash;
                } else {
                    Xpriser.lastLocationHash = window.location.hash;
                    var length = Xpriser.AreaArray.length;
                    for (var i = 0; i < length; i++) {
                        var areaConfig = Xpriser.AreaArray[i];
                        if (areaConfig.EnableRequestUpdate) {
                            Xpriser.UpdateAreaConfig(areaConfig);
                            Xpriser.UpdateArea(areaConfig);
                        }
                    }
                }
            }
        },
        StartUpdateCheck: function () {
            if (!Xpriser.IntervalTimer)
                Xpriser.IntervalTimer = window.setInterval(Xpriser.UpdateCheck, Xpriser.IntervalDelay);
        },
        StopUpdateCheck: function () {
            if (Xpriser.IntervalTimer) {
                window.clearInterval(Xpriser.IntervalDelay);
                Xpriser.IntervalTimer = undefined;
            }
        },
        OnLoad: function () {
            Xpriser.SetDebugMessage("Version: " + Xpriser.Version);
            Xpriser.SetDebugMessage("Released date: " + Xpriser.ReleasedDate);
            Xpriser.SetDebugMessage("jQuery: " + $().jquery);

            if (typeof (XpriserLoad) == "function") XpriserLoad();
        },
        SetDebugMessage: function (message) {
            if (Xpriser.DebugElement === undefined) {
                Xpriser.DebugElement = null;
                var debugElement = $("#debug");
                if (debugElement && debugElement.length > 0) {
                    debugElement.css("white-space", "pre");
                    Xpriser.DebugElement = debugElement;
                }
            }
            if (Xpriser.DebugElement !== null) {
                var text = Xpriser.DebugElement.text();
                if (text) text += "\r\n";
                text += message;
                Xpriser.DebugElement.text(text);
            }
        }
    };
    $.extend({
        getUrlVars: function () {
            var vars = [], hash;
            var index = window.location.href.indexOf('?');
            if (index > -1) {
                var hashes = window.location.href.slice(index + 1).split('&');
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = hash[1];
                }
            }
            return vars;
        },
        getUrlVar: function (name) { return $.getUrlVars()[name]; },

        getHashVars: function () {
            var vars = [], hash;
            var index = window.location.hash.indexOf('#');
            if (index > -1) {
                var hashes = window.location.hash.slice(index + 1).split('&');
                for (var i = 0; i < hashes.length; i++) {
                    hash = hashes[i].split('=');
                    vars.push(hash[0]);
                    vars[hash[0]] = unescape(hash[1]);
                }
            }
            return vars;
        },
        getHashVar: function (name) { return $.getHashVars()[name]; },

        cookie: function (name, value, options) {
            if (typeof value != 'undefined') { // set cookie
                options = options || {};
                if (value === null) {
                    value = '';
                    options.expires = -1;
                }
                var expires = '';
                if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
                    var date;
                    if (typeof options.expires == 'number') {
                        date = new Date();
                        date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
                    } else {
                        date = options.expires;
                    }
                    expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
                }
                var path = options.path ? '; path=' + (options.path) : '';
                var domain = options.domain ? '; domain=' + (options.domain) : '';
                var secure = options.secure ? '; secure' : '';
                document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
            } else { // get cookie
                var cookieValue = null;
                if (document.cookie && document.cookie != '') {
                    var cookies = document.cookie.split(';');
                    for (var i = 0; i < cookies.length; i++) {
                        var cookie = jQuery.trim(cookies[i]);
                        if (cookie.substring(0, name.length + 1) == (name + '=')) {
                            cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                            break;
                        }
                    }
                }
                return cookieValue;
            }
        }
    });
    $(Xpriser.OnLoad);
    return Xpriser;
})(jQuery);          // Xpriser

Xpriser.Modules.Search = (function ($) {
    var Search = {
        Element: undefined,
        ButtonElement: undefined,
        InputElement: undefined,
        Init: function (areaConfig) {
            Xpriser.SetDebugMessage("Search.Init, id=" + areaConfig.Id);
            var element = Xpriser.Modules.Search.Element = areaConfig.Element;
            var inputElement = Search.InputElement = $(".search .input input", element);
            inputElement.bind("keypress", inputElement, Search.InputKeypress).val(Search.Query());
            var buttonElement = Search.ButtonElement = $(".search .button button", element);
            buttonElement.bind("click", inputElement, Search.ButtonClick);
        },
        Query: function (query) {
            if (query === undefined) return $.getHashVar("q");
            else if (query) {
                var qp = $(".parameters input[type=checkbox]:checked", Xpriser.Modules.Search.Element).val();
                qp = qp == undefined ? "" : "&qp=" + escape(qp);
                var cpath = $(".parameters input[name=cpath]", Xpriser.Modules.Search.Element).val();
                if (!cpath) cpath = $.getHashVar("cpath");
                cpath = cpath == undefined ? "" : "&cpath=" + escape(cpath);
                window.location.hash = "#q=" + escape(query) + qp + cpath;
            }
        },
        ButtonClick: function (event) {
            event.preventDefault();
            Search.Query(event.data.val());
        },
        InputKeypress: function (event) {
            if (event.which == '13') {
                event.preventDefault();
                Search.Query(event.data.val());
            }
        },
        InputFocus: function () {
            setTimeout(function () { Search.InputElement.focus(); }, 100);
        }
    };
    return Search;
})(jQuery); // Xpriser.Modules.Search

Xpriser.Modules.Image = (function ($) {
    var Image = {
        PopupContainerElement: undefined,
        PopupImageElement: undefined,
        PopupVisible: false,
        PopupLoaded: false,
        Init: function(areaConfig) {
            Xpriser.SetDebugMessage("Image.Init, id=" + areaConfig.Id);
            Xpriser.Modules.Image.InitPopupArea();
            $(".productlist .list .item .image img", areaConfig.Element)
                .bind("mouseover", Xpriser.Modules.Image.MouseOver)
                .bind("mouseout", Xpriser.Modules.Image.MouseOut);
        },
        InitPopupArea: function() {
            if (Xpriser.Modules.Image.PopupImageElement !== undefined)
                Xpriser.Modules.Image.MouseOut();
            else {
                Xpriser.SetDebugMessage("Image.InitPopupArea");
                $("body").append('<div id="xpriser_imagepopup" class="xpriser" style="position:absolute; top:1px; left:1px; display:none;"><div class="popupimage"><div class="outer"><div class="inner"><img /></div></div></div></div>');
                Xpriser.Modules.Image.PopupContainerElement = $("body>#xpriser_imagepopup");
                Xpriser.Modules.Image.PopupImageElement = $("body>#xpriser_imagepopup img").bind("load", Xpriser.Modules.Image.PopupImageLoad);
            }
        },
        MouseOver: function(event) {
            Xpriser.Modules.Image.PopupLoaded = false;
            var src = event.target.src.replace( /_\d+(?=\.\w+)/ , "");
            Xpriser.Modules.Image.PopupImageElement.attr("src", src);

            Xpriser.Modules.Image.PopupVisible = true;
            var position = $(event.target).offset();
            Xpriser.Modules.Image.PopupContainerElement.css("left", position.left + 75).css("top", position.top + 50).addClass("loader").show();
        },
        MouseOut: function(event) {
            Xpriser.Modules.Image.PopupContainerElement.hide();
            Xpriser.Modules.Image.PopupVisible = false;
        },
        PopupImageLoad: function(event) {
            Xpriser.Modules.Image.PopupContainerElement.removeClass("loader");
            Xpriser.Modules.Image.PopupLoaded = true;
        }
    };
    return Image;
})(jQuery); // Xpriser.Modules.Image

Xpriser.Modules.CategoryList = (function ($) {
    var jQuery = $;
    /** 
    #  * Copyright (c) 2008 Pasyuk Sergey (www.codeasily.com) 
    #  * Licensed under the MIT License: 
    #  * http://www.opensource.org/licenses/mit-license.php 
    #  *  
    #  * Splits a <ul>/<ol>-list into equal-sized columns. 
    #  *  
    #  * Requirements:  
    #  * <ul> 
    #  * <li>"ul" or "ol" element must be styled with margin</li> 
    #  * </ul> 
    #  *  
    #  * @see http://www.codeasily.com/jquery/multi-column-list-with-jquery 
    #  */
    jQuery.fn.makeacolumnlists = function (settings) {
        settings = jQuery.extend({
            cols: 2, 			// set number of columns
            colWidth: 0, 		// set width for each column or leave 0 for auto width
            equalHeight: false, 	// can be false, 'ul', 'ol', 'li'
            startN: 1				// first number on your ordered list
        }, settings);

        if (jQuery('> li', this)) {
            this.each(function (y) {
                var y = jQuery('.li_container').size(),
                    height = 0,
                    maxHeight = 0,
                    t = jQuery(this),
                    classN = t.attr('class'),
                    listsize = jQuery('> li', this).size(),
                    percol = Math.ceil(listsize / settings.cols),
                    contW = t.width(),
                    bl = (isNaN(parseInt(t.css('borderLeftWidth'), 10)) ? 0 : parseInt(t.css('borderLeftWidth'), 10)),
                    br = (isNaN(parseInt(t.css('borderRightWidth'), 10)) ? 0 : parseInt(t.css('borderRightWidth'), 10)),
                    pl = parseInt(t.css('paddingLeft'), 10),
                    pr = parseInt(t.css('paddingRight'), 10),
                    ml = parseInt(t.css('marginLeft'), 10),
                    mr = parseInt(t.css('marginRight'), 10),
                    col_Width = Math.floor((contW - (settings.cols - 1) * (bl + br + pl + pr + ml + mr)) / settings.cols);
                if (settings.colWidth) {
                    col_Width = settings.colWidth;
                }

                var colnum = 1, percol2 = percol;
                jQuery(this).addClass('li_cont1').wrap('<div id="li_container' + (++y) + '" class="li_container"></div>');
                for (var i = 0; i <= listsize; i++) {
                    if (i >= percol2) {
                        percol2 += percol;
                        colnum++;
                    }
                    var eq = jQuery('> li:eq(' + i + ')', this);
                    eq.addClass('li_col' + colnum);
                    if (jQuery(this).is('ol')) {
                        eq.attr('value', '' + (i + settings.startN)) + '';
                    }
                }
                jQuery(this).css({ 'float': 'left', 'width': (col_Width + 'px') });
                for (colnum = 2; colnum <= settings.cols; colnum++) {
                    if (jQuery(this).is('ol')) {
                        jQuery('li.li_col' + colnum, this).appendTo('#li_container' + y).wrapAll('<ol class="li_cont' + colnum + ' ' + classN + '" style="float:left; width: ' + col_Width + 'px;"></ol>');
                    } else {
                        jQuery('li.li_col' + colnum, this).appendTo('#li_container' + y).wrapAll('<ul class="li_cont' + colnum + ' ' + classN + '" style="float:left; width: ' + col_Width + 'px;"></ul>');
                    }
                }
                if (settings.equalHeight == 'li') {
                    for (colnum = 1; colnum <= settings.cols; colnum++) {
                        jQuery('#li_container' + y + ' li').each(function () {
                            var e = jQuery(this);
                            var border_top = (isNaN(parseInt(e.css('borderTopWidth'), 10)) ? 0 : parseInt(e.css('borderTopWidth'), 10));
                            var border_bottom = (isNaN(parseInt(e.css('borderBottomWidth'), 10)) ? 0 : parseInt(e.css('borderBottomWidth'), 10));
                            height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
                            maxHeight = (height > maxHeight) ? height : maxHeight;
                        });
                    }
                    for (colnum = 1; colnum <= settings.cols; colnum++) {
                        var eh = jQuery('#li_container' + y + ' li');
                        var border_top = (isNaN(parseInt(eh.css('borderTopWidth'), 10)) ? 0 : parseInt(eh.css('borderTopWidth'), 10));
                        var border_bottom = (isNaN(parseInt(eh.css('borderBottomWidth'), 10)) ? 0 : parseInt(eh.css('borderBottomWidth'), 10));
                        mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom);
                        eh.height(mh);
                    }
                } else if (settings.equalHeight == 'ul' || settings.equalHeight == 'ol') {
                    for (colnum = 1; colnum <= settings.cols; colnum++) {
                        jQuery('#li_container' + y + ' .li_cont' + colnum).each(function () {
                            var e = jQuery(this);
                            var border_top = (isNaN(parseInt(e.css('borderTopWidth'), 10)) ? 0 : parseInt(e.css('borderTopWidth'), 10));
                            var border_bottom = (isNaN(parseInt(e.css('borderBottomWidth'), 10)) ? 0 : parseInt(e.css('borderBottomWidth'), 10));
                            height = e.height() + parseInt(e.css('paddingTop'), 10) + parseInt(e.css('paddingBottom'), 10) + border_top + border_bottom;
                            maxHeight = (height > maxHeight) ? height : maxHeight;
                        });
                    }
                    for (colnum = 1; colnum <= settings.cols; colnum++) {
                        var eh = jQuery('#li_container' + y + ' .li_cont' + colnum);
                        var border_top = (isNaN(parseInt(eh.css('borderTopWidth'), 10)) ? 0 : parseInt(eh.css('borderTopWidth'), 10));
                        var border_bottom = (isNaN(parseInt(eh.css('borderBottomWidth'), 10)) ? 0 : parseInt(eh.css('borderBottomWidth'), 10));
                        mh = maxHeight - (parseInt(eh.css('paddingTop'), 10) + parseInt(eh.css('paddingBottom'), 10) + border_top + border_bottom);
                        eh.height(mh);
                    }
                }
                jQuery('#li_container' + y).append('<div style="clear:both; overflow:hidden; height:0px;"></div>');
            });
        }
    };

    jQuery.fn.uncolumnlists = function () {
        jQuery('.li_cont1').each(function (i) {
            var onecolSize = jQuery('#li_container' + (++i) + ' .li_cont1 > li').size();
            if (jQuery('#li_container' + i + ' .li_cont1').is('ul')) {
                jQuery('#li_container' + i + ' > ul > li').appendTo('#li_container' + i + ' ul:first');
                for (var j = 1; j <= onecolSize; j++) {
                    jQuery('#li_container' + i + ' ul:first li').removeAttr('class').removeAttr('style');
                }
                jQuery('#li_container' + i + ' ul:first').removeAttr('style').removeClass('li_cont1').insertBefore('#li_container' + i);
            } else {
                jQuery('#li_container' + i + ' > ol > li').appendTo('#li_container' + i + ' ol:first');
                for (var j = 1; j <= onecolSize; j++) {
                    jQuery('#li_container' + i + ' ol:first li').removeAttr('class').removeAttr('style');
                }
                jQuery('#li_container' + i + ' ol:first').removeAttr('style').removeClass('li_cont1').insertBefore('#li_container' + i);
            }
            jQuery('#li_container' + i).remove();
        });
    };
    var CategoryList = {
        Init: function(areaConfig) {
            Xpriser.SetDebugMessage("CategoryList.Init, id=" + areaConfig.Id);
            $(".category>.outer>.inner>ul", areaConfig.Element).makeacolumnlists({ cols: 3, colWidth: 0, equalHeight: false });
        }
    };
    return CategoryList;
})(jQuery); // Xpriser.Modules.CategoryList


Xpriser.Modules.ListItem = (function ($) {
    var ListItem = {
        Init: function(areaConfig) {
            Xpriser.SetDebugMessage("ListItem.Init, id=" + areaConfig.Id);
            $(".list .item:has(a)", areaConfig.Element)
                .bind("mouseover", Xpriser.Modules.ListItem.MouseOver)
                .bind("mouseout", Xpriser.Modules.ListItem.MouseOut)
                .bind("click", Xpriser.Modules.ListItem.Click);
        },
        MouseOver: function(event) {
            var element = $(event.currentTarget);
            element.addClass("mouseover");
        },
        MouseOut: function(event) {
            var element = $(event.currentTarget);
            element.removeClass("mouseover");
        },
        Click: function (event) {
            event.preventDefault();
            var element = $(event.currentTarget);
            var href = $("a", element).attr("href");
            if (href != undefined) {
                element.removeClass("mouseover");
                if (href.indexOf("#") == 0)
                    window.location.hash = href;
                else if (href.indexOf(window.location.hostname) > -1)
                    window.location = href;
                else
                    window.open(href);
            }
        }
    };
    return ListItem;
})(jQuery); // Xpriser.Modules.ListItem
