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;
}
//for open archive
function openarc(pubid)
{
//alert(pubid);
 document.getElementById("archi").src="archives.aspx?pubid="+pubid;
 document.getElementById("archives_dialog").style.visibility="visible";
 document.getElementById("archives_dialog").style.display="block";
}
//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);
		
			/***************************/
				if (document.Form1.ZoomLevel[i].value=='fw')
				{
				//set value of width textbox
			
					document.getElementById("fitheight").value="fw";
		
				}
				else if (document.Form1.ZoomLevel[i].value=='fh')
					{
					
					document.getElementById("fitheight").value="fh";
							
					}
				else
					{
					document.getElementById("fitheight").value="";
					
					}
			
			
			/*****************************/
			
			}
		}
		
		
		
		
		for (i = 0; i < document.Form1.ZoomLevel_M.length; i++) 
		{
			if (document.Form1.ZoomLevel_M[i].checked)
			{
			ZoomCheckValue_M =changeSelZoom(document.Form1.ZoomLevel_M[i].value);
			}
		}
		
		document.getElementById("txtstandardviewpath").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?pgno=" + pgno + "&mode=" + mode +"&Sresolution=" + windowWidth + "&Standardview=" + standardview + "&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value + "&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
 		
		}
	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=="fh")
{
	//return "thumbnails\\small\\";
			
				//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.	ZoomLevel_M[i].checked)
		{
		MagnifiedCheckValue = i;
		zoomvalue_M=document.Form1.ZoomLevel_M[i].value;
		}

	}


	//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;
			}
			}
		else
			{
			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=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + st + "&Magnifiedview=" + mg;
		//parent.document.getElementById("settingspreview").src="previewpage.aspx?pgno=" + pgno + "&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + st +"&Magnifiedview=" + mg;
		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?pgno=" + document.getElementById("pgno").value + "&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth ;
	
		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?pgno=1&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	
		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?pgno="+ pgno +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	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);
	
	
	if (windowWidth>='1396')
	{
	pageno=parent.document.getElementById("topbarbig_TxtGoToPage1400").value;
	}
	else if ((windowWidth>=1260) && (windowWidth<1396))
	{
	 pageno=parent.document.getElementById("topbar7_TxtGoToPage").value;
	}
	else if ((windowWidth>810) && (windowWidth<=1260))
	{
	 pageno=parent.document.getElementById("Topbar1_TxtGoToPage1024").value;
	}
	else if (windowWidth<='810')
	{
	 pageno=parent.document.getElementById("Topbar2_Txt800").value;
	}
	else
	{
	 pageno='1';
	}
	
	
	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?pgno="+ pgno +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	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("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("content_dialog").style.visibility="hidden";
		      document.getElementById("links_dialog").style.visibility="hidden";
		         document.getElementById("share_dialog1").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 (i==document.getElementById("txtMagnifiedViewPath").value)
						{
							document.Form1.ZoomLevel_M[i].checked=true;
						}
				}
					
		
			changepreview();
		   }
		else if (bildertausch=="archives_dialog")
		   {
		        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("content_dialog").style.visibility="hidden";
		      document.getElementById("links_dialog").style.visibility="hidden";
		       document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		  }
		 else if(bildertausch=="find_dialog")
		 {
		        document.getElementById("print_dialog").style.visibility="hidden";
		        document.getElementById("help_dialog").style.visibility="hidden";
		       document.getElementById("links_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";
			  document.getElementById("content_dialog").style.visibility="hidden";
		      document.getElementById("archives_dialog").style.visibility="hidden";
		       document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		 }
		 else if(bildertausch=="links_dialog")
		 {
		        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("content_dialog").style.visibility="hidden";
		      document.getElementById("archives_dialog").style.visibility="hidden";
		       document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		}
	  	     	    
	      else if(bildertausch=="content_dialog")
		 {		
		       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("archives_dialog").style.visibility="hidden";
			  document.getElementById("links_dialog").style.visibility="hidden";
			   document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		} 
		 else if(bildertausch=="help_dialog")
		 {
		      document.getElementById("print_dialog").style.visibility="hidden";
		      document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("links_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";
			  document.getElementById("content_dialog").style.visibility="hidden";
		      document.getElementById("archives_dialog").style.visibility="hidden";
		       document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		 }
		 else if(bildertausch=="print_dialog")
		 {
		     // document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("find_dialog").style.visibility="hidden";
		      document.getElementById("links_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";
			  document.getElementById("content_dialog").style.visibility="hidden";
		      document.getElementById("archives_dialog").style.visibility="hidden";
		       document.getElementById("share_dialog1").style.visibility="hidden";
		      document.getElementById(bildertausch).style.visibility="visible";
		 }
		  else if(bildertausch=="share_dialog1")
		 {
		 //alert("hello")
		      document.getElementById("find_dialog").style.visibility="hidden";
		        document.getElementById("print_dialog").style.visibility="hidden";
		      document.getElementById("links_dialog").style.visibility="hidden";
		         document.getElementById("help_dialog").style.visibility="hidden";
		      document.getElementById("settings_dialog").style.visibility="hidden";
			  document.getElementById("content_dialog").style.visibility="hidden";
		      document.getElementById("archives_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;
		 }
		  
	}
	
	
	/*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) 
	{
	 //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";
    }	
    
    /*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?pgno="+pgno+ "&mode=" + mode +"&Sresolution=" + Sresolution+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	
		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")
{
	//alert('hit');
	parent.document.getElementById("Imagefirst").src="images-1024/First_02_over.jpg";
	parent.document.getElementById("Imagefirst800").src="images-800/First_02_over.jpg";
	parent.document.getElementById("ImagePrev").src="images-1024/Previous_03_over.jpg";
	parent.document.getElementById("ImagePrev800").src="images-800/Previous_03_over.jpg";
	
	parent.document.getElementById("Imagefirst1400").src="new_toolbar/images-1400/First_02_over.jpg";
	parent.document.getElementById("ImagePrev1400").src="new_toolbar/images-1400/Previous_03_over.jpg";
	parent.document.getElementById("Imagefirst1200").src="new_toolbar/images-1280/First_02_over.jpg";
	parent.document.getElementById("ImagePrev1200").src="new_toolbar/images-1280/Previous_03_over.jpg";
}
else
{
	//alert('hit1');
	parent.document.getElementById("Imagefirst").src="images-1024/First_02.jpg";
	//alert(parent.document.getElementById("Imagefirst").src);
	parent.document.getElementById("Imagefirst800").src="images-800/First_02.jpg";
	parent.document.getElementById("ImagePrev").src="images-1024/Previous_03.jpg";
	parent.document.getElementById("ImagePrev800").src="images-800/Previous_03.jpg";
	
	parent.document.getElementById("Imagefirst1400").src="new_toolbar/images-1400/First_02.jpg";
	parent.document.getElementById("ImagePrev1400").src="new_toolbar/images-1400/Previous_03.jpg";
	parent.document.getElementById("Imagefirst1200").src="new_toolbar/images-1280/First_02.jpg";
	parent.document.getElementById("ImagePrev1200").src="new_toolbar/images-1280/Previous_03.jpg";
}

if (pgno==i)
{
	parent.document.getElementById("ImageLast").src="images-1024/Last_06_over.jpg";
	parent.document.getElementById("ImageLast800").src="images-800/Last_06_over.jpg";
	parent.document.getElementById("ImageNext800").src="images-800/Next_05_over.jpg";
	parent.document.getElementById("ImageNext").src="images-1024/Next_05_over.jpg";
	
	parent.document.getElementById("ImageNext1400").src="new_toolbar/images-1400/Next_05_over.jpg";
	parent.document.getElementById("ImageLast1400").src="new_toolbar/images-1400/Last_06_over.jpg";
	//alert(parent.document.getElementById("ImageLast1400").src);
	parent.document.getElementById("ImageNext1200").src="new_toolbar/images-1280/Next_05_over.jpg";
	parent.document.getElementById("ImageLast1200").src="new_toolbar/images-1280/Last_06_over.jpg";
}
else
{
	parent.document.getElementById("ImageLast").src="images-1024/Last_06.jpg";
	parent.document.getElementById("ImageLast800").src="images-800/Last_06.jpg";
	parent.document.getElementById("ImageNext800").src="images-800/Next_05.jpg";
	parent.document.getElementById("ImageNext").src="images-1024/Next_05.jpg";
	
	parent.document.getElementById("ImageNext1400").src="new_toolbar/images-1400/Next_05.jpg";
	parent.document.getElementById("ImageLast1400").src="new_toolbar/images-1400/Last_06.jpg";
	parent.document.getElementById("ImageNext1200").src="new_toolbar/images-1280/Next_05.jpg";
	parent.document.getElementById("ImageLast1200").src="new_toolbar/images-1280/Last_06.jpg";
	
}

}




/*Handle Next Page click*/

function handlePreviousPageClick()
{
var c,lastpage,mode,pgno;
windowWidth = getWidth();
 windowHeight = getHeight();
var ie=document.all

		var ns6=document.getElementById&&!document.all
		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?pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
				parent.document.getElementById("pgno").value=pgno;
		
		
		changestatus(pgno);
			handlePageSrc();
			changepreview();
}

function handleLastPageClick()
{
var c,nextpagevalue,pgno;
var i;
var standardview,magnifiedview;

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?pgno="+ c +" &mode=" + mode +"&Sresolution=" + screen.width+"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + parent.document.body.clientHeight + '&clintwidth=' + parent.document.body.clientWidth;


	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?pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	
}
function handleNextPageClick()
{
var c,mode,pgno;
var i,mode1;
c=readCookie("LastPage");
var standardview,magnifiedview;
windowWidth = getWidth();
windowHeight = getHeight();

if(parent.document.getElementById("pgno").value==c)
return;
		var ns6=document.getElementById&&!document.all;
		
	var ie=document.all;	
	
		
		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?pgno="+ pgno +" &mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
	
		
			changestatus(pgno);
			handlePageSrc();
			changepreview();

}


/*first page*/
function handleFirstPageClick()
{
var standardview,magnifiedview;
		var ie=document.all
		var ns6=document.getElementById&&!document.all
		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?pgno=1&mode=" + mode+"&Sresolution=" + windowWidth +"&Standardview=" + standardview +"&Magnifiedview=" + magnifiedview+ '&fitparam=' + parent.document.getElementById("fitheight").value +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth;
		
		//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?pgno="+ pgno +" &mode=" + mode + "&Sresolution=" + windowWidth + '&fitparam=' + windowHeight +"&clintheight=" + windowHeight + '&clintwidth=' + windowWidth + "&Standardview=" + standardview + "&Magnifiedview=" + magnifiedview+"&search=S";
		
		}
		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)
{

		//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("Topbar2_gotopage1").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("Topbar2_gotopage1").value="2";
					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("Topbar2_gotopage1").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("Topbar2_gotopage1").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("Topbar2_gotopage1").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("Topbar2_Txt800").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("Topbar2_Txt800").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("Topbar2_Txt800").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("Topbar2_Txt800").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("Topbar2_Txt800").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) {
//alert("hello");
	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));
	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("img0").style.display="none";
		document.getElementById("img1").style.display="block";
		
		if(document.getElementById("i1").src.indexOf('largest3')>0)
		{
			if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
				zoomx=1;
				zoomy=1;
			}
		}
		else if(document.getElementById("i1").src.indexOf('largest2')>0)
		{
			if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
				/*zoomx=(1368/964);
				zoomy=(1714/1208);*/
				zoomx=(largest3_width/largest2_width);
				zoomy=(largest3_height/largest2_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest2')>0)
			{
				zoomx=1;
				zoomy=1;
			}
			
		}
		else if(document.getElementById("i1").src.indexOf('largest')>0)
		{
			if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/largest_width);
				zoomy=(largest3_height/largest_height);
				//alert("largest3");
			}
			else if(document.getElementById("i2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/largest_width);
				zoomy=(largest2_height/largest_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest')>0)
			{
				zoomx=1;
				zoomy=1;
			}
			
		}
		else if(document.getElementById("i1").src.indexOf('large2')>0)
		{
		
		if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/large2_width);
				zoomy=(largest3_height/large2_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/large2_width);
				zoomy=(largest2_height/large2_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/large2_width);
				zoomy=(largest_height/large2_height);
			}
			else if(document.getElementById("i2").src.indexOf('large2')>0)
			{
				zoomx=1;
				zoomy=1;	
			}
					
		}
		else if(document.getElementById("i1").src.indexOf('large')>0)
		{
		//alert(document.getElementById("i2").src);
			if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
			//alert("largest3");
				zoomx=(largest3_width/large_width);
			//	alert(zoomx);
				zoomy=(largest3_height/large_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/large_width);
				zoomy=(largest2_height/large_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/large_width);
				zoomy=(largest_height/large_height);
				//alert("largest");
			}
			else if(document.getElementById("i2").src.indexOf('large2')>0)
			{
				zoomx=(large2_width/large_width);
				zoomy=(large2_height/large_height);	
			}
			else if(document.getElementById("i2").src.indexOf('large')>0)
			{
				zoomx=1;
				zoomy=1;	
			}
			
		}
		else if(document.getElementById("i1").src.indexOf('small')>0)
		{
			if(document.getElementById("i2").src.indexOf('largest3')>0)
			{
				zoomx=(largest3_width/small_width);
				zoomy=(largest3_height/small_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest2')>0)
			{
				zoomx=(largest2_width/small_width);
				zoomy=(largest2_height/small_height);
			}
			else if(document.getElementById("i2").src.indexOf('largest')>0)
			{
				zoomx=(largest_width/small_width);
				zoomy=(largest_height/small_height);
			}
			else if(document.getElementById("i2").src.indexOf('large2')>0)
			{
				zoomx=(large2_width/small_width);
				zoomy=(large2_height/small_height);	
			}
			else if(document.getElementById("i2").src.indexOf('large')>0)
			{
				zoomx=(large_width/small_width);
				zoomy=(large_height/small_height);		
			}
			else if(document.getElementById("i2").src.indexOf('small')>0)
			{
				zoomx=1;
				zoomy=1;		
			}	
		}
	var windowWidth = getWidth();
	var windowHeight = getHeight();
 
	if ((windowWidth-60>pagex) && (windowHeight-60>pagey) &&  document.getElementById("i2").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";
}
}
//mail validation
function validateEmailAddress(txtemail) {
	var isValidEmail;
	var strEmail = new String(txtemail);
	isValidEmail = true;
	// a@b.c should be the shortest an address could be
	if (strEmail.length < 5) 
		isValidEmail = false;
	else if (strEmail.indexOf("@") < 0)  // has at least one "@"
		isValidEmail = false;
	else if (strEmail.indexOf(".") < 0) // has at least one "."
		isValidEmail = false;
	else if (strEmail.indexOf(" ") > 0) // should not have space "."
		isValidEmail = false;
	else if (strEmail.indexOf ("@") > strEmail.indexOf("."))
			isValidEmail = false;
	else
	 {
		//has only one "@"
		var atCnt;
		var i;
		atCnt = 0
		for (i = 1; i <= strEmail.length; i++) {
			if  (strEmail.charAt(i) == "@") 
				atCnt = atCnt + 1
		}
		if (atCnt > 1) 
			isValidEmail = false
	}
	return isValidEmail;
}
/*for drag & drop of div tag*/
document.onmousedown=function drags(e){
if (!ie&&!ns6)
return
var firedobj=ns6? e.target : event.srcElement
//alert(event.srcElement.id)
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
}
}

document.onmouseup=new Function("dragapproved=false")
document.onmouseout=function drags(e){
dragapproved=false
}
