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 if fullscreen mode is checked
		/*if (document.Form1.RadioFullScreen.checked)		
		{

		window.open("lightwave.aspx" ,"","channelmode=yes,target=_self");
		top.close();
		}
		*/
		//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 = changeSelZoom(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);
		  
		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=="small")
	{
		return "thumbnails\\small\\";
	
	}
	else if (zoomvalue=="large")
	{
		return "thumbnails\\large\\";
	
	}
	else if(zoomvalue=="large2")
	{
		return "thumbnails\\large2\\";
	
	
	}
	else if (zoomvalue=="largest")
	{
		return "thumbnails\\largest\\";
		
	}

	else if (zoomvalue=="largest2")
	{
		return "thumbnails\\largest2\\";

	}

	else if (zoomvalue=="largest3")
	{
		return "thumbnails\\largest3\\";
	}
//else if (zoomvalue=="fw")
//{

//		if (windowWidth>='1396')
//				{
//				 return "thumbnails\\large2\\";
//				}
//		else if ((windowWidth>=1260) && (windowWidth<1396))
//				{
//				//alert('in width');
//					 return "thumbnails\\large2\\";
//				
//				}
//				else if ((windowWidth>810) && (windowWidth<=1260))
//				{
//					 return "thumbnails\\large\\";
//					
//				}
//				else if (windowWidth<='810')
//				{
//					return "thumbnails\\small\\";
//				}
//		
//}
else if (zoomvalue=="fs")
{           return "fs";
	
			
//				//to be changed based on client requirement
//				if (windowWidth>='1396')
//				{
//				 return "thumbnails\\large2\\";
//				}
//				else if ((windowWidth>=1260) && (windowWidth<1396))
//				{
//				//alert('in width');
//					 return "thumbnails\\large2\\";
//				
//				}
//				else if ((windowWidth>=810) && (windowWidth<=1260))
//				{
//					 return "thumbnails\\large\\";
//					
//				}
//				else if (windowWidth<='810')
//				{
//					return "thumbnails\\small\\";
//				}
			
		}
}

function changepreview()
{
//var i;
//windowWidth = getWidth();

//var mode;
//var Sresolution;//document.body.clientWidth;
//		
//		Sresolution=windowWidth;
//		mode=parent.document.getElementById("mode").value;
//		pgno=parent.document.getElementById("pgno").value;
//		//parent.document.getElementById("settingspreview").src="previewpage.aspx?pgno=" + pgno + "&mode=" + mode +"&Sresolution=" + Sresolution + "&Standardview=" + parent.document.getElementById("txtstandardviewpath").value+"&Magnifiedview=" + parent.document.getElementById("txtMagnifiedViewPath").value+"&clintheight=" + windowHeight+ '&clintwidth=' +windowWidth + '&fitparam=' + parent.document.getElementById("fitheight").value ;
	
}




//function changeselpreview()
//{
////check if zoom level is different
//windowWidth = getWidth();
//windowHeight = getHeight();

//var zoomvalue,zoomvalue_M,fitparam;
//var MagnifiedCheckValue,StandardCheckValue;
//var i;

//var radioCheckmode;

//for (i = 0; i < document.Form1.RadioZoom.length; i++) 
//{
//			if (document.Form1.RadioZoom[i].checked)
//			{
//			radioCheckmode = document.Form1.RadioZoom[i].value;
//			}

//}
////check for magnified zoom value

////	for (i = 0; i < document.Form1.ZoomLevel_M.length; i++) 
////	{
//		if (document.Form1.chkIncZoomfactor.checked)
//		{
//		//MagnifiedCheckValue = i;
//		zoomvalue_M="true";
//		}

////	}


//	//check for standard zoom value

//	for (i = 0; i < document.Form1.ZoomLevel.length; i++) 
//	{
//	if (document.Form1.ZoomLevel[i].checked)
//	{
//		zoomvalue=document.Form1.ZoomLevel[i].value;

