﻿var NPage='http://pallikalvi.in';var SKeyUrl='pallikalvi';
var ImageTimer;
var incrementer;
var TempImage;
var FadderElement=100;
var LoadPageTimer;
var PageValidater=
{
    Validate: function ()
    {
        try
        {
            if(window.navigator.appName!='Microsoft Internet Explorer')
            {
                window.setTimeout("try{window.parent.document.getElementById('Menuframe').height=document.body.offsetHeight;}catch(e){}",100); 
                window.setInterval("try{window.parent.document.getElementById('Menuframe').height=document.body.offsetHeight;}catch(e){}",100); 
            }
            else
            {
                window.setTimeout("try{window.parent.document.getElementById('Menuframe').style.height=document.body.offsetHeight;}catch(e){}",100); 
                window.setInterval("try{window.parent.document.getElementById('Menuframe').style.height=document.body.offsetHeight;}catch(e){}",100); 
            }
        
            document.oncontextmenu=function ss(){return false;}
            if(window.parent.location.href==window.location.href)
                window.parent.location.href=NPage;
            
            if(window.parent.location.href.toLowerCase().indexOf(SKeyUrl.toLowerCase())==-1)
                window.parent.location.href=NPage;
        }
        catch(e){}
        
        try
        {
        if(window.parent.location.href!=window.location.href) 
        if(String(window.parent.location.href).toLowerCase().indexOf('directorates')!=-1)
        {
            var DName=String(window.parent.location.href).toLowerCase().substring(String(window.parent.location.href).toLowerCase().indexOf('directorates')).split('/');
            var SheetName="#";
            var linklist=document.getElementsByTagName("link");   
            
           switch(DName[1])
            {
                case "dee":
                        if(String(window.location.href).toLowerCase().indexOf('dee')==-1)
                        SheetName="../DEE/css/Style4New.css";
                        else
                        SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                    break;
                case "dms":
                        if(String(window.location.href).toLowerCase().indexOf('dms')==-1)
                        SheetName="../DMS/css/Style4New.css";
                        else
                        SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                    break;
                case "dge":
                        if(String(window.location.href).toLowerCase().indexOf('dge')==-1)
                        SheetName="../DGE/css/Style4New.css";
                        else
                        SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                    break;
                case "dpl":
                        if(String(window.location.href).toLowerCase().indexOf('dpl')==-1)
                        SheetName="../DPL/css/Style4New.css";
                        else
                        SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                    break;
                case "pta":
                        if(String(window.location.href).toLowerCase().indexOf('pta')==-1)
                        SheetName="../PTA/css/Style4New.css";
                        else
                        SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                    break;
                case "dtert":
                    if(String(window.location.href).toLowerCase().indexOf('dtert')==-1)
                    SheetName="../DTERT/css/Style4New.css";
                    else
                    SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                break;
               case "dse":
                    if(String(window.location.href).toLowerCase().indexOf('dse')==-1)
                    SheetName="../dse/css/Style4New.css";
                    else
                    SheetName=String(window.location.href).toLowerCase().substring(0,String(window.location.href).toLowerCase().indexOf(DName[1])) + DName[1] +  "/css/Style.css";
                break;
            }
            
            if(DName[1]!='dpl' && DName[1]!='nfe')
           for(var i=0;i<linklist.length;i++){if(linklist[i].href.toLowerCase().indexOf('style.css')!=-1){linklist[i].href=SheetName;}}  
            
        }
        }
        catch(e){alert('Error Occured While Changing StyleSheet');}
        
    },
    
    ValidateHome: function()
    {
        try
        {
            document.oncontextmenu=function sss(){return false;}
            if(window.parent.location.href.toLowerCase().indexOf(SKeyUrl.toLowerCase())==-1)
                window.parent.location.href=NPage;
        }
        catch(e){}
    } 
}


    function LoadPopupImage(ImgURL)
    {
    document.getElementById('AD1').style.display='none';
        document.getElementById('AD2').style.display='none';
        document.getElementById('AD3').style.display='none';
        try{window.document.getElementById("embed1").style.display='none';}catch(e){}
    
        //try
        //{
          //  window.parent.document.getElementById("hideDocument").style.display='block';   
            //window.parent.document.getElementById("hideDocument").style.height=window.parent.document.documentElement.lastChild.childNodes[0].offsetHeight+20; 
            //window.parent.document.getElementById("FaderScreen").style.height=window.parent.document.getElementById("hideDocument").style.height 
            //window.parent.document.getElementById("imgloader").style.display='block';          
            //window.parent.document.getElementById("imageloader").innerHTML="<table style='border:3px solid #6e89dd;background-color:#eef0fc;'><tr><td style='width:1px'></td><td><img src='images/load.gif'></td><td style='font-family:Tahoma;font-size:11px;font-weight:bold'>Loading.. please wait</td><td style='width:10px'></td></tr></table>";
            
           // Preparepopupwindow(ImgURL);   
        //}
        //catch(e)
        //{
         //alert(e.message);   
        //} 
         try
        {
            window.document.getElementById("hideDocument").style.display='block';   
            window.document.getElementById("hideDocument").style.height=window.document.documentElement.lastChild.childNodes[0].offsetHeight+20; 
            window.document.getElementById("FaderScreen").style.height=window.document.getElementById("hideDocument").style.height 
            window.document.getElementById("imgloader").style.display='block';          
            window.document.getElementById("imageloader").innerHTML="<table style='border:3px solid #6e89dd;background-color:#eef0fc;'><tr><td style='width:1px'></td><td><img src='images/load.gif'></td><td style='font-family:Tahoma;font-size:11px;font-weight:bold'>Loading.. please wait</td><td style='width:10px'></td></tr></table>";
            
            Preparepopupwindow(ImgURL);   
        }
        catch(e)
        {
         alert(e.message);   
        } 
    }

