﻿/*
/*
 * jQuery Address Plugin v1.3
 * http://www.asual.com/jquery/address/
 *
 * Copyright (c) 2009-2010 Rostislav Hristov
 * Dual licensed under the MIT or GPL Version 2 licenses.
 * http://jquery.org/license
 *
 * Date: 2010-09-26 17:58:16 +0300 (Sun, 26 Sep 2010)
 */
(function (c) {
    c.address = function () {
        var x = function (a) { c(c.address).trigger(c.extend(c.Event(a), function () { for (var b = {}, f = c.address.parameterNames(), h = 0, q = f.length; h < q; h++) b[f[h]] = c.address.parameter(f[h]); return { value: c.address.value(), path: c.address.path(), pathNames: c.address.pathNames(), parameterNames: f, parameters: b, queryString: c.address.queryString()} } .call(c.address))) }, y = function (a, b, f) { c(c.address).bind(a, b, f); return c.address }, A = function () { return z.pushState && typeof d.state !== t }, H = function () {
            return "/" +
e.pathname.replace(new RegExp(d.state), "") + e.search + (G() ? "#" + G() : "")
        }, G = function () { var a = e.href.indexOf("#"); return a != -1 ? B(e.href.substr(a + 1), l) : "" }, u = function () { return A() ? H() : G() }, ra = function () { return "javascript" }, $ = function (a, b) { if (d.strict) a = b ? a.substr(0, 1) != "/" ? "/" + a : a : a == "" ? "/" : a; return a }, B = function (a, b) { if (d.crawlable && b) return (a != "" ? "!" : "") + a; return a.replace(/^\!/, "") }, C = function (a, b) { return parseInt(a.css(b), 10) }, aa = function (a) {
            for (var b, f, h = 0, q = a.childNodes.length; h < q; h++) {
                if (a.childNodes[h].src) b =
String(a.childNodes[h].src); if (f = aa(a.childNodes[h])) b = f
            } return b
        }, M = function () { if (!R) { var a = u(), b = g != a; if (D && o < 523) { if (I != z.length) { I = z.length; if (typeof F[I - 1] != t) g = F[I - 1]; J(l) } } else if (b) if (E && o < 7) e.reload(); else { E && o < 8 && d.history && v(U, 50); g = a; J(l) } } }, J = function (a) { x(ba); x(a ? ca : da); v(ea, 10) }, ea = function () {
            if (d.tracker !== "null" && d.tracker !== null) {
                var a = c.isFunction(d.tracker) ? d.tracker : j[d.tracker], b = (e.pathname + e.search + (c.address && !A() ? c.address.value() : "")).replace(/\/\//, "/").replace(/^\/$/,
""); if (c.isFunction(a)) a(b); else if (c.isFunction(j.urchinTracker)) j.urchinTracker(b); else if (typeof j.pageTracker != t && c.isFunction(j.pageTracker._trackPageview)) j.pageTracker._trackPageview(b); else typeof j._gaq != t && c.isFunction(j._gaq.push) && j._gaq.push(["_trackPageview", b])
            } 
        }, U = function () {
            var a = ra() + ":" + l + ";document.open();document.writeln('<html><head><title>" + m.title + "</title><script>var " + p + ' = "' + u() + (m.domain != e.host ? '";document.domain="' + m.domain : "") + "\";<\/script></head></html>');document.close();";
            if (o < 7) n.src = a; else n.contentWindow.location.replace(a)
        }, ga = function () { if (N && fa != -1) { var a, b = N.substr(fa + 1).split("&"); for (r = 0; r < b.length; r++) { a = b[r].split("="); if (/^(autoUpdate|crawlable|history|strict|wrap)$/.test(a[0])) d[a[0]] = isNaN(a[1]) ? /^(true|yes)$/i.test(a[1]) : parseInt(a[1], 10) !== 0; if (/^(state|tracker)$/.test(a[0])) d[a[0]] = a[1] } N = null } g = u() }, ia = function () {
            if (!ha) {
                ha = k; ga(); var a = c("body").ajaxComplete(function () { sa.call(this); ta.call(this) }).trigger("ajaxComplete"); if (d.wrap) {
                    c("body > *").wrapAll('<div style="padding:' +
(C(a, "marginTop") + C(a, "paddingTop")) + "px " + (C(a, "marginRight") + C(a, "paddingRight")) + "px " + (C(a, "marginBottom") + C(a, "paddingBottom")) + "px " + (C(a, "marginLeft") + C(a, "paddingLeft")) + 'px;" />').parent().wrap('<div id="' + p + '" style="height:100%; overflow:auto;' + (D ? window.statusbar.visible && !/chrome/i.test(V) ? "" : " resize:both;" : "") + '" />'); c("html, body").css({ height: "100%", margin: 0, padding: 0, overflow: "hidden" }); D && c('<style type="text/css" />').appendTo("head").text("#" + p + "::-webkit-resizer { background-color: #fff; }")
                } if (E &&
o < 8) { a = m.getElementsByTagName("frameset")[0]; n = m.createElement((a ? "" : "i") + "frame"); if (a) { a.insertAdjacentElement("beforeEnd", n); a[a.cols ? "cols" : "rows"] += ",0"; n.noResize = k; n.frameBorder = n.frameSpacing = 0 } else { n.style.display = "none"; n.style.width = n.style.height = 0; n.tabIndex = -1; m.body.insertAdjacentElement("afterBegin", n) } v(function () { c(n).bind("load", function () { var b = n.contentWindow; g = typeof b[p] != t ? b[p] : ""; if (g != u()) { J(l); e.hash = B(g, k) } }); typeof n.contentWindow[p] == t && U() }, 50) } else if (D) {
                    if (o < 418) {
                        c(m.body).append('<form id="' +
p + '" style="position:absolute;top:-9999px;" method="get"></form>'); W = m.getElementById(p)
                    } if (typeof e[p] == t) e[p] = {}; if (typeof e[p][e.pathname] != t) F = e[p][e.pathname].split(",")
                } v(function () { x("init"); J(l) }, 1); if (!A()) if (E && o > 7 || !E && "on" + O in j) if (j.addEventListener) j.addEventListener(O, M, false); else j.attachEvent && j.attachEvent("on" + O, M); else ua(M, 50)
            } 
        }, sa = function () { var a, b = c("a"), f = b.size(), h = -1; v(function () { if (++h != f) { a = c(b.get(h)); a.is("[rel*=address:]") && a.address(); v(arguments.callee, 1) } }, 1) },
va = function () { if (g != u()) { g = u(); J(l) } }, wa = function () { if (j.removeEventListener) j.removeEventListener(O, M, false); else j.detachEvent && j.detachEvent("on" + O, M) }, ta = function () {
    var a = e.pathname.replace(/\/$/, ""); c("body").html().indexOf("_escaped_fragment_") != -1 && c("a[href]:not([href^=http]), , a[href*=" + document.domain + "]", this).each(function () {
        var b = c(this).attr("href").replace(/^http:/, "").replace(new RegExp(a + "/?$"), ""); if (b == "" || b.indexOf("_escaped_fragment_") != -1) c(this).attr("href", "#" + this.decode(b.replace(/\/(.*)\?_escaped_fragment_=(.*)$/,
"!$2")))
    })
}, K = function (a) { return encodeURIComponent(a).replace(/%20/g, "+") }, ja = function (a) { return a.split("#")[0].split("?")[0] }, ka = function (a) { a = ja(a); var b = a.replace(/\/{2,9}/g, "/").split("/"); if (a.substr(0, 1) == "/" || a.length === 0) b.splice(0, 1); a.substr(a.length - 1, 1) == "/" && b.splice(b.length - 1, 1); return b }, S = function (a) { a = a.split("?"); return a.slice(1, a.length).join("?").split("#")[0] }, la = function (a, b) {
    if (b = S(b)) {
        params = b.split("&"); b = []; for (r = 0; r < params.length; r++) {
            var f = params[r].split("="); f[0] ==
a && b.push(f.slice(1).join("="))
        } if (b.length !== 0) return b.length != 1 ? b : b[0]
    } 
}, ma = function (a) { var b = S(a); a = []; if (b && b.indexOf("=") != -1) { b = b.split("&"); for (var f = 0; f < b.length; f++) { var h = b[f].split("=")[0]; c.inArray(h, a) == -1 && a.push(h) } } return a }, na = function (a) { a = a.split("#"); return a.slice(1, a.length).join("#") }, p = "jQueryAddress", t = "undefined", O = "hashchange", ba = "change", ca = "internalChange", da = "externalChange", k = true, l = false, d = { autoUpdate: k, crawlable: l, history: k, strict: k, wrap: l }, s = c.browser, o = parseFloat(c.browser.version),
oa = s.mozilla, E = s.msie, pa = s.opera, D = s.webkit, X = l, j = function () { try { return top.document !== undefined ? top : window } catch (a) { return window } } (), m = j.document, z = j.history, e = j.location, ua = setInterval, v = setTimeout, V = navigator.userAgent, n, W, N = aa(document), fa = N ? N.indexOf("?") : -1, Y = m.title, I = z.length, R = l, ha = l, Z = k, qa = k, T = l, F = [], g = u(); if (E) {
            o = parseFloat(V.substr(V.indexOf("MSIE") + 4)); if (m.documentMode && m.documentMode != o) o = m.documentMode != 8 ? 7 : 8; c(document).bind("propertychange", function () {
                if (m.title != Y && m.title.indexOf("#" +
u()) != -1) m.title = Y
            })
        } if (X = oa && o >= 1 || E && o >= 6 || pa && o >= 9.5 || D && o >= 312) {
            for (var r = 1; r < I; r++) F.push(""); F.push(g); if (pa) history.navigationMode = "compatible"; if (document.readyState == "complete") var xa = setInterval(function () { if (c.address) { ia(); clearInterval(xa) } }, 50); else { ga(); c(ia) } s = H(); if (typeof d.state !== t) if (z.pushState) s.substr(0, 3) == "/#/" && e.replace(d.state.replace(/^\/$/, "") + s.substr(2)); else s != "/" && s.replace(/^\/#/, "") != G() && e.replace(d.state.replace(/^\/$/, "") + "/#" + s); c(window).bind("popstate",
va).bind("unload", wa)
        } else !X && G() != "" || D && o < 418 && G() != "" && e.search != "" ? e.replace(e.href.substr(0, e.href.indexOf("#"))) : ea(); return { bind: function (a, b, f) { return y(a, b, f) }, init: function (a) { return y("init", a) }, change: function (a) { return y(ba, a) }, internalChange: function (a) { return y(ca, a) }, externalChange: function (a) { return y(da, a) }, baseURL: function () { var a = e.href; if (a.indexOf("#") != -1) a = a.substr(0, a.indexOf("#")); if (/\/$/.test(a)) a = a.substr(0, a.length - 1); return a }, autoUpdate: function (a) {
            if (a !== undefined) {
                d.autoUpdate =
a; return this
            } return d.autoUpdate
        }, crawlable: function (a) { if (a !== undefined) { d.crawlable = a; return this } return d.crawlable }, history: function (a) { if (a !== undefined) { d.history = a; return this } return d.history }, state: function (a) { if (a !== undefined) { d.state = a; return this } return d.state }, strict: function (a) { if (a !== undefined) { d.strict = a; return this } return d.strict }, tracker: function (a) { if (a !== undefined) { d.tracker = a; return this } return d.tracker }, wrap: function (a) { if (a !== undefined) { d.wrap = a; return this } return d.wrap },
            update: function () { T = k; this.value(g); T = l; return this }, encode: function (a) { var b = ka(a), f = ma(a), h = S(a), q = na(a), P = a.substr(0, 1), L = a.substr(a.length - 1), i = ""; c.each(b, function (w, Q) { i += "/" + K(Q) }); if (h !== "") { i += "?"; if (f.length === 0) i += h; else { c.each(f, function (w, Q) { w = la(Q, a); if (typeof w !== "string") c.each(w, function (za, ya) { i += K(Q) + "=" + K(ya) + "&" }); else i += K(Q) + "=" + K(w) + "&" }); i = i.substr(0, i.length - 1) } } if (q !== "") i += "#" + K(q); if (P != "/" && i.substr(0, 1) == "/") i = i.substr(1); if (/#|&|\?/.test(L)) i += L; return i }, decode: function (a) {
                return decodeURIComponent(a.replace(/\+/g,
"%20"))
            }, title: function (a) { if (a !== undefined) { v(function () { Y = m.title = a; if (qa && n && n.contentWindow && n.contentWindow.document) { n.contentWindow.document.title = a; qa = l } if (!Z && oa) e.replace(e.href.indexOf("#") != -1 ? e.href : e.href + "#"); Z = l }, 50); return this } return m.title }, value: function (a) {
                if (a !== undefined) {
                    a = $(this.encode(a), k); if (a == "/") a = ""; if (g == a && !T) return; Z = k; g = a; if (d.autoUpdate || T) {
                        J(k); if (A()) z[d.history ? "pushState" : "replaceState"]({}, "", d.state.replace(/\/$/, "") + (g == "" ? "/" : g)); else {
                            R = k; F[z.length] =
g; if (D) if (d.history) { e[p][e.pathname] = F.toString(); I = z.length + 1; if (o < 418) { if (e.search == "") { W.action = "#" + B(g, k); W.submit() } } else if (o < 523 || g == "") { a = m.createEvent("MouseEvents"); a.initEvent("click", k, k); var b = m.createElement("a"); b.href = "#" + B(g, k); b.dispatchEvent(a) } else e.hash = "#" + B(g, k) } else e.replace("#" + B(g, k)); else if (g != u()) if (d.history) e.hash = "#" + B(g, k); else e.replace("#" + B(g, k)); E && o < 8 && d.history && v(U, 50); if (D) v(function () { R = l }, 1); else R = l
                        } 
                    } return this
                } if (!X) return null; return $(this.decode(g),
l)
            }, path: function (a) { if (a !== undefined) { var b = this.queryString(), f = this.hash(); this.value(a + (b ? "?" + b : "") + (f ? "#" + f : "")); return this } return ja(this.value()) }, pathNames: function () { return ka(this.value()) }, queryString: function (a) { if (a !== undefined) { var b = this.hash(); this.value(this.path() + (a ? "?" + a : "") + (b ? "#" + b : "")); return this } return S(this.value()) }, parameter: function (a, b, f) {
                var h, q; if (b !== undefined) {
                    var P = this.parameterNames(); q = []; for (h = 0; h < P.length; h++) {
                        var L = P[h], i = this.parameter(L); if (typeof i == "string") i =
[i]; if (L == a) i = b === null || b === "" ? [] : f ? i.concat([b]) : [b]; for (var w = 0; w < i.length; w++) q.push(L + "=" + i[w])
                    } c.inArray(a, P) == -1 && b !== null && b !== "" && q.push(a + "=" + b); this.queryString(q.join("&")); return this
                } return la(a, this.value())
            }, parameterNames: function () { return ma(this.value()) }, hash: function (a) { if (a !== undefined) { this.value(this.value().split("#")[0] + (a ? "#" + a : "")); return this } return na(this.value()) } 
        }
    } (); c.fn.address = function (x) {
        if (!c(this).attr("address")) {
            var y = function (A) {
                if (c(this).is("a")) {
                    var H = x ?
x.call(this) : /address:/.test(c(this).attr("rel")) ? c(this).attr("rel").split("address:")[1].split(" ")[0] : typeof c.address.state() !== "undefined" && c.address.state() != "/" ? c(this).attr("href").replace(new RegExp("^(.*" + c.address.state() + "|\\.)"), "") : c(this).attr("href").replace(/^(#\!?|\.)/, ""); c.address.value(H); A.preventDefault()
                } 
            }; c(this).click(y).live("click", y).submit(function (A) {
                if (c(this).is("form")) {
                    var H = x ? x.call(this) : c(this).attr("action") + "?" + c.address.decode(c(this).serialize()); c.address.value(H);
                    A.preventDefault()
                } 
            }).attr("address", true)
        } return this
    } 
})(jQuery);




/*
* AVBSEGUROS (C) 2010 http://www.zenn.pt 
* Developed by David Oliveira | david.oliveira@zenn.pt 
*/

// Global Vars ////////////////////////////////////////
var CONTENTMASTER = '#ContentMaster';
var PAGETITLE = '#TitlePage';
var IDLANGUAGE = 'pt';
var FIRSTLOAD = true;
var NOLOADURL = false;

// Navigation /////////////////////////////////////////
jQuery.address.change(function (event) {    
    if (FIRSTLOAD) Avb.Start();
    if (NOLOADURL == false)
        Navigation.LoadUrl(event);
    else
        NOLOADURL = false;

    if (FIRSTLOAD) FIRSTLOAD = false;
});

var Navigation = {
    LoadUrl: function (url) {

        var section = null;
        if (url.pathNames.length > 0) section = url.pathNames[0].toLowerCase();

        Navigation.LoadUrlContent('frontoffice/Page.aspx', { IdLanguage: 'pt', Url: url.value }, 'GET', true, true, null);
    },

    LoadUrlContent: function (URL, Vars, Method, PreLoading, ScrollTop, onLoaded) {
        jQuery.ajax({ url: 'frontoffice/Loading.htm', type: 'GET', cache: true, dataType: 'html', async: false,
            success: function (data, textStatus) {
                if (PreLoading) {
                    jQuery(CONTENTMASTER).html(data);
                }
                jQuery.ajax({ url: URL, type: Method, data: Vars, cache: false, dataType: 'html',
                    success: function (data, textStatus) {
                        jQuery(CONTENTMASTER).html(data).show('slide', { direction: 'up' }, 200);
                        var title = jQuery(PAGETITLE);
                        if (jQuery(title).html() != null && jQuery(title).html().length > 0) jQuery.address.title(jQuery(title).html());
                        if (onLoaded != undefined && onLoaded != null) onLoaded();
                        if (ScrollTop) scroll(0, 0);
                        if (NOLOADURL == true) NOLOADURL = false;

                        var url = jQuery.url.attr('anchor');                        
                        if (url == null || url == undefined) url = '/Home/1/';
                        if (url[0] == '!') url = url.substr(1);
                        _gaq.push(['_trackPageview', url]);
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) { Navigation.LoadErrorPage(textStatus + ' ' + errorThrown); }
                });
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) { Navigation.LoadErrorPage(textStatus + ' ' + errorThrown); }
        });
    },
    LoadErrorPage: function (Description) {
        jQuery.ajax({ url: 'frontoffice/Error.htm', type: 'GET', cache: true, dataType: 'html',
            success: function (data, textStatus) {
                jQuery(CONTENTMASTER).html(data);
                jQuery('#ErrorPage-Content-Status').html(Description);
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) { }
        });
    }
}

// Avb //////////////////////////////////////////////
var Avb = {
    Start: function () {
        IDLANGUAGE = jQuery.url.attr('query');
    },
    NewsletterSubscribe: function (InputId, ButtonId) {
        var email = jQuery.trim(jQuery('#' + InputId).val());

        if (!Validation.IsEmail(email)) {
            jQuery('#' + InputId).css('border', '1px solid red');
            window.setTimeout(function () {
                jQuery('#' + InputId).css('border', '1px solid black');
            }, 2500);
            return;
        }
        else
            jQuery('#' + InputId).css('border', '1px solid black');

        jQuery('#' + ButtonId).hide();
        var span = document.createElement('span');
        jQuery(span).html(' <span class="Icon Icon-True">&nbsp;</span>');
        jQuery(span).insertAfter('#' + ButtonId).show('slow');

        window.setTimeout(function () { jQuery(span).remove(); jQuery('#' + InputId).val(''); jQuery('#' + ButtonId).show(); }, 2000);

        jQuery.ajax({ url: 'API.ashx', data: 'a=SubscribeNewsletter&Email=' + email + '&IdLanguage=' + IDLANGUAGE, type: 'POST', dataType: 'json',
            success: function (data, textStatus) { },
            error: function (XMLHttpRequest, textStatus, errorThrown) { }
        });
    },
    Search: function () {
        window.location = '#!/Pesquisar/' + $('#SearchValue').val() + '/19/';
    }
}

// Backoffice ///////////////////////////////////////
var Backoffice = {
    Load: function(Title, Url, Width, Height) { ZennWindow(Url, Width, Height); },
    Close: function() { ZennWindowClose(); },
    CloseAndRefresh: function() { ZennWindowCloseAndRefresh(); },
    CloseAndRedirect: function(Url) { ZennWindowCloseAndRedirect(Url); },
    NoticeDelete: function(IdNotice) {
        Utilities.PopupQuestion('Apagar', '<img src="images/icons/icon-delete.png" class="Icon" alt="" /> Tem a certeza que deseja apagar esta Notícia?', 
            function() { // callback function for 'YES'
                jQuery.ajax({ url: 'API.ashx', type: 'POST', data: 'a=DeleteNotice&IdNotice=' + IdNotice, dataType: 'json',
                    success: function (data, textStatus) { jQuery.address.value('#!/Home/1/'); },
                    error: function(XMLHttpRequest, textStatus, errorThrown) { LoadErrorPage(textStatus + ' ' + errorThrown); }           
                });
            }, null
        );
    },
    TipDelete: function(IdTip) {
        Utilities.PopupQuestion('Apagar', '<img src="images/icons/icon-delete.png" class="Icon" alt="" /> Tem a certeza que deseja apagar esta Dica?',
		    function() { // callback function for 'YES'
		        jQuery.ajax({ url: 'API.ashx', type: 'POST', data: 'a=DeleteTip&IdTip=' + IdTip, dataType: 'json',
		            success: function(data, textStatus) { jQuery.address.value('#!/Home/1/'); },
		            error: function(XMLHttpRequest, textStatus, errorThrown) { LoadErrorPage(textStatus + ' ' + errorThrown); }
		        });
		    }, null
	    );
    }
}

// UI ///////////////////////////////////////////////
var UI = {
    FixContentBoxIEBug: function(ObjId) {
        var ie = jQuery.browser.msie;
        var version = jQuery.browser.version;

        if (ie && Number(version) < 8) {
            jQuery('#' + ObjId).css('border', '0px');
        }
    },

    BudgetSelected: function (id) {
        var url = $("OPTION:selected", '#' + id).val();
        window.location = url;
    }
}

// Utilities ////////////////////////////////////////

var Utilities = {
    PopupMessage: function(Message, TimeOut) {
        alert(Message);
    },
    PopupQuestion: function(Title, Question, YesFunction, NoFunction) {
        if (confirm(Question))
            YesFunction();
        else
            if(NoFunction != null)
                NoFunction();
    }
}



/*
* Zenn Window
*
* Copyright (c) 2009-01-24   
* David Oliveira | david.oliveira@zenn.pt
* 
* Depends:
*	jQuery v1.3
*
* Notes: To Close Window from URL target, call parent.ZennWindowClose();
*
*/

function ZennWindow(/*String*/URL, /*Number*/Width, /*Number*/Height) {
    var fwImagesPath = 'images/default/';
    var modalWidth = Number(Width) + 20;
    var modalHeight = Number(Height);
    var modalPositionTop = (Number(jQuery(window).height()) - Number(modalHeight)) / 2;
    if (modalPositionTop < 0) modalPositionTop = 0;
    var modalPositionLeft = (Number(jQuery(window).width()) - Number(modalWidth)) / 2;
    if (modalPositionLeft < 0) modalPositionLeft = 0;

    jQuery('body').append('<div id="fwOverlay" style="position: absolute; top:0px; left:0px; z-index: 5; width: 100%; height:100%; filter: Alpha(Opacity=60); -moz-opacity:0.6; opacity: 0.6; background-color:#85BBEF;"></div>');
    if (modalHeight > jQuery('#fwOverlay').height())
        jQuery('#fwOverlay').height(modalHeight + 45);

    var ie = jQuery.browser.msie;
    var version = jQuery.browser.version;

    var border = '';
    if (ie && Number(version) < 8) {        
        border = 'border:1px solid transparent;';
    }    


    var html = '<div id="fwModal" style="display:none; position:absolute; top:' + modalPositionTop + 'px; left:' + modalPositionLeft + 'px; z-index:1000; width:' + modalWidth + 'px;">';
    html += '<div style="position:relative; display:block; height:25px;">';
    html += '<div style="position:absolute; left:0px; top:0px;"><img src="' + fwImagesPath + 'fw-left-top.gif" /></div>';
    html += '<div style="margin:0px 10px 0px 10px; ' + border + ' background:url(' + fwImagesPath + 'fw-right-middle.gif); text-align:right;"><span id="fwBtnClose" style="cursor:pointer;"><img src="' + fwImagesPath + 'fw-btn-close.gif" alt=""></span></div>';
    html += '<div style="position:absolute; right:0px; top:0px;"><img src="' + fwImagesPath + 'fw-right-top.gif" /></div>';
    html += '</div>';


    html += '<div style="position:relative; display:block; margin-top:-2px;">';
    html += '<div style="position:absolute; left:0px; top:0px; width:7px; height:' + modalHeight + 'px; background-image:url(' + fwImagesPath + 'fw-frame-left.gif);"></div>';
    html += '<div style="margin:-2px 7px 0px 7px; height:' + modalHeight + 'px; background-color:#FFFFFF;">';
    html += '<iframe width="' + Width + '" height="' + Height + '"  frameborder="0" marginwidth="0" marginheight="0" scrolling="NO" src="' + URL + '"></iframe>';
    html += '</div>';
    html += '<div style="position:absolute; right:0px; top:0px; width:7px; height:' + modalHeight + 'px; background-image:url(' + fwImagesPath + 'fw-frame-right.gif);"></div>';
    html += '</div>';

    html += '<div style="position:relative; display:block; height:7px;">';
    html += '<div style="position:absolute; left:0px; top:0px;"><img src="' + fwImagesPath + 'fw-bottom-left-c.gif" style="vertical-align:top;" /></div>';
    html += '<div style="margin:0px 7px 0px 7px; background-image:url(' + fwImagesPath + 'fw-bottom-middle.gif); height:7px;">&nbsp;</div>';
    html += '<div style="position:absolute; right:0px; top:0px;"><img src="' + fwImagesPath + 'fw-bottom-right-c.gif" style="vertical-align:top;" /></div>';
    html += '</div>';

    html += '</div>';
    jQuery('body').append(html);

    jQuery('#fwBtnClose').click(ZennWindowClose);
    scroll(0, 0);
    document.documentElement.style.overflow = "hidden";
    jQuery('#fwModal').toggle('slow');

}

function ZennWindowClose() {
    jQuery('#fwOverlay').remove();
    jQuery('#fwModal').toggle('slow', function() {
        jQuery('#fwModal').remove();
        document.documentElement.style.overflow = "auto";
    });
}

function ZennWindowCloseAndRedirect(/*String*/URL) {
    ZennWindowClose();
    window.location = URL;
}

function ZennWindowCloseAndRefresh() {
    ZennWindowClose();  
    window.location.reload(true);
}

/*
* Validation Class
*
* Copyright (c) 2009-12-11   
* David Oliveira | david.oliveira@zenn.pt
* 
* Depends:
*	jQuery v1.3
*
* Example: Validation.IsEmail(email@email.com);
*
*/

var Validation = {
    IsEmail: function(str) {
        if (str.length == 0) return false;
        var re = /^[^\s()<>@,;:\/]+@\w[\w\.-]+\.[a-z]{2,}$/i
        return re.test(str);
    }
}


