var myThisId;
var rgxEmail=/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;

function AddCommas(pArea,nStr,nFormat) 
{
    if(window.event.keyCode==9||window.event.keyCode==16) 
    {
        return false;
    }
    else 
    {
        if(nFormat.indexOf('.')!="-1") 
        {
            nFormat=nFormat.split('.')[1].length-1

            nStrLen=nStr.length;
            nStrLastChar=nStr.substring(nStrLen-1,nStrLen);

            if(nStrLastChar=='0'||nStrLastChar=='1'||nStrLastChar=='2'||nStrLastChar=='3'||nStrLastChar=='4'||nStrLastChar=='5'||nStrLastChar=='6'||nStrLastChar=='7'||nStrLastChar=='8'||nStrLastChar=='9'||nStrLastChar=='-'||nStrLastChar==',') 
            {
                if(nStrLastChar=='-'&nStrLen>1) 
                {
                    nStr=nStr.substring(0,nStrLen-1);
                }

                if(nStrLastChar==',') 
                {
                    if(nStr.indexOf(',')<nStr.lastIndexOf(',')) 
                    {
                        nStr=nStr.substring(0,nStrLen-1);
                    }
                }

                if(nStr.indexOf(',')== -1) 
                {
                    nNum=1;

                    if(nStr.substring(0,1)=='-') 
                    {
                        nNum=2;
                    }

                    if(nStr.length>nNum&(nStr.substring(0,1)=='0'||nStr.substring(0,2)=='-0')) 
                    {
                        nStr=nStr.substring(0,nStrLen-1);
                    }
                }
            }
            else 
            {
                nStr=nStr.substring(0,nStrLen-1);
            }

            nStrLen=nStr.length;
            nNewStr="";

            for(i=0;i<=nStrLen-1;i++) 
            {
                nStrChar=nStr.substring(i,i+1);
                if(nStrChar=='0'||nStrChar=='1'||nStrChar=='2'||nStrChar=='3'||nStrChar=='4'||nStrChar=='5'||nStrChar=='6'||nStrChar=='7'||nStrChar=='8'||nStrChar=='9'||nStrChar=='-'||nStrChar==',') 
                {
                    nNewStr+=nStrChar;
                }
            }
            nStr=nNewStr;

            nSing='';

            if(nStr.substring(0,1)=='-') 
            {
                nSing='-';
                nStr=nStr.substring(1,nStr.length);
            }

            x=nStr.split(',');
            x1=x[0];
            x2=x[1];

            if(x1==null||x1=='') 
            {
                if(nStr.indexOf(',')!= -1) 
                {
                    x1=0;
                }
            }

            if(x2==null) 
            {
                nStr=AddCommasFormat(x1);
            }
            else
            {
                nX2Len=x2.length;

                if(nX2Len>nFormat) 
                {
                    nStr=AddCommasFormat(x1)+","+x2.substring(0,nFormat);
                }
                else 
                {
                    nStr=AddCommasFormat(x1)+","+x2;
                }
            }

            document.getElementById(pArea).value=nSing+nStr;
        }
        else 
        {
            nStrLen=nStr.length;
            nStrLastChar=nStr.substring(nStrLen-1,nStrLen);

            if(nStrLastChar=='0'||nStrLastChar=='1'||nStrLastChar=='2'||nStrLastChar=='3'||nStrLastChar=='4'||nStrLastChar=='5'||nStrLastChar=='6'||nStrLastChar=='7'||nStrLastChar=='8'||nStrLastChar=='9'||nStrLastChar=='-') 
            {
                if(nStrLastChar=='-'&nStrLen>1) 
                {
                    nStr=nStr.substring(0,nStrLen-1);
                }

                nNum=1;
                if(nStr.substring(0,1)=='-') 
                {
                    nNum=2;
                }

                if(nStr.length>nNum&(nStr.substring(0,1)=='0'||nStr.substring(0,2)=='-0')) 
                {
                    nStr=nStr.substring(0,nStrLen-1);
                }
            }
            else 
            {
                nStr=nStr.substring(0,nStrLen-1);
            }

            document.getElementById(pArea).value=nStr;
        }
    }
}