function Preparepopupwindow(ImgURL)
{
      try
        {
            
            window.document.getElementById("imageloader").innerHTML="<table cellspacing=0 cellpadding=0 style='background-color:white'><tr><td align='left'></td><td align='right'><span onclick='javascript:ClosePopImage();' style='cursor:pointer;font-family:Tahoma;font-size:12px;letter-spacing:1px' onmouseover='javascript:this.style.textDecoration=\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"'>Close</span>&nbsp;</td></tr><tr><td colspan='3'><img id=\"graphimage\" src='" + ImgURL + "'></td></tr></table>";
            window.document.getElementById("FaderScreen").style.display='block';
            window.document.getElementById("FaderScreen").style.height=window.document.getElementById("hideDocument").style.height;    
            
            window.document.getElementById("imgloader").style.border='1px solid maroon';
            window.scrollTo(0,0);
            
            window.document.getElementById("imgloader").style.left=((screen.width-window.document.getElementById("imgloader").offsetWidth)/2);
            window.document.getElementById("imgloader").style.top=100;
        
            if(window.navigator.appName=='Microsoft Internet Explorer')  
            window.document.getElementById("FaderScreen").style.filter='Alpha(opacity=100)';        
            else
            window.document.getElementById("FaderScreen").style.opacity=1;  
                  
            incrementer=80;
            ImageTimer =window.setInterval("fader()",1);
            ImageTimer =window.setTimeout("fader()",1);
            window.scrollTo(0,0);
        }
        catch(e)
        {
        
        } 

        //try
        //{
            
           // window.parent.document.getElementById("imageloader").innerHTML="<table cellspacing=0 cellpadding=0 style='background-color:white'><tr><td align='left'></td><td align='right'><span onclick='javascript:ClosePopImage();' style='cursor:pointer;font-family:Tahoma;font-size:12px;letter-spacing:1px' onmouseover='javascript:this.style.textDecoration=\"underline\"' onmouseout='javascript:this.style.textDecoration=\"none\"'>Close</span>&nbsp;</td></tr><tr><td colspan='3'><img id=\"graphimage\" src='" + ImgURL + "'></td></tr></table>";
            //window.parent.document.getElementById("FaderScreen").style.display='block';
            //window.parent.document.getElementById("FaderScreen").style.height=window.parent.document.getElementById("hideDocument").style.height;    
            
           // window.parent.document.getElementById("imgloader").style.border='1px solid maroon';
            //window.parent.scrollTo(0,0);
            
            //window.parent.document.getElementById("imgloader").style.left=((screen.width-window.parent.document.getElementById("imgloader").offsetWidth)/2);
            //window.parent.document.getElementById("imgloader").style.top=100;
        
            //if(window.navigator.appName=='Microsoft Internet Explorer')  
           // window.parent.document.getElementById("FaderScreen").style.filter='Alpha(opacity=100)';        
            //else
            //window.parent.document.getElementById("FaderScreen").style.opacity=1;  
                  
            //incrementer=80;
            //ImageTimer =window.setInterval("fader()",1);
            //ImageTimer =window.setTimeout("fader()",1);
            //window.parent.scrollTo(0,0);
        //}
       // catch(e)
        //{
        
        //} 
}

