var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
    if (document.getElementById != null)
    {
        var html = '<HTML>\n<HEAD>\n';
        
        if (document.getElementsByTagName != null)
        {
            var headTags = document.getElementsByTagName("head");
            if (headTags.length > 0)
                html += headTags[0].innerHTML;
        }

        html += '\n</HEAD>\n<BODY style="background-color:#FFFFFF">\n';

        var printReadyElem = document.getElementById("printReady");

        if (printReadyElem != null)
        {
            html += "<table align='center'cellpadding=0 cellspacing=0 border='0'>";
            html += "<tr><td width='780' height='186'>"
            html += "<img src='/Images/print/1.gif' width='780' height='186' />";
            html += "</td></tr>"
            html += "<tr><td align='center' height='100%' dir='ltr' width='780px' background='/images/print/2.gif' style='padding:0 0 0 0'>"
            html += "<div align='center' width='780px' style='padding:10 10 10 10' dir=rtl>";
            html += printReadyElem.innerHTML ;
            html += "</div>";
            html += "</td></tr>"
            html += "</table>";
        }
        else
        {
            alert("عفوا لايدعم متصفحك هذه الخاصية");
            return;
        }

        html += '\n</BODY>\n</HTML>';

        var printWin = window.open("","printSpecial");
        printWin.document.open();
        printWin.document.write(html);
        printWin.document.close();
        if (gAutoPrint)
            printWin.print();
    }
    else
    {
        alert("عفوا لايدعم متصفحك هذه الخاصية");
    }
}



function windowOpener(windowHeight, windowWidth, windowName, windowUri)
{
    //alert(windowUri);
    var centerWidth = (window.screen.width - windowWidth) / 2;
    var centerHeight = (window.screen.height - windowHeight) / 2;

    newWindow = window.open(windowUri, windowName, 'resizable=0,width=' + windowWidth + 
        ',height=' + windowHeight + 
        ',left=' + centerWidth + 
        ',top=' + centerHeight);
}

