var windowWidth;// = getWidth();
var windowHeight;// = getHeight();


function getWidth() 
{
    var width;
    if (self.innerWidth)
     {  
        width = parent.self.innerWidth;
     }
else if (document.documentElement && document.documentElement.clientWidth) 
{
        width = parent.document.documentElement.clientWidth;
       
}
else if (document.body) 
{
        width = parent.document.body.clientWidth;
        
}
else 
{
        // don't know width
        width = 0;
}
    return width;
}

//Disable Right Click
function clickIE4()
{

if (event.button==2)
{

	return false;
}
}



function clickNS4(e)
{
	if (document.layers||document.getElementById&&!document.all)
	{
		if (e.which==2||e.which==3)
		{
		
		return false;
		}
	}
}

/*End - Disable right click*/


function openWindow(url,name) 
{
//avoid pop-up blocking
		name = 'w' + Math.round(Math.random()*(1000000000));
	w = screen.width - 10;
	h = screen.height - 40;
	nurl = url;
	window.open(nurl,name,'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,left=0,top=0,width=' + w + ',height=' + h);
}

function getHeight() {
    var height;
    //alert('height');
    if (self.innerHeight) {
      height = parent.self.innerHeight;
    }
    else if (document.documentElement && document.documentElement.clientHeight) {
        height = parent.document.documentElement.clientHeight;
    }
    else if (document.body) {
        height = parent.document.body.clientHeight;
    }
    else {
        // don't know height
        height = 0;
    }
    return height;
}


function download()
{
openStandardWindow('download.asp?FileName='+readCookie("PdfName"),'download');
}


/*********************************settings-start*****************************/
function setChanges()
{           


		/*check which radio button is clicked*/
		var radioCheckvalue;
		var ZoomCheckValue,ZoomCheckValue_M,standardview,magnifiedview;
		var i;
		windowWidth = getWidth();
		windowHeight = getHeight();
		//single page,two page 
		for (i = 0; i < document.Form1.RadioZoom.length; i++) 
		{
			if (document.Form1.RadioZoom[i].checked)
			{
			radioCheck = document.Form1.RadioZoom[i].value;
			}
		}
		//set the value of mode textbox
		document.getElementById("mode").value=radioCheck;
			
		
		//check zoom level
	
	for (i = 0; i < document.Form1.ZoomLevel.length; i++) 
		{
			if (document.Form1.ZoomLevel[i].checked)
			{
			//ZoomCheckValue = document.Form1.ZoomLevel[i].value;
		
			ZoomCheckValue = document.Form1.ZoomLevel[i].value;
			
			}
		}
		
		//full zomm
			if (document.Form1.chkIncZoomfactor.checked)
			{
			ZoomCheckValue_M ="true";
			}
	
		
		//document.getElementById("txtstandardviewpath").value=ZoomCheckValue;
		document.getElementById("fitheight").value =  ZoomCheckValue;
		document.getElementById("txtMagnifiedViewPath").value=ZoomCheckValue_M;
	
			//changeSelZoom(ZoomCheckValue);
		zu('settings_dialog');
		var pgno,mode;
		
		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=="" )
		{
		pgno=document.getElementById("pgno").value;
		mode=document.getElementById("mode").value;
		standardview=(document.getElementById("txtstandardviewpath").value);
		magnifiedview=(document.getElementById("txtMagnifiedViewPath").value);
		  windowHeight=(document.getElementById("txtWindowHeight").value);
		document.getElementById("detail").src="fullimage1.aspx?ed="+document.getElementById("hdQEid").value+"&pgno=" + pgno + "&mode=" + mode +"&Sresolution=" + windowWidth + "&Standardview=" + standardview + "&Magnifiedview=" + magnifiedview + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight=" + document.getElementById("fitheight").value;
 		
		}
	changepreview();
}


//function changeSelZoom(zoomvalue)
//{
//	windowWidth = getWidth();
//	windowHeight = getHeight();
//		
//     if (zoomvalue=="fs")
//    {          
//        return "fs";
//    }
//    else if(zoomvalue=="fh")
//    {return "fh";
//    }
//    else 
//	{
//		return zoomvalue;
//	
//	}
//}

function changepreview()
{

}


function changepreviewsetting(radioCheckmode,st,mg,fitparam)
{
var i;
	
		var mode;
		var Sresolution;//document.body.clientWidth;
		windowWidth = getWidth();
 		//Sresolution=windowWidth;
		mode=parent.document.getElementById("mode").value;
		pgno=parent.document.getElementById("pgno").value;
		//parent.document.getElementById("settingspreview").src="previewpage.aspx?pgno=" + pgno + "&mode=" + radioCheckmode +"&Sresolution=" + windowWidth + "&Standardview=" + st +"&Magnifiedview=" + mg +"&clintheight=" + windowHeight+ '&clintwidth=' +windowWidth + '&fitparam=' + fitparam ;
}

