full_screen=0;var tog_on=0;var cit_on=0;var store_on=0;var lib_on=0;var srch_on=0;var scroll_div=1;(function($){$.scrollTo=function(r,s){return $('html,body').scrollTo(r,s)};$.scrollTo.defaults={axis:'y',speed:1};$.fn.scrollTo=function(r,s){s=$.extend({},$.scrollTo.defaults,s);if(s.axis.length!=2)s.queue=false;if(s.queue)s.speed=Math.ceil(s.speed/2);return this.each(function(){var e=$(this),t=r,u,w,k={};switch(typeof t){case'string':if(/^([+-]=)?\d+(px)?$/.test(t))break;t=$(t,this);case'object':u=$(t).offset()}$.each(s.axis.split(''),o);animate(s.onAfter);function o(i,x){var h=x=='x'?'Left':'Top',n=h.toLowerCase(),z='scroll'+h;k[z]=u?u[n]+(e.is('html,body')?0:e[0][z]-e.offset()[n]):t;if(s.margin&&typeof t=='object')k[z]-=parseInt($(t).css('margin'+h))||0;if(!i&&s.queue){if(e[0][z]!=k[z])animate(s.onAfterFirst);delete k[z]}};function animate(j){e.animate(k,s.speed,s.easing,function(){if(j)j.call(this,e,k,t)})}})}})(jQuery);var SetHeight=25;var SetHeight2=25;var browserHeight=getBrowserHeight();
var page_loc=0
function loadhelp() {
var load = window.open('AboutSortBy','','scrollbars=no,menubar=no,height=200,width=400,resizable=yes,toolbar=no,location=no,status=no');
}
function loadlucenehelp(coll) {
var load = window.open('AboutLuceneSearch?collection='+coll,'','scrollbars=yes,menubar=no,height=300,width=700,resizable=yes,toolbar=no,location=no,status=no');
}

function loadhelpSub() {
var load = window.open('AboutSubject','','scrollbars=no,menubar=no,height=200,width=400,resizable=yes,toolbar=no,location=no,status=no');
}


function loadpagehelp() {
var load = window.open('PageHelp','','scrollbars=yes,menubar=no,height=500,width=600,resizable=yes,toolbar=no,location=no,status=no');
}


function loadMyHeinHelp() {
var load = window.open('AboutMyHein?base=js','','scrollbars=yes,menubar=no,height=500,width=600,resizable=yes,toolbar=no,location=no,status=no');
}



function showSummary(link, number, images){
	
	
	var url_index=$(link).attr("href") + "&base=js";
	var target_div = number;
	
	var regex=/minus/;
	 if($('#'+target_div+ "_vol2").css('display') == 'none'){
					
					
				
				$.get(url_index,function(data){
					//alert(url_index);
					$('#'+target_div+ "_vol2").html(data);
				
				
				//	$("#"+target_div+" h2").hide();
				//	$("#"+target_div+" h3").hide();
					
					$('#'+target_div+ "_vol2").show();
					link.innerHTML="<img src='"+images+"/minus.png' title='compress' style='vertical-align:baseline;'/>";
				})
	 }else{
	 	$('#'+target_div+ "_vol2").slideUp('fast',function(target_div){
			$('#'+target_div+ "_vol2").html("");});
			link.innerHTML="<img src='"+images+"/plus.png' title='expand' style='vertical-align:baseline;'/>";
	 }
	
}


function showSummaryCite(link, number, images){
	
	
	
	var target_div = number;
	var regex=/minus/;
	 if($('#'+target_div+ "_vol2").css('display') == 'none'){
					
				
					$('#'+target_div+ "_vol2").show();
					link.innerHTML="<img src='"+images+"/minus.png' title='compress' style='vertical-align:baseline;'/>";
				
	 }else{
	 	$('#'+target_div+ "_vol2").slideUp('fast',function(target_div){
			$('#'+target_div+ "_vol2").hide(); 
			link.innerHTML="<img src='"+images+"/plus.png' title='expand' style='vertical-align:baseline;'/>";
	 })
	
}
}


function showSummaryX(url, target_div, link, images){
    
	var url_index=$(link).attr("href") + "&base=js";
    var regex=/minus/;
	//var url_index="Index?collection="+coll+"&index="+ind_name+"&base=js&javascript_magic=yes";
	
	if(link != null){
	
	if(regex.test(link.innerHTML)){
		$('#'+target_div+ "_vol").slideUp('fast',function(target_div){
			$('#'+target_div+ "_vol").html("");});
			link.innerHTML="<img src='"+images+"/plus.png' title='expand' />";
			}else{
				
				link.innerHTML="<img src='"+images+"/minus.png' title='compress' />";
				
				
				
				
								$("#"+target_div+"_idle").html("Please Wait...");
				$("#"+target_div+"_idle").fadeIn('fast');
				
				
				$.get(url_index,function(data){
					//alert(url_index);
					$('#'+target_div+ "_vol").html(data);
					$("#"+target_div+"_idle").hide();
				//	$("#"+target_div+" h2").hide();
				//	$("#"+target_div+" h3").hide();
					
					$('#'+target_div+ "_vol").show();
				})
			}
	}
				return false;
				};
				






var viewportwidth;
 var viewportheight;
 var browserHeight_first=getBrowserHeight();
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 function get_browser_vars(){
 if (typeof window.innerWidth != 'undefined')
 {
 	
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }

 }
 
var wrap_width_start= $("#wrapper").width(); 

function dynamicLayout(from){
//	if(from == 'load'){
//alert(from);	
//	}



if(scroll_div==1){
	//var t_x =  findPosY(document.getElementById("ScrollDiv"));
 //if (document.getElementById('ScrollDiv') != null){
 //$('#ScrollDiv').css("height", browserHeight - t_x - SetHeight + "px");
//}
}

var wrap_width= $("#wrapper").width();

//alert(wrap_width + " : " + win_width);

if(wrap_width_start != wrap_width){
	wrap_width_start= $("#wrapper").width();

	get_browser_vars();
	//	alert(viewportwidth);
var win_width = viewportwidth;
if(wrap_width > win_width){


      $('#ScrollDiv').css("height", "");
      $('#ScrollDiv').removeClass('ScrollOn');
      $('#ScrollDiv').addClass('ScrollOff');

  //    $('#ScrollDivX').css("height", "");
   //   $('#ScrollDivX').removeClass('ScrollOn');
    //  $('#ScrollDivX').addClass('ScrollOff');


      $('#ScrollDiv1').css("height", "");
      $('#ScrollDiv1').removeClass('ScrollOn');
      $('#ScrollDiv1').addClass('ScrollOff');


	
$('#lowerbuttons').show();
}else{
	
	
//	 $('#ScrollDivX').removeClass('ScrollOff');
  //    $('#ScrollDivX').addClass('ScrollOn');

	 $('#ScrollDiv1').removeClass('ScrollOff');
      $('#ScrollDiv1').addClass('ScrollOn');


	
	 $('#ScrollDiv').removeClass('ScrollOff');
      $('#ScrollDiv').addClass('ScrollOn');
	$('#lowerbuttons').hide();
	
	
	
}
//
}

if(scroll_div==1){
	var browserHeight=getBrowserHeight();
	if((browserHeight_first != browserHeight)||(from != 'timed')||(from == 'load')){
		browserHeight_first = browserHeight;
	$(".ScrollOn").each(function(){
		var t_x=$(this).offset().top;
		var id=$(this).attr('id');
		$(this).css("height",browserHeight-t_x-SetHeight+"px");
		}
		);
		}//}
}
	

	
}


