/*
 * jQuery JavaScript Library v1.3.2
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-02-19 17:34:21 -0500 (Thu, 19 Feb 2009)
 * Revision: 6246
 */
 
 
		$(function() {

			var $tabs = $('#tabs').tabs();
	
			$(".ui-tabs-panel").each(function(i){
	
			  var totalSize = $(".ui-tabs-panel").size() - 1;
	
			  if (i != totalSize) {
			      next = i + 2;
		   		  $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page &#187;</a>");
			  }
	  
			  if (i != 0) {
			      prev = i;
		   		  $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Page</a>");
			  }
   		
			});
	
			$('.next-tab, .prev-tab').click(function() { 
		           $tabs.tabs('select', $(this).attr("rel"));
		           return false;
		       });
       

		});
 
 
 
//on page load
$(document).ready(function() {
    $(".jumpmenu").change(function() {
        var val = $(this).selectedValues();
        if (val != '') {
            location.href=val;
        }
    });
});





//var isInIFrame = (window.location != window.parent.location) ? true : false;


 
 
		function clearForm(form) {
		  // iterate over all of the inputs for the form
		  // element that was passed in
			$(':input', form).each(function() {
		 		var type = this.type;
		 		var tag = this.tagName.toLowerCase(); // normalize case
		 		// it's ok to reset the value attr of text inputs,
		 		// password inputs, and textareas
				switch (this.type) {
		      case "password":
		      case "textarea":
		      case "text":
		        this.value = "";
		        break;
		      case "select-multiple":
		      case "select-one":
		        this.value = 0;
		        break;
		      
		      case "checkbox":
		        this.checked = false;
		        break;
		        

		    }
		    
		    

		 	});
		 	$('input[name="language"]')[0].checked = true;
		 	
		 	$('input[name="sortOrder"]')[0].checked = true;
		};
		
					
			$(function() { 
			    $(".toggleSearchAndClear").click(function(evt) {
			        var d = $(this).attr("searchdiv");
			        $(".search_block[searchdiv=" + d + "], .toggleSearch[searchdiv=" + d + "]").toggle();
			        clearForm();
			       	return false;

			        
			    }); 
			});
			
			
			
			$(function() { 
			    $(".toggleSearch").click(function(evt) {
			        var d = $(this).attr("searchdiv");
			        $(".search_block[searchdiv=" + d + "], .toggleSearch[searchdiv=" + d + "]").toggle();
			        
			         $( 'html, body' ).animate( { scrollTop: 0 }, 0 );
			        
			       	return false;

			        
			    }); 
			    
			   

			    
			});
		
	 $(function() {
		var $tabs = $('#tabs').tabs();
			$(".ui-tabs-panel").each(function(i){
		
			  var totalSize = $(".ui-tabs-panel").size() - 1;
		
			  if (i != totalSize) {
			      next = i + 2;
		   		  $(this).append("<a href='#' class='next-tab mover' rel='" + next + "'>Next Page &#187;</a>");
			  }
		
			  if (i != 0) {
			      prev = i;
		   		  $(this).append("<a href='#' class='prev-tab mover' rel='" + prev + "'>&#171; Prev Page</a>");
			  }
		
			});
		
			$('.next-tab, .prev-tab').click(function() {
		           $tabs.tabs('select', $(this).attr("rel"));
		           return false;
		       });
		
		});
		function clearSearchForm(){
			//$( "form" )[ 0 ].reset();
			
			$('#dropDownSearchEngine').val(0);
			$('#textSearchEngine').val('');
				
				return false;
		
			}
			
		$(document).ready(function() {
		


			$(function() { 
			    $(".view-code").click(function(evt) {
			        var d = $(this).attr("keywordsDiv");
			        $(".keywords_block[keywordsDiv=" + d + "], .view-code[keywordsDiv=" + d + "]").toggle();
			       return false;
        
			    }); 
			});

 

			


			$(function() { 
			    $(".view-code").click(function(evt) {
			        var d = $(this).attr("citedbydiv");
			        $(".citedBy_block[citedbydiv=" + d + "], .view-code[citedbydiv=" + d + "]").toggle();
			       return false;
			    }); 
			});
 			$(function() { 
			    $(".view-code").click(function(evt) {
			        var d = $(this).attr("summaryDiv");
			        $(".summary_block[summaryDiv=" + d + "], .view-code[summaryDiv=" + d + "]").toggle();
			       	return false;

			        
			    }); 
			});	

 			$(function() { 
			    $(".toggleContent").click(function(evt) {
			        var d = $(this).attr("uniqueId");
			        $(".toggleBlock[uniqueId=" + d + "], .toggleContent[uniqueId=" + d + "]").toggle();
			       	return false;

			        
			    }); 
			});				

				
			$('[class^=toggle-item]').hide();
			$('[class^=link]').click(function() {
				var $this = $(this);
				var x = $this.attr("className");
				$('.toggle-item-' + x).toggle();
				return false;
			});
		});
	
	
	$(function(){
    $('a.new-window').click(function(){
        window.open(this.href);
        return false;
    });
	});	
	
	
	/* ---------------------------- */
/* XMLHTTPRequest Enable */
/* ---------------------------- */
function createObject() {
var request_type;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
request_type = new ActiveXObject("Microsoft.XMLHTTP");
} else {
request_type = new XMLHttpRequest();
}
return request_type;
}

var http = createObject();

/* -------------------------- */
/* SEARCH */
/* -------------------------- */
function searchDocNos() {
volume = encodeURI(document.getElementById('ajax_volume').value);
page = encodeURI(document.getElementById('ajax_page').value);
document.getElementById('msg').style.display = "block";
document.getElementById('msg').innerHTML = "Searching for <strong>volume = " + volume+" page =" +page+"";
// Set te random number to add to URL request
nocache = Math.random();
http.open('get', 'docsearch.cfm?volume='+volume+'&page='+page+'&nocache = '+nocache);
http.onreadystatechange = searchDocNosReply;
http.send(null);
}
function searchDocNosReply() {
if(http.readyState == 4){
var response = http.responseText;
document.getElementById('search-result').innerHTML = response;
}
}
