﻿/*
* jQuery Address Plugin v1.1
* http://www.asual.com/jquery/address/
*
* Copyright (c) 2009 Rostislav Hristov
* Dual licensed under the MIT and GPL licenses.
* http://docs.jquery.com/License
*
* Date: 2009-12-23 14:27:00 +0200 (Wed, 23 Dec 2009)
*/
(function(a) { a.address = (function() { var c = function(i) { a(this).trigger(a.extend(a.Event(i), (function() { var ah = { value: this.value(), path: this.path(), pathNames: this.pathNames(), parameterNames: this.parameterNames(), parameters: {}, queryString: this.queryString() }; for (var ag = 0, p = ah.parameterNames.length; ag < p; ag++) { ah.parameters[ah.parameterNames[ag]] = this.parameter(ah.parameterNames[ag]) } return ah }).call(this))) }; var V = function() { c.call(a.address, "init") }; var o = function() { c.call(a.address, "change") }; var P = function() { var i = U.href.indexOf("#"); return i != -1 ? ae(q(U.href.substr(i + 1))) : "" }; var h = function() { try { return top.document != undefined ? top : window } catch (i) { return window } }; var F = function(p, i) { if (C.strict) { p = i ? (p.substr(0, 1) != "/" ? "/" + p : p) : (p == "" ? "/" : p) } return p }; var r = function(i, p) { return (j && U.protocol == "file:") ? (p ? Q.replace(/\?/, "%3F") : Q.replace(/%253F/, "?")) : i }; var af = function(ai) { for (var ag = 0, p = ai.childNodes.length, ah; ag < p; ag++) { if (ai.childNodes[ag].src) { l = String(ai.childNodes[ag].src) } if (ah = af(ai.childNodes[ag])) { return ah } } }; var X = function() { if (!t) { var p = P(); var i = !(Q == p); if (u && s < 523) { if (E != Y.length) { E = Y.length; if (typeof z[E - 1] != G) { Q = z[E - 1] } T(false) } } else { if (j && s < 7 && i) { U.reload() } else { if (i) { Q = p; T(false) } } } } }; var T = function(i) { o(); if (i) { c.call(a.address, "internalChange") } else { c.call(a.address, "externalChange") } n(w, 10) }; var w = function() { var p = (U.pathname + (/\/$/.test(U.pathname) ? "" : "/") + D.value()).replace(/\/\//, "/").replace(/^\/$/, ""); var i = window[C.tracker]; if (typeof i == g) { i(p) } else { if (typeof pageTracker != G && typeof pageTracker._trackPageview == g) { pageTracker._trackPageview(p) } else { if (typeof urchinTracker == g) { urchinTracker(p) } } } }; var e = function() { var i = f.contentWindow.document; i.open(); i.write("<html><head><title>" + ac.title + "</title><script>var " + x + ' = "' + P() + '";<\/script></head></html>'); i.close() }; var N = function() { if (!S) { S = B; if (j && s < 8) { var i = ac.getElementsByTagName("frameset")[0]; f = ac.createElement((i ? "" : "i") + "frame"); if (i) { i.insertAdjacentElement("beforeEnd", f); i[i.cols ? "cols" : "rows"] += ",0"; f.src = "javascript:false"; f.noResize = true; f.frameBorder = f.frameSpacing = 0 } else { f.src = "javascript:false"; f.style.display = "none"; ac.body.insertAdjacentElement("afterBegin", f) } n(function() { a(f).bind("load", function() { var p = f.contentWindow; var ag = p.location.href; Q = (typeof p[x] != G ? p[x] : ""); if (Q != P()) { T(false); U.hash = r(Q, B) } }); if (typeof f.contentWindow[x] == G) { e() } }, 50) } else { if (u) { if (s < 418) { a(ac.body).append('<form id="' + x + '" style="position:absolute;top:-9999px;" method="get"></form>'); J = ac.getElementById(x) } if (typeof U[x] == G) { U[x] = {} } if (typeof U[x][U.pathname] != G) { z = U[x][U.pathname].split(",") } } } n(function() { V(); T(false) }, 1); if (j && s >= 8) { ac.body.onhashchange = X } else { v(X, 50) } a("a[rel*=address:]").address() } }; var D = { baseURL: function() { var i = U.href; if (i.indexOf("#") != -1) { i = i.substr(0, i.indexOf("#")) } if (i.substr(i.length - 1) == "/") { i = i.substr(0, i.length - 1) } return i }, strict: function() { return C.strict }, history: function() { return C.history }, tracker: function() { return C.tracker }, title: function() { return ac.title }, value: function() { if (!ab) { return null } return q(F(r(Q, Z), Z)) }, path: function() { var i = this.value(); return (i.indexOf("?") != -1) ? i.split("?")[0] : i }, pathNames: function() { var p = this.path(); var i = p.split("/"); if (p.substr(0, 1) == "/" || p.length == 0) { i.splice(0, 1) } if (p.substr(p.length - 1, 1) == "/") { i.splice(i.length - 1, 1) } return i }, queryString: function() { var p = this.value(); var i = p.indexOf("?"); if (i != -1 && i < p.length) { return p.substr(i + 1) } }, parameter: function(am) { var aj = this.value(); var ag = aj.indexOf("?"); if (ag != -1) { aj = aj.substr(ag + 1); var al = aj.split("&"); var ak, ah = al.length, ai = []; while (ah--) { ak = al[ah].split("="); if (ak[0] == am) { ai.push(ak[1]) } } if (ai.length != 0) { return ai.length != 1 ? ai : ai[0] } } }, parameterNames: function() { var ah = this.value(); var p = ah.indexOf("?"); var ai = []; if (p != -1) { ah = ah.substr(p + 1); if (ah != "" && ah.indexOf("=") != -1) { var aj = ah.split("&"); var ag = 0; while (ag < aj.length) { ai.push(aj[ag].split("=")[0]); ag++ } } } return ai } }; var H = { strict: function(i) { C.strict = i }, history: function(i) { C.history = i }, tracker: function(i) { C.tracker = i }, title: function(i) { i = q(i); n(function() { I = ac.title = i; if (K && f && f.contentWindow && f.contentWindow.document) { f.contentWindow.document.title = i; K = Z } if (!M && aa) { U.replace(U.href.indexOf("#") != -1 ? U.href : U.href + "#") } M = Z }, 50) }, value: function(ag) { ag = ae(q(F(ag, B))); if (ag == "/") { ag = "" } if (Q == ag) { return } M = B; Q = ag; t = B; T(true); z[Y.length] = Q; if (u) { if (C.history) { U[x][U.pathname] = z.toString(); E = Y.length + 1; if (s < 418) { if (U.search == "") { J.action = "#" + Q; J.submit() } } else { if (s < 523 || Q == "") { var i = ac.createEvent("MouseEvents"); i.initEvent("click", B, B); var p = ac.createElement("a"); p.href = "#" + Q; p.dispatchEvent(i) } else { U.hash = "#" + Q } } } else { U.replace("#" + Q) } } else { if (Q != P()) { if (C.history) { U.hash = "#" + r(Q, B) } else { U.replace("#" + Q) } } } if ((j && s < 8) && C.history) { n(e, 50) } if (u) { n(function() { t = Z }, 1) } else { t = Z } } }; var x = "jQueryAddress", g = "function", G = "undefined", B = true, Z = false, A = a.browser, s = parseFloat(a.browser.version), aa = A.mozilla, j = A.msie, L = A.opera, u = A.safari, ab = Z, O = h(), ac = O.document, Y = O.history, U = O.location, v = setInterval, n = setTimeout, q = decodeURI, ae = encodeURI, ad = navigator.userAgent, f, J, l, I = ac.title, E = Y.length, t = Z, S = Z, M = B, K = B, z = [], y = {}, Q = P(), k = {}, C = { history: B, strict: B }; if (j) { s = parseFloat(ad.substr(ad.indexOf("MSIE") + 4)); if (ac.documentMode && ac.documentMode != s) { s = ac.documentMode != 8 ? 7 : 8 } } ab = (aa && s >= 1) || (j && s >= 6) || (L && s >= 9.5) || (u && s >= 312); if (ab) { for (var W = 1; W < E; W++) { z.push("") } z.push(P()); if (j && U.hash != P()) { U.hash = "#" + r(P(), B) } if (L) { history.navigationMode = "compatible" } af(document); var b = l.indexOf("?"); if (l && b > -1) { var m, d = l.substr(b + 1).split("&"); for (var W = 0, R; R = d[W]; W++) { m = R.split("="); if (/^(history|strict)$/.test(m[0])) { C[m[0]] = (isNaN(m[1]) ? /^(true|yes)$/i.test(m[1]) : (parseInt(m[1]) != 0)) } if (/^tracker$/.test(m[0])) { C[m[0]] = m[1] } } } a(N) } else { if ((!ab && U.href.indexOf("#") != -1) || (u && s < 418 && U.href.indexOf("#") != -1 && U.search != "")) { ac.open(); ac.write('<html><head><meta http-equiv="refresh" content="0;url=' + U.href.substr(0, U.href.indexOf("#")) + '" /></head></html>'); ac.close() } else { w() } } a.each(("init,change,internalChange,externalChange").split(","), function(ag, p) { k[p] = function(ah, i) { a(a.address).bind(p, i || ah, i && ah); return this } }); a.each(("strict,history,tracker,title,value").split(","), function(ag, p) { k[p] = function(i) { if (typeof i != "undefined") { if (ab) { H[p](i) } return a.address } else { return D[p]() } } }); a.each(("baseURL,path,pathNames,queryString,parameter,parameterNames").split(","), function(ag, p) { k[p] = function(i) { return D[p](i) } }); return k })(); a.fn.address = function(b) { a(this).click(function() { var c = b ? b.call(this) : /address:/.test(a(this).attr("rel")) ? a(this).attr("rel").split("address:")[1].split(" ")[0] : a(this).attr("href").replace(/^#/, ""); a.address.value(c); return false }) } } (jQuery));


/*
 * ICEBEL (C) 2010 http://www.zenn.pt 
 * Developed by David Oliveira | david.oliveira@zenn.pt 
 */

// Global Vars ////////////////////////////////////////
var AJAX = null;
var IDLANGUAGE = null;
var FIRSTLOAD = true;
var NOLOADURL = false;
var CONTENTMASTER = '#Page-Middle';
var PAGETITLE = '#TitlePage';

// Navigation /////////////////////////////////////////
jQuery.address.change(function(event) {
    if (FIRSTLOAD) Icebel.Start();
    
    if (NOLOADURL == false)
        LoadUrl(event);
    else
        NOLOADURL = false;

    if (FIRSTLOAD) FIRSTLOAD = false;
});

function LoadUrl(url) {

    var section = null;
    if (url.pathNames.length > 1) section = url.pathNames[1].toLowerCase();  
    
    if (section == null || section == '1') {
        LoadUrlContent('pages/Home.aspx', { IdLanguage: IDLANGUAGE }, 'POST', true, true, null);
        UI.MenuSelectOption(null);
    }
    if (Number(section) >= 2 && Number(section) <= 9 || Number(section) == 15 || Number(section) == 16) {
        LoadUrlContent('pages/Content.aspx', { IdLanguage: IDLANGUAGE, IdPage: section }, 'POST', true, true, null);
        if (Number(section) >= 2 && Number(section) <= 3 || Number(section) == 15) UI.MenuSelectOption(1);
        if (Number(section) >= 6 && Number(section) <= 8) UI.MenuSelectOption(5);
        if (Number(section) == 4 || Number(section) == 5 || Number(section) == 9) UI.MenuSelectOption(2);
    }
    if (Number(section) == 10) {
        var IdNotice = '';
        if (url.pathNames.length > 3) IdNotice = url.pathNames[3];
        LoadUrlContent('pages/Notice.aspx', { IdLanguage: IDLANGUAGE, IdPage: section, IdNotice: IdNotice }, 'POST', true, true, null);
        UI.MenuSelectOption(5);
    }
    if (Number(section) == 11) {
        var IdCategory = '';
        var id = $.address.parameter('id') == undefined ? '' : $.address.parameter('id');
        if (url.pathNames.length > 3) IdCategory = url.pathNames[3]; 
        LoadUrlContent('pages/Category.aspx', { IdLanguage: IDLANGUAGE, IdPage: section, IdCategory: IdCategory, Id: id }, 'POST', true, true, null);        
        UI.MenuSelectOption(3);
    }
    if (Number(section) == 12) {
        var IdProduct = url.pathNames[2];
        LoadUrlContent('pages/Product.aspx', { IdLanguage: IDLANGUAGE, IdPage: section, IdProduct: IdProduct }, 'POST', true, true, null);
        UI.MenuSelectOption(3);
    }
    if (Number(section) == 13) {        
        LoadUrlContent('pages/Customers.aspx', { IdLanguage: IDLANGUAGE, IdPage: section}, 'POST', true, true, null);
        UI.MenuSelectOption(4);
    }
    if (Number(section) == 14) {
        LoadUrlContent('pages/Newsletter.aspx', { IdLanguage: IDLANGUAGE, IdPage: section }, 'POST', true, true, null);
        UI.MenuSelectOption(4);
    }
    if (Number(section) == 17) {
        LoadUrlContent('pages/Sitemap.aspx', { IdLanguage: IDLANGUAGE, IdPage: section }, 'POST', true, true, null);
        UI.MenuSelectOption(4);
    }
    if (Number(section) == 20) {
        LoadUrlContent('pages/Search.aspx', { IdLanguage: IDLANGUAGE, SearchValue: url.pathNames[2], IdPage: section }, 'POST', true, true, null);
        UI.MenuSelectOption(null);
    }
    if (Number(section) == 19) {
        LoadUrlContent('pages/NewsletterSubscribe.aspx', { IdLanguage: IDLANGUAGE, Email: url.pathNames[2] }, 'POST', true, true, null);
        UI.MenuSelectOption(null);
    }   
}

function LoadUrlContent(URL, Vars, Method, PreLoading, ScrollTop, onLoaded, Attempt) {
    if (Attempt == null || Attempt == undefined) Attempt = 1;
    if (PreLoading) {
        jQuery(CONTENTMASTER).html('<div id="LoadingPage"><div id="LoadingPage-Content"><img src="images/default/loading1.gif" alt="" class="Icone" /></div></div>');
    }
    if (AJAX != null) AJAX.abort();
    AJAX = jQuery.ajax({
        url: URL, type: Method, data: Vars, cache: false, dataType: 'html',
        success: function (data, textStatus) {
            AJAX = null;
            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 = '!/1/Home/';
            _gaq.push(['_trackPageview', url]);
        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            AJAX = null;
            if (Attempt < 4)
                window.setTimeout(function() { LoadUrlContent(URL, Vars, Method, PreLoading, ScrollTop, onLoaded, Number(Attempt) + 1); }, 1000);
            else
                LoadErrorPage(XMLHttpRequest.statusText + '<br/>' + XMLHttpRequest.responseText); 
        }
    });

}

function LoadErrorPage(Description) {
    jQuery.ajax({
        url: 'pages/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) { }
    });
}

// ICEBEL /////////////////////////////////////////////
var Icebel = {
    Start: function () {
        IDLANGUAGE = $.url.attr('source');
        IDLANGUAGE = IDLANGUAGE.substr(IDLANGUAGE.indexOf('?') + 1, 2);
        UI.Start();
    },
    SubscribeNewsletter: function () {
        var InputId = '#NewsletterSubscribeEmail';
        var StatusId = '#NewsletterSubscribe-Status';
        var Color = '#7D7D7D';
        var email = jQuery.trim(jQuery(InputId).val());

        if (!Validation.IsEmail(email)) {
            jQuery(InputId).css('color', 'red');
            window.setTimeout(function () { jQuery(InputId).css('color', Color); }, 2500);
            return;
        }

        window.location = '#!/19/' + email + '/';
        jQuery(InputId).val('e-email');
        /*
        jQuery.ajax({ url: 'API.ashx', data: 'a=SubscribeNewsletter&Email=' + email + '&IdLanguage=' + IDLANGUAGE, type: 'POST', dataType: 'json',
        success: function (data, textStatus) { jQuery(StatusId).hide().html('<span class="Icon Icon-True">&nbsp;</span>').show('slow'); window.setTimeout(function () { jQuery(StatusId).hide('slow'); }, 2500); },
        error: function (XMLHttpRequest, textStatus, errorThrown) { }
        });*/
    },
    SendMessage: function () {
        var StatusId = '#ContactForm-Status';
        var Color = '#3C3C3C';
        var inputs = ['#ContactFormName', '#ContactFormEmail', '#ContactFormMessage'];

        for (var i = 0; i != inputs.length; ++i) {
            if (jQuery.trim(jQuery(inputs[i]).val()).length < 3 || (i == 1 && !Validation.IsEmail(jQuery.trim(jQuery(inputs[i]).val())))) {
                jQuery(inputs[i]).css('color', 'red');
                window.setTimeout(function () { jQuery(inputs[i]).css('color', Color); }, 2500);
                return;
            }
        }
        jQuery(StatusId).html('<img src="images/loading4.gif" alt="" />');
        jQuery.ajax({ url: 'API.ashx', data: 'a=SendMessage&Name=' + jQuery(inputs[0]).val() + '&Email=' + jQuery(inputs[1]).val() + '&Message=' + jQuery(inputs[2]).val() + '&IdLanguage=' + IDLANGUAGE, type: 'POST', dataType: 'json',
            success: function (data, textStatus) { jQuery(StatusId).hide().html('<span class="Icon Icon-True">&nbsp;</span>').show('slow'); window.setTimeout(function () { jQuery(StatusId).hide('slow'); }, 2500); },
            error: function (XMLHttpRequest, textStatus, errorThrown) { }
        });
    },
    Search: function () {
        window.location = '#!/20/' + jQuery('#SearchFormValue').val() + '/';
    }
}



// UI /////////////////////////////////////////////////
var UI = {
    Start: function () {
        var ie = jQuery.browser.msie;
        var version = jQuery.browser.version;
        UI.NoticesStart();

        $('.autoclean').focus(function () {
            if ($(this).val() == $(this).attr('title')) {
                $(this).val('');
            }
        });
        $('.autoclean').blur(function () {
            if ($(this).val() == '') $(this).val($(this).attr('title'));
        });
    },
    MenuSelectOption: function (id) {
        jQuery('.MenuOption-Selected').removeClass('MenuOption-Selected');
        jQuery('#MenuOption-' + id).addClass('MenuOption-Selected');
    },
    Notices: null,
    NoticesCurrent: null,
    NoticesStart: function () {
        UI.Notices = jQuery('.LastNotices-Item');
        UI.NoticesCurrent = -1;
        UI.NoticesNext();
    },
    NoticesLoad: function () {
        if (UI.Notices.length > 0) {
            jQuery('.LastNotices-Item-On').hide();
            jQuery('.LastNotices-Item-On').removeClass('LastNotices-Item-On');
            jQuery(UI.Notices[UI.NoticesCurrent]).show();
            jQuery(UI.Notices[UI.NoticesCurrent]).addClass('LastNotices-Item-On');
        }
    },
    NoticesNext: function () {
        UI.NoticesCurrent++;
        if (UI.NoticesCurrent >= UI.Notices.length) UI.NoticesCurrent = 0;
        UI.NoticesLoad();
    },
    NoticesPrev: function () {
        UI.NoticesCurrent--;
        if (UI.NoticesCurrent < 0) UI.NoticesCurrent = UI.Notices.length - 1;
        UI.NoticesLoad();
    },
    OpenSession: function () {
        Backoffice.Load('Login', 'pages/Session.aspx', 305, 140);
    }
}

// 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('/1/Home/'); },
                    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('/1/Home/'); },
		            error: function(XMLHttpRequest, textStatus, errorThrown) { LoadErrorPage(textStatus + ' ' + errorThrown); }
		        });
		    }, null
	    );
    }
}

// Utilities ////////////////////////////////////////

var Utilities = {
    PopupMessage: function(Message, TimeOut) {
        alert(Message);
    },
    PopupQuestion: function(Title, Question, YesFunction, NoFunction) {
        if (confirm(Question))
            YesFunction();
        else
            if (NoFunction != null)
            NoFunction();
    }
}


/*
* 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);
    }
}

/*
* 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(ZennWindowCloseAndRefresh);
    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);
}