function checkTitle(myForm, checkval){

if(	$("#"+checkval).val() == ''){
	alert("You must enter a title");
}else{
 myForm.submit();	
}
}


 



function removeEventx(obj,type,fn){if(obj.detachEvent){obj.detachEvent('on'+type,obj[type+fn]);obj[type+fn]=null;}else
obj.removeEventListener(type,fn,false);}

function getBrowserHeight(){if(window.innerHeight){return window.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight!=0){return document.documentElement.clientHeight;}
else if(document.body){return document.body.clientHeight;}
return 0;}

function findPosY(obj){var curtop=0;if(obj){if(obj.offsetParent){while(1){curtop+=obj.offsetTop;if(!obj.offsetParent){break;}
obj=obj.offsetParent;}}else if(obj.y){curtop+=obj.y;}
return curtop;}}




//window.onload=dynamicLayout('load');
//addEvent(window,'resize',dynamicLayout);


//$(document).ready(function() {
//  dynamicLayout('load');
//   });
   
  
  version=0
if (navigator.appVersion.indexOf("MSIE")!=-1){
	//alert('hi');
	//addEvent(window,'resize',longTime);
    //window.onload=dynamicLayout('load');
//setTimeout("dynamicLayout('load');",2800);
$(document).ready(function() {
  dynamicLayout('load');
   });
	
	
	timedCount();
}else{
addEvent(window,'resize',dynamicLayout);


//timedCount();
$(document).ready(function() {
  dynamicLayout('load');
   });
}

setTimeout("dynamicLayout('load');",2800);

  
   
   function timedCount()
{
dynamicLayout('timed');
//alert('hi');
t=setTimeout("timedCount()",2000);
}

function stopCount()
{
clearTimeout(t);
}

//timedCount();




 
function CollectionCitLoader(coll2){$('#ajax_cit_loc').html("<img src='/static/holimages200805/progress_bar.gif' >");var url2="/HOLtest/citation-navigator?inside=yes&collection="+coll2;$.get(url2,function(data){$("#ajax_cit_loc").html(data);});}



function CollectionSearchLoader(coll2){$('#ajax_search').html("<img src='/static/holimages200805/progress_bar.gif' >");var url2="/HOLtest/sidetools/search-bar?base=js&inside=yes&collection="+coll2;$.get(url2,function(data){$("#ajax_search").html(data);});}



function showIndexGo(name,ind_name,coll,link,images, dest_anchor){
	var regex=/minus/;
	var url_index="Index?collection="+coll+"&index="+ind_name+"&base=js&javascript_magic=yes";
	if(regex.test(link.innerHTML)){
		$('#'+name).slideUp('fast',function(name){
			$('#'+name).html("");});
			link.innerHTML="<img src='"+images+"/plus.png' title='expand' />";
			}else{
				$("#"+name+"_idle").html("Please Wait...");
				$("#"+name+"_idle").fadeIn('fast');
				link.innerHTML="<img src='"+images+"/minus.png' title='compress' />";
				$('#'+name).load(url_index+" dl:last",function(){
					$("#"+name+"_idle").hide();
					$("#"+name+" h2").hide();
					$("#"+name+" h3").hide();
					$('#'+name).show();
					//alert(dest_anchor);
					//window.location.hash=dest_anchor; 
					});}


	
}


function showIndex(name,ind_name,coll,link,images, dest_anchor){
	//alert('hi');
	showIndexGo(name,ind_name,coll,link,images, dest_anchor);
	
	
	
	
}





function showSearchVol(url, target_div, link, images){
    
	var url_index=url + "&base=js";
    var regex=/minus/;
	//var url_index="Index?collection="+coll+"&index="+ind_name+"&base=js&javascript_magic=yes";
	
	if(link != null){
	
	if(regex.test(link.innerHTML)){
		$('#'+target_div+ "_vol").slideUp('fast',function(target_div){
			$('#'+target_div+ "_vol").html("");});
			link.innerHTML="<img src='"+images+"/plus.png' title='expand' />";
			}else{
				
				link.innerHTML="<img src='"+images+"/minus.png' title='compress' />";
				
				
				
				
								$("#"+target_div+"_idle").html("Please Wait...");
				$("#"+target_div+"_idle").fadeIn('fast');
				
				
				$.get(url_index,function(data){
					//alert(url_index);
					$('#'+target_div+ "_vol").html(data);
					$("#"+target_div+"_idle").hide();
				//	$("#"+target_div+" h2").hide();
				//	$("#"+target_div+" h3").hide();
					
					$('#'+target_div+ "_vol").show();
				})
			}
	}
				
				
				return false;
				};
				


function showSearchVolMore(url, target_div, link, images){
    
	var url_index=url + "&base=js";
    var regex=/minus/;
	//var url_index="Index?collection="+coll+"&index="+ind_name+"&base=js&javascript_magic=yes";
	
	if(link != null){
	
	
				
				
								$("#"+target_div+"_idle").html("Please Wait...");
				$("#"+target_div+"_idle").fadeIn('fast');
				
				
				$.get(url_index,function(data){
					//alert(url_index);
					$('#'+target_div+ "_vol").html(data);
					$("#"+target_div+"_idle").hide();
				//	$("#"+target_div+" h2").hide();
				//	$("#"+target_div+" h3").hide();
					
					
				})
			}
	
				return false;
				};
				




function ShowLCMD(switch_l, target_div,images){
	var regex=/minus/;
	
//	alert(regex.test(switch_l.innerHTML));
	if(regex.test(switch_l.innerHTML)){
		$('#'+target_div).slideUp('fast',function(){
			
			switch_l.innerHTML="<img src='"+images+"/plus.png' title='expand' />";
		});
			}else{
			
				switch_l.innerHTML="<img src='"+images+"/minus.png' title='compress' />";
				$('#'+target_div).show();
					//alert(dest_anchor);
					//window.location.hash=dest_anchor; 
			}	


	
}








function ResetTime(coll,ran){var url="resetSession?base=js&ran="+ran;$.get(url,function(data){LoadMyHein(coll,random_num);});}

