

if (document.layers)
{
		document.captureEvents(Event.MOUSEDOWN);
		document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById)
{
		document.onmousedown=clickIE4;
} 
document.oncontextmenu=new Function("return false;")


var windowWidth;
var windowHeight;
var ie=document.all
var ns6=document.getElementById&&!document.all

function fullScreen()
{
    var hdiff;
    window.resizeTo(screen.width/2,screen.height/2);
    window.moveTo(0,10);
    hdiff=window.screenTop;
    window.moveTo(-6,-hdiff+6);
    window.resizeTo(screen.width+13,screen.height+hdiff+26);
}

function fixdimention1()
{
    var wHeight
    windowWidth = getWidth();
    windowHeight = getHeight();
    document.getElementById("detail").width=windowWidth;	
   // 
   if (windowWidth < '1250')
    {
        //valResolution = "1024";
        wHeight=windowHeight-26
    }
    else if (windowWidth < '1370')
    {
        //valResolution = "1280";
        wHeight=windowHeight-32
    }
    else if (windowWidth < '1570')
    {
        //valResolution = "1400";
        wHeight=windowHeight-35
    }
    else if (windowWidth >= '1570')
    {
        //valResolution = "1600";
        wHeight=windowHeight-40
    }
   // alert(wHeight);
    document.getElementById("detail").height=wHeight;
    var imagezoomval=parent.document.getElementById("TxtZoomFolders").value;
    var imageval= imagezoomval.split(",");        
    var k ;
    var size;
    var m,catgry;
    catgry=-1;
    size = imageval.length-1;
   var maxSize=SizeAccWidth();
   //alert(maxSize);
    for (i=1; i<=maxSize; i++)
	    {   
	        m=i*2; 	    
	        if(imageval[m-1]> wHeight)
          		{    
                    catgry=i-1;
                    break;
                }						
	    }
	   
	if(catgry==-1)
    {
        document.getElementById("txtstandardviewpath").value=maxSize;
    }
   else if(catgry==0)
    {
        document.getElementById("txtstandardviewpath").value=1;
    }
    else
    {
        if(imageval[(2*catgry)+1]-wHeight<=15)
        {
            document.getElementById("txtstandardviewpath").value=catgry+1;
        }
        else
       { 
            document.getElementById("txtstandardviewpath").value=catgry;
       }

    }
   
    var sz =  "ZoomLevelsize"+document.getElementById("txtstandardviewpath").value;  
    //alert(sz);    
    document.getElementById(sz).checked=true;
    document.getElementById("txtMagnifiedViewPath").value=document.getElementById("txtstandardviewpath").value+3;
    if(document.getElementById("txtMagnifiedViewPath").value>10)
    {
        document.getElementById("txtMagnifiedViewPath").value=8;
    }
    fixdimention();			
	
}

		
function fixdimention()
{
	
		var scrOfY;
		var scrOfX;
	
		windowWidth = getWidth();
		windowHeight = getHeight();
		document.getElementById("searchsrc").height=windowHeight-200;	
		document.getElementById("archiveWindow").style.height=windowHeight-200;		
		document.getElementById("sharewindow").style.height=windowHeight-200;
        document.getElementById("CommentsWindow").style.height=windowHeight-200; 
        document.getElementById("detail").width=windowWidth;
		
		if(document.getElementById("searchresult").value != "")
		{
		    auf(document.getElementById("searchresult").value);
		}
		
		if(document.getElementById("mode").value=="")
		document.getElementById("mode").value="2";
		
		if(document.getElementById("ToolBar_hdPageNo").value<=0)
		{
		    if(document.getElementById("pgno").value=="")
		    document.getElementById("pgno").value="1";
		}
		else
		{
		    document.getElementById("pgno").value = document.getElementById("ToolBar_hdPageNo").value;		    
		}
		location.hash='pg'+document.getElementById("pgno").value;
//		if(Number(parent.document.getElementById("hdNumPageDRM").value)<1000)
//		{
//		auf('Drm_dialog');
//		}
//		else
//		{
//		    zu('Drm_dialog');
//		}
        if (document.Form1.chkIncZoomfactor.checked)
			{
			document.getElementById("txtMagnifiedViewPath").value ="true";
			}
	
		if(document.getElementById("detail").src.indexOf("javapagecontent.html")>=0  )
		{
			document.getElementById("detail").src="javapagecontent.html";
		}
		else if(document.getElementById("detail").src.indexOf("fullimage1.aspx")>=0 || document.getElementById("detail").src=="" )
		{           
			document.getElementById("detail").src="fullimage1.aspx?ed="+document.getElementById("hdQEid").value+"&pgno=" + document.Form1.pgno.value + "&mode=" +document.Form1.mode.value+"&Standardview="+ document.getElementById("txtstandardviewpath").value +"&clintheight=" + windowHeight+ '&clintwidth=' +windowWidth + "&magnifiedview=" + parent.document.getElementById("txtMagnifiedViewPath").value  ;		
		    changestatus(document.getElementById("pgno").value);
	        handlePageSrc();
	   
		}   
		
 }
		 
	function changediv()
	{
	createCookie("searchstring",document.Form1.search1.value);
	createCookie("per_page1",document.Form1.per_page.value);
	createCookie("doc_id1","1");
	var search_typevalue;
 
	for (i = 0; i < document.Form1.Radio1.length; i++) 
	{
	if (document.Form1.search_type[i].checked)
	search_typevalue = document.Form1.search_type[i].value;
	}
	createCookie("search_type12",search_typevalue);
	document.Form1.action="pages.aspx?divval=find_dialog";
	document.Form1.submit();
	if(document.Form1.divtagsvisibility.value=="find_dialog")
		document.getElementById("find_dialog").style.visibility="visible";
	}
	
	
	
		/*for drag & drop of div tag*/
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")

function movepic(img_name,img_src) 
{

document.getElementById(img_name).src=img_src;

}

document.onkeydown=function()
{	
	if(122==event.keyCode)
	{
window.moveTo(-4,-4);
window.resizeTo(screen.width+8,screen.availHeight+8);
}

}

function SizeAccWidth()
{ var size;
	 if (screen.width < '1020')
        {
            //valResolution = "800";
            size =  1;
           
        }
		 if (screen.width < '1272')
        {
            //valResolution = "1024";
             size =  3;          
        }

        else if (screen.width < '1392')
        {
            //valResolution = "1280";
             size =  5;
        }
         else if (screen.width < '1592')
        {
            //valResolution = "1400";
             size =  6;
        }
          else if (screen.width < '1792')
        {
            //valResolution = "1600";
             size =  7;
        }
        else if (screen.width < '1992')
        {   size =  8;
            //valResolution = "1800";
             
        }
        else if(screen.width >= '1992')
        { size =  9;
            //valResolution = "2000";
             
        }
        return size;
 }