function AddCommasFormat(xStr) 
{
    z1=xStr;
    var rgx=/(\d+)(\d{3})/;
    while(rgx.test(z1)) 
    {
        z1=z1.replace(rgx,'$1'+'.'+'$2');
    }
    return z1;
}

function AddReCommas(pArea,nStr,nFormat,nMinVal) 
{
    if(nFormat.indexOf('.')!="-1") 
    {
        nFormat=nFormat.split('.')[1].length-1

        nSing='';
        if(nStr.substring(0,1)=='-') 
        {
            nSing='-';
            nStr=nStr.substring(1,nStr.length);
        }

        x=nStr.split(',');
        x1=x[0];
        if(x1==null||x1=='') 
        {
            if(nMinVal==null||nMinVal=='') 
            {
                nMinVal=0;
            }
            x1=nMinVal;
        }

        x2=x[1];

        if(x2==null) 
        {
            nStr=x1+",";
            for(i=0;i<=nFormat-1;i++) 
            {
                nStr+="0";
            }
        }
        else 
        {
            nX2Len=x2.length;

            if(nX2Len<nFormat) 
            {
                nStr=x1+","+x2;

                for(i=0;i<=nFormat-nX2Len-1;i++) 
                {
                    nStr+="0";
                }
            }
        }

        document.getElementById(pArea).value=nSing+nStr;
    }
    else 
    {
        if(nStr==null||nStr==''||nStr=='-') 
        {
            if(nMinVal==null||nMinVal=='') 
            {
                nMinVal=0;
            }
            nStr=nMinVal;
        }
        else
        {
            if(parseInt(nStr)<parseInt(nMinVal)) 
            {
                nStr=nMinVal;
            }
        }
        document.getElementById(pArea).value=nStr;
    }
}


function AddCommasText(nStr,nFormat) 
{
    if(nFormat.indexOf('.')!="-1") 
    {
        nFormat=nFormat.split('.')[1].length-1

        nStrLen=nStr.length;
        nStrLastChar=nStr.substring(nStrLen-1,nStrLen);

        if(nStrLastChar=='0'||nStrLastChar=='1'||nStrLastChar=='2'||nStrLastChar=='3'||nStrLastChar=='4'||nStrLastChar=='5'||nStrLastChar=='6'||nStrLastChar=='7'||nStrLastChar=='8'||nStrLastChar=='9'||nStrLastChar=='-'||nStrLastChar==',') 
        {
            if(nStrLastChar=='-'&nStrLen>1) 
            {
                nStr=nStr.substring(0,nStrLen-1);
            }

            if(nStrLastChar==',') 
            {
                if(nStr.indexOf(',')<nStr.lastIndexOf(',')) 
                {
                    nStr=nStr.substring(0,nStrLen-1);
                }
            }

            if(nStr.indexOf(',')== -1) 
            {
                nNum=1;

                if(nStr.substring(0,1)=='-') 
                {
                    nNum=2;
                }

                if(nStr.length>nNum&(nStr.substring(0,1)=='0'||nStr.substring(0,2)=='-0')) 
                {
                    nStr=nStr.substring(0,nStrLen-1);
                }
            }
        }
        else 
        {
            nStr=nStr.substring(0,nStrLen-1);
        }

        nStrLen=nStr.length;
        nNewStr="";

        for(i=0;i<=nStrLen-1;i++) 
        {
            nStrChar=nStr.substring(i,i+1);

            if(nStrChar=='0'||nStrChar=='1'||nStrChar=='2'||nStrChar=='3'||nStrChar=='4'||nStrChar=='5'||nStrChar=='6'||nStrChar=='7'||nStrChar=='8'||nStrChar=='9'||nStrChar=='-'||nStrChar==',') 
            {
                nNewStr+=nStrChar;
            }
        }
        nStr=nNewStr;

        nSing='';

        if(nStr.substring(0,1)=='-') 
        {
            nSing='-';
            nStr=nStr.substring(1,nStr.length);
        }

        x=nStr.split(',');
        x1=x[0];
        x2=x[1];

        if(x1==null||x1=='') 
        {
            if(nStr.indexOf(',')!= -1) 
            {
                x1=0;
            }
        }

        if(x2==null) 
        {
            nStr=AddCommasFormat(x1);
        }
        else 
        {
            nX2Len=x2.length;

            if(nX2Len>nFormat) 
            {
                nStr=AddCommasFormat(x1)+","+x2.substring(0,nFormat);
            }
            else 
            {
                nStr=AddCommasFormat(x1)+","+x2;
            }
        }
    }
    else 
    {
        nStrLen=nStr.length;
        nStrLastChar=nStr.substring(nStrLen-1,nStrLen);

        if(nStrLastChar=='0'||nStrLastChar=='1'||nStrLastChar=='2'||nStrLastChar=='3'||nStrLastChar=='4'||nStrLastChar=='5'||nStrLastChar=='6'||nStrLastChar=='7'||nStrLastChar=='8'||nStrLastChar=='9'||nStrLastChar=='-') 
        {
            if(nStrLastChar=='-'&nStrLen>1) 
            {
                nStr=nStr.substring(0,nStrLen-1);
            }

            nNum=1;
            if(nStr.substring(0,1)=='-') 
            {
                nNum=2;
            }

            if(nStr.length>nNum&(nStr.substring(0,1)=='0'||nStr.substring(0,2)=='-0')) 
            {
                nStr=nStr.substring(0,nStrLen-1);
            }
        }
        else 
        {
            nStr=nStr.substring(0,nStrLen-1);
        }
    }

    return nStr;
}