function LoadMyHein(coll2,rand, images){$('#men2').html("<img src='"+images+"/progress_bar.gif' >");var url2="sidetools/myHein-bar?base=js&collection="+coll2+"&rand_num="+rand;$.get(url2,function(data){$("#men2").html(data);});}

function LibSelShow(){if(lib_on==0){document.getElementById("lib-sel").style.display='';lib_on=1;}else{lib_on=0;document.getElementById("lib-sel").style.display='none';}}

function tohide(rand){$('#side-tool').css("display",'none');$('#guide').css("marginLeft",'130px');$('#content-container').css("margin-left",'20px');$('#unhide').css("display",'');$.post("dummy?men_hide=true&rand_num="+rand);dynamicLayout();}

function unhide(rand){$('#unhide').css("display",'none');if($('#side-tool').css("display")=='none'){$('#side-tool').css("display",'block');}
//if($('#guide')!=null){$('#guide').css("marginLeft",'270px');}
if($('#content-container')!=null){$('#content-container').css("margin-left",'280px');}
var browserHeight=getBrowserHeight();var url1="dummy?men_hide=false&rand_num="+rand;$.post("dummy?men_hide=false&rand_num="+rand);dynamicLayout('unhide');}

function toggle_scroll_div(){if(scroll_div==1){$('#ScrollDiv').css("height","");$('#ScrollDiv').removeClass('ScrollOn');$('#ScrollDiv').addClass('ScrollOff');
scroll_div=0;
//removeEvent(window,'resize',dynamicLayout('toggle'));
stopCount();    
}else{
	//addEvent(window,'resize',dynamicLayout);
	timedCount();
	$('#ScrollDiv').removeClass('ScrollOff');$('#ScrollDiv').addClass('ScrollOn');scroll_div=1;
	dynamicLayout('toggle_now');}}

function removeEvent(obj,type,fn){if(obj.detachEvent){obj.detachEvent('on'+type,obj[type+fn]);obj[type+fn]=null;}else
obj.removeEventListener(type,fn,false);}

/*
function addEvent(obj,type,fn){if(obj.addEventListener){obj.addEventListener(type,fn,false);}
else if(obj.attachEvent){obj["e"+type+fn]=fn;obj[type+fn]=function(){obj["e"+type+fn](window.event);}
obj.attachEvent("on"+type,obj[type+fn]);}}
*/

function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
   // alert("Handler could not be attached");
  }
}

function find_act(handle, page){
	var url23="tera-info?base=js&handle="+handle+"&id="+page;
	
	//alert(url2);
	//window.open(url2);
	//return;
	
	$.get(url23,function(data){
		//alert(data);
		window.open(data, "_self");
			});
	

	
	
}

function find_articles(handle, page){
	//alert(handle);
	//alert(page);
	var re = /journals/;
	var url2="citation-info?find=raw_cite&noamp=0&start=1&base=js&handle="+handle+"&id="+page;
	
	//alert(url2);
	//window.open(url2);
	//return;
	
	$.get(url2,function(data){
	//	alert(data);
		if (re.test(handle)){
			//alert('hi');
			window.open("LuceneSearch?terms=%22"+data+"%22&collection=journals&searchtype=advanced&submit=Go&sections=any&sections=external&other_cols=yes", "_self");
		}else{
			//alert('hi2');
			window.open("LuceneSearch?terms=%22"+data+"%22&collection=journals&searchtype=advanced&submit=Go&other_cols=yes", "_self");
		}
	});
	

}

function find_metadata(handle, page, collection){
	//alert(handle);
	//alert(page);
	//alert(page);
	var re = /unts/;
	var re3 = /lnts/;
	var re2 = /selden/;
	//alert(handle);
	if (re2.test(handle)){
		//window.open("UNTSmetadata?handle="+handle+"&collection=unl&id="+page, "_self");
	}else if (re.test(handle)){
		window.open("UNTSmetadata?handle="+handle+"&collection=unl&id="+page, "_self");
	}else if (re3.test(handle)){
		window.open("LNTSmetadata?handle="+handle+"&collection=unl&id="+page, "_self");
	}else{
		
		var url2c="citation-info?handle="+handle+"&id="+page+"&collection="+collection+"find=ustlink";
		$.get(url2c,function(data){
			//console.log( [data , $(data).find("a"),$(data).filter("a"), $(data).find("a").attr("href")  ] );
			var link = $(data).filter("a");
			//alert(link.eq(0).attr('href'));
			if(link.eq(0).attr('href')){
				window.open(link.eq(0).attr('href'), "_self");
			}
		});
	}
	

}


var cur_section_ident=0;
function get_cite_count(handle, div){
//	if(document.getElementById('cite_counts')!=null){
//	var url2c="ajaxcalls/get-section-cite-count?base=js&handle="+handle+"&div="+div;
//	$.get(url2c,function(data){
		
//		document.getElementById('cite_counts').innerHTML=data;
//		if(data >=1){
//			$('#count_show').show();
//		}else{
//			$('#count_show').hide();
//		}

//	}
//	);
//	}
}
	


var temp_section =0;
function identify_section(coll,handle,page,this_sec){
	//alert(coll,handle,page,this_sec );
	if(this_sec!=null){
		$('#contents-show span').removeClass('sectionhighlight');
		$('#section_marker_'+this_sec).addClass('sectionhighlight');
		cur_section_ident=this_sec;
}else{
	var url2="ajaxcalls/get-section-id?base=js&handle="+handle+"&id="+page;
	$.get(url2,function(data){
	//	alert(data + " " + cur_section_ident);
	   
	
		if(cur_section_ident==parseInt(data)){
			
			$('#contents-show span').removeClass('sectionhighlight');
			$('#section_marker_'+data).addClass('sectionhighlight');
			}else{
				$('#contents-show span').removeClass('sectionhighlight');$('#section_marker_'+data).addClass('sectionhighlight');
				}

			get_cite_count(handle, data);
			
			
//use these lines to send the dummy url
//var url2="ajaxcalls/get-section-id?base=js&handle="+handle+"&id="+page;
//	$.get(url2,function(data){

var anc_str="section_anchor_"+parseInt(data);
cur_section_ident=parseInt(data);
var urls_dummy = "dummySection?new_section=true&collection="+coll+"&section_id="+cur_section_ident+"&handle="+handle+"&page_id="+page;
 if(temp_section != cur_section_ident){
	   $.get(urls_dummy,function(data){});
	temp_section = cur_section_ident;
	random_numX = (Math.random()*9)+1;
	if(handle.match(/hein\.beal/)){
	}else if (handle.match(/hein\.trials/)){
		
	}else{
	GetCitation(coll, handle, page, random_numX);
	}
 }
if(document.getElementById('TOCScroll')!=null){
	$('#TOCScroll')[0].scrollTop=findPosY(document.getElementById(anc_str))-150;}
	
	
	
	
	});}
	}
	
	
	
	
	
