$(document).ready(function () { $("#dlgsearch").dialog({ bgiframe: true, autoOpen: false, height: 610, width: 1000, modal: false, title: "Astroved Google Search" }); });
function showResponseLogin(responseText, statusText) { $("#message").html(responseText); }
function closeCartDialog() { $("#viewcart").dialog("close"); }
function gotoproducts() { window.location.href = '/services/offerings/planetary'; }
function redirectHistory() { history.go(-2); }
    
var flag = true;
function mapsLoaded() {
    var searchControl = new google.search.SearchControl();
    searchControl.setLinkTarget(searchControl.LINK_TARGET_SELF);
    searchControl.setResultSetSize(google.search.Search.LARGE_RESULTSET);
    var siteSearch = new GwebSearch();
    siteSearch.setUserDefinedLabel("Astroved.com");
    siteSearch.setUserDefinedClassSuffix("siteSearch");
    siteSearch.setSiteRestriction("astroved.com");
    var drawOptions = new google.search.DrawOptions();
    drawOptions.setInput(document.getElementById('query_input'));
    var options = new GsearcherOptions();
    options.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
    options.setRoot(document.getElementById("searchresult"));
    searchControl.addSearcher(siteSearch, options);
    searchControl.draw('searchcontrol', drawOptions);
    GSearch.getBranding(document.getElementById("googlebrand"));
}

function loadMaps() {google.load("search", "1", { "callback": mapsLoaded });}

function initLoader() {
    if (flag) {
        var script = document.createElement("script");
        if (document.location.protocol == 'https:') {
            script.src = "https://www.google.com/jsapi?key=ABQIAAAAoaqzZrdbwIFiQIIpWxDWARSIdR4F-3-vczd9RRLo5-PFVp7ncRTC10S3Fvl5RSvJQcaMjg4h0kAT3g&callback=loadMaps";
        }
        else {
            script.src = "http://www.google.com/jsapi?key=ABQIAAAAoaqzZrdbwIFiQIIpWxDWARSIdR4F-3-vczd9RRLo5-PFVp7ncRTC10S3Fvl5RSvJQcaMjg4h0kAT3g&callback=loadMaps";
        }
        script.type = "text/javascript";
        document.getElementsByTagName("head")[0].appendChild(script);
    }
    flag = false;
}
function getSearch() {
    initLoader();
    $("#query_input").delay(1000, function () {
        $("#query_input").trigger('keyup');
    });
    $("#dlgsearch").dialog("open");
}
jQuery.fn.delay = function (time, func) {
    this.each(function () {
        setTimeout(func, time);
    });
    return this;
};
/*function showSubContent(id, noOfId, preFixName, className) {
    hideShowSubContent(noOfId, preFixName, className);
    document.getElementById(id).className = document.getElementById(id).className + " sel" + className;
    opacity(id, 5, 100, 1000);
}
function hideShowSubContent(noOfId, preFixName, className) {
    for (i = 1; i <= noOfId; i++) {
        document.getElementById(preFixName + i).className = className;
    }
}
function opacity(id, opacStart, opacEnd, millisec) {
    var speed = Math.round(millisec / 100);
    var timer = 0;
    if (opacStart > opacEnd) {
        for (i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
    else if (opacStart < opacEnd) {
        for (i = opacStart; i <= opacEnd; i++) {
            setTimeout("changeOpac(" + i + ",'" + id + "')", (timer * speed));
            timer++;
        }
    }
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}*/

$(document).ready(function () {
    $("#query_input").keypress(function (e) {
        code = e.keyCode ? e.keyCode : e.which;
        if (code.toString() == 13) {
            getSearch();
        }
    });
});