/**************************settings - end************************************/
function OpenContent()

{
var standardview,magnifiedview;
		var mode;
	//alert(readCookie("ContentPage"));
		var standardview,magnifiedview;
		windowWidth = getWidth();
		windowHeight = getHeight();
		var Sresolution=windowWidth;
		standardview=document.getElementById("txtstandardviewpath").value ;
		magnifiedview=document.getElementById("txtMagnifiedViewPath").value;
	
		document.getElementById("pgno").value =readCookie("ContentPage");
		mode=document.getElementById("mode").value ;
		  windowHeight=(document.getElementById("txtWindowHeight").value);
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+document.getElementById("hdQEid").value+"&pgno=" + document.getElementById("pgno").value + "&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight="+ document.getElementById("fitheight").value;
	   
		changestatus(document.getElementById("pgno").value);
		handlePageSrc();
}



function OpenCover()
{
	var standardview,magnifiedview;
	var mode;
	windowWidth = getWidth();
	windowHeight = getHeight();
	var Sresolution=windowWidth;
	
		standardview=document.getElementById("txtstandardviewpath").value ;
		magnifiedview=document.getElementById("txtMagnifiedViewPath").value;
		
		document.getElementById("pgno").value =1;
		mode=document.getElementById("mode").value ;
		  windowHeight=(document.getElementById("txtWindowHeight").value);
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+document.getElementById("hdQEid").value+"&pgno=1&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth+ "&fitheight="+ document.getElementById("fitheight").value;
	
		changestatus('1');
		handlePageSrc();
}



/*Handle goto*/
function gotopage(pageno)
{   
	var standardview,magnifiedview;
	var c,i;
	var standardview,magnifiedview;
	windowWidth = getWidth();
	windowHeight = getHeight();
	c=readCookie("LastPage");
	i=parseInt(c);
	if(pageno=="Cover 1")
			    pgno=1;			
	else if(pageno=="Cover 2")
	            pgno=2;				
	else if(pageno=="Cover 3")
				pgno=i-1;
	else if(pageno=="Cover 4")
				pgno=i;
	else
				pgno=pageno;
		
	
	standardview=parent.document.getElementById("txtstandardviewpath").value ;
		magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
		
		mode=document.getElementById("mode").value ;
		parent.document.getElementById("pgno").value=pgno;
		  windowHeight=(document.getElementById("txtWindowHeight").value);
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth+ "&fitheight="+ parent.document.getElementById("fitheight").value;
	changestatus(pgno);

	handlePageSrc();	
	changepreview();

}


function gotoTextPage()
{
var windowWidth = getWidth();
var pageno;
	var standardview,magnifiedview;
	var c,i;
	var standardview,magnifiedview;
	windowWidth = getWidth();
	windowHeight = getHeight();
	c=readCookie("LastPage");
	i=parseInt(c);
	
	pageno=parent.document.getElementById("ToolBar_TxtGoToPage").value;
		
	if(pageno=="Cover 1")
				pgno=1;
	else if(pageno=="Cover 2")
				pgno=2;
	else if(pageno=="Cover 3")
				pgno=i-1;
	else if(pageno=="Cover 4")
				pgno=i;
	else
				pgno=pageno;
		
	
	standardview=parent.document.getElementById("txtstandardviewpath").value ;
	magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
		
		mode=document.getElementById("mode").value ;
		parent.document.getElementById("pgno").value=pgno;
		  windowHeight=(document.getElementById("txtWindowHeight").value);
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;+ "&fitheight="+ parent.document.getElementById("fitheight").value;
	changestatus(pgno);

	handlePageSrc();	
	changepreview();
}


/*function to hide and show div tags - search,links,contents,archives,settings*/

