﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

/*
* jQuery / CSS menu
* URL: http://javascript-array.com/scripts/jquery_simple_drop_down_menu/
*/
var timeout = 500, closetimer = 0, ddmenuitem = 0; function jsddm_open() { jsddm_canceltimer(); jsddm_close(); ddmenuitem = $(this).find("ul").css("visibility", "visible") } function jsddm_close() { ddmenuitem && ddmenuitem.css("visibility", "hidden") } function jsddm_timer() { closetimer = window.setTimeout(jsddm_close, timeout) } function jsddm_canceltimer() { if (closetimer) { window.clearTimeout(closetimer); closetimer = null } } $(document).ready(function() { $("#jsddm > li").bind("mouseover", jsddm_open); $("#jsddm > li").bind("mouseout", jsddm_timer) }); document.onclick = jsddm_close;

/*
* jQuery Querystring
* URL: http://plugins.jquery.com/project/query-object
*/
new (function(k) { var q = k.separator || "&", o = k.spaces === false ? false : true, r = (k.prefix === false ? false : true) ? k.hash === true ? "#" : "?" : "", s = k.numbers === false ? false : true; jQuery.query = new (function() { var g = function(a, b) { return a != undefined && a !== null && (b ? a.constructor == b : true) }, p = function(a) { for (var b = /\[([^[]*)\]/g, c = /^([^[]+)(\[.*\])?$/.exec(a), e = c[1], d = []; a = b.exec(c[2]); ) d.push(a[1]); return [e, d] }, j = function(a, b, c) { var e = b.shift(); if (typeof a != "object") a = null; if (e === "") { a || (a = []); if (g(a, Array)) a.push(b.length == 0 ? c : j(null, b.slice(0), c)); else if (g(a, Object)) { for (e = 0; a[e++] != null; ); a[--e] = b.length == 0 ? c : j(a[e], b.slice(0), c) } else { a = []; a.push(b.length == 0 ? c : j(null, b.slice(0), c)) } } else if (e && e.match(/^\s*[0-9]+\s*$/)) { var d = parseInt(e, 10); a || (a = []); a[d] = b.length == 0 ? c : j(a[d], b.slice(0), c) } else if (e) { d = e.replace(/^\s*|\s*$/g, ""); a || (a = {}); if (g(a, Array)) { var f = {}; for (e = 0; e < a.length; ++e) f[e] = a[e]; a = f } a[d] = b.length == 0 ? c : j(a[d], b.slice(0), c) } else return c; return a }, m = function(a) { var b = this; b.keys = {}; a.queryObject ? jQuery.each(a.get(), function(c, e) { b.SET(c, e) }) : jQuery.each(arguments, function() { var c = "" + this; c = c.replace(/^[?#]/, ""); c = c.replace(/[;&]$/, ""); if (o) c = c.replace(/[+]/g, " "); jQuery.each(c.split(/[&;]/), function() { var e = decodeURIComponent(this.split("=")[0] || ""), d = decodeURIComponent(this.split("=")[1] || ""); if (e) { if (s) if (/^[+-]?[0-9]+\.[0-9]*$/.test(d)) d = parseFloat(d); else if (/^[+-]?[0-9]+$/.test(d)) d = parseInt(d, 10); d = !d && d !== 0 ? true : d; if (d !== false && d !== true && typeof d != "number") d = d; b.SET(e, d) } }) }); return b }; m.prototype = { queryObject: true, has: function(a, b) { a = this.get(a); return g(a, b) }, GET: function(a) { if (!g(a)) return this.keys; var b = p(a); a = b[1]; for (b = this.keys[b[0]]; b != null && a.length != 0; ) b = b[a.shift()]; return typeof b == "number" ? b : b || "" }, get: function(a) { a = this.GET(a); if (g(a, Object)) return jQuery.extend(true, {}, a); else if (g(a, Array)) return a.slice(0); return a }, SET: function(a, b) { b = !g(b) ? null : b; a = p(a); var c = a[0]; this.keys[c] = j(this.keys[c], a[1].slice(0), b); return this }, set: function(a, b) { return this.copy().SET(a, b) }, REMOVE: function(a) { return this.SET(a, null).COMPACT() }, remove: function(a) { return this.copy().REMOVE(a) }, EMPTY: function() { var a = this; jQuery.each(a.keys, function(b) { delete a.keys[b] }); return a }, load: function(a) { var b = a.replace(/^.*?[#](.+?)(?:\?.+)?$/, "$1"), c = a.replace(/^.*?[?](.+?)(?:#.+)?$/, "$1"); return new m(a.length == c.length ? "" : c, a.length == b.length ? "" : b) }, empty: function() { return this.copy().EMPTY() }, copy: function() { return new m(this) }, COMPACT: function() { function a(b) { var c = typeof b == "object" ? g(b, Array) ? [] : {} : b; if (typeof b == "object") { function e(d, f, h) { if (g(d, Array)) d.push(h); else d[f] = h } jQuery.each(b, function(d, f) { if (!g(f)) return true; e(c, d, a(f)) }) } return c } this.keys = a(this.keys); return this }, compact: function() { return this.copy().COMPACT() }, toString: function() { var a = [], b = [], c = function(f) { f += ""; if (o) f = f.replace(/ /g, "+"); return encodeURIComponent(f) }, e = function(f, h, i) { if (!(!g(i) || i === false)) { h = [c(h)]; if (i !== true) { h.push("="); h.push(c(i)) } f.push(h.join("")) } }, d = function(f, h) { var i = function(l) { return !h || h == "" ? "" + l : [h, "[", l, "]"].join("") }; jQuery.each(f, function(l, n) { typeof n == "object" ? d(n, i(l)) : e(b, i(l), n) }) }; d(this.keys); b.length > 0 && a.push(r); a.push(b.join(q)); return a.join("") } }; return new m(location.search, location.hash) }) })(jQuery.query || {});

/*
* Document load
*/
$(document).ready(function() {
    if ($.query.get('q') != '') {
        $('.searchBox input.search').val($.query.get('q'));
    }
    
    $('.searchBox input.search').keypress(function(e) {
        var code = (e.keyCode ? e.keyCode : e.which);
        if (code == 13) { //Enter keycode
            window.location.href = '/soeg.htm?q=' + $(this).val();
            e.preventDefault();
        }
    });

    $('.searchBox a.search').click(function() {
        var input = $(this).parent().parent().parent().parent().find('input.search').val();
        window.location.href = '/soeg.htm?q=' + input;
        e.preventDefault();
    });
});