// ---------
// Light Box
// ---------
var divOverlay;

function LightBox(pWidth,pHeight,pType,pLink,pOverFlow) 
{
    divOverlay = document.createElement('div');
    divOverlay.setAttribute('id','divOverlay');
    divOverlay.style.display = 'none';
    divOverlay.style.position = 'absolute';
    divOverlay.style.top = '0';
    divOverlay.style.left = '0';
    divOverlay.style.zIndex = '1';
    if(document.all) { divOverlay.style.width = ScreenSize()[0] + "px"; } else { divOverlay.style.width = (parseInt(ScreenSize()[0]) - 20).toString() +"px"; }
    divOverlay.style.height = ScreenScroll() + PageSize()[1] + "px";
    divOverlay.style.backgroundImage='url(../../Tools/Images/Overlay.png)';
    divOverlay.style.display = 'block'
    divOverlay.onclick = function () { LightBoxClose(); return false; }
    bdyMsgBox=document.getElementsByTagName("body").item(0);
    bdyMsgBox.insertBefore(divOverlay,bdyMsgBox.firstChild);

    switch(pOverFlow) 
    {
        case "yes":
            pOverFlow="auto";
            break;
        case "no":
            pOverFlow="hidden";
            break;
        case "1":
            pOverFlow="auto";
            break;
        default:
            pOverFlow="hidden";
            break;
    }

    divLightBox=document.createElement('div');
    divLightBox.setAttribute('id','divLightBox');
    divLightBox.style.position='absolute';
    divLightBox.style.zIndex='2';
    divLightBox.style.border='Solid 1px #cccccc'
    divLightBox.style.backgroundColor='White';
    divLightBox.style.padding='10px 10px 0px 10px';
    divLightBox.style.width=pWidth+"px";
    divLightBox.style.height=(parseInt(pHeight)+30)+"px";
 
    tabTable=document.createElement('table');
    tabTable.setAttribute('cellpadding','0');
    tabTable.setAttribute('cellSpacing','0');
    tabBody=document.createElement('tbody');

    tabCell=document.createElement('td');
    tabCell.style.width='100%';

    // -------------------------------------------------------------------
    // IMAGE or IFRAME
    // -------------------------------------------------------------------
    switch(pType) 
    {
        case "IMAGE":
            divImage=document.createElement('div');
            divImage.setAttribute('id','divImage');
            divImage.style.zIndex='1';
            divImage.style.position='relative';
            divImage.style.textAlign='Center'
            divImage.style.width=pWidth+"px";
            divImage.style.height=(parseInt(pHeight))+"px";
            divImage.style.overflow= pOverFlow;
            imgImage=document.createElement("img");
            imgImage.src=pLink;

            divImage.appendChild(imgImage);

            tabCell.appendChild(divImage);
            break;

        case "DOCUMENT":
            divFrame=document.createElement('iframe');
            divFrame.setAttribute('id','divFrame');
            divFrame.style.zIndex='1';
            divFrame.style.textAlign='Center'
            divFrame.style.width=pWidth;
            divFrame.style.height=pHeight;
            if(pOverFlow=="hidden") 
            {
                divFrame.setAttribute('scrolling','no');
            }
            else
            {
                divFrame.setAttribute('scrolling',pOverFlow);
            }
            divFrame.src=pLink;

            tabCell.appendChild(divFrame);
            break;
    }

    tabRow=document.createElement('tr');
    tabRow.appendChild(tabCell);
    tabBody.appendChild(tabRow);

    // -------------------------------------------------------------------
    // CLOSE
    // -------------------------------------------------------------------
    imgClose=document.createElement('img');
    imgClose.src='../../Tools/Images/LightBoxClose.png';
    imgClose.onmouseover=function() { this.style.cursor='pointer'; }
    imgClose.onclick = function() { LightBoxClose();return false; }

    tabCell=document.createElement('td');
    tabCell.style.width='100%';
    tabCell.style.verticalAlign='middle';

    tabCell.appendChild(imgClose);

    tabRow=document.createElement('tr');
    tabRow.style.textAlign='Right'
    tabRow.style.verticalAlign='middle';
    tabRow.style.height= '30px';
    tabRow.appendChild(tabCell);

    tabBody.appendChild(tabRow);

    // -------------------------------------------------------------------
    // -------------------------------------------------------------------

    tabTable.appendChild(tabBody);

    divLightBox.appendChild(tabTable);

    divLightBox.style.top=(ScreenScroll()+((ScreenSize()[1]-pHeight)/2)-20)+"px";
    divLightBox.style.left=((ScreenSize()[0]-pWidth)/2)+"px";

    bdyLightBox=document.getElementsByTagName("body").item(0);
    bdyLightBox.insertBefore(divLightBox,bdyLightBox.firstChild);

    divOverlay.style.display='block';
}