////		if (document.Form1.ZoomLevel[i].value=='fw')
////			{
////				fitparam='fw';
////			if (windowWidth>=1396)
////			{
////				StandardCheckValue=2;
////			}
////			else if ((windowWidth>=1260) && (windowWidth<1396))
////			{
////				StandardCheckValue=2;
////			}
////			else if ((windowWidth>=810) && (windowWidth<=1260))
////			{
////				StandardCheckValue=1;
////			}
////			else if (windowWidth<=810 )
////			{
////				StandardCheckValue=0;
////			}
////			
////			}
////		else if (document.Form1.ZoomLevel[i].value=='fh')
////			{
////			fitparam='fh';
////			//StandardCheckValue=1;
////			if (windowWidth>=1396)
////			{
////				StandardCheckValue=2;
////			}
////			else if ((windowWidth>=1260) && (windowWidth<1396))
////			{
////				StandardCheckValue=2;
////			}
////			else if ((windowWidth>=810) && (windowWidth<=1260))
////			{
////				StandardCheckValue=1;
////			}
////			else if (windowWidth<=810 )
////			{
////				StandardCheckValue=0;
////			}
////			}
//		
//			fitparam="";
//			StandardCheckValue = i;
//		
//			
//	}

//	}

//	//if user selected standard zoom value is greater than magnified zoom value then alert

////	if (MagnifiedCheckValue<StandardCheckValue)
////	{
////		alert("The 'Zoom Factor' selected must be larger than the 'Magazine Size'");
////		//change the standard zoom level
////	/*if (StandardCheckValue<=1)
////	{
////	
////	document.Form1.ZoomLevel_M[2].checked=true;
////	}*/
////	if (zoomvalue=='fw')
////	{
////	document.Form1.ZoomLevel_M[StandardCheckValue+1].checked=true;
////	zoomvalue_M=document.Form1.ZoomLevel_M[StandardCheckValue+1].value;
////	fitparam='fw';
////	}
////	else if (zoomvalue=='fh')
////	{
////	document.Form1.ZoomLevel_M[StandardCheckValue+1].checked=true;
////	zoomvalue_M=document.Form1.ZoomLevel_M[StandardCheckValue+1].value;
////	fitparam='fh';
////	}
////	else
////	{
////	document.Form1.ZoomLevel[MagnifiedCheckValue-1].checked=true;
////	zoomvalue=document.Form1.ZoomLevel_M[MagnifiedCheckValue-1].value;
////	fitparam='';
////	}
////		
////	}
////	else if (MagnifiedCheckValue == StandardCheckValue)
////	{
////	alert("The 'Zoom Factor' selected is similar to 'Magazine Size'.It must be larger");
////	/*if (StandardCheckValue<=1)
////	{
////	document.Form1.ZoomLevel_M[2].checked=true;
////	}*/
////		if (zoomvalue=='fw')
////		{
////			document.Form1.ZoomLevel_M[StandardCheckValue+1].checked=true;
////			zoomvalue_M=document.Form1.ZoomLevel_M[StandardCheckValue+1].value;
////			fitparam='fw';
////		}
////		else if (zoomvalue=='fh')
////		{
////			document.Form1.ZoomLevel_M[StandardCheckValue+1].checked=true;
////			zoomvalue_M=document.Form1.ZoomLevel_M[StandardCheckValue+1].value;
////			fitparam='fh';
////		}
////		else if (MagnifiedCheckValue<=0)
////		{
////			document.Form1.ZoomLevel_M[StandardCheckValue+1].checked=true;
////			zoomvalue_M=document.Form1.ZoomLevel_M[StandardCheckValue+1].value;
////		}
////		else
////		{
////			document.Form1.ZoomLevel[MagnifiedCheckValue-1].checked=true;
////			zoomvalue=document.Form1.ZoomLevel[MagnifiedCheckValue-1].value;
////		}
////		
////	}