function auf(bildertausch)
{
		
	windowWidth = getWidth();
	windowHeight = getHeight();
	createCookie("valueofdiv",bildertausch);
	document.getElementById("searchresult").value=bildertausch;
	if (bildertausch=="settings_dialog")
	{
		    
        var radiostandardview,radiomagnifiedview,radiomode;
        document.getElementById("download_dialog").style.visibility="hidden";
        document.getElementById("print_dialog").style.visibility="hidden";
        //document.getElementById("help_dialog").style.visibility="hidden";
        document.getElementById("archives_dialog").style.visibility="hidden";
        document.getElementById("find_dialog").style.visibility="hidden";			      
        document.getElementById("share_dialog1").style.visibility="hidden";	
        document.getElementById("comments_dialog").style.visibility="hidden"; 	    
        document.getElementById(bildertausch).style.visibility="visible";
        //show the radio buttons that are checked
        radiomode=readCookie("Mode");
		      
	    //check for magnified zoom value
		radiomode=parent.document.getElementById("mode").value;
					
		
	    if ("1"==radiomode)
	    {
    	   document.Form1.RadioZoom[0].checked=true;
	    }
	    else
	    {
			document.Form1.RadioZoom[1].checked=true;
	    }
        //zoom level sg

//        for (i = 1; i <= document.Form1.ZoomLevel.length; i++) 
//	        {
//        	
//		        if (i==document.getElementById("txtstandardviewpath").value)
//		        {
//			       // document.Form1.ZoomLevel[i].checked=true;
//		        }
//	        }
//	        //mode
        	
       // for (i = 0; i < document.Form1.ZoomLevel_M.length; i++) 
       // {
//		        if (document.getElementById("txtMagnifiedViewPath").value == "true")
//		        {
//			        document.Form1.chkIncZoomfactor.checked=true;
//		        }
      //  }        	
        //document.Form1.ZoomLevel[3].checked=true;
        //document.Form1.ZoomLevel_M[4].checked=true;
        changepreview();
	 }
		  
		else if (bildertausch=="archives_dialog")
		 {
            document.getElementById("download_dialog").style.visibility="hidden";
            document.getElementById("print_dialog").style.visibility="hidden";
            //document.getElementById("help_dialog").style.visibility="hidden";
            document.getElementById("find_dialog").style.visibility="hidden";
            document.getElementById("settings_dialog").style.visibility="hidden";           
            document.getElementById("share_dialog1").style.visibility="hidden";		
            document.getElementById("comments_dialog").style.visibility="hidden"; 	    
            document.getElementById(bildertausch).style.visibility="visible";
		  }
		 else if(bildertausch=="find_dialog")
		 {  
		    document.getElementById("download_dialog").style.visibility="hidden";
            document.getElementById("print_dialog").style.visibility="hidden";
            //document.getElementById("help_dialog").style.visibility="hidden";            
            document.getElementById("settings_dialog").style.visibility="hidden";			 
            document.getElementById("archives_dialog").style.visibility="hidden";
            document.getElementById("share_dialog1").style.visibility="hidden";		
            document.getElementById("comments_dialog").style.visibility="hidden"; 	  
            document.getElementById(bildertausch).style.visibility="visible";
		 }
				
//		 else if(bildertausch=="help_dialog")
//		 {    
//		      document.getElementById("download_dialog").style.visibility="hidden";   
//		      document.getElementById("print_dialog").style.visibility="hidden";
//		      document.getElementById("find_dialog").style.visibility="hidden";		     
//		      document.getElementById("settings_dialog").style.visibility="hidden";			
//		      document.getElementById("archives_dialog").style.visibility="hidden";
//		      document.getElementById("share_dialog1").style.visibility="hidden";	
//		      document.getElementById("comments_dialog").style.visibility="hidden"; 		   
//		      document.getElementById(bildertausch).style.visibility="visible";
//		 }
		 else if(bildertausch=="print_dialog")
		 {
		      document.getElementById("download_dialog").style.visibility="hidden";
		    //  document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("find_dialog").style.visibility="hidden";		     
		      document.getElementById("settings_dialog").style.visibility="hidden";			 
		      document.getElementById("archives_dialog").style.visibility="hidden";
		      document.getElementById("share_dialog1").style.visibility="hidden";		
		      document.getElementById("comments_dialog").style.visibility="hidden"; 	      
		      document.getElementById(bildertausch).style.visibility="visible";
		 }

		  else if(bildertausch=="share_dialog1")
		 {
		      document.getElementById("download_dialog").style.visibility="hidden";
		      document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("print_dialog").style.visibility="hidden";		    
		     // document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";			 
		      document.getElementById("archives_dialog").style.visibility="hidden";
		      document.getElementById("comments_dialog").style.visibility="hidden"; 	
		      document.getElementById(bildertausch).style.visibility="visible";		     
		      document.getElementById("sharewindow").src="mailanartical.aspx?pg="+ document.Form1.pgno.value + "&mode=" + document.Form1.mode.value + "&Sresolution=" + windowWidth;
		 }
		
		   else if(bildertausch=="download_dialog")
		 {
		
		      document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("print_dialog").style.visibility="hidden";		     
		     // document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";			  
		      document.getElementById("archives_dialog").style.visibility="hidden";		      
		      document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById("comments_dialog").style.visibility="hidden"; 	
		      document.getElementById(bildertausch).style.visibility="visible";
		  }
		    else if(bildertausch=="comments_dialog")
		 {
		
		      document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("print_dialog").style.visibility="hidden";		     
		     // document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";			  
		      document.getElementById("archives_dialog").style.visibility="hidden";		      
		      document.getElementById("share_dialog1").style.visibility="hidden";		     
		      document.getElementById(bildertausch).style.visibility="visible";
		      document.getElementById("CommentsWindow").src="comments.aspx?pg="+ document.Form1.pgno.value + "&mode=" + document.Form1.mode.value;
	
		  }
		  
	}
	
	
	/*Function to call thumb view of pages*/
	
	function handleThumbsClick()
	{
	//alert("hello:");
	document.getElementById("detail").src="javapagecontent.html";
	changepreview();
	}
	
	/* Function to close the div tags*/
	    
	function zu(bildertausch) 
	{
	try
	{
	 //createCookie("valueofdiv","0",-1);
    // createCookie("valueofdiv","0",1);
    // createCookie("valueofdiv","0");
     parent.document.getElementById("searchresult").value="";
     //alert(document.getElementById("searchresult").value);
     parent.document.getElementById(bildertausch).style.visibility="hidden";
     }
     catch(e)
     {
		alert("hello");
     }
    }	
    
    /*called onclick of image--when user moves to another page*/
    
    function removeComponent(pagename,pgno)
		{
		 	
		var i;
		var standardview,magnifiedview;
		var mode;
		 windowWidth = getWidth();		 
		windowHeight = getHeight();
		var Sresolution=windowWidth;		
		parent.document.getElementById("pgno").value =pgno;
		mode=parent.document.getElementById("mode").value ;
		standardview=parent.document.getElementById("txtstandardviewpath").value ;
		magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
		  windowHeight=(parent.document.getElementById("txtWindowHeight").value);
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+pgno+ "&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;
	
		changestatus(pgno);
			handlePageSrc();
			changepreview();
		}
		
		
   