function LightBoxClose() 
{
    divOverlay.style.display='none';
    divLightBox.style.display='none';
}

function ScreenSize() 
{
    if(self.innerHeight) 
    {
        xWidth=self.innerWidth;
        xHeight=self.innerHeight;
    }
    else if(document.documentElement&&document.documentElement.clientHeight) 
    {
        xWidth=document.documentElement.clientWidth;
        xHeight=document.documentElement.clientHeight;
    }
    else if(document.body) 
    {
        xWidth=document.body.clientWidth;
        xHeight=document.body.clientHeight;
    }

    return new Array(xWidth,xHeight);
}

function ScreenScroll() 
{
    if(self.pageYOffset) 
    {
        yScroll=self.pageYOffset;
    }
    else if(document.documentElement&&document.documentElement.scrollTop) 
    {
        yScroll=document.documentElement.scrollTop;
    }
    else if(document.body) 
    {
        yScroll=document.body.scrollTop;
    }

    return yScroll;
}

function PageSize() 
{
    if(window.innerHeight&&window.scrollMaxY) 
    {
        xWidth=document.body.scrollWidth;
        xHeight=window.innerHeight+window.scrollMaxY;
    }
    else
        if(document.body.scrollHeight>document.body.offsetHeight) 
        {
            xWidth=document.body.scrollWidth;
            xHeight=document.body.scrollHeight;
        }
        else 
        {
            xWidth=document.body.offsetWidth;
            xHeight=document.body.offsetHeight;
        }

    return new Array(xWidth,xHeight);
}

function EmailValidation(pEmail)
{
    if(rgxEmail.test(pEmail)==false) 
    {
        return false;
    }
    else 
    {
        return true;
    }
}

//-----------
// Image Zoom
//-----------
var myZoomImageSize="";

function ZoomImageSizeSet(pSize)
{
    myZoomImageSize=pSize;
}