/*
    /jquery/iepngfix_tilebg.js
    for PNG fix transperent images
*/
    var IEPNGFix = window.IEPNGFix || {}; IEPNGFix.tileBG = function (elm, pngSrc, ready) { var data = this.data[elm.uniqueID], elmW = Math.max(elm.clientWidth, elm.scrollWidth), elmH = Math.max(elm.clientHeight, elm.scrollHeight), bgX = elm.currentStyle.backgroundPositionX, bgY = elm.currentStyle.backgroundPositionY, bgR = elm.currentStyle.backgroundRepeat; if (!data.tiles) { data.tiles = { elm: elm, src: '', cache: [], img: new Image(), old: {}} } var tiles = data.tiles, pngW = tiles.img.width, pngH = tiles.img.height; if (pngSrc) { if (!ready && pngSrc != tiles.src) { tiles.img.onload = function () { this.onload = null; IEPNGFix.tileBG(elm, pngSrc, 1) }; return tiles.img.src = pngSrc } } else { if (tiles.src) ready = 1; pngW = pngH = 0 } tiles.src = pngSrc; if (!ready && elmW == tiles.old.w && elmH == tiles.old.h && bgX == tiles.old.x && bgY == tiles.old.y && bgR == tiles.old.r) { return } var pos = { top: '0%', left: '0%', center: '50%', bottom: '100%', right: '100%' }, x, y, pc; x = pos[bgX] || bgX; y = pos[bgY] || bgY; if (pc = x.match(/(\d+)%/)) { x = Math.round((elmW - pngW) * (parseInt(pc[1]) / 100)) } if (pc = y.match(/(\d+)%/)) { y = Math.round((elmH - pngH) * (parseInt(pc[1]) / 100)) } x = parseInt(x); y = parseInt(y); var repeatX = { 'repeat': 1, 'repeat-x': 1}[bgR], repeatY = { 'repeat': 1, 'repeat-y': 1}[bgR]; if (repeatX) { x %= pngW; if (x > 0) x -= pngW } if (repeatY) { y %= pngH; if (y > 0) y -= pngH } this.hook.enabled = 0; if (!({ relative: 1, absolute: 1}[elm.currentStyle.position])) { elm.style.position = 'relative' } var count = 0, xPos, maxX = repeatX ? elmW : x + 0.1, yPos, maxY = repeatY ? elmH : y + 0.1, d, s, isNew; if (pngW && pngH) { for (xPos = x; xPos < maxX; xPos += pngW) { for (yPos = y; yPos < maxY; yPos += pngH) { isNew = 0; if (!tiles.cache[count]) { tiles.cache[count] = document.createElement('div'); isNew = 1 } var clipR = Math.max(0, xPos + pngW > elmW ? elmW - xPos : pngW), clipB = Math.max(0, yPos + pngH > elmH ? elmH - yPos : pngH); d = tiles.cache[count]; s = d.style; s.behavior = 'none'; s.left = (xPos - parseInt(elm.currentStyle.paddingLeft)) + 'px'; s.top = yPos + 'px'; s.width = clipR + 'px'; s.height = clipB + 'px'; s.clip = 'rect(' + (yPos < 0 ? 0 - yPos : 0) + 'px,' + clipR + 'px,' + clipB + 'px,' + (xPos < 0 ? 0 - xPos : 0) + 'px)'; s.display = 'block'; if (isNew) { s.position = 'absolute'; s.zIndex = -999; if (elm.firstChild) { elm.insertBefore(d, elm.firstChild) } else { elm.appendChild(d) } } this.fix(d, pngSrc, 0); count++ } } } while (count < tiles.cache.length) { this.fix(tiles.cache[count], '', 0); tiles.cache[count++].style.display = 'none' } this.hook.enabled = 1; tiles.old = { w: elmW, h: elmH, x: bgX, y: bgY, r: bgR} }; IEPNGFix.update = function () { for (var i in IEPNGFix.data) { var t = IEPNGFix.data[i].tiles; if (t && t.elm && t.src) { IEPNGFix.tileBG(t.elm, t.src) } } }; IEPNGFix.update.timer = 0; if (window.attachEvent && !window.opera) { window.attachEvent('onresize', function () { clearTimeout(IEPNGFix.update.timer); IEPNGFix.update.timer = setTimeout(IEPNGFix.update, 100) }) }


/*
    /jquery/jquery.tipsy.js
    facebook type login in top of the page
*/
(function ($) { $.fn.tipsy = function (opts) { opts = $.extend({ fade: false, gravity: 'n' }, opts || {}); var tip = null, cancelHide = false; this.hover(function () { $.data(this, 'cancel.tipsy', true); var tip = $.data(this, 'active.tipsy'); if (!tip) { tip = $('<div class="tipsy"><div class="tipsy-inner">' + $(this).attr('title') + '</div></div>'); tip.css({ position: 'absolute', zIndex: 100000 }); $(this).attr('title', ''); $.data(this, 'active.tipsy', tip) } var pos = $.extend({}, $(this).offset(), { width: this.offsetWidth, height: this.offsetHeight }); tip.remove().css({ top: 0, left: 0, visibility: 'hidden', display: 'block' }).appendTo(document.body); var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight; switch (opts.gravity.charAt(0)) { case 'n': tip.css({ top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 }).addClass('tipsy-north'); break; case 's': tip.css({ top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 }).addClass('tipsy-south'); break; case 'e': tip.css({ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth }).addClass('tipsy-east'); break; case 'w': tip.css({ top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width }).addClass('tipsy-west'); break } if (opts.fade) { tip.css({ opacity: 0, display: 'block', visibility: 'visible' }).animate({ opacity: 1 }) } else { tip.css({ visibility: 'visible' }) } }, function () { $.data(this, 'cancel.tipsy', false); var self = this; setTimeout(function () { if ($.data(this, 'cancel.tipsy')) return; var tip = $.data(self, 'active.tipsy'); if (opts.fade) { tip.stop().fadeOut(function () { $(this).remove() }) } else { tip.remove() } }, 100) }) } })(jQuery);