////var st=changeSelZoom(zoomvalue);
////var mg=changeSelZoom(zoomvalue_M);
////changepreviewsetting(radioCheckmode,st,mg,fitparam);
//}

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 ;
		
		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 ;
		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;
		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;
		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

        for (i = 0; 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;
		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 imgurl()
//{
//document.getElementById("Topbar1_ImageButton2").src="images-1024/Download_13_over.jpg";
//document.getElementById("Topbar2_ImageButton1").src="images-800/Download_13_over.jpg";
//}

//function imgurlout()
//{
//document.getElementById("Topbar1_ImageButton2").src="images-1024/Download_13.jpg";
//document.getElementById("Topbar2_ImageButton1").src="images-800/Download_13.jpg";
//}
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;
			
				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 ;
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;
		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;
			//alert(windowHeight);
			//alert(standardview);

			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;

		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;
			
		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;
//}	



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)
{

		//alert(pgno);
		//alert(parent.document.getElementById("Topbar1:gotopage1").value);
		//alert(parent.document.getElementById("Topbar2:gotopage1").value);
		c=readCookie("LastPage");
		//alert(c);
		//alert(pgno);
		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";
					//parent.document.getElementById("Topbar1_gotopage1").value="1";
					//parent.document.getElementById("topbar7:gotopage1").value="1";
					//parent.document.getElementById("topbarbig:gotopage1").value="1";
					//parent.document.getElementById("topbar7_gotopage1").value="1";
					//parent.document.getElementById("topbarbig_gotopage1").value="1";
		}
			
		else if(pgno=="2")
		{

					parent.window.status="Cover 2";
					parent.document.getElementById("ToolBar_ddPages").value="1";
					//parent.document.getElementById("Topbar1_gotopage1").value="2";
					//parent.document.getElementById("topbar7_gotopage1").value="2";
					//parent.document.getElementById("topbarbig_gotopage1").value="2";
					
			
		}
		else if(parseInt(pgno)==parseInt(c)-1)
		{
					parent.window.status="Cover 3";
					parent.document.getElementById("ToolBar_ddPages").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("Topbar1_gotopage1").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("topbar7_gotopage1").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("topbarbig_gotopage1").value=(parseInt(c)-1).toString();
		
		}
		else if(parseInt(pgno)==parseInt(c))
		{
					//alert(c);
					//alert(pgno);
					parent.window.status="Cover 4";
					parent.document.getElementById("ToolBar_ddPages").value=c.toString();
					//parent.document.getElementById("Topbar1_gotopage1").value=c.toString();
					//parent.document.getElementById("topbar7_gotopage1").value=c.toString();
					//parent.document.getElementById("topbarbig_gotopage1").value=c.toString();
					
			
		}
		else
			{
					//alert('hitt');
					parent.document.getElementById("ToolBar_ddPages").value=pgno;
					//parent.document.getElementById("Topbar1_gotopage1").value=pgno;
					//parent.document.getElementById("topbar7_gotopage1").value=pgno;
					//parent.document.getElementById("topbarbig_gotopage1").value=pgno;
				
					var tooltipval=parent.document.getElementById("tooltip1").value;
					//alert(tooltipval);
					var toolval= tooltipval.split(";");
					//alert(toolval[0]);
					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;
					 //parent.window.status=toolval[i].replace(pgno.toString() +":",'');
					 //exit;
					 }
					}
					//parent.window.status="Page " +pgno.toString();
						//alert(parent.document.getElementById("Topbar2_gotopage1").innerHTML);
					//alert(parent.document.getElementById("Topbar2_gotopage1").value);
			
			
			}
	
	
	}
	
	if (feature=="Text")
	{
	//For GoTo TextBox
	if(pgno=="1")
		{
		
		
					parent.window.status="Cover 1";
					parent.document.getElementById("ToolBar_TxtGoToPage").value="1";
					//parent.document.getElementById("Topbar1_TxtGoToPage1024").value="1";
					//parent.document.getElementById("topbar7:gotopage1").value="1";
					//parent.document.getElementById("topbarbig:gotopage1").value="1";
					//parent.document.getElementById("topbar7_TxtGoToPage").value="1";
					//parent.document.getElementById("topbarbig_TxtGoToPage1400").value="1";
		}
			
		else if(pgno=="2")
		{

					parent.window.status="Cover 2";
					parent.document.getElementById("ToolBar_TxtGoToPage").value="2";
					//parent.document.getElementById("Topbar1_TxtGoToPage1024").value="2";
					//parent.document.getElementById("topbar7_TxtGoToPage").value="2";
					//parent.document.getElementById("topbarbig_TxtGoToPage1400").value="2";
					
			
		}
		else if(parseInt(pgno)==parseInt(c)-1)
		{
					parent.window.status="Cover 3";
					parent.document.getElementById("ToolBar_TxtGoToPage").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("Topbar1_TxtGoToPage1024").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("topbar7_TxtGoToPage").value=(parseInt(c)-1).toString();
					//parent.document.getElementById("topbarbig_TxtGoToPage1400").value=(parseInt(c)-1).toString();
		
		}
		else if(parseInt(pgno)==parseInt(c))
		{
					//alert(c);
					//alert(pgno);
					parent.window.status="Cover 4";
					parent.document.getElementById("ToolBar_TxtGoToPage").value=c.toString();
					//parent.document.getElementById("Topbar1_TxtGoToPage1024").value=c.toString();
					//parent.document.getElementById("topbar7_TxtGoToPage").value=c.toString();
					//parent.document.getElementById("topbarbig_TxtGoToPage1400").value=c.toString();
					
			
		}
		else
			{
					//alert('hitt');
					parent.document.getElementById("ToolBar_TxtGoToPage").value=pgno;
					//parent.document.getElementById("Topbar1_TxtGoToPage1024").value=pgno;
					//parent.document.getElementById("topbar7_TxtGoToPage").value=pgno;
					//parent.document.getElementById("topbarbig_TxtGoToPage1400").value=pgno;
				
					var tooltipval=parent.document.getElementById("tooltip1").value;
					//alert(tooltipval);
					var toolval= tooltipval.split(";");
					//alert(toolval[0]);
					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;
					 //parent.window.status=toolval[i].replace(pgno.toString() +":",'');
					 //exit;
					 }
					}
					//parent.window.status="Page " +pgno.toString();
						//alert(parent.document.getElementById("Topbar2_gotopage1").innerHTML);
					//alert(parent.document.getElementById("Topbar2_gotopage1").value);
			
			
			}
	
	}
		

		
}
function openReSizableWindow(url,name) {
	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 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()
{

	var imagezoomval=parent.document.getElementById("TxtZoomFolders").value;
	var imageval= imagezoomval.split(";");
	
	var smalldim=imageval[0];
	var largedim=imageval[1];
	var large2dim=imageval[2];
	var largestdim=imageval[3];
	var largest2dim=imageval[4];
	var largest3dim=imageval[5];
	
	var i;
	i=smalldim.indexOf(",");
	var small_width=smalldim.substring(0,i);
	var small_height=smalldim.substring(i+1,smalldim.length);
	
	
	i=largedim.indexOf(",");
	var large_width=largedim.substring(0,i);
	var large_height=largedim.substring(i+1,largedim.length);
	
	
	i=large2dim.indexOf(",");
	var large2_width=large2dim.substring(0,i);
	var large2_height=large2dim.substring(i+1,large2dim.length);
	
	
	i=largestdim.indexOf(",");
	var largest_width=largestdim.substring(0,i);
	var largest_height=largestdim.substring(i+1,largestdim.length);

	
	
	i=largest2dim.indexOf(",");
	var largest2_width=largest2dim.substring(0,i);
	var largest2_height=largest2dim.substring(i+1,largest2dim.length);
	

	i=largest3dim.indexOf(",");
	var largest3_width=largest3dim.substring(0,i);
	var largest3_height=largest3dim.substring(i+1,largest3dim.length);
	
	var zoomx;
	var zoomy;
	if (zoomfactor1 ==0)
	{
		zoomfactor1 = 1;
		var windowWidth1 = getWidth();
		var windowHeight1 = getHeight();
		document.getElementById("img1").style.display="block";
		document.getElementById("img0").style.display="none";
		
		if(document.getElementById("ii1").src.indexOf('largest3')>0)
		{
			if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
				zoomx=1;
				zoomy=1;
			}
		}
		else if(document.getElementById("ii1").src.indexOf('largest2')>0)
		{
			if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
				/*zoomx=(1368/964);
				zoomy=(1714/1208);*/
				zoomx=(largest3_width/largest2_width);
				zoomy=(largest3_height/largest2_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest2')>0)
			{
				zoomx=1;
				zoomy=1;
			}
			
		}
		else if(document.getElementById("ii1").src.indexOf('largest')>0)
		{
			if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/largest_width);
				zoomy=(largest3_height/largest_height);
				//alert("largest3");
			}
			else if(document.getElementById("ii2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/largest_width);
				zoomy=(largest2_height/largest_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest')>0)
			{
				zoomx=1;
				zoomy=1;
			}
			
		}
		else if(document.getElementById("ii1").src.indexOf('large2')>0)
		{
		
		if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/large2_width);
				zoomy=(largest3_height/large2_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/large2_width);
				zoomy=(largest2_height/large2_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/large2_width);
				zoomy=(largest_height/large2_height);
			}
			else if(document.getElementById("ii2").src.indexOf('large2')>0)
			{
				zoomx=1;
				zoomy=1;	
			}
					
		}
		else if(document.getElementById("ii1").src.indexOf('large')>0)
		{
		//alert(document.getElementById("ii2").src);
			if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
			//alert("largest3");
				zoomx=(largest3_width/large_width);
			//	alert(zoomx);
				zoomy=(largest3_height/large_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/large_width);
				zoomy=(largest2_height/large_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/large_width);
				zoomy=(largest_height/large_height);
				//alert("largest");
			}
			else if(document.getElementById("ii2").src.indexOf('large2')>0)
			{
				zoomx=(large2_width/large_width);
				zoomy=(large2_height/large_height);	
			}
			else if(document.getElementById("ii2").src.indexOf('large')>0)
			{
				zoomx=1;
				zoomy=1;	
			}
			
		}
		else if(document.getElementById("ii1").src.indexOf('small')>0)
		{
			if(document.getElementById("ii2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/small_width);
				zoomy=(largest3_height/small_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/small_width);
				zoomy=(largest2_height/small_height);
			}
			else if(document.getElementById("ii2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/small_width);
				zoomy=(largest_height/small_height);
			}
			else if(document.getElementById("ii2").src.indexOf('large2')>0)
			{
				zoomx=(large2_width/small_width);
				zoomy=(large2_height/small_height);	
			}
			else if(document.getElementById("ii2").src.indexOf('large')>0)
			{
				zoomx=(large_width/small_width);
				zoomy=(large_height/small_height);		
			}
			else if(document.getElementById("ii2").src.indexOf('small')>0)
			{
				zoomx=1;
				zoomy=1;		
			}	
		}
	var windowWidth = getWidth();
	var windowHeight = getHeight();
 
	if ((windowWidth-60>pagex) && (windowHeight-60>pagey) &&  document.getElementById("ii2").src.indexOf('largest3')<=0)
	{
		
		pagey=parseInt(eval((pagey*zoomy)-(windowHeight/2)),10);
		pagex=parseInt(eval((pagex*zoomx)-(windowWidth/2)),10);
	}
	else
	{	

	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)
{
//alert("1");
zoomfactor1 = 0;
document.getElementById("img0").style.display="block";
document.getElementById("img1").style.display="none";
}
	
	}
	
	function SpeakText()
		{
			
			//alert("HI");			
			var lyr,url;
			lyr="showstory";
			url="Speak.aspx?pageid="+parent.document.getElementById("pgno").value;
			//alert(url);
			//alert(url);
			if (document.all)
			{
				// IE version
				try 
				{
					var xml = new ActiveXObject("Microsoft.XMLHTTP");
					xml.Open("GET",url,false );
					xml.Send()
					var rp=xml.responseText;	
					//alert(rp);	
					//document.getElementById(lyr).innerHTML= rp;
				}
				catch (e) 
				{
					var xml = new ActiveXObject("MSXML2.XMLHTTP.4.0");
					xml.Open( "GET", "readxml.aspx", false );
					xml.Send()
					var rp1=xml.responseText;
				//	document.getElementById(lyr).innerHTML= rpl;
				}
			}
			else
			{
					// Mozilla/Netscrap 6+ version
						var xml=new XMLHttpRequest();
						xml.open("GET",url,false);
						xml.send(null);
					//	document.getElementById(lyr).innerHTML= xml.responseText;
			}
			//}
			//end of function to diaplay contnent of other page
				//alert(document.getElementById("showstory").style.height );


				//function 
					var my_test1=rp;//document.getElementById("txt1").value;
			var VoiceObj = new ActiveXObject("Sapi.SpVoice");
			VoiceObj.Speak(my_test1, 1 );
			
			//my_test = "Hi rachit. how r u?. Local tests show Indonesian child died of. bird flu JAKARTA, Jan 19, 2006 (AFP) - Tests carried out by Indonesian health authorities have shown. second Hi Neeraj. how r u?. Local tests show Indonesian child died of. bird flu JAKARTA, Jan 19, 2006 (AFP) - Tests carried out by Indonesian health authorities have shown. third Hi Neeraj. how r u?. Local tests show Indonesian child died of. bird flu JAKARTA, Jan 19, 2006 (AFP) - Tests carried out by Indonesian health authorities have shown.  ";
				var z=my_test1.split('.');
			for(l=0;l<z.lenght;l++)
			{
				SpeakText(z[l].toString())
			}
		 
		}