var toc_loaded=0;
function toggleDiv(name){

 if(tog_on ==0){

    tog_on =1;
    
    	$(".ScrollOn").each(function(){
			$(this).removeClass('ScrollOn');
			$(this).addClass('ScrollOff');
		
		
   
       $(this).css("height", "");
        });
        
         $('#ie-prob1').css("padding-left", '0px');
         $('#ie-prob2').css("margin-left", '0px');
         
          //document.body.style.backgroundImage='url()'; 
    
           $('#content-container').css("margin-left", '0px');
//removeEvent(window, 'resize', dynamicLayout);
  stopCount();    
 if(name == "Contents"){

 var url=document.getElementById('ScrollDiv').src;
 window.open(url,'_top'); 
 
 }

       $('#guide').hide();
       $('#content-container').css("padding", '0px');
     //   document.getElementById('submenu').style.display = 'none';
      //  document.getElementById('head').style.display = 'none';
    $('#men-tabs-wrapper').hide();
      $('#side-tool').hide();
        if ($('#sub-menu2') != null){
          $('#sub-menu2').hide();
          
        //  document.getElementById('ScrollDiv').style.height = '100%';
          }

if ($('#SearchPage') != null){
          $('#SearchPage').css("overflow", 'visible');
          
        
          }

$('#foot').hide();
}
else{
	
   tog_on =0;
$(".ScrollOff").each(function(){
			$(this).removeClass('ScrollOff');
			$(this).addClass('ScrollOn');
	
   
     $(this).css("height", "410px");
     	});
         $('#ie-prob1').css("padding-left", '700px');
         $('#ie-prob2').css("margin-left", '-700px');
          $('#content-container').css("margin-left", '265px');
//addEvent(window, 'resize', dynamicLayout);
     timedCount();    
         
        $('#guide').show();
       $('#content-container').css("padding", '15px');
     //   document.getElementById('submenu').style.display = 'none';
      //  document.getElementById('head').style.display = 'none';
         $('#men-tabs-wrapper').show();
       $('#side-tool').show();
        if ( $('#sub-menu2') != null){
          $('#sub-menu2').show();
          
          }

if ( $('#SearchPage') != null){
           $('#SearchPage').css("overflow", 'auto');
          
        
          }

}

dynamicLayout('togglediv');

        return 0;
}




function fullScreen(){if(full_screen==0){$('#head').hide();$('#guide').hide();$('#side-tool').css('top','30px');$('#lowerbuttons').show();full_screen=1;}
else{$('#submenu').show();$('#head').show();$('#guide').show();$('#men-tabs-wrapper').show();$('#lowerbuttons').hide();$('#side-tool').css('top','74px');full_screen=0;}
dynamicLayout('fullscreen');}

function shift_it(elem,link){$('#men1 .sub-list').slideUp('fast');$('#men1 .slide_links').html('+');if(link.innerHTML=='-'){link.innerHTML='+';}else{link.innerHTML='-';$(elem).slideDown('fast');}return false;}

function loadlookuphelp() {
var load = window.open('AboutLookup','','scrollbars=no,menubar=no,height=280,width=400,resizable=yes,toolbar=no,location=no,status=no');
}

function loadInfo(url) {
var load = window.open(url,'','scrollbars=yes,menubar=no,height=500,width=700,resizable=yes,toolbar=no,location=no,status=no');
}



function loadPoll() {
var load = window.open('Poll','','scrollbars=no,menubar=no,height=200,width=400,resizable=yes,toolbar=no,location=no,status=no');
return false;
}



