﻿Play_img = new Image();
Stop_img = new Image();
mp3_img = new Image();
Stop_img.src = "http://images.quran4u.net/Stop.gif";
Play_img.src = "http://images.quran4u.net/Play.gif";
mp3_img.src = "http://images.quran4u.net/icon_mp3.gif";

function openWindow(SS, AA) {
    width = 500;
    height = 350;
    x = (800 - width) / 2, y = (600 - height) / 2;

    if (screen) {
        y = (screen.availHeight - height) / 2;
        x = (screen.availWidth - width) / 2;
    }

    window.open('PopupTafseer.aspx?surah=' + SS + '&Ayah=' + AA, 'newWin', 'width=' + width + ',height=' + height + ',screenX=' + x + ',scrollbars=yes,screenY=' + y + ',top=' + y + ',left=' + x);
}

function openWindow2(SS, AA) {
    width = 500;
    height = 470;
    x = (800 - width) / 2, y = (600 - height) / 2;

    if (screen) {
        y = (screen.availHeight - height) / 2;
        x = (screen.availWidth - width) / 2;
    }

    window.open('http://www.qurancomplex.org/quran/ayat_services.asp?l=arb&nSora=' + SS + '&nAya=' + AA, 'newWin', 'width=' + width + ',height=' + height + ',screenX=' + x + ',scrollbars=yes,screenY=' + y + ',top=' + y + ',left=' + x);
}

function PopupVideo(SS) {
    width = 485;
    height = 430;
    x = (800 - width) / 2, y = (600 - height) / 2;

    if (screen) {
        y = (screen.availHeight - height) / 2;
        x = (screen.availWidth - width) / 2;
    }

    window.open('Video_AbdelBasit/' + SS + '.htm', 'newWin', 'width=' + width + ',height=' + height + ',screenX=' + x + ',scrollbars=yes,screenY=' + y + ',top=' + y + ',left=' + x);
}

function FP_swapImg() {//v1.0
    var doc = document, args = arguments, elm, n; doc.$imgSwaps = new Array(); for (n = 2; n < args.length;
 n += 2) {
        elm = FP_getObjectByID(args[n]); if (elm) {
            doc.$imgSwaps[doc.$imgSwaps.length] = elm;
            elm.$src = elm.src; elm.src = args[n + 1];
        } 
    }
}

function FP_preloadImgs() {//v1.0
    var d = document, a = arguments; if (!d.FP_imgs) d.FP_imgs = new Array();
    for (var i = 0; i < a.length; i++) { d.FP_imgs[i] = new Image; d.FP_imgs[i].src = a[i]; }
}

function FP_getObjectByID(id, o) {//v1.0
    var c, el, els, f, m, n; if (!o) o = document; if (o.getElementById) el = o.getElementById(id);
    else if (o.layers) c = o.layers; else if (o.all) el = o.all[id]; if (el) return el;
    if (o.id == id || o.name == id) return o; if (o.childNodes) c = o.childNodes; if (c)
        for (n = 0; n < c.length; n++) { el = FP_getObjectByID(id, c[n]); if (el) return el; }
    f = o.forms; if (f) for (n = 0; n < f.length; n++) {
        els = f[n].elements;
        for (m = 0; m < els.length; m++) { el = FP_getObjectByID(id, els[n]); if (el) return el; } 
    }
    return null;
}

var goto_top_type = -1;
var goto_top_itv = 0;

function goto_top_timer() {
    var y = goto_top_type == 1 ? document.documentElement.scrollTop : document.body.scrollTop;
    //alert(y);
    var moveby = 15; // set this to control scroll seed. minimum is fast

    y -= Math.ceil(y * moveby / 100);
    if (y < 0)
        y = 0;

    if (goto_top_type == 1)
        document.documentElement.scrollTop = y;
    else
        document.body.scrollTop = y;

    if (y == 0) {
        clearInterval(goto_top_itv);
        goto_top_itv = 0;
    }
}

function goto_top() {
    if (goto_top_itv == 0) {
        if (document.documentElement && document.documentElement.scrollTop)
            goto_top_type = 1;
        else if (document.body && document.body.scrollTop)
            goto_top_type = 2;
        else
            goto_top_type = 0;

        if (goto_top_type > 0)
            goto_top_itv = setInterval('goto_top_timer()', 25);
    }
}

function PopupSharawy(SS) {
    width = 800;
    height = 430;
    x = (800 - width) / 2, y = (600 - height) / 2;

    if (screen) {
        y = (screen.availHeight - height) / 2;
        x = (screen.availWidth - width) / 2;
    }

    window.open('http://elsharawy.com/sharawy.aspx?p_name_english=s' + SS, 'newWin', 'width=' + width + ',height=' + height + ',screenX=' + x + ',scrollbars=yes,screenY=' + y + ',top=' + y + ',left=' + x);
}