$(document).ready(function () {
    $(".signin").click(function (e) {$("fieldset#signin_menu").toggle();$(".signin").toggleClass("menu-open");});
    $("fieldset#signin_menu").mouseup(function () {return false});
    $(document).mouseup(function (e) {if ($(e.target).parent("a.signin").length == 0) {$(".signin").removeClass("menu-open");$("fieldset#signin_menu").hide();}});
    $('#resend_password_link').tipsy({ gravity: 'w' });
});


/*
    /jquery/jquery.maxlength.js
    for textarea characters validation.
*/
(function ($) { $.fn.maxlength = function (settings) { if (typeof settings == 'string') { settings = { feedback: settings} } settings = $.extend({}, $.fn.maxlength.defaults, settings); function length(el) { var parts = el.value; if (settings.words) parts = el.value.length ? parts.split(/\s+/) : { length: 0 }; return parts.length } return this.each(function () { var field = this, $field = $(field), $form = $(field.form), limit = settings.useInput ? $form.find('input[name=maxlength]').val() : $field.attr('maxlength'), $charsLeft = $form.find(settings.feedback); function limitCheck(event) { var len = length(this), exceeded = len >= limit, code = event.keyCode; if (!exceeded) return; switch (code) { case 8: case 9: case 17: case 36: case 35: case 37: case 38: case 39: case 40: case 46: case 65: return; default: return settings.words && code != 32 && code != 13 && len == limit } } var updateCount = function () { var len = length(field), diff = limit - len; $charsLeft.html(diff || "0"); if (settings.hardLimit && diff < 0) { field.value = settings.words ? field.value.split(/(\s+)/, (limit * 2) - 1).join('') : field.value.substr(0, limit); updateCount() } }; $field.keyup(updateCount).change(updateCount); if (settings.hardLimit) { $field.keydown(limitCheck) } updateCount() }) }; $.fn.maxlength.defaults = { useInput: false, hardLimit: true, feedback: '.charsLeft', words: false} })(jQuery);