function Menu(which,link,flag,men_tab,coll,hidden_side,rand){
	var divs_to_bring=new Array('men1','men2','men3','men4','men5','men6','men7');
	//unhide(rand);
	var a_len=divs_to_bring.length;
//	alert(a_len);
	
	$.each(divs_to_bring,function(i,val){
		if($("#"+divs_to_bring[i])!=null){
			$("#"+divs_to_bring[i]).hide();
			}
			}
			);
			$("#"+which).show();
			var links=$("#men-tabs a");
			var prevlinks=new Array();
			var c=0;
			$.each(links,function(i,val){
				links[i].className='';}
				);
				var dead_flag=0;
				if(flag==1){link.className="selected";
				}else{
					if(document.getElementById(link)!=null){
						document.getElementById(link).className="selected";
						}else{
							Menu('men1','nav_link',0,flag,'nav',coll,hidden_side,rand)
							dead_flag=1;
						}
					}
					if(hidden_side=="true"){
					//	$("#side-tool").css({ backgroundColor:"#CCCCCC"});
					//	$("#"+which).animate({ width: "+=300", marginBottom: 10 }, 2000).animate({ backgroundColor: "black" }, {queue: false, duration: 2000});
						set_men_tab(men_tab,coll,rand);
					}
				
dynamicLayout('menu');
}
var confirmMsg  = 'Are you sure you want to ';
function confirmLink(theLink, theSqlQuery){    // Confirmation is not required in the configuration file    // or browser is Opera (crappy js implementation)    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {        return true;    }    var is_confirmed = confirm(confirmMsg + ' ' + theSqlQuery);    if (is_confirmed) {        theLink.href += '&is_js_confirmed=1';    }    return is_confirmed;} // end of the 'confirmLink()' function

function set_men_tab(tab,coll,rand){var url="dummy?base=js&collection="+coll+"&men_tab="+tab+"&rand_num="+rand;$.post(url);}
function collectionselecter(x){var url='Index?collection='+x+'&set_as_cursor=clear';window.open(url,'_top');}
function LoadTOC(coll,handle,index){toc_loaded=1;$("#men3").html("<img src='/static/holimages200805/progress_bar.gif' >");var url="sidetools/toc-bar?collection="+coll+"&handle="+handle+"&index="+index;$.get(url,function(data){$("#men3").html(data);dynamicLayout('toc');identify_section(coll,handle,document.getElementById('pageSelect').options[document.getElementById('pageSelect').selectedIndex].value);});}
function TrackerQ(col_name,handle_name,page_id){if(store_on==0){store_on=1;
//$("#citationInfo").html("");
$("#citationInfo").show();lib_on=0;srch_on=0;var url="MyHeinTest?base=js&action=new&collection="+col_name+"&handle="+handle_name+"&id="+page_id+"&tracker=yes&controller=tags";$.get(url,function(data){$("#citationInfo").html(data);});store_on=1;}else{store_on=0;
//$("#citationInfo").html("");
$("#citationInfo").hide();}}
function Tracker(col_name,handle_name,page_id,cit_input,tag_old,tag_new){var url="MyHeinTest?action=create&controller=tags&base=js&insert=yes&collection="+col_name+"&handle="+handle_name+"&id="+page_id+"&cit_input="+cit_input+"&tag_old="+tag_old+"&tag_new="+tag_new;$.get(url,function(data){$("#citationInfo").html(data);});}
function GetCitation(col_name,handle_name,id,randX){if(cit_on==0){cit_on=1;$("#citationInfo").show();$("#waiting_notifier").html("<p>Please Wait...<br/><img src='/static/holimages200805/progress_bar.gif' ></p>");$("#waiting_notifier").css("display",'none');var url="citation-info?collection="+col_name+"&handle="+handle_name+"&id="+id+"&rand="+randX;$.get(url,function(data){$("#citationInfo").html(data);$("#waiting_notifier").html('');$("#waiting_notifier").hide();dynamicLayout('citation');});}else{cit_on=0;
//$("#citationInfo").html("");
$("#citationInfo").hide();dynamicLayout('remove cit');}}
function GetCitationX(col_name,handle_name,id,randX){cit_on=1;var url="citation-info?collection="+col_name+"&handle="+handle_name+"&id="+id+"&rand="+randX;$.get(url,function(data){$("#citationInfo").html(data);dynamicLayout('citx');});}
function pageselecter(id,handle,size,index_in,isize,rot,coll){swapFade(handle,0,coll,'jump',id,'adv',size);}
function start_wait(){$("#waiting_notifier").html("<p>Please Wait...<br/><img src='/static/holimages200805/progress_bar.gif' ></p>");$("#waiting_notifier").css("display",'block');}
function end_wait(){$("#waiting_notifier").html('');$("#waiting_notifier").hide();}
var divs_to_fade=new Array('box-1','box-2','box-3','box-4','box-5','box-6','box-7','box-8','box-9');var imgs_to_fade=new Array('box_1_image','box_2_image','box_3_image','box_4_image','box_5_image','box_6_image','box_7_image','box_8_image','box_9_image');var i=0;var wait=5000;var dir=1;var load_first=1;var load_back=1;var kill_box=0;function PadDigits(n,totalDigits)
{n=n.toString();var pd='';if(totalDigits>n.length)
{for(i=0;i<(totalDigits-n.length);i++)
{pd+='0';}}
return pd+n.toString();}



		function showRequestX(formData, jqForm, options) { 
		    // formData is an array; here we use $.param to convert it to a string to display it 
		    // but the form plugin does this for you automatically when it submits the data 
		    var queryString = $.param(formData); 

		    // jqForm is a jQuery object encapsulating the form element.  To access the 
		    // DOM element for the form do this: 
		    // var formElement = jqForm[0]; 

		  //  alert('About to submit: \n\n' + queryString); 

		    // here we could return false to prevent the form from being submitted; 
		    // returning anything other than false will allow the form submit to continue 
		    return true; 
		} 

		// post-submit callback 
		function showResponseX(responseText, statusText)  { 
		    // for normal html responses, the first argument to the success callback 
		    // is the XMLHttpRequest object's responseText property 

		    // if the ajaxForm method was passed an Options Object with the dataType 
		    // property set to 'xml' then the first argument to the success callback 
		    // is the XMLHttpRequest object's responseXML property 

		    // if the ajaxForm method was passed an Options Object with the dataType 
		    // property set to 'json' then the first argument to the success callback 
		    // is the json data object returned by the server 
              $('#save_success').show();
		//    alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.'); 
		}

function swapFadeSpecial(handle_var,dir,collection,how,new_page,where,size,this_sec,url){
	var next_handle;
	var nextid;
	if((collection=="fedreg")||(collection=="fedregsampler")){
		var str=handle_var;
		var ar=str.match(/(.+)(\d\d\d)(\d\d\d)$/);
		var handpart=RegExp.$1;
		var vol=RegExp.$2;
		var num=RegExp.$3;
		if(dir==1){
			num=num*1+1;
			if(handpart!=""){
				var newnumber=PadDigits(num,3);
				next_handle=handpart+vol+newnumber;
				nextid=1;
				}
			}
if(dir==-1){
	num=num*1-1;
	if(handpart!=""){var newnumber=PadDigits(num,3);var next_handle=handpart+vol+newnumber;next_handle=handpart+vol+newnumber;nextid='last';}}}
window.open("Page?collection="+collection+"&id="+nextid+"&handle="+next_handle,'_self');}














function swapFadeText(handle_var,dir,collection,how,new_page,where,size,this_sec,url){
	if(document.getElementById('handle')!=null){
//		alert(handle_var+" "+document.getElementById('handle').value);
		if(document.getElementById('handle').value == handle_var){
			url = url+"&base=js";
			//alert(url);
			$.get(url,function(data){
				$("#content-container").html(data);	
				
	dynamicLayout('sfadetexzt');
			});
		}else{
			window.open(url,'_top');
			
			
		}

	}else{
		window.open(url,'_top');
	}
	
	
	
}




function swapFade(handle_var,dir,collection,how,new_page,where,size,this_sec,url,search_terms, search_type){
	
	var searched_t = document.getElementById('searched_text').value;
	//alert(searched_t);
	
	if((searched_t=='X')&&(url)){
		var target_url=url + "&terms="+document.getElementById('pageterms').value + "&termtype=" +document.getElementById('pagetermtype').value;
		if(new_page != ''){
			var target_url="Page?handle="+handle_var+"&id="+new_page+"&collection="+collection +"&terms="+document.getElementById('pageterms').value + "&termtype=" +document.getElementById('pagetermtype').value;
;
		}
		identify_section(collection,handle_var,new_page);
		swapFadeText(handle_var,dir,collection,how,new_page,where,size,this_sec,target_url);
		
	}else{
	 document.getElementById('searched_text').value=0;
	
	if(!size){
		if(document.getElementById('page_size')!=null){
			size=document.getElementById('page_size').value;
			}else{
				size=3;
			}
	}
	var page_rot=0;
	if(document.getElementById('page_rot')!=null){
		page_rot=document.getElementById('page_rot').value;
	}else{
		page_rot=0;
	}
	
	if((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageBox")!=null)||(document.getElementById("PageTextBox")!=null)){
		
		var target_page=new_page;
		var where_flag=0;
		var a_len=divs_to_fade.length;
		$('.fade-box').removeClass('ViewedPage');
		for(var y=0;y<a_len;y++){
			if(document.getElementById(divs_to_fade[y])!=null){
				document.getElementById(divs_to_fade[y]).style.display='none';
			}
		}
		
                if(!where){
                    
			if((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageTextBox")!=null)){
				where='simple';
			}else{
				where='adv';
			}
		}else{
			where_flag=1;
		}
		// alert(where);
		if(((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageTextBox")!=null))&&(where_flag!=1)){

			if((kill_box==1)&&(document.getElementById('box-1')!=null)){
				document.getElementById('box-1').innerHTML="<img src='' id='box_1_image' />";
				kill_box=0;
			}
			
			//document.getElementById("citationInfo").innerHTML='';
			$("#citationInfo").hide();
			dynamicLayout('swapfade');
			cit_on=0;
			store_on=0;
			var j;
			var j_id;
			var k_id;
			var k;
			var place_id=1200;
			
			if(dir==0){
				if(how=="jump"){
					identify_section(collection,handle_var,new_page);
					//alert(how);
					i_id++;
					load_first=1;
					load_back=1;
					i_id=new_page;
					j=i+1;
					if(j==9)j=0;
					j_id=i_id-1+2;
					if(j_id==0)j_id=1;
					if(j==-1)j=8;
					k=i-1;
					if(k==-1)k=8;
					k_id=new_page-1;
					if(k_id==0)k_id=1;
					if(document.getElementById("PageTextBox")!=null){
						
						var target_url="Page?handle="+handle_var+"&id="+new_page+"&type=text&collection="+collection;window.open(target_url,'_top');
						return false;
					}else{
						
						identify_section(collection,handle_var,target_page,this_sec);
						if(page_rot==0){
                                                  var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+target_page+"&box="+i+"&terms="+search_terms+"&termtype="+search_type+"&cotp=false&size="+size;
								
							//alert(url_high);
                                                                 $("#"+divs_to_fade[i]).html("<br>");
								$.get(url_high,function(data){
									//alert(url_index);
                                                                      //  alert('jump');
									$("#"+divs_to_fade[i]).html(data);
									 $("#"+divs_to_fade[i]).show();
								//	alert("why ie?");
								});
							//document.getElementById(divs_to_fade[i]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+new_page+"&collection="+collection+"&size="+size+"' alt='handle is "+handle_var+" and id is "+new_page+"'/>";
						}else{
							document.getElementById(divs_to_fade[i]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+new_page+"&size="+size+"' alt='handle is "+handle_var+" and id is "+new_page+"'/>";
						}
						if(page_rot==0){
							document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
							document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
						}else{
							document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
							document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
						}
						var opts=document.getElementById("pageSelect").options;
						for(var c=0;c<opts.length;c++){
							if(opts[c].value==new_page){
								document.getElementById("pageSelect").options[c].selected=true;
							}
						}
					}
				}
			}else{
				if(document.getElementById("PageTextBox")!=null){
				}else{
					document.getElementById(divs_to_fade[i]).style.display='none';
				}
				if(dir==1){
				i++;
				i_id++;
				if(i==9)i=0;
				j=i+1;
				if(j==9)j=0;
				j_id=i_id+1;
				k_id=j_id+1;
				k=j+1;
				if(k==9)k=0;
				var opts=document.getElementById("pageSelect").options;
				for(var c=0;c<opts.length;c++){
					if(opts[c].value==i_id){
						document.getElementById("pageSelect").options[c].selected=true;
					}
				}
				target_page=i_id;
				if(document.getElementById("PageTextBox")!=null){
					var target_url="Page?handle="+handle_var+"&id="+target_page+"&type=text&collection="+collection;window.open(target_url,'_top');
					return false;
				}else{
					identify_section(collection,handle_var,target_page);
					if(page_rot==0){
						var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+j_id+"&box="+j+"&terms="+search_terms+"&termtype="+search_type+"&cotp=false&size="+size;
						//alert(size);
						//	$.get(url_high,function(data){
								//alert(url_index);
						//		$("#"+divs_to_fade[i]).html(data);
					//			$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
					//		});
						
							$.get(url_high,function(data){
								//alert(url_index);
								$("#"+divs_to_fade[j]).html(data);
								//$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
							});
						//document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+j_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+k_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
					}else{
						document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
					}
					if(load_first==1){
						load_first=0;
					}
				}
			}
			if(dir==-1){
				i--;
				i_id--;
				if(i==-1)i=8;
				j=i-1;
				if(j==-1)j=8;
				j_id=i_id-1;
				if(j_id==0)j_id=1;
				if(j_id==-1)j_id=1;
				if(i_id==0)i_id=1;
				k_id=j_id-1;
				k=j-1;
				if(k==-1)k=8;
				if(k_id==0)k_id=1;
				target_page=i_id;
				if(document.getElementById("PageTextBox")!=null){
					var target_url="Page?handle="+handle_var+"&id="+target_page+"&type=text&collection="+collection;window.open(target_url,'_top');return false;}else{identify_section(collection,handle_var,target_page);
					var opts=document.getElementById("pageSelect").options;
					for(var c=0;c<opts.length;c++){
						if(opts[c].value==i_id){
							document.getElementById("pageSelect").options[c].selected=true;
						}
					}
				if(page_rot==0){
					var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+j_id+"&box="+j+"&terms="+search_terms+"&termtype="+search_type+"&cotp=false&size="+size;
						//alert(size);
						//	$.get(url_high,function(data){
								//alert(url_index);
						//		$("#"+divs_to_fade[i]).html(data);
					//			$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
					//		});
						
							$.get(url_high,function(data){
								//alert(url_index);
								$("#"+divs_to_fade[j]).html(data);
								//$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
							});
							
					//document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+j_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+k_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
				}else{
					document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
				}
				if(load_back==1){
					load_back=0;
				}
			}
		}
	}
	
	var url="PageDummy?base=js&handle="+handle_var+"&collection="+collection+"&id="+target_page;
	$.get(url);
	
	//alert('hi');
var myFile = document.location.toString();
var where = myFile.split('#')[0];
var loco= document.getElementById('pageSelect').value;
	// window.location.href = where + '#' + loco;
	page_loc=loco;
	setTimeout("document.getElementById(divs_to_fade[i]).style.display='';",20);
	}else{
         
		LoadPageAdv(handle_var,dir,how,new_page,collection,where,size,this_sec);
	}
	if(scroll_div==1){
		if(document.getElementById('ScrollDiv')!=null){
			document.getElementById('ScrollDiv').scrollTop=(findPosY(document.getElementById("page_top"))-150);}
		}
	}else{
		
		window.open(url,'_top');
		return false;
	}
	}
}
	
	
	
	
var help_where;
var handle_var_hlp;
var dir_hlp;
var how_hlp;
var new_page_hlp;
var col_hlp;


function LoadPageAdv(handle_var,dir,how,new_page,col,where,size,this_sec){identify_section(col,handle_var,new_page,this_sec);$("#waiting_notifier").html("<p>Please Wait...<br/><img src='/static/holimages200805/progress_bar.gif' ></p>");$("#waiting_notifier").css("display",'block');var url;if(where=='adv'){url="PageADV?base=js&collection="+col+"&handle="+handle_var+"&id="+new_page+"&size="+size;}
if(where=='simple'){url="Page?base=js&collection="+col+"&handle="+handle_var+"&id="+new_page+"&size="+size;}
help_where=where;handle_var_hlp=handle_var;dir_hlp=dir;how_hlp=how;new_page_hlp=new_page;col_hlp=col;$("#content-container").html('');$.get(url,function(data){$("#content-container").html(data);if(help_where=='simple'){swapFade(handle_var_hlp,0,col_hlp,'jump',new_page_hlp);}
dynamicLayout('loadpageadv');$("#waiting_notifier").html('');$("#waiting_notifier").hide();});}
function findPosY(obj){var curtop=0;if(obj){if(obj.offsetParent){while(1){curtop+=obj.offsetTop;if(!obj.offsetParent){break;}
obj=obj.offsetParent;}}else if(obj.y){curtop+=obj.y;}
return curtop;}}



$(function(){

	 $("#journal_box > input[type='checkbox']").change(function(){
	 	
	 	var val_for = $(this).val()
	 	//alert(val_for);
	 	
	 		    if((val_for == 'ALL')&&($("#journal_box > input[id='ALL']").attr("checked") == true)){
	 		 		$("#journal_box").find('label').css({ backgroundColor:""});
	 				$("#journal_box > input[type='checkbox']").removeAttr("checked");
	 				$("#journal_box > input[id='ALL']").attr('checked', 'checked');
	 				$("#journal_box> label[for="+$(this).attr('id') + "]").css({ backgroundColor:"#FFFF99"});
	 				
	 				//$("#journal_box > input[type='checkbox']").removeAttr('disabled');	 		 	
	 		 }else{
	 		 	$("#journal_box > input[id='ALL']").find('label').css({ backgroundColor:""});
	 			$("#journal_box > input[id='ALL']").removeAttr("checked");
	 			if(($(this).attr("checked") == true )){
	 				$("#journal_box> label[for="+$(this).attr('id') + "]").css({ backgroundColor:"#FFFF99"});	
	 			}else{
	 				$("#journal_box> label[for="+$(this).attr('id') + "]").css({ backgroundColor:""});
	 			}
	 			 }
	 			 
	 			 
	 			 });
});

function ded(){
	 $("#journal_box > input[type='checkbox']").each(function(){
	 			if(($(this).attr("checked") == true )){
	 				$("#journal_box").find('label[for='+ $(this).attr('id') +']').css({ backgroundColor:"#FFFF99"});	 			}else{
	 			$("#journal_box > input[id='ALL']").find('label').css({ backgroundColor:""});		
	 				}
	 		 });

}


var page_loading = true


function subchange(option){
	
	
	}

function get_node_form(handle, id, todo, target_div){
	
	
	var url_high = "node_form?handle="+handle+"&node_id="+id+"&action="+todo+"&base=js";
	if(todo =='add_view'){
		url_high = "node_form?handle="+handle+"&parent_id="+id+"&action="+todo+"&base=js";

	}
	
$.get(url_high,function(data){
								//	alert(url_high);
                                                                      //  alert('jump');
									$("#"+target_div).html(data);
									$("#"+target_div).toggle();
								//	alert("why ie?");
								});
}

function get_handle_form(handle, id, todo, target_div){
	
	var url_high = "handle_form?handle="+handle+"&node_id="+id+"&action="+todo+"&base=js";
	
	
$.get(url_high,function(data){
								//	alert(url_high);
                                                                      //  alert('jump');
									$("#"+target_div).html(data);
									$("#"+target_div).toggle();
								//	alert("why ie?");
								});
}



////$#########




function swapFadeC(search_terms, search_type, handle_var,dir,collection,how,new_page,where,size,this_sec,url){
     var num_pages = 2;
     //alert(search_terms);
     //function swapFade(handle_var,dir,collection,how,new_page,where,size,this_sec,url){
        if(document.getElementById('cotp_toggle').value == 1){
          //alert('hi');
	  // go to swapfade if citations are actualy OFF
          swapFade(handle_var,dir,collection,how,new_page,where,size,this_sec,url,search_terms, search_type);
          //return false;
          
        }else{
        // alert('cotp');
	var searched_t = document.getElementById('searched_text').value;
	//alert(searched_t);
	//alert(how);
	if((searched_t=='X')&&(url)){
		var target_url=url + "&terms="+document.getElementById('pageterms').value + "&termtype=" +document.getElementById('pagetermtype').value;
		if(new_page != ''){
			var target_url="Page?handle="+handle_var+"&id="+new_page+"&collection="+collection +"&terms="+document.getElementById('pageterms').value + "&termtype=" +document.getElementById('pagetermtype').value;
;
		}
		swapFadeText(handle_var,dir,collection,how,new_page,where,size,this_sec,target_url);
		
	}else{
	 document.getElementById('searched_text').value=0;
	
	if(!size){
		if(document.getElementById('page_size')!=null){
			size=document.getElementById('page_size').value;
			}else{
				size=3;
			}
	}
	var page_rot=0;
	if(document.getElementById('page_rot')!=null){
		page_rot=document.getElementById('page_rot').value;
	}else{
		page_rot=0;
	}
	if((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageBox")!=null)||(document.getElementById("PageTextBox")!=null)){
		var target_page=new_page;
		var where_flag=0;
		//alert(how);
		var a_len=divs_to_fade.length;
		$('.fade-box').removeClass('ViewedPage');
		for(var y=0;y<a_len;y++){
			if(document.getElementById(divs_to_fade[y])!=null){
				document.getElementById(divs_to_fade[y]).style.display='none';
			}
		}
		if(!where){
			if((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageTextBox")!=null)){
				where='simple';
			}else{
				where='adv';
			}
		}else{
			where_flag=1;
		}
                
		if(((document.getElementById("crossfade-container")!=null)||(document.getElementById("PageTextBox")!=null))&&(where_flag!=1)){
			if((kill_box==1)&&(document.getElementById('box-1')!=null)){
				document.getElementById('box-1').innerHTML="<img src='' id='box_1_image' />";
				kill_box=0;
			}
		//	document.getElementById("citationInfo").innerHTML='';
			$("#citationInfo").hide();
			dynamicLayout('swapfade');
			cit_on=0;
			store_on=0;
			var j;
			var j_id;
			var k_id;
			var k;
			var place_id=1200;
			if(dir==0){
				if((how=="jump")||(how=="preload")){
                                  
					
					i_id++;
					load_first=1;
					load_back=1;
					i_id=new_page;
					j=i+1;
					if(j==9)j=0;
					j_id=i_id-1+2;
					if(j_id==0)j_id=1;
					if(j==-1)j=8;
					k=i-1;
					if(k==-1)k=8;
					k_id=new_page-1;
					if(k_id==0)k_id=1;
                                        
					if(document.getElementById("PageTextBox")!=null){
						var target_url="Page?handle="+handle_var+"&id="+new_page+"&type=text&collection="+collection;window.open(target_url,'_top');
						return false;
					}else{
						if(how=="jump"){
                                                
						identify_section(collection,handle_var,target_page,this_sec);
                                                 
						if(page_rot==0){
							
								var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+target_page+"&box="+i+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;
								//alert(size);
                                                                 $("#"+divs_to_fade[i]).html("<br>");
								$.get(url_high,function(data){
									//alert(url_index);
                                                                      //  alert('jump');
									$("#"+divs_to_fade[i]).html(data);
									 $("#"+divs_to_fade[i]).show();
								//	alert("why ie?");
								});
                                                               
						//	document.getElementById(divs_to_fade[i]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+new_page+"&collection="+collection+"&size="+size+"' alt='handle is "+handle_var+" and id is "+new_page+"'/>";
						}else{
							document.getElementById(divs_to_fade[i]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+new_page+"&size="+size+"' alt='handle is "+handle_var+" and id is "+new_page+"'/>";
						}
					}
						if(page_rot==0){
								var url_high1 = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&box="+j+"&shr_thisid="+j_id+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;

								$.get(url_high1,function(data){
									//alert(url_index);
									$("#"+divs_to_fade[j]).html(data);
									//$("#"+divs_to_fade[i]).show();
								//	alert("why ie?");
								});
								var url_high2 = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&box="+k+"&shr_thisid="+k_id+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;

									$.get(url_high2,function(data){
										//alert(url_index);
										$("#"+divs_to_fade[k]).html(data);
										//$("#"+divs_to_fade[i]).show();
									//	alert("why ie?");
									});
						//	document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
						//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
						}else{
						
							document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
							document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
						}
						var opts=document.getElementById("pageSelect").options;
						for(var c=0;c<opts.length;c++){
							if(opts[c].value==new_page){
								document.getElementById("pageSelect").options[c].selected=true;
							}
						}
					}
				}
			}else{
				if(document.getElementById("PageTextBox")!=null){
				}else{
					document.getElementById(divs_to_fade[i]).style.display='none';
				}
				if(dir==1){
				//	alert("fore");
				i++;
				i_id++;
				if(i==9)i=0;
				j=i+1;
				if(j==9)j=0;
				j_id=i_id+1;
				k_id=j_id+1;
				k=j+1;
				if(k==9)k=0;
				var opts=document.getElementById("pageSelect").options;
				for(var c=0;c<opts.length;c++){
					if(opts[c].value==i_id){
						document.getElementById("pageSelect").options[c].selected=true;
					}
				}
				target_page=i_id;
				if(document.getElementById("PageTextBox")!=null){
					var target_url="Page?handle="+handle_var+"&id="+target_page+"&type=text&collection="+collection;window.open(target_url,'_top');
					return false;
				}else{
					identify_section(collection,handle_var,target_page);
					if(page_rot==0){
					//	alert(divs_to_fade[i]);
					//	$("#"+divs_to_fade[i]).css({ backgroundColor:"#CCCCCC"});
							var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+j_id+"&box="+j+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;
						//alert(size);
						//	$.get(url_high,function(data){
								//alert(url_index);
						//		$("#"+divs_to_fade[i]).html(data);
					//			$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
					//		});
						
							$.get(url_high,function(data){
								//alert(url_index);
								$("#"+divs_to_fade[j]).html(data);
								//$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
							});
							var url_high2 = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&shr_thisid="+k_id+"&box="+k+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;
							
						//		$.get(url_high2,function(data){
									//alert(url_index);
						//			$("#"+divs_to_fade[k]).html(data);
									//$("#"+divs_to_fade[i]).show();
								//	alert("why ie?");
						//		});
					//	document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+j_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+k_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
					}else{
						
						
						document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
					}
					
					if(load_first==1){
						load_first=0;
					}
				}
			}
			if(dir==-1){
				i--;
				i_id--;
				if(i==-1)i=8;
				j=i-1;
				if(j==-1)j=8;
				j_id=i_id-1;
				if(j_id==0)j_id=1;
				if(j_id==-1)j_id=1;
				if(i_id==0)i_id=1;
				k_id=j_id-1;
				k=j-1;
				if(k==-1)k=8;
				if(k_id==0)k_id=1;
				target_page=i_id;
				if(document.getElementById("PageTextBox")!=null){
					var target_url="Page?handle="+handle_var+"&id="+target_page+"&type=text&collection="+collection;window.open(target_url,'_top');return false;}else{identify_section(collection,handle_var,target_page);
					var opts=document.getElementById("pageSelect").options;
					for(var c=0;c<opts.length;c++){
						if(opts[c].value==i_id){
							document.getElementById("pageSelect").options[c].selected=true;
						}
					}
				if(page_rot==0){
							var url_high = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&box="+j+"&shr_thisid="+j_id+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;
						
						//	$.get(url_high,function(data){
								//alert(url_index);
						//		$("#"+divs_to_fade[i]).html(data);
					//			$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
					//		});
						
							$.get(url_high,function(data){
								//alert(url_index);
								$("#"+divs_to_fade[j]).html(data);
								//$("#"+divs_to_fade[i]).show();
							//	alert("why ie?");
							});
							var url_high2 = "insertBeta?base=js&collection="+collection+"&handle="+handle_var+"&box="+k+"&shr_thisid="+k_id+"&terms="+search_terms+"&termtype="+search_type+"&cotp=true&size="+size;
							
						//		$.get(url_high2,function(data){
									//alert(url_index);
						//			$("#"+divs_to_fade[k]).html(data);
									//$("#"+divs_to_fade[i]).show();
								//	alert("why ie?");
						//		});
				//	document.getElementById(divs_to_fade[j]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+j_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
				//	document.getElementById(divs_to_fade[k]).innerHTML="<img src='ViewImageLocal?handle="+handle_var+"&id="+k_id+"&collection="+collection+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
				}else{
					document.getElementById(divs_to_fade[j]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+j_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+j_id+"'/>";
					//document.getElementById(divs_to_fade[k]).innerHTML="<img src='Rotate?handle="+handle_var+"&d="+page_rot+"&collection="+collection+"&id="+k_id+"&size="+size+"'  alt='handle is "+handle_var+" and id is "+k_id+"'/>";
				}
				
				if(load_back==1){
					load_back=0;
				}
			}
		}
	}
	
	var url="PageDummy?base=js&handle="+handle_var+"&collection="+collection+"&id="+target_page;
	$.get(url);
	//alert("showing page " + i);
	$("#"+divs_to_fade[i]).show();
	
	//alert('hi');
var myFile = document.location.toString();
var where = myFile.split('#')[0];
var loco= document.getElementById('pageSelect').value;
	 window.location.href = where + '#' + loco;
	page_loc=loco;
	
	//setTimeout("document.getElementById(divs_to_fade[i]).style.display='';",20);
	}else{
		LoadPageAdv(handle_var,dir,how,new_page,collection,where,size,this_sec);
	}
	if(scroll_div==1){
		if(document.getElementById('ScrollDiv')!=null){
			document.getElementById('ScrollDiv').scrollTop=(findPosY(document.getElementById("page_top"))-150);}
		}
	}else{
		window.open(url,'_top');
		return false;
	}
	}
}
}
	