function MouseMove(event,pThis,pTable,pPosition,pPadding,pTableWidth,pDivWidth) 
{
    if(myZoomImageSize==""||myZoomImageSize=="0|0") 
    {
        myZoomImageSize=document.getElementById(pThis.id.split('_')[0]+"_"+"imgZoom_Images").width+"|"+document.getElementById(pThis.id.split('_')[0]+"_"+"imgZoom_Images").height;
    }

    Set_DivZoomPosition(pThis.id.split('_')[0] + "_" + "divZoom_Images",pThis.id.split('_')[0] + "_" + pTable,pPosition,pPadding,pTableWidth, pDivWidth);

    if(document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").style.display != "")
    {
        document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").style.display = "";
        document.getElementById(pThis.id.split('_')[0] + "_" + "imgZoom_Images").src = pThis.src.replace("_" + pThis.src.split('/')[4].split('_')[1] + "_" + pThis.src.split('/')[4].split('_')[2],"");
    }

    myRate_x = Math.round((parseInt(myZoomImageSize.split('|')[0]) / parseInt(pThis.style.width.replace('px','')))*100)/100;
    myRate_y = Math.round((parseInt(myZoomImageSize.split('|')[1]) / parseInt(pThis.style.height.replace('px','')))*100)/100;

    if(event.pageX||event.pageY) 
    {
        myPos_x = event.pageX ;
        myPos_y = event.pageY ;
    }
    else if (event.clientX || event.clientY) 	
    {
        myPos_x = event.clientX + document.body.parentElement.scrollLeft ;
    	myPos_y = event.clientY + document.body.parentElement.scrollTop ;
    }
 
    myTable_x =document.getElementById(pThis.id.split('_')[0] + "_" + pTable).offsetLeft;
    myTable_y =document.getElementById(pThis.id.split('_')[0] + "_" + pTable).offsetTop;

    var myTable_obj = document.getElementById(pThis.id.split('_')[0] + "_" + pTable);

    while(myTable_obj.offsetParent) 
    {
        if(myTable_obj == document.getElementsByTagName('body')[0]) 
        {
            break;
        }
        else 
        {
            myTable_x = myTable_x + myTable_obj.offsetParent.offsetLeft;
            myTable_y = myTable_y + myTable_obj.offsetParent.offsetTop;
            myTable_obj = myTable_obj.offsetParent;
        }
    }

    myPos_x = parseInt(myPos_x) - parseInt(document.getElementById(pThis.id).offsetLeft) - parseInt(myTable_x);
    myPos_y = parseInt(myPos_y) - parseInt(document.getElementById(pThis.id).offsetTop) - parseInt(myTable_y);

    myDiv_x = Math.round(parseInt(document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").style.width.replace("px","")));
    myDiv_y = Math.round(parseInt(document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").style.height.replace("px","")));
        
    myPos_x = Math.round(parseInt(myPos_x) * myRate_x);
    myPos_y = Math.round(parseInt(myPos_y) * myRate_y);

    myPos_x = myPos_x - (myDiv_x / 2);
    myPos_y = myPos_y - (myDiv_y / 2)  ;

    document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").scrollLeft = myPos_x ;
    document.getElementById(pThis.id.split('_')[0] + "_" + "divZoom_Images").scrollTop = myPos_y - document.body.scrollTop;
}

function MouseOut(pThis) 
{
    document.getElementById(pThis.id.split('_')[0]+"_"+"imgZoom_Images").src="";
    document.getElementById(pThis.id.split('_')[0]+"_"+"divZoom_Images").style.display="none";
}

function Set_DivZoomPosition(pZoomId,pTableId,pPosition,pPadding,pTableWidth,pDivWidth) 
{
    if(document.getElementById(pZoomId).style.left.replace("px","").replace("pt","")=="0") 
    {
        myTable_x=document.getElementById(pTableId).offsetLeft
        myTable_y=document.getElementById(pTableId).offsetTop

        var myTable_obj=document.getElementById(pTableId);

        while(myTable_obj.offsetParent) 
        {
            if(myTable_obj==document.getElementsByTagName('body')[0]) 
            {
                break;
            }
            else 
            {
                myTable_x = myTable_x + myTable_obj.offsetParent.offsetLeft;
                myTable_y = myTable_y + myTable_obj.offsetParent.offsetTop;
                myTable_obj = myTable_obj.offsetParent;
            }
        }

        if(pPosition=="2") 
        {
            myDiv_x=parseInt(myTable_x)+parseInt(pTableWidth)+parseInt(pPadding);
            myDiv_y=myTable_y;
        }
        else 
        {
            myDiv_x=parseInt(myTable_x)-parseInt(pDivWidth)-parseInt(pPadding);
            myDiv_y=myTable_y;
        }

        document.getElementById(pZoomId).style.left=myDiv_x+"px";
        document.getElementById(pZoomId).style.top=myDiv_y+"px";
    }
}


// -------------------
// General Message Box
// -------------------
var divMsgBox;

function MsgBox(pIcon,pMessage,pButton,pFocus,pDoPostBackId) 
{
    MsgBoxClose('');

    divOverlay = document.createElement('div');
    divOverlay.setAttribute('id','divOverlay');
    divOverlay.style.display = 'none';
    divOverlay.style.position = 'absolute';
    divOverlay.style.top = '0';
    divOverlay.style.left = '0';
    divOverlay.style.zIndex = '0'; 
    if(document.all) { divOverlay.style.width = ScreenSize()[0] + "px"; } else { divOverlay.style.width = (parseInt(ScreenSize()[0]) - 20).toString() +"px"; }
    divOverlay.style.height = ScreenScroll() + PageSize()[1] + "px";
    divOverlay.style.backgroundImage='url(../../Tools/Images/Overlay.png)';
    divOverlay.style.display = 'block'
    bdyMsgBox=document.getElementsByTagName("body").item(0);
    bdyMsgBox.insertBefore(divOverlay,bdyMsgBox.firstChild);

    divMsgBox=document.createElement('div');
    divMsgBox.setAttribute('id','divMsgBox');
    divMsgBox.style.position='absolute';
    divMsgBox.style.zIndex='1';
    divMsgBox.style.textAlign='Center'
    
    tabTable_B = document.createElement('table');
    tabTable_B.setAttribute('cellpadding','0');
    tabTable_B.setAttribute('cellSpacing','0');
    
    tabBody_B = document.createElement('tbody');
    
    // -------------------------------------------------------------------
    // Üst Alan
    // -------------------------------------------------------------------
    
    tabRow_L1 = document.createElement('tr');
    
    tabCell_TL = document.createElement('td');
    tabCell_TL.style.width = '18px';
    tabCell_TL.style.backgroundImage='url(../../Tools/Images/MsgBoxTL.png)';
    tabCell_TL.style.backgroundRepeat = 'no-repeat';
    tabRow_L1.appendChild(tabCell_TL);

    //T
    tabCell_T = document.createElement('td');
    tabCell_T.style.height = '20px';
    tabCell_T.style.backgroundImage='url(../../Tools/Images/MsgBoxT.png)';
    tabCell_T.style.backgroundRepeat = 'repeat-x';
    tabRow_L1.appendChild(tabCell_T);

    //TR
    tabCell_TR = document.createElement('td');
    tabCell_TR.style.width = '20px';
    tabCell_TR.style.height = '20px';
    tabCell_TR.style.backgroundImage='url(../../Tools/Images/MsgBoxTR.png)';
    tabCell_TR.style.backgroundRepeat = 'no-repeat';
    tabRow_L1.appendChild(tabCell_TR);

    tabBody_B.appendChild(tabRow_L1);

    // -------------------------------------------------------------------
    // Orta Alan
    // -------------------------------------------------------------------
    tabRow_L2 = document.createElement('tr');
    
    //BL
    tabCell_L = document.createElement('td');
    tabCell_L.style.backgroundImage='url(../../Tools/Images/MsgBoxL.png)';
    tabCell_L.style.backgroundRepeat = 'repeat-y';
    tabRow_L2.appendChild(tabCell_L);

    //B
    tabCell_M = document.createElement('td');
    tabCell_M.style.padding='10px';

    //-----------------------------------------------------------------------
    //-----------------------------------------------------------------------

    tabTable_Msg = document.createElement('table');
    tabTable_Msg.setAttribute('cellpadding','0');
    tabTable_Msg.setAttribute('cellSpacing','0');

    tabBody_Msg = document.createElement('tbody');

    tabRow_Msg = document.createElement('tr');

    // ICON SET

    if(pIcon!="") 
    {
        tabCell_Msg = document.createElement('td');
        tabCell_Msg.style.padding='5px';
        tabCell_Msg.style.verticalAlign='top';

        imgIcon = document.createElement("img");

        switch(pIcon) 
        {
            case "Error":
                imgIcon.src='../../Tools/Images/Error.png';
                break;
            case "Info":
                imgIcon.src='../../Tools/Images/Info.png';
                break;
            case "Okey":
                imgIcon.src='../../Tools/Images/Okey.png';
                break;
            case "Question":
                imgIcon.src='../../Tools/Images/Question.png';
                break;
            case "Warning":
                imgIcon.src='../../Tools/Images/Warning.png';
                break;
            case "Process":
                imgIcon.src='../../Tools/Images/Process.gif';
                break;
            case "Basket":
                imgIcon.src='../../Tools/Images/Basket.png';
                break;
        }

        imgIcon.style.width='48px';
        imgIcon.style.height='51px';

        tabCell_Msg.appendChild(imgIcon);
        tabRow_Msg.appendChild(tabCell_Msg);
    }

    // MESSAGE

    tabCell_Msg = document.createElement('td');
    tabCell_Msg.style.padding='5px';
    tabCell_Msg.style.paddingLeft='15px';
    tabCell_Msg.setAttribute('nowrap','nowrap');

    labMessage=document.createElement('label');
    labMessage.style.fontFamily='Century Gothic';
    labMessage.style.fontSize='14px';
    labMessage.style.color='#000000'
    labMessage.innerHTML=pMessage;

    tabCell_Msg.appendChild(labMessage);
    tabRow_Msg.appendChild(tabCell_Msg);

    tabBody_Msg.appendChild(tabRow_Msg);
    tabTable_Msg.appendChild(tabBody_Msg);

    // -------------------------------------------------------------------
    // Button
    // -------------------------------------------------------------------
    if(pButton!="") 
    {
        tabRow_Btn = document.createElement('tr');

        tabCell_Btn = document.createElement('td');
        tabRow_Btn.appendChild(tabCell_Btn);

        tabCell_Btn = document.createElement('td');
        tabCell_Btn.setAttribute('align','center');
        tabCell_Btn.style.paddingTop = '10px';

        switch(pButton) 
        {
            case "OK":

                imgOK = document.createElement('img');
                imgOK.src = '../../Tools/Images/ButtonOK.png';
                imgOK.onclick = function() { MsgBoxClose(pFocus);return false; }
                imgOK.onmouseover = function() { this.style.cursor = 'pointer'; }

                tabCell_Btn.appendChild(imgOK);
                tabRow_Btn.appendChild(tabCell_Btn);
                break;

            case "YES/NO":

                imgYES = document.createElement('img');
                imgYES.src = '../../Tools/Images/ButtonYES.png';
                imgYES.onclick = function() { MsgBoxClose(pFocus);return true; }
                imgYES.onmouseover = function () { this.style.cursor = 'pointer'; }

                tabCell_Btn.appendChild(imgYES);
                tabRow_Btn.appendChild(tabCell_Btn);

                labSpace = document.createElement('label');
                labSpace.innerHTML = "&nbsp";

                tabCell_Btn.appendChild(labSpace);
                tabRow_Btn.appendChild(tabCell_Btn);

                imgNO = document.createElement('img');
                imgNO.src = '../../Tools/Images/ButtonNO.png';
                imgNO.onclick = function () { MsgBoxClose(pFocus); return false; }
                imgNO.onmouseover = function () { this.style.cursor = 'pointer'; }

                tabCell_Btn.appendChild(imgNO);
                tabRow_Btn.appendChild(tabCell_Btn);
                break;
          
          case "ADDBASKET":

                imgYES = document.createElement('img');
                imgYES.src = '../../Tools/Images/ButtonSHOP.png';
                imgYES.onclick = function () { MsgBoxClose(pFocus); return false;}
                imgYES.onmouseover = function () { this.style.cursor = 'pointer'; }

                tabCell_Btn.appendChild(imgYES);
                tabRow_Btn.appendChild(tabCell_Btn);

                labSpace = document.createElement('label');
                labSpace.innerHTML = "&nbsp";

                tabCell_Btn.appendChild(labSpace);
                tabRow_Btn.appendChild(tabCell_Btn);

                imgNO = document.createElement('img');
                imgNO.src = '../../Tools/Images/ButtonBASKET.png';
                imgNO.onclick = function() { MsgBoxClose(pFocus); ax_GoBasket();}
                imgNO.onmouseover = function () { this.style.cursor = 'pointer'; }

                tabCell_Btn.appendChild(imgNO);
                tabRow_Btn.appendChild(tabCell_Btn);
                break;
        }

        tabBody_Msg.appendChild(tabRow_Btn);
        tabTable_Msg.appendChild(tabBody_Msg);
    }

    //-----------------------------------------------------------------------
    //-----------------------------------------------------------------------

    tabCell_M.style.backgroundColor = 'White';
    tabCell_M.appendChild(tabTable_Msg);
    tabRow_L2.appendChild(tabCell_M);

    //TR
    tabCell_R = document.createElement('td');
    tabCell_R.style.width = '20px';
    tabCell_R.style.backgroundImage='url(../../Tools/Images/MsgBoxR.png)';
    tabCell_R.style.backgroundRepeat = 'repeat-y';
    tabRow_L2.appendChild(tabCell_R);

    tabBody_B.appendChild(tabRow_L2);

    // -------------------------------------------------------------------
    // Alt Alan
    // -------------------------------------------------------------------
    tabRow_L3 = document.createElement('tr');
    
    //BL
    tabCell_BL = document.createElement('td');
    tabCell_BL.style.backgroundImage='url(../../Tools/Images/MsgBoxBL.png)';
    tabCell_BL.style.backgroundRepeat = 'no-repeat';
    tabRow_L3.appendChild(tabCell_BL);

    //B
    tabCell_B = document.createElement('td');
    tabCell_B.style.height = '20px';
    tabCell_B.style.backgroundImage='url(../../Tools/Images/MsgBoxB.png)';
    tabCell_B.style.backgroundRepeat = 'repeat-x';
    tabRow_L3.appendChild(tabCell_B);

    //TR
    tabCell_BR = document.createElement('td');
    tabCell_BR.style.backgroundImage='url(../../Tools/Images/MsgBoxBR.png)';
    tabCell_BR.style.backgroundRepeat = 'no-repeat';
    tabRow_L3.appendChild(tabCell_BR);

    tabBody_B.appendChild(tabRow_L3);

    tabTable_B.appendChild(tabBody_B);

    divMsgBox.appendChild(tabTable_B);
    
    bdyMsgBox=document.getElementsByTagName("body").item(0);
    bdyMsgBox.insertBefore(divMsgBox,bdyMsgBox.firstChild);

    divMsgBox.style.display='block';

    divMsgBox.style.top=ScreenScroll()+((ScreenSize()[1]-divMsgBox.clientHeight)/2)+"px";
    divMsgBox.style.left=((ScreenSize()[0]-divMsgBox.clientWidth)/2)+"px";

    window.setInterval('_MsgBoxMove()',5);

    if(pButton=='CLOSE') { setTimeout("MsgBoxClose('')",2500); }
}

function MsgBoxMove() 
{
    divMsgBox.style.top=ScreenScroll()+((ScreenSize()[1]-divMsgBox.clientHeight)/2)+"px";
    divMsgBox.style.left=((ScreenSize()[0]-divMsgBox.clientWidth)/2)+"px";
}

function MsgBoxClose(pFocus) 
{
    if(document.getElementById('divMsgBox')!=null) 
    {
        divMsgBox.style.display='none';
        divOverlay.style.display='none';

        if(pFocus!='') 
        {
            document.getElementById(pFocus).focus();
        }
    }
}

function RadioButtonSelect(pId, pControl) 
{
    var myRadioButton = document.getElementsByTagName('input');            
             
    for(i = 0 ; i < myRadioButton.length - 1 ; i++)
    {
        if (myRadioButton[i].type == "radio") 
        {
            if (myRadioButton[i].id.indexOf(pControl) > 0)
            {
                myRadioButton[i].checked = false;
            }
        }
    }

    document.getElementById(pId).checked = true;
}


function Redirected()
{
    MsgBox("Process","Yönlendiriliyorsunuz... </br> Lütfen Bekleyiniz.","");
}

function Process()
{
    MsgBox("Process","İşlem Yapılıyor. </br> Lütfen Bekleyiniz.","");
}