function fader()
{
try
    {
            if(incrementer>=1)
            {
                
                if(window.navigator.appName=='Microsoft Internet Explorer')  
                {
                    window.document.getElementById("FaderScreen").style.filter='Alpha(opacity=' + String(incrementer) + ')'; 
                }
                else
                {
                    window.document.getElementById("FaderScreen").style.opacity=String(incrementer/100); 
                    window.document.getElementById('imgloader').style.left='20%';
                    window.document.getElementById('imgloader').style.top='20%';
                }
                try{window.document.getElementById('imgloader').style.left=((screen.width-window.document.getElementById('imgloader').offsetWidth)/2);}catch(e){}
                incrementer=incrementer-2;
                window.parent.scrollTo(0,0); 
            }
            else
            {
            window.clearTimeout(ImageTimer); 
            window.clearInterval(ImageTimer); 
            window.document.getElementById("FaderScreen").style.display='none';
            }
    }
    catch(e)
    {
        window.clearTimeout(ImageTimer); 
        window.clearInterval(ImageTimer); 
        window.document.getElementById("FaderScreen").style.display='none';
    } 
//    try
//    {
//            if(incrementer>=1)
//            {
//                
//                if(window.navigator.appName=='Microsoft Internet Explorer')  
//                {
//                    window.parent.document.getElementById("FaderScreen").style.filter='Alpha(opacity=' + String(incrementer) + ')'; 
//                }
//                else
//                {
//                    window.parent.document.getElementById("FaderScreen").style.opacity=String(incrementer/100); 
//                    window.parent.document.getElementById('imgloader').style.left='20%';
//                    window.parent.document.getElementById('imgloader').style.top='20%';
//                }
//                try{window.parent.document.getElementById('imgloader').style.left=((screen.width-window.parent.document.getElementById('imgloader').offsetWidth)/2);}catch(e){}
//                incrementer=incrementer-2;
//                window.parent.scrollTo(0,0); 
//            }
//            else
//            {
//            window.clearTimeout(ImageTimer); 
//            window.clearInterval(ImageTimer); 
//            window.parent.document.getElementById("FaderScreen").style.display='none';
//            }
//    }
//    catch(e)
//    {
//        window.clearTimeout(ImageTimer); 
//        window.clearInterval(ImageTimer); 
//        window.parent.document.getElementById("FaderScreen").style.display='none';
//    } 
}