/*set the image src in document*/

function movepic(img_name,img_src) 
{
document[img_name].src=img_src;
}

/*call to forms*/

function share()
 {
       	var pg;
		var mode;
		
		
		pg=parent.document.getElementById("pgno").value;
		mode=parent.document.getElementById("mode").value;
				
		var path="mailanartical.aspx?pg=" + pg + "&mode=" + mode ;
		
        window.open(path,"share"," dependent=no,toolbar=no,location=0,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,top=0,left=0,width=450,height=500,outerHeight=100")
       
    }
       
  function printpage()
 {
 window.open("printpage.aspx","prnt"," toolbar=no,location=0,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,top=0,left=0,width=450,height=260,titlebar=no")
 }
 
 
	 function forhelp()
   {
   window.open("help.aspx",""," toolbar=no,location=0,directories=no,status=no,scrollbars=no,resizable=no,menubar=no,top=0,left=0,width=791,height=596,titlebar=yes")
 }
 
 
var ie=document.all
var ns6=document.getElementById&&!document.all
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
var InitTwoWaitTime = 100;
win1=false
win2=false
win3=false
aa=1
bb="30523650"
var ie=document.all
var ns6=document.getElementById&&!document.all
var boxid
var parentid
var dragapproved=false
var z,x,y
var menu1=false;
var menu2=false;
function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "HTML" : "BODY"
//alert(firedobj.tagName);
//alert(firedobj.name);
//alert(firedobj.id);
if (firedobj.tagName!="INPUT" && firedobj.tagName!="scrollbar" && firedobj.id!="settings2" && firedobj.id!="archive1")
{
    while (firedobj.tagName!=topelement&&firedobj.className!="drag")
    {
    //alert(firedobj.tagName);
		
		firedobj=ns6? firedobj.parentNode : firedobj.parentElement
    }
   
 }

if (firedobj.className=="drag")
{
	dragapproved=true
	z=firedobj
	temp1=parseInt(z.style.left+0)
	temp2=parseInt(z.style.top+0)
	x=ns6? e.clientX: event.clientX
	y=ns6? e.clientY: event.clientY
	document.onmousemove=move
	return false
}
}

function move(e)
{
if (dragapproved)
{

z.style.left=ns6? temp1+e.clientX-x: temp1+event.clientX-x
z.style.top=ns6? temp2+e.clientY-y : temp2+event.clientY-y
if (parseInt(z.style.top)<32 )  
{
	
		z.style.top=32;
}

if (parseInt(z.style.left)<0 ) 
	z.style.left=0;
	//	alert(screen.width);
if(ie)
{
 if((z.style.left + 370) > screen.width)
 z.style.left=370;
 }
 if(ns6)
 {
 if((z.style.left + 370) > document.body.clientWidth)
 z.style.left=370;
  }

return false
}
}

function createCookie(name,value) 
{
   
  document.cookie = name+"="+value;
}



function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ')
     c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0)
    return c.substring(nameEQ.length,c.length);
  }
  return null;
}



function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


