// JScript File

var h=0;
var HHTTPP = null;
var HHTTPP2 = null;
var htm1='h00h';
var htm2='h00h';
var htm3='h00h';
var htm4='h00h';

var bool = 'true';
var bool2= 'true';
function Creat()
    {
        if(window.ActiveXObject)
        {
            HHTTPP = new ActiveXObject('Microsoft.XMLHTTP');    
        }
        else
        {
            HHTTPP = new XMLHttpRequest();
        }
        return HHTTPP;
    }


function Creat2()
    {
        if(window.ActiveXObject)
        {
            HHTTPP2 = new ActiveXObject('Microsoft.XMLHTTP');    
        }
        else
        {
            HHTTPP2 = new XMLHttpRequest();
        }
        return HHTTPP2;
    }
    
function sendandR(num)
    {
        Creat();
        HHTTPP.open('POST','../parts/ajaxpalet/update.aspx?num='+num,true);
        HHTTPP.onreadystatechange = update;
        HHTTPP.send(null);        
    }
function update()
    {
        if(HHTTPP.readyState == 4)
        {
            if(HHTTPP.status == 200)
            {
                task ='<img alt="برای بستن مطلب کلیک کنید" src="../parts/ajaxpalet/pic/close.gif" onclick="closebutton()"  style="vertical-align: middle" /> اطلاعات دریافت شد';
                
                var htm = HHTTPP.responseText ;
                CLOSE();
                document.getElementById("HTMLINNERDIV00100200").innerHTML=htm;
                document.getElementById("taskdiv").innerHTML=task;
            }
            else if(HHTTPP.status == 404)
            {
                task ="اشکال در بر قراری ارتباط";
                document.getElementById("taskdiv").innerHTML=task;
            }
        }
        else
        {
            if(HHTTPP.readyState < 4 )
            {
               OPEN();
               task="لطفا کمی صبر کنید ...";
               document.getElementById("HTMLINNERDIV00100200").innerHTML='<img src="../parts/ajaxpalet/pic/loading.gif" width="35"><br />لطفا کمی صبر کنید ...      ';
            }
            else
                task="اشکال در دریافت اطلاعات";
        }
        document.getElementById("taskdiv").innerHTML=task;
    }

function tabletdover(td,num)
{

if(bool2=='true')
    {
    bool2='false';
    
        h=num;
        sendandR2(num);
    }
    if(num==1)
    {
        document.getElementById("td1").src="../parts/ajaxpalet/pic/row.gif";
    }
    if(num==2)
    {
        document.getElementById("td2").src="../parts/ajaxpalet/pic/row.gif";
    }
    if(num==3)
    {
        document.getElementById("td3").src="../parts/ajaxpalet/pic/row.gif";
    }
    if(num==4)
    {
        document.getElementById("td4").src="../parts/ajaxpalet/pic/row.gif";
    }
        td.style.backgroundColor="#AFDCFD";
}

function tabletdout(td,num)
{
if(num==1)
    {
    document.getElementById("td1").src="../parts/ajaxpalet/pic/row0.gif";
    }
    if(num==2)
    {document.getElementById("td2").src="../parts/ajaxpalet/pic/row0.gif";
    }
    if(num==3)
    {document.getElementById("td3").src="../parts/ajaxpalet/pic/row0.gif";
    }
    if(num==4)
    {document.getElementById("td4").src="../parts/ajaxpalet/pic/row0.gif";
    }
   td.style.backgroundColor="";
}

function tabletdclick(num)
{
    sendandR(num);
}
function OPEN()
{
    document.getElementById("HTMLINNERDIV00100200").style.height=50;
    document.getElementById("HTMLINNERDIV00100200").style.width=620;
    document.getElementById("HTMLINNERDIV00100200").style.fontSize=9;
    document.getElementById("HTMLINNERDIV00100200").style.backgroundColor= "";
}
function CLOSE()
{
    document.getElementById("HTMLINNERDIV00100200").style.height="";
    document.getElementById("HTMLINNERDIV00100200").style.width="";
    document.getElementById("HTMLINNERDIV00100200").style.fontSize="";
    document.getElementById("HTMLINNERDIV00100200").style.backgroundColor= "";
}
function add()
{
        document.getElementById("HTMLINNERDIV00100200").style.height=h;
    
}
function closebutton()
{
    document.getElementById("HTMLINNERDIV00100200").innerHTML="";
    document.getElementById("taskdiv").innerHTML="";    
}
function sendandR2(num)
    {
        if(num==1)
        {
            if(htm1=='h00h')
            {
            bool = 'true';
            }
            else
            {
                document.getElementById("HTMLINNERDIV001002002").innerHTML=htm1;
                bool = 'false';
                bool2='true';
            }
        }
        
        if(num==2)
        {
            if(htm2=='h00h')
            {
            bool = 'true';
            }
            else
            {
                document.getElementById("HTMLINNERDIV001002002").innerHTML=htm2;
                bool = 'false';
                bool2='true';
            }
        }
        
        if(num==3)
        {
            if(htm3=='h00h')
            {
            bool = 'true';
            
            }
            else
            {
                document.getElementById("HTMLINNERDIV001002002").innerHTML=htm3;
                bool = 'false';
                bool2='true';
            }
        }
        
        if(num==4)
        {
            if(htm4=='h00h')
            {
            bool = 'true';
            }
            else
            {
                document.getElementById("HTMLINNERDIV001002002").innerHTML=htm4;
                bool = 'false';
                bool2='true';
            }
        }
        if(bool == 'true')
        {
        Creat2();
        HHTTPP2.open('POST','../parts/ajaxpalet/update2.aspx?num='+num,true);
        HHTTPP2.onreadystatechange = update2;
        HHTTPP2.send(null); 
        }       
    }
function update2()
    {
    var task="";
        if(HHTTPP2.readyState == 4)
        {
            if(HHTTPP2.status == 200)
            {
                
                var htm = HHTTPP2.responseText ;
                document.getElementById("HTMLINNERDIV001002002").innerHTML=htm;
                bool2='true';
                if(h==1)
                    htm1=htm;
                    
                if(h==2)
                    htm2=htm;
                    
                if(h==3)                
                    htm3=htm;
                    
                if(h==4)
                    htm4=htm;
            }
            else if(HHTTPP2.status == 404)
            {
                task ="اشکال در بر قراری ارتباط";
                document.getElementById("taskdiv").innerHTML=task;
            }
        }
        else
        {
            if(HHTTPP2.readyState < 4 )
            {
               document.getElementById("HTMLINNERDIV001002002").innerHTML='<img src="../parts/ajaxpalet/pic/loading.gif" width="35"><br />لطفا کمی صبر کنید ...      ';
            }
            else
            {
                task="اشکال در دریافت اطلاعات";                
                document.getElementById("taskdiv").innerHTML=task;
            }
        }
    }
    sendandR2(1);
    
    
    function tableover2(td)
{
       td.style.backgroundColor="#FAFADC";
}
function tableout2(td)
{
   td.style.backgroundColor="";
}