function startFadding()
{
try
    {
        if(FadderElement>=0)
        {
            if(window.navigator.appName=='Microsoft Internet Explorer')
                document.getElementById("hideDocument").style.filter='Alpha(opacity=' + String(FadderElement) + ')';     
            else
                document.getElementById("hideDocument").style.opacity=String(FadderElement/100);
            
            FadderElement--;
        }
        else
        {
            
            
            if(FadderElement>=-1)
            { 
                document.getElementById("hideDocument").style.display ='none';
                
                if(window.navigator.appName=='Microsoft Internet Explorer')  
                document.getElementById("hideDocument").style.filter='Alpha(opacity=80)';
                else
                document.getElementById("hideDocument").style.opacity=0.8;
            }
            
            FadderElement--;
            window.document.getElementById("hideDocument").style.height=window.parent.document.body.offsetHeight+100; 
            window.clearTimeout(LoadPageTimer);      
            window.clearInterval(LoadPageTimer);        
        } 
    }
    catch(e)
    {
        if(FadderElement>=-1) 
        {
            document.getElementById("hideDocument").style.display ='none';
            
            if(window.navigator.appName=='Microsoft Internet Explorer')  
                document.getElementById("hideDocument").style.filter='Alpha(opacity=80)';
                else
                document.getElementById("hideDocument").style.opacity=0.8;
        }
        window.clearTimeout(LoadPageTimer);      
        window.clearInterval(LoadPageTimer);        
    }

//    try
//    {
//        if(FadderElement>=0)
//        {
//            if(window.navigator.appName=='Microsoft Internet Explorer')
//                document.getElementById("hideDocument").style.filter='Alpha(opacity=' + String(FadderElement) + ')';     
//            else
//                document.getElementById("hideDocument").style.opacity=String(FadderElement/100);
//            
//            FadderElement--;
//        }
//        else
//        {
//            
//            
//            if(FadderElement>=-1)
//            { 
//                document.getElementById("hideDocument").style.display ='none';
//                
//                if(window.navigator.appName=='Microsoft Internet Explorer')  
//                document.getElementById("hideDocument").style.filter='Alpha(opacity=80)';
//                else
//                document.getElementById("hideDocument").style.opacity=0.8;
//            }
//            
//            FadderElement--;
//            window.parent.document.getElementById("hideDocument").style.height=window.parent.document.body.offsetHeight+100; 
//            window.clearTimeout(LoadPageTimer);      
//            window.clearInterval(LoadPageTimer);        
//        } 
//    }
//    catch(e)
//    {
//        if(FadderElement>=-1) 
//        {
//            document.getElementById("hideDocument").style.display ='none';
//            
//            if(window.navigator.appName=='Microsoft Internet Explorer')  
//                document.getElementById("hideDocument").style.filter='Alpha(opacity=80)';
//                else
//                document.getElementById("hideDocument").style.opacity=0.8;
//        }
//        window.clearTimeout(LoadPageTimer);      
//        window.clearInterval(LoadPageTimer);        
//    }
}
function IFrameLoader(PageURL,PageWidth,PageHeight)
{
    try
    {
    
        document.getElementById("IFramesLoader").style.display='block';  
        document.getElementById("Iframeslloader").src=PageURL + "?" + new Date().getTime();   
        document.getElementById("Iframeslloader").style.width=PageWidth;
        document.getElementById("Iframeslloader").style.height=PageHeight;
        document.getElementById("hideDocument").style.display='block';
        document.getElementById("hideDocument").style.backgroundColor='#EEEEEE';
        if(window.navigator.appName=='Microsoft Internet Explorer')
        {
            document.getElementById("hideDocument").style.filter='Alpha(opacity=80)';
            document.getElementById("IFramesLoader").style.left=(screen.width-document.getElementById("IFramesLoader").offsetWidth)/2;
        }
        else
        {
            document.getElementById("hideDocument").style.opacity=0.8;
            document.getElementById("IFramesLoader").style.left="25%";
        }  
        document.getElementById("IFramesLoader").style.top='100px';
    }
    catch(e)
    {
      //alert(e.message);   
    } 
}
function CloseIframeViewer()
{
document.getElementById('AD1').style.display='block';
document.getElementById('AD2').style.display='block';
document.getElementById('AD3').style.display='block';
try{window.document.getElementById("embed1").style.display='block';}catch(e){}
    document.getElementById("IFramesLoader").style.display='none';
    document.getElementById("hideDocument").style.display='none';
    document.getElementById("Iframeslloader").src="";
}
function CloseIframeViewer1()
{
    //document.getElementById('AD1').style.display='block';
    //document.getElementById('AD2').style.display='block';
    //document.getElementById('AD3').style.display='block';
    try{window.document.getElementById("embed1").style.display='block';}catch(e){}
    document.getElementById("IFramesLoader").style.display='none';
    document.getElementById("hideDocument").style.display='none';
    document.getElementById("Iframeslloader").src="";
}