/*Handle Image src click*/
function handlePageSrc()
{
var pgno,i;
var c;

c=readCookie("LastPage");
i=parseInt(c);

pgno=parseInt(parent.document.getElementById("pgno").value);
if(pgno<1)
{
	pgno=1;
	parent.document.getElementById("pgno").value='1';
}
else if(pgno>i) 
{
	pgno=i;
	parent.document.getElementById("pgno").value=c;
}

//first page button
if(pgno=="1")
{	
    
    if(parent.document.getElementById("previous-page").src.indexOf("over")<=0)	
	document.getElementById("previous-page").src = document.getElementById("previous-page").src.replace(/.gif/, "_over.gif");
	
	
	 if(parent.document.getElementById("First-page").src.indexOf("over")<=0)
	 parent.document.getElementById("First-page").src = parent.document.getElementById("First-page").src.replace(/.gif/, "_over.gif");
}
else
{  
	parent.document.getElementById("previous-page").src = parent.document.getElementById("previous-page").src.replace(/_over/, "");	
 
	parent.document.getElementById("First-page").src = parent.document.getElementById("First-page").src.replace(/_over/, "");	
	
	
}

if(pgno==i)
{
     
 
   if(parent.document.getElementById("Next-page").src.indexOf("over")<=0)  
	 parent.document.getElementById("Next-page").src = parent.document.getElementById("Next-page").src.replace(/.gif/, "_over.gif");	
	 
	 if(parent.document.getElementById("Last-page").src.indexOf("over")<=0)  
 	parent.document.getElementById("Last-page").src = parent.document.getElementById("Last-page").src.replace(/.gif/, "_over.gif");
   
	
}
else
{   
	
	parent.document.getElementById("Next-page").src = parent.document.getElementById("Next-page").src.replace(/_over/, "");	
 	  
 	parent.document.getElementById("Last-page").src = parent.document.getElementById("Last-page").src.replace(/_over/, "");	
	
}


}




/*Handle previous Page click*/

function handlePreviousPageClick()
{
var c,lastpage,mode,pgno;
if(!parent.document.getElementById("pgno"))
		{
			//alert('in load');
			return false;
		}
		if(isNaN(parent.document.getElementById("pgno").value))
		{
			//alert('in load');
			return false;
		}
windowWidth = getWidth();
 windowHeight = getHeight();
var ie=document.all

		var ns6=document.getElementById&&!document.all
		//alert(isNaN(parent.document.getElementById("pgno").value));
		
		pgno=parseInt(parent.document.getElementById("pgno").value)
		if(pgno=="1")
		return;
		windowWidth = getWidth();
	 windowHeight = getHeight();
		
		
			mode=parent.document.getElementById("mode").value;
					if(mode==2)
					{
						if(pgno>1)
							pgno=parseInt(parent.document.getElementById("pgno").value) - 2;
						else
							pgno=parseInt(parent.document.getElementById("pgno").value);
					}
					else
					{
					
						if(pgno>1)
							pgno=parseInt(parent.document.getElementById("pgno").value) - 1;
						else
							pgno=parseInt(parent.document.getElementById("pgno").value);
					}
				standardview=parent.document.getElementById("txtstandardviewpath").value ;
				magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
			  windowHeight=(parent.document.getElementById("txtWindowHeight").value);
		
				parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;
				parent.document.getElementById("pgno").value=pgno;
		
		
		    changestatus(pgno);
			handlePageSrc();
			//changepreview();
			//alert(parent.document.getElementById("pgno").value);
			//if(parent.document.getElementById("pgno").value==3)			
			//window.open("webform5.aspx","","_blank");
}

function handleLastPageClick()
{
var c,nextpagevalue,pgno;
var i;
var standardview,magnifiedview;
if(!parent.document.getElementById("pgno"))
{
	return false;
}
if(isNaN(parent.document.getElementById("pgno").value))
{

	return false;
}
c=readCookie("LastPage");

if(parent.document.getElementById("pgno").value==c)
return;
standardview=parent.document.getElementById("txtstandardviewpath").value ;
magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
parent.document.getElementById("pgno").value=c;
mode=parent.document.getElementById("mode").value ;
windowHeight=(parent.document.getElementById("txtWindowHeight").value);
		
document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ c +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ "&clintheight=" + parent.document.body.clientHeight + '&clintwidth=' + parent.document.body.clientWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;


	c=readCookie("LastPage");
	pgno=c;
	changestatus(pgno);
			handlePageSrc();
			changepreview();
}
function changepage(pgno)
{
	var c,mode,pgno;
	var i,mode1;
	var standardview,magnifiedview;
	windowWidth = getWidth();
	windowHeight = getHeight();
		mode=document.getElementById("mode").value ;
		standardview=document.getElementById("txtstandardviewpath").value ;
		magnifiedview=document.getElementById("txtMagnifiedViewPath").value;
		parent.document.getElementById("pgno").value=pgno;
		windowHeight=(document.getElementById("txtWindowHeight").value);
		
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;
	
}
function handleNextPageClick()
{
var c,mode,pgno;
if(!parent.document.getElementById("pgno"))
{
	return false;
}
if(isNaN(parent.document.getElementById("pgno").value))
{

	return false;
}
var no=parent.document.getElementById("pgno").value;
var i,mode1;
c=readCookie("LastPage");
var standardview,magnifiedview;
windowWidth = getWidth();
windowHeight = getHeight();
if(parseInt(c)%2!=0 && (parseInt(no) +1)==c)
{

parent.document.getElementById("pgno").value=parseInt(no) +1;
}
if(parent.document.getElementById("pgno").value==c)
return;
		var ns6=document.getElementById&&!document.all;
		
	var ie=document.all;	
		if(parent.document.getElementById("pgno").value=="")
			parent.document.getElementById("pgno").value=1;
		if(parent.document.getElementById("mode").value=="")
			parent.document.getElementById("mode").value=2;
		mode=parent.document.getElementById("mode").value;
			if(mode==2)
				pgno=parseInt(parent.document.getElementById("pgno").value) + 2;
			else
				pgno=parseInt(parent.document.getElementById("pgno").value) + 1;
			standardview=parent.document.getElementById("txtstandardviewpath").value ;
			magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;			
            windowHeight=(parent.document.getElementById("txtWindowHeight").value);		
			parent.document.getElementById("pgno").value=pgno;
			parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;
	
		
			changestatus(pgno);
			handlePageSrc();
			//changepreview();
		/*	alert(parent.document.getElementById("pgno").value);
			if(parent.document.getElementById("pgno").value==3)			
			window.open("webform5.aspx","","_blank");*/

}


