﻿function switchTabs(oldTab1, oldTab2, newTab)
{
    if(document.getElementById(oldTab1) != null && document.getElementById(oldTab2) != null && document.getElementById(newTab) != null)
    {
        if(oldTab1 != 'null')
        {
            document.getElementById(oldTab1).style.display = "none";
        }
        if(oldTab2 != 'null')
        {
            document.getElementById(oldTab2).style.display = "none";
        }
        if(newTab != 'null')
        {
            document.getElementById(newTab).style.display = "block";  
        }
    }
}
function switchUpperTabs(oldTab, newTab)
{
    if(document.getElementById(oldTab) != null && document.getElementById(newTab) != null)
    {
        if(oldTab != 'null')
        {
            document.getElementById(oldTab).style.display = "none";
        }
        if(newTab != 'null')
        {
            if(window.navigator.appName.indexOf("Explorer") == -1)
            {
                document.getElementById(newTab).style.display = "table-cell";  
            }
            else
            {
                document.getElementById(newTab).style.display = "block";  
            }
        }
    }
}

function switchClasses(id, newClass)
{
    if(document.getElementById(id) != null)
    {
        document.getElementById(id).className = newClass;
    }
}
function customWindowOpen(strUrl, strWindow, strParams, iWidth, iHeight)
{
	try
	{
//		var iLeft, iTop;
//		iLeft = (window.screen.width - iWidth) / 2;
//		iTop = (window.screen.height - iHeight) / 2;
//		strParams = strParams + ",width=" + iWidth.toString() + ",height=" + iHeight.toString() + ",left=" + iLeft.toString() + ",top=" + iTop.toString();
        strParams = strParams + "fullscreen=yes";
		window.open(strUrl, strWindow, strParams);
	}
	catch (e) 
	{ 
		
	} 
}

function createSearchEvent()
{
   
    // In Case Of Pressing Enter Perform Search			
    if(event.keyCode == 13)
    {	
        __doPostBack('_ctl0$HeaderUC1$ButtonSearch$LinkButton2','')
                
        return false;
    }		
}
function GetImage(i)
{
        // first position
        if(position == 0)
        {
            if(i < 0)
            {
                return false;
                
            }            
        }

        // last position
        if(position == filenamearray.length-1)
        {
             if(i > 0)
            {
                return false;
            }
        }
        // 
        //debugger;
//        position+=i;
//        if(document.getElementById(imgContentItem) != null)
//        {
           position+=i;
           
           //document.getElementById(imgContentItem).style.display="block";
           
           document.getElementById(imgContentItem).src = 'ThumbnailImage.aspx?filename=' + filenamearray[position];
//        }
}

function SaveImage(i)
{
//debugger
        // first position
        if(position == 0)
        {
            if(i < 0)
            {
                return false;
            }            
        }
        // last position
        if(position == filenamearray.length-1)
        {
             if(i > 0)
            {
                return false;
            }
        }
        // 
        //debugger;
//        position+=i;
//        if(document.getElementById(imgContentItem) != null)
//        {
           position+=i;
           
           //document.getElementById(imgContentItem).style.display="block";
           
          
            var strUrl, strWindow, strParams;
		 
		    strWindow = null;
		    strUrl = 'SaveImage.aspx?filename=' + filenamearray[position];		    
		    strParams = null;
		    
		    window.location.href = '/ArchiveGov/Templates/ArchiveNavigation/SaveImage.aspx?filename=' + filenamearray[position];
	
		    
		    //window.open(strUrl, strWindow, strParams);
           
           //document.getElementById(lnkSaveImage).src = 'SaveImage.aspx?filename=' + filenamearray[position];
//        }
}


function OnLoadImage()
{
    // 
    if(filenamearray.length > 0)
    {
        document.getElementById(imgContentItem).src = 'ThumbnailImage.aspx?filename=' + filenamearray[position];
    }
}

function DisplayFullSize(mySrc)
{
    myWindow = window.open(rootpath + 'ThumbnailFrame.htm?filename=' + filenamearray[position] + '&fullsize=1', "printFrameDemo", "fullscreen=yes, scrollbars=auto,resizable=1");
    
}

var oArrPhText = new Array();
