﻿var Contact = (function () {
    var w = document.body.clientWidth, h = document.body.clientHeight;
    document.getElementById('lcCenter').style.left = (w / 2.5);
    var c = document.getElementById('ContactUs');
    c.onclick = function () {
        Contact.open('../pages/contact_us.aspx', { initialWidth: 490, initialHeight: 320 });
        return false;
    }
    c.href = '#'
    c = document.getElementById('SendNews');
    c.onclick = function () {
        Contact.open('sendNews.aspx', { initialWidth: 480, initialHeight: 365 });
        return false;
    }
    c.href = '#'
});
Contact.open = function (url, options) {
    var centerWidth = (options.initialWidth) ? options.initialWidth : 250,
 centerHeight = (options.initialHeight) ? options.initialHeight : 250,
 center = document.getElementById('lcCenter'),
 middle = document.body.scrollTop + (document.body.clientHeight / 2),
 frame = document.getElementById('lbIframe'),
 overlay = document.getElementById('lcOverlay');
    center.style.width = centerWidth,
 center.style.height = centerHeight,
 center.style.marginLeft = -centerWidth / 2,
 center.style.display = "";

    if (navigator.appName == 'Microsoft Internet Explorer') {
        center.style.top = Math.max(0, middle - (centerHeight / 2));
        center.style.position = "absolute"
    }

    overlay.style.height = document.body.scrollHeight;
    overlay.style.width = document.body.clientWidth;
    overlay.style.display = "";
    frame.src = url;
    return false;
}
Contact.isActive = function () { return document.getElementById('lcCenter').style.display != "none"; }
Contact.close = function () {
    document.getElementById('lcCenter').style.display = "none";
    document.getElementById('lcOverlay').style.display = "none"; return false;
}

function favoris() { if (navigator.appName == 'Microsoft Internet Explorer') { window.external.AddFavorite("http://www.mojahedin.org/", "سايت سازمان مجاهدين خلق ايران"); } else if (navigator.appName == 'Netscape') { window.sidebar.addPanel("سايت سازمان مجاهدين خلق ايران", "http://www.mojahedin.org", ""); } else if (navigator.appName == 'Opera') { alert('[CLTR] + D'); } else { alert(' [CMD] + D'); } return 0; }