/*first page*/
function handleFirstPageClick()
{
        var standardview,magnifiedview;
		var ie=document.all
		var ns6=document.getElementById&&!document.all
		if(!parent.document.getElementById("pgno"))
		{
			return false;
		}
		if(isNaN(parent.document.getElementById("pgno").value))
		{

			return false;
		}
		pgno=parseInt(parent.document.getElementById("pgno").value)
		windowWidth = getWidth();
		windowHeight = getHeight();

		if(pgno=="1")
		return;
		//standardview=document.getElementById("txtstandardviewpath").value ;
		//magnifiedview=document.getElementById("txtMagnifiedViewPath").value;
		
	
		mode=parent.document.getElementById("mode").value;
		parent.document.getElementById("pgno").value=1;
		standardview=parent.document.getElementById("txtstandardviewpath").value ;
		magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
        windowHeight=(parent.document.getElementById("txtWindowHeight").value);
		
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno=1&mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ "&fitparam=" + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + "&clintwidth=" + windowWidth + "&fitheight="+ parent.document.getElementById("fitheight").value;
		
		//changepreview();
		changestatus("1");
	  
        handlePageSrc();
        //changepreview();
}





//for text serach
function movenext(pgno)
{

document.getElementById("startingrecord").value = pgno;
document.Form1.submit();
document.getElementById("startingrecord").value = pgno;

}

//for search in another site

function movenextsite(pgno,site)
{
alert("hello");
alert(site);
document.getElementById("startingrecord").value = pgno;
window.open(site);
}

function Changepg()
{

document.getElementById("detail").src="fullimage1.aspx";
}

function changediv()
	{

	document.Form1.submit();
	document.Form1.divtagsvisibility.value="find_dialog"
	if(document.Form1.divtagsvisibility.value=="find_dialog")
	document.getElementById("find_dialog").style.visibility="visible";
	}
	