/*
/jquery/jquery.watermark.min.js

Watermark v3.0.6 (June 21, 2010) plugin for jQuery
http://jquery-watermark.googlecode.com/
Copyright (c) 2009-2010 Todd Northrop
http://www.speednet.biz/
Dual licensed under the MIT or GPL Version 2 licenses.
*/
(function (b) { var l = "function", j = "password", d = "maxLength", f = "type", c = true, a = "", e = false, t = "watermark", u, m = t, i = "watermarkClass", q = "watermarkFocus", k = "watermarkSubmit", o = "watermarkMaxLength", h = "watermarkPassword", g = "watermarkText", s = ":data(" + m + ")", n = ":text,:password,:search,textarea", p = ["Page_ClientValidate"], r = e; b.extend(b.expr[":"], { search: function (b) { return "search" === (b.type || a) }, data: function (g, i, h) { var f, d = /^((?:[^=!^$*]|[!^$*](?!=))+)(?:([!^$*]?=)(.*))?$/.exec(h[3]); if (d) { f = b(g).data(d[1]); if (f !== u) { if (d[2]) { f = a + f; switch (d[2]) { case "=": return f == d[3]; case "!=": return f != d[3]; case "^=": return f.slice(0, d[3].length) == d[3]; case "$=": return f.slice(-d[3].length) == d[3]; case "*=": return f.indexOf(d[3]) !== -1 } } return c } } return e } }); b.watermark = { version: "3.0.6", options: { className: t, useNative: c }, hide: function (a) { b(a).filter(s).each(function () { b.watermark._hide(b(this)) }) }, _hide: function (b, n) { var m = b.val() || a, k = b.data(g) || a, l = b.data(o) || 0, j = b.data(i); if (k.length && m == k) { b.val(a); if (b.data(h)) if ((b.attr(f) || a) === "text") { var e = b.data(h) || [], c = b.parent() || []; if (e.length && c.length) { c[0].removeChild(b[0]); c[0].appendChild(e[0]); b = e } } if (l) { b.attr(d, l); b.removeData(o) } if (n) { b.attr("autocomplete", "off"); window.setTimeout(function () { b.select() }, 1) } } j && b.removeClass(j) }, show: function (a) { b(a).filter(s).each(function () { b.watermark._show(b(this)) }) }, _show: function (e) { var t = e.val() || a, k = e.data(g) || a, p = e.attr(f) || a, s = e.data(i); if ((t.length == 0 || t == k) && !e.data(q)) { r = c; if (e.data(h)) if (p === j) { var n = e.data(h) || [], m = e.parent() || []; if (n.length && m.length) { m[0].removeChild(e[0]); m[0].appendChild(n[0]); e = n; e.attr(d, k.length) } } if (p === "text" || p === "search") { var l = e.attr(d) || 0; if (l > 0 && k.length > l) { e.data(o, l); e.attr(d, k.length) } } s && e.addClass(s); e.val(k) } else b.watermark._hide(e) }, hideAll: function () { if (r) { b.watermark.hide(n); r = e } }, showAll: function () { b.watermark.show(n) } }; b.fn.watermark = function (r, o) { var p = "string"; if (!this.length) return this; var s = e, t = typeof r === p; if (typeof o === "object") { s = typeof o.className === p; o = b.extend({}, b.watermark.options, o) } else if (typeof o === p) { s = c; o = b.extend({}, b.watermark.options, { className: o }) } else o = b.watermark.options; if (typeof o.useNative !== l) o.useNative = o.useNative ? function () { return c } : function () { return e }; return this.each(function () { var v = "dragleave", u = "dragenter", x = this, e = b(x); if (!e.is(n)) return; if (e.data(m)) { if (t || s) { b.watermark._hide(e); t && e.data(g, r); s && e.data(i, o.className) } } else { if (o.useNative.call(x, e)) if ((a + e.css("-webkit-appearance")).replace("undefined", a) !== a && (e.attr("tagName") || a) !== "TEXTAREA") { t && e.attr("placeholder", r); return } e.data(g, t ? r : a); e.data(i, o.className); e.data(m, 1); if ((e.attr(f) || a) === j) { var y = e.wrap("<span>").parent(), l = b(y.html().replace(/type=["']?password["']?/i, 'type="text"')); l.data(g, e.data(g)); l.data(i, e.data(i)); l.data(m, 1); l.attr(d, r.length); l.focus(function () { b.watermark._hide(l, c) }).bind(u, function () { b.watermark._hide(l) }).bind("dragend", function () { window.setTimeout(function () { l.blur() }, 1) }); e.blur(function () { b.watermark._show(e) }).bind(v, function () { b.watermark._show(e) }); l.data(h, e); e.data(h, l) } else e.focus(function () { e.data(q, 1); b.watermark._hide(e, c) }).blur(function () { e.data(q, 0); b.watermark._show(e) }).bind(u, function () { b.watermark._hide(e) }).bind(v, function () { b.watermark._show(e) }).bind("dragend", function () { window.setTimeout(function () { b.watermark._show(e) }, 1) }).bind("drop", function (c) { var b = c.originalEvent.dataTransfer.getData("Text"); e.val().replace(b, a) === e.data(g) && e.val(b); e.focus() }); if (x.form) { var p = x.form, w = b(p); if (!w.data(k)) { w.submit(b.watermark.hideAll); if (p.submit) { w.data(k, p.submit); p.submit = function (c, a) { return function () { var d = a.data(k); b.watermark.hideAll(); if (d.apply) d.apply(c, Array.prototype.slice.call(arguments)); else d() } } (p, w) } else { w.data(k, 1); p.submit = function (a) { return function () { b.watermark.hideAll(); delete a.submit; a.submit() } } (p) } } } } b.watermark._show(e) }) }; p.length && b(function () { for (var a, c, d = p.length - 1; d >= 0; d--) { a = p[d]; c = window[a]; if (typeof c === l) window[a] = function (a) { return function () { b.watermark.hideAll(); return a.apply(null, Array.prototype.slice.call(arguments)) } } (c) } }) })(jQuery);