function getsearchPage(pgno,searchword,pdfname,site,publication)
	{
	
		var  mode;
		var standardview,magnifiedview;
		var search;
		//alert("hello");
		windowWidth = getWidth();
		windowHeight = getHeight();
		
		//alert(windowHeight);
		if (document.all)
		{
			//alert("hello2");
			// IE version
				try 
				{
					var xml = new ActiveXObject("Microsoft.XMLHTTP");
					xml.Open( "GET", "SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno +"&mode="+ parent.document.getElementById("mode").value, false );
					xml.Send()
					rp=xml.responseText;
				}
				catch (e) 
				{
				var xml = new ActiveXObject("MSXML2.XMLHTTP.4.0");
				xml.Open( "GET", "SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno+"&mode="+ parent.document.getElementById("mode").value, false );
				xml.Send()
				rp=xml.responseText;
				}
			}
		else
		{
			// Mozilla/Netscrap 6+ version
			
					var xml=new XMLHttpRequest();
					xml.open("GET","SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno+"&mode="+ parent.document.getElementById("mode").value,false);
					xml.send(null);
					rp=xml.responseText;
		}
		//search="SearchInputPage.aspx?searchword=" + searchword + "&pdfname=" + pdfname + "&pageno=" + pgno;
		//window.open(search);
					//alert("hello4");
		mode=parent.document.getElementById("mode").value;
		parent.document.getElementById("pgno").value=pgno.toString();
	
		standardview=parent.document.getElementById("txtstandardviewpath").value ;
		magnifiedview=parent.document.getElementById("txtMagnifiedViewPath").value;
	    windowHeight=(parent.document.getElementById("txtWindowHeight").value);
		
		if (publication=="current")
		{
		
		parent.document.getElementById("detail").src="fullimage1.aspx?ed="+parent.document.getElementById("hdQEid").value+"&pgno="+ pgno +" &mode=" + mode + "&Sresolution=" + windowWidth + '&fitparam=' + windowHeight +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&Standardview=" + standardview + "&Magnifiedview=" + magnifiedview+"&search=S"+ "&fitheight="+ parent.document.getElementById("fitheight").value;
		
		}
		else
		{
		
		var site1=site + "?pg=" + pgno + " &mode=" + mode ;
		window.open(site1);
		
		}
		
		changestatus(pgno);
			//alert("hello8");
			
	}
	




var DELAY_AFTER_KEYDOWN = 50;  // in ms (1000 = 1s)
var ALT_KEY = 18;

var SHIFT_X_KEY     = 88;
var PAGE_UP_KEY     = 33;
var PAGE_DOWN_KEY   = 34;
var ARROW_UP_KEY    = 38;
var ARROW_DOWN_KEY  = 40;
var ARROW_LEFT_KEY  = 37;
var ARROW_RIGHT_KEY = 39;
//alert(document.captureEvents(Event.KEYDOWN));
var ns4 = (document.layers)? true:false;
var ie4 = (document.all)? true:false;

var current_x = 0; // Know where we are, scrolling around...
var current_y = 0; // Know where we are, scrolling around...

var last_x = 0; // So we remember where we were the last time we moved...
var last_y = 0; // So we remember where we were the last time we moved...

document.onkeydown = handleKeyDown;
window.onscroll    = handleScroll;

if (ns4) {
  document.captureEvents(Event.KEYDOWN);
}

function handleScroll () {
    current_x = document.body.scrollLeft || window.pageXOffset;
    current_y = document.body.scrollTop || window.pageYOffset;
}

/* **************************************************
   handleKeyDown()

   Responds to key press events.

 ************************************************** */

function handleKeyDown (e) {
if ((event.keyCode=='122') && window.opener)
window.close('fs');
  var pushed_key = 'default';

  if (ie4) {
    pushed_key = event.keyCode;
  } else {
    pushed_key = e.which;
    
  }

  setTimeout("getScrollPos("+pushed_key+")", DELAY_AFTER_KEYDOWN);
}


function getScrollPos(pushed){

  if (!ie4) { return; }

  // Note: all of these document.body.scrollTop and
  // document.body.scrollLeft entries are IE-specific, and will need a
  // netscape check using self.pageYOffset (and X)... I think.

  if(current_y == last_y) { // Then we're at the end, move on:
  //pushed == PAGE_DOWN_KEY  ||
    if ( pushed == ARROW_DOWN_KEY || pushed == PAGE_DOWN_KEY ) {
         handleNextPageClick();
    }
    //pushed == PAGE_UP_KEY ||
    if ( pushed == ARROW_UP_KEY || pushed == PAGE_UP_KEY){
   // alert('prev1');
      handlePreviousPageClick();
    }
  }

  if(current_x == last_x) { // Then we're at the end, move on:
    if (pushed == ARROW_LEFT_KEY){
   // alert('next2');
      handlePreviousPageClick();
    }
    if (pushed == ARROW_RIGHT_KEY){
  //alert('prev2');
      handleNextPageClick();
    }
  }

  last_x = current_x;
  last_y = current_y;
}

function changestatus(pgno)
{
		c=readCookie("LastPage");		
		if(parseInt(pgno)>parseInt(c))
				pgno=c;
		 if(pgno=="0")
		 pgno="1";
		
		var feature=readCookie("GoTo");
		
		if (feature=="DropDown")
		{
		if(pgno=="1")
		{
					parent.window.status="Cover 1";
					parent.document.getElementById("ToolBar_ddPages").value="1";
					
		}
			
		else if(pgno=="2")
		{

					parent.window.status="Cover 2";
					parent.document.getElementById("ToolBar_ddPages").value="2";
					
			
		}
		else if(parseInt(pgno)==parseInt(c)-1)
		{
					parent.window.status="Cover 3";
					parent.document.getElementById("ToolBar_ddPages").value=(parseInt(c)-1).toString();
					
		}
		else if(parseInt(pgno)==parseInt(c))
		{
					
					parent.window.status="Cover 4";
					parent.document.getElementById("ToolBar_ddPages").value=c.toString();
					
		}
		else
			{					
					parent.document.getElementById("ToolBar_ddPages").value=pgno;
					
					var tooltipval=parent.document.getElementById("tooltip1").value;
					
					var toolval= tooltipval.split(";");
					
					for(i=0;i<toolval.length;i++)
					{
					if(toolval[i].indexOf(pgno.toString() +":")==0)
					{
						var a=toolval[i].replace(pgno.toString() +":",'')
						if (isNaN(a))
							parent.window.status=a;
						else
							parent.window.status="Page " + a;
					 
					 }
					}
				
			}
	
	}
	
	if (feature=="Text")
	{
	//For GoTo TextBox
	if(pgno=="1")
		{
		
		
					parent.window.status="Cover 1";
					parent.document.getElementById("ToolBar_TxtGoToPage").value="1";
					
		}
			
		else if(pgno=="2")
		{	parent.window.status="Cover 2";
			parent.document.getElementById("ToolBar_TxtGoToPage").value="2";	
		}
		else if(parseInt(pgno)==parseInt(c)-1)
		{
					parent.window.status="Cover 3";
					parent.document.getElementById("ToolBar_TxtGoToPage").value=(parseInt(c)-1).toString();
		}
		else if(parseInt(pgno)==parseInt(c))
		{
					parent.window.status="Cover 4";
					parent.document.getElementById("ToolBar_TxtGoToPage").value=c.toString();
					
		}
		else
			{
					
					parent.document.getElementById("ToolBar_TxtGoToPage").value=pgno;					
					var tooltipval=parent.document.getElementById("tooltip1").value;					
					var toolval= tooltipval.split(";");					
					for(i=0;i<toolval.length;i++)
					{
					if(toolval[i].indexOf(pgno.toString() +":")==0)
					{
						var a=toolval[i].replace(pgno.toString() +":",'')
						if (isNaN(a))
							parent.window.status=a;
						else
							parent.window.status="Page " + a;
					 }
					}
					
			}
	
	}
		

		
}
function openReSizableWindow(url,name) {
	name = 'w' + Math.round(Math.random()*(1000000000));	
	nurl = url;
	window.open(nurl,name);//,'toolbar=no,menubar=no,resizable=yes,scrollbars=yes,left=0,top=0,width=' + w + ',height=' + h);
}
function openStandardWindow(url,name) 
{
	//alert('hiy');
	name = 'w' + Math.round(Math.random()*(1000000000));
	parent.window.open(url,name,'toolbar=yes,menubar=no,resizable=yes,scrollbars=no,left=5,top=5');
}

function zoomimagedimensions()
{
if (dragexecuted) return; 
	var imagezoomval=parent.document.getElementById("TxtZoomFolders").value;
	var imageval= imagezoomval.split(",");
	var zoomx;
	var zoomy;
    var k ;
    var size;
    var m,n;
    size = imageval.length-1;
	if (zoomfactor1 ==0)
	{
    var iL =document.getElementById("imp").offsetLeft;
    var iT= document.getElementById("imp").offsetTop;  
    var sWidth= document.getElementById("img0").style.width.replace("px","");
    sWidth = Number(sWidth); sWidth=sWidth/2;
    
      pagex=pagex-(iL-sWidth);   
      pagey=pagey-iT;
        //alert(pagex);
		zoomfactor1 = 1;
		var windowWidth1 = getWidth();
		var windowHeight1 = getHeight();
		document.getElementById("img1").style.display="block";
		document.getElementById("img0").style.display="none";
		setvideoDiv("img1");
		var i,j;
		
	   
	for (i=1; i<=(size/2); i++)
	    {   
	        if(document.getElementById("stSize").value==i)
		    { 
	            for(j=i+1; j<=(size/2); j++)
	            { 
			        if(document.getElementById("mfSize").value==j)
			        {
			            m=i*2;
			            n=j*2
			           
			           zoomx=imageval[n-2]/imageval[m-2];
				       zoomy=imageval[n-1]/imageval[m-1];
				       
				        break;	
			        }	
			       	   
			    } 
			     break;   	    
	        }
	       
	    }
	
	var windowWidth = getWidth();
	var windowHeight = getHeight();
	if ((windowWidth-60>pagex) && (windowHeight-60>pagey) &&  document.getElementById("mfSize").value<=10)
	{
		//alert("in");
		pagey=parseInt(eval((pagey*zoomy)-(windowHeight/2)),10);
		pagex=parseInt(eval((pagex*zoomx)-(windowWidth/2)),10);
		
	}
	else
	{	//alert("out");
	    pagey=parseInt(eval((pagey*zoomy)),10);
	    pagex=parseInt(eval((pagex*zoomx)),10);
	    
	}
	
	if (pagey < 0) 
	{
	pagey = 0;
	}
	if (pagex < 0)
	{
	pagex = 0;
	}

	scrollTo(pagex,pagey);
	
	
}
    else if (zoomfactor1 ==1)
    {

        zoomfactor1 = 0;
        document.getElementById("img0").style.display="block";
        document.getElementById("img1").style.display="none";
        setvideoDiv("img0");
    }
	
}
	
	function MyFuntion()
	{
	   setTimeout('zoomfactor()',50);
	}
