/*
    FILE:       : wbPopup.js
    DESCRIPTION : Defines the common variables and common functions used across the site
                : This is included in template files and navbar
    DATE        : 27 Nov 2001
    AUTHOR      : Siddalinga Murthy K M
    CHANGE CONTROL:
*/

/* wbPopup.js defines header variables like 
    1. Document
    2. Window features
    3. Function for opening a new window.
	4. Function for opening a new article.
*/

var d = document;
// start of UCF-WB-ENH-165
var citepadding="3em";
var citetext="-1em";
// end of UCF-WB-ENH-165

// Get the browser version
var indentWidth="0Px";
var sBrowserName = navigator.appName;
var bAgt=navigator.userAgent.toLowerCase();
var listStyle="none";

if (sBrowserName == "Netscape")
{
  var iBrowser = 1;
// UCF-WB-ENH-083 to handle indentation
  if (bAgt.indexOf("mac") != -1 )
  {
     listStyle="decimal";
     indentWidth="0Px";
  }
  else
  {
    // UCF-WB-ENH-083 initialising the variable indentWidth
    if (parseInt(navigator.appVersion)>=5)
    {
      indentWidth="-12Px";
    }
    else
    {
      indentWidth="-25Px";
	  citepadding="10px";
	  citetext="-3px";
    }
  }
}
else
{
  indentWidth="8Px";
}
// End of UCF-WB-ENH-083

// start of UCF-WB-ENH-165
document.write("<style>");
d.write(".citeAuthor {FONT-SIZE: 10px; COLOR: #333333; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;	");
d.write("display: block; padding-left:"+citepadding+"; text-indent:"+ citetext+";}");
document.write("</style>");
// End of UCF-WB-ENH-165
// Frameless Window Names stored in a array
var windowName = new Array(
    'wbPrint',
    'wbSave',
    'wbPron',
    'wbSrbt',
    'wbRelInfo',
    'wbSchools',
    'wbForgotPass',
    'wbRegistration',
    'wbRenewal',
    'wbSubscription'
);

// Framed Window Names stored in a array
var frameWinName = new Array(
     'wbWebSite',
     'wbPeriodicals',
     'wbSurvey',
     'wbEmail',
     'wbHelp',
     'wbTerms',
     'wbTerms',
     'wbPron',  
     'wbMyacc'
);

// Window Features defined for specific functions.
// However a standard feature set only will be used throughout.
var commonfeatures = 'width=500,height=400,scrollbars=yes,resizable=yes,menubar=yes,toolbars=yes';
var loginWinFeatures = 'width=800,height=400,scrollbars=yes,resizable=yes,menubar=yes';

var features = new Array(
    'width=600,height=400,scrollbars=yes,resizable=yes,menubar=yes', 
    'width=600,height=400,scrollbars=yes,resizable=yes,menubar=yes,toolbars=yes',
    'width=350,height=250',
    'width=600,height=400,scrollbars=yes,resizable=yes,menubar=yes,toolbars=yes',
    commonfeatures,
    loginWinFeatures,
    loginWinFeatures,
    loginWinFeatures,
    loginWinFeatures,
    'width=660,height=520,scrollbars=yes,resizable=no,menubar=no' 
);

var frameWinFeatures = new Array(
    commonfeatures,
    commonfeatures,
    commonfeatures,
    'width=350,height=250',
    commonfeatures,
    commonfeatures,
    commonfeatures,
    'width=300,height=150',
    'width=640,height=400,scrollbars=yes,resizable=yes,menubar=yes,toolbars=yes',
	'width=650,height=550,left=0,top=0,scrollbars=yes'
);

/*
    Name   : positionWindow
    Input  : A number which decides the window id
    Output : Null
    Desc   : The position attribute of the window are appended to the array of features

*/
function positionWindow(winId,winType)
{
  if( winType == 1)
    var winProp = features[winId];
  else
    var winProp = frameWinFeatures[winId];
  var widthPos = winProp.indexOf("width=") + 6;
  var width = winProp.substring(widthPos,widthPos+3);
  var heightPos = winProp.indexOf("height=") + 7;
  var height = winProp.substring(heightPos,heightPos+3);
  var xposition = (screen.width - width) / 2;
  var yposition = (screen.height - height) / 2;
  var position = ',screenx=' + xposition + ','  + 'screeny=' + yposition + ',' + 'left=' + xposition + ',' + 'top=' + yposition;  
  winProp += position;
  return winProp;
}

/*
    Name   : openAWindow
    Input  : A number which decides the window name and features , partial path to the file to be opened
    Output : A new window pops up with the requested file
    Desc   : Opens a frameless page

*/
function openAWindow(fn,path)
{
  //features[fn] = positionWindow(fn,1);
  var url =path;
  if (url.indexOf("/print.htm")!= -1)
	//ENH-242 /wb Removed for Advanced
	url=path;

  wbWin = window.open(url, windowName[fn],features[fn]);
  wbWin.focus();
}


/*
    Name   : openAFramedWindow
    Input  : A number which decides the window name and features , partial path to the file to be opened
    Output : A new framed window pops up with the requested file
    Desc   : Opens a framed page
*/
function openAFramedWindow(fn,path)
{
  //frameWinFeatures[fn] = positionWindow(fn,2);
  wbFrameWin = window.open(path,frameWinName[fn],frameWinFeatures[fn]);
  wbFrameWin.focus();
  return false;
}


/*
    Name   : showArticle
    Input  : Partial path to the file, section number, target anchor to be focussed on and the view
    Desc   : Submits the form frmSection to wbArticle.jsp with the hidden values of section, url and target set
*/
//UCF-WB-ENH-075 Added to refine the function showArticle
function showArticle(section,target) {	

	 
	/*ENH-157 If the displayed article is trial, 
	link on index page should be redirected to sell page*/
	// UCF-WB-ENH-200-1c /wb/Sellpage changed to /wb/Subscribe
	//var url=self.location.toString();
		// ENH-242 removed /wb/	
		
		if (url.indexOf("/Subscribe") != -1 || url.indexOf("/Sellpage") != -1 || url.indexOf("/Login") != -1) {		
		location.href=url+tu;
		return false;
	}
	// ENH-242 removed /wb/ and changed the case
	var hrefURL="article?";
	
	// UCF-WB-ENH-200-1c

	if (url.indexOf("&gr=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&gr=[a-zA-z0-9]*(.*)',''),"");		
	}
	// ENH-215 If loop added to remove the em from the url
	if (url.indexOf("&em=")!= -1) {
		url=url.replace(new RegExp('&em=[a-z]{2}[0-9]{6}[a-z]?',''),'');
	}

	if (url.indexOf("&flag=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&flag=[a-zA-z0-9]*(.*)',''),"");		
	}

	var sectionURL="";
	var targetURL="";
	//check if its a short article
	// yes, then just scroll to the section
	//else
	// if its full view
	// just scroll to the target
	// else
	// open the section and scroll
	if (longArticle == "true"){ 
	//If the view is full article view
    	if (url.indexOf("sc=-1")!= -1 ) {
    	    if (target !="")
    			hrefURL+=url+"#"+target;
    	    else
    			hrefURL+=url+"#s"+section;
    	}
    	// If the sectional view
    	else {
    		//check for the existance of sc parameter in the URL
    		// If sc parameter is not present, add the parameter only if the section is not null
    		if (url.indexOf("&sc") == -1) {
    			if (section != ""){
    				sectionURL="&sc="+section;
				}
    			if (target != "" ) {
    				targetURL="#"+target;			
    		}}
    		//If the parameter sc exists in the URL, replace the parameter
    		else {
    			
    			if (section != "") {
    				section="sc="+section;
    				url=url.replace(new RegExp('&em=[a-z]{2}[0-9]{6}[a-z]?',''),'');
    				url=url.replace(new RegExp('sc=-?[0-9]+',''),section);
    			}
    			if (target !="")
    				targetURL="#"+target;
    		}		
    		hrefURL+=url+sectionURL+targetURL;
    	}
	}
    else
	{
	    // handle the short articles	    
	    if (target != "")
			hrefURL+=url+"#"+target;
	    else
	    {
	      // For short articles, just a direct #target should work. But in case of ExtMedia, the article is treated as short.
              // To handle the /ExtMedia, some redundatn code has been added here.
	      if (url.indexOf("&sc") != -1){
                var tempSc="sc="+section;
                url=url.replace(new RegExp('sc=-?[0-9]+',''),tempSc); 
              }
	      hrefURL+=url+"#s"+section;
	    }
	}
	location.href=hrefURL;
	return false;
}   

/* ENH-242
    Name   : showEbook
    Input  : 
    Desc   : 
*/
function showEbook(target) {	
	if (url.indexOf("/Subscribe") != -1 || url.indexOf("/Sellpage") != -1 || url.indexOf("/Login") != -1) {		
		location.href=url+tu;
		return false;
	}
	var hrefURL="ebook?";
	if (target != "")  {
		hrefURL+=url+"#"+target;		  
	}  
	location.href=hrefURL;
	return false;
}


/*
    Name   : highlightMedia
    Input  : 
    Desc   : 
*/
function highlightMedia() {
	// ENH-242 removed /wb/ and changed the case for media
	location.href="media?"+url+"&hl=1#stw";
	return false;
}   


/*
    Name   : highlightArticle
    Input  : 
    Desc   : 
*/
function highlightArticle() {
	// ENH-242 removed /wb/ and changed the case for article
	var hrefURL="article?";
	//var url=self.location.toString();
	if (url.indexOf("&sc") != -1) {
		url=url.replace(new RegExp('sc=-?[0-9]+',''),"sc=-1");
	}
	else
		url=url+"&sc=-1";

	location.href=hrefURL+url+"&hl=1#stw";
	return false;
}   

// UCF-WB-ENH-075 Function showExtSource() moved from mkarts.pl to the JS file to refine mkarts.pl
/*
    Name   : showExtSource
    Input  : URL of the external media type
    Desc   : Displays the External media type
*/
function showExtSource(extUrl)
{
	/*ENH-157 If the displayed article is trial,link on index page should be redirected to sell page*/
	// UCF-WB-ENH-200 /wb/Sellpage changed to /wb/Subscribe	
	//var url=self.location.toString();
	// ENH-242 /wb changed for advanced
	if (url.indexOf("/Subscribe") != -1 || url.indexOf("/Sellpage") != -1 || url.indexOf("/Login") != -1) 	{		
		location.href=url+tu;
		return false;
	}
	// ENH-242 removed /wb/ and changed the case for media
	var hrefURL="extmedia?";
	// UCF-WB-ENH-200-1c
	if (url.indexOf("&gr=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&gr=[a-zA-z0-9]*(.*)',''),"");
	}
	/*  WB-BUG-227 Changed the regExp to handle em parameter for any RIT length. */
	if (url.indexOf("em=")!= -1) {
		hrefURL+=url.replace(new RegExp('em=([a-z]{2}[0-9]{6}[a-z]?)?',''),"em="+extUrl);
		//alert(url.replace(new RegExp('em=([a-z]{2}[0-9]{6}[a-z]?)?',''),"em="+extUrl));
	}

	else {
		hrefURL+=url+"&em="+extUrl;
	}
	location.href=hrefURL;
	return false;
}
//End UCF-WB-ENH-075



// ENH-246 Function showWbaExtSource() 
/*
    Name   : showWbaExtSource
    Input  : URL of the external media
    Desc   : Displays the External media type
*/
function showWbaExtSource(extUrl)
{	
	var hrefURL="wbaextmedia?";
	if (url.indexOf("&gr=")!= -1) {
		//To prevent Greeting text remaining.		
		url=url.replace(new RegExp('&gr=[a-zA-z0-9]*(.*)',''),"");
	}	
	
	hrefURL+=url+"&em="+extUrl;	
	location.href=hrefURL;
	return false;
}
// ENH-246 end showWbaExtSource() 






/*
    Name   : showPronIcon
    Input  : Number to identify the pronunciation window, partial path to pronunciation file,name of the image and the text in ALT tag
    Desc   : Writes the html code for the hyperlink which opens the pronunciation window
*/
function showPronIcon(winNum,path,image,word)
{
  if ((document.cookie.indexOf('acct=9901AOL') == -1))
  {
    d.write('&nbsp;<A HREF="#" onClick="openAFramedWindow(' + winNum + ', \'' +path +'\')">');
    d.write('<IMG SRC="/na/img/'+image+'" WIDTH="16" HEIGHT="16" BORDER="0"');
    d.write('ALT="Hear pronunciation of &quot;'+word+'&quot;">');
    d.write('</A>');
  }
}
/*End UCF-WB-ENH-132*/


/*
    Name   : searchFocus
    Input  : None
    Desc   : It is called when the page is loaded and from the event onload of the body element.
	     Focus on search text field of homepage,navbar,advanced search and browse
*/
function searchFocus()
{
	//Changes made for ENH-195 to focus on search box once page is loaded starts here
	SearchFormId = document.getElementById("SearchForm");
	if (SearchFormId)
	{	
		SearchFormId.st1.focus();
	}
	//Changes made for ENH-195 ends here
}


/** For ENH-173 Starts*/
/*
	Name	:	makeRelatedLinks
	Input	:	MT and target
	Output	:	Generates Link
	Desc	:	This function is responsible for generating dynamic links
			for the Resource Guide and Related Info pages,depending upon
			the Input parameter,mt and target.
*/
function makeRelatedLinks(MT,target) 
{
  var hrefURL = "";

  /*Get the URL*/
  var url = ""+window.location;
  // UCF-WB-ENH-200-1c
	if (url.indexOf("&gr=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&gr=[a-zA-z0-9]*(.*)',''),"");
	}
	 
	if (url.indexOf("&flag=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&flag=[a-zA-z0-9]*(.*)',''),"");		
	}
	
	if (url.indexOf("&type=")!= -1) {
		url=url.replace(new RegExp('&type=[a-zA-z0-9]*(.*)',''),"");		
	}
  var targetURL = "";
 
  // ENH-226 adding ResearchGuide	
  // ENH-242 removed /wb/ and changed the case
  // ENH-246 : Added pathfinder url
  if ((url.indexOf("/pathfinder") != -1) ||(url.indexOf("/RelatedInfo") != -1) || (url.indexOf("/Article") != -1)  ||(url.indexOf("/ExtMedia") != -1) || (url.indexOf("/ResearchGuide") != -1) || (url.indexOf("/relatedinfo") != -1) || (url.indexOf("/article") != -1) || (url.indexOf("/extmedia") != -1)  || (url.indexOf("/researchguide") != -1)) 
      {
	    strMt = "mt=" + MT;
			
		if (target!="") 
		{
			/*Add the target prefixed with #*/
			targetURL="#"+target;
		}
		if (url.indexOf("&mt") != -1) 
		{
			/* Replace the subsection id number from RIT*/
			hrefURL = url.replace(new RegExp('id=([a-z]{2}[0-9]{6})(-[0-9]*)*(.*)',''),"id=$1$3");

			/*Replace the mt parameter with strMt*/
			hrefURL = hrefURL.replace(new RegExp('mt=([a-z]{2})',''),strMt);

			/*Replace # with empty space*/
			hrefURL = hrefURL.replace(new RegExp('(#[a-z]*)',''),"");
		}
		else 
		{
			hrefURL = url.replace(new RegExp('(#.*)',''),"");
			hrefURL =hrefURL+"&mt="+MT;
		}
		if(MT == 'cw')
		{
			hrefURL =hrefURL+"&type=gen";
		}

		/*Add the target URL with hrefURL*/
		hrefURL += targetURL;
		
			/*If the URL has article ,then replace the Article with RelatedInfo*/
			// ENH-242 Added conditions to check lowercase also
			if((hrefURL.indexOf("/Article") != -1) || (hrefURL.indexOf("/ExtMedia") != -1) || (hrefURL.indexOf("/article") != -1) || (hrefURL.indexOf("/extmedia") != -1))
			{
				strRelated = "relatedinfo";
				// ENH-242 Changed to lowercase
				if (hrefURL.indexOf("/Article") != -1) {
					strRefURL= "Article";
				}
				else if (hrefURL.indexOf("/article") != -1) {
					strRefURL= "article";
				}
				else if (hrefURL.indexOf("/ExtMedia") != -1) {
					strRefURL= "ExtMedia";
				}
				else if (hrefURL.indexOf("/extmedia") != -1) {
					strRefURL= "extmedia";
				}
				// strRefURL = (hrefURL.indexOf("/Article") != -1) ? "article" : "extmedia";				
				/*Replace Article with RelatedInfo*/
				hrefURL=hrefURL.replace(new RegExp(strRefURL,''),strRelated);
						
			}
  
  }
  // ENH-242 Added conditions to check lowercase also
  else if ((url.indexOf("/Resource") != -1) || (url.indexOf("/resource") != -1))
  {
		strMt = "mt=" + MT;
		if (target!="") 
		{
			/*Add the target prefixed with #*/
			targetURL="#"+target;
		}
		if (url.indexOf("&mt") != -1) 
		{
			
			hrefURL = url;

			/* replace the section number from RIT*/
			if (hrefURL.indexOf("&sc") != -1) {	
				hrefURL = hrefURL.replace(new RegExp('(&sc=[0-9]*)',''),'');
			}

			/*Replace the mt parameter with strMt*/
			hrefURL = hrefURL.replace(new RegExp('mt=([a-z]{2})',''),strMt);

			/*Replace # with empty space*/
			hrefURL = hrefURL.replace(new RegExp('(#[a-z]*)',''),"");
		}
		else 
		{
			hrefURL =url+"&mt="+MT;
		}

		/*Add the target URL with hrefURL*/
		hrefURL += targetURL;		
 }

 location.href=hrefURL;
 return false;
}

/* ENH-173 changes*/

function showNextLinks(sc) 
{
  var hrefURL = "";

  /*Get the URL*/
  var url = ""+window.location;

  var targetURL = "";
  
  // ENH-242 Added condition for handling with lowercase
  if((url.indexOf("/Resources") != -1) || (url.indexOf("/resources") != -1)) {	
	if (url.indexOf("&sc") != -1) {	
		hrefURL = url.replace(new RegExp('sc=([0-9])*',''),"sc="+sc);
	}
	else {
		hrefURL = url + "&sc="+sc;
	}
  }

  if(url.indexOf("/RelatedInfo") != -1 || url.indexOf("/relatedinfo") != -1) {
	if (sc == "0") {
		hrefURL = url.replace(new RegExp('id=([a-z]{2}[0-9]{6})(-[0-9])*',''),"id=$1");
	}
	else {
		hrefURL = url.replace(new RegExp('id=([a-z]{2}[0-9]{6})(-[0-9])*',''),"id=$1-"+sc);
	}
	
  }

if(url.indexOf("/pathfinder") != -1) {
	if (sc == "0") {
		hrefURL = url.replace(new RegExp('id=([a-z]{2}[0-9]{6})(-[0-9])*',''),"id=$1");
	}
	else {
		hrefURL = url.replace(new RegExp('id=([a-z]{2}[0-9]{6})(-[0-9])*',''),"id=$1-"+sc);
	}
	
  }

  location.href=hrefURL;
  return false;
}

/**ENH-173 End */

/** ENH-215 start */

function exp_coll(ind) {	

 
 s = document.getElementById("sp_" + ind);
 i = document.getElementById("im_" + ind);
/* ENH-221 */
	var url=self.location.toString();
	// ENH-242 Added condition to check for documents and ebooks lower case. 
	if ((url.indexOf("/Article")!=-1) || (url.indexOf("/ExtMedia")!=-1) ||
	    (url.indexOf("/article")!=-1) || (url.indexOf("/extmedia")!=-1) ||
	    (url.indexOf("/document")!=-1) || (url.indexOf("/ebook")!=-1))
	{		
	 if (s.style.display == 'none') {
	   s.style.display = 'block';
	   getObject("im_"+ind).className="wb-index-heading-h3-minus";
	   classString="wb-index-heading-h3-minus";
	 }
	 else if (s.style.display == 'block') {
	   s.style.display = 'none';
	   getObject("im_"+ind).className="wb-index-heading-h3-plus";
	   classString="wb-index-heading-h3-plus";
	 }
	}
	// Expandable outline for Students Tab index.
	else {		
		if(s.className == "wb-index-heading-ul-none") {   
			
		  getObject("im_"+ind).className="wb-index-heading-h3-minus";
		  classString="wb-index-heading-h3-minus";
		  getObject("sp_"+ind).className="wb-index-heading-ul-block";
		  classString="wb-index-heading-ul-block";   
		}
		else if(s.className == "wb-index-heading-ul-block") {  			
		  getObject("im_"+ind).className="wb-index-heading-h3-plus";
		  classString="wb-index-heading-h3-plus";
		  getObject("sp_"+ind).className="wb-index-heading-ul-none";
		  classString="wb-index-heading-ul-none";
		}
	}
}

function exp(ind) {	
 s = document.getElementById("sp_" + ind);
 i = document.getElementById("im_" + ind);
 if (!(s && i )) return false;
 s.style.display = 'block';
 getObject("im_"+ind).className="wb-index-heading-h3-minus";
 classString="wb-index-heading-h3-minus";
}

function coll(ind) {	
 s = document.getElementById("sp_" + ind);
 i = document.getElementById("im_" + ind);

 if (!(s && i )) return false;
 s.style.display = 'none';
 getObject("im_"+ind).className="wb-index-heading-h3-plus";
 classString="wb-index-heading-h3-plus";
}

function exp_all(count)
{
	var counter =0;	
	while(counter < count)
	{
		exp(counter);
		counter++;			
	} 
}

function expandlinks(querystring,section) {
	//added condition if "sc" is not present then expand all the links
	if (url.indexOf("&sc") == -1)
	{
	  exp_all(section); 	
	}	
	var sc= "0";
	var sectionval = null;
	if (querystring.indexOf("&sc") != -1) {
		   sc = querystring.substring(querystring.indexOf("&sc")+ 4); 
	} 
	if(sc.indexOf("&") != -1)   {
			sc =sc.substring(0,sc.indexOf("&"));
		}
	if (null != section){
		sectionval = section;
			if(sc == -1 || (parseInt(sectionval) <=3)) { 						
				exp_all(section); 
			} 
			else {				
				exp(sc); 
			} 
	} 
	else{		
		exp(sc); 
	} 
}

/*
    Name   : showOutlineExtSource
    Input  : URL and the Section Number
    Function called when an External Media link is clicked
*/
function showOutlineExtSource(extUrl,section)  {

	//ENH-242 /wb removed for Advanced
	if (url.indexOf("/Subscribe") != -1 || url.indexOf("/Sellpage") != -1 || url.indexOf("/Login") != -1) 	{
		location.href=url+tu;
		return false;
	}

 
	// ENH-242 changed the case
	var hrefURL="extmedia?";
	if (url.indexOf("&flag=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&flag=[a-zA-z0-9]*(.*)',''),"");
	}
	if (url.indexOf("&gr=")!= -1) {
		//ENH-217 To prevent Greeting text remaining.
		//url=url.replace(new RegExp('&gr=(.*?!)',''),"");
		url=url.replace(new RegExp('&gr=[a-zA-z0-9]*(.*)',''),"");
	}
	if (url.indexOf("&sc") == -1) {
		if (section != "") {
			url +="&sc="+section;
		}
	}
	
	else {
		if (section != "") {
			section="sc="+section;
			url=url.replace(new RegExp('sc=-?[0-9]+',''),section);
		}
	}
	if (url.indexOf("&em=")!= -1) {
			url=url.replace(new RegExp('em=[a-z]{2}[0-9]{6}[a-z]?',''),"em="+extUrl);
			hrefURL+=url;		
	}
	else {
			hrefURL+=url+"&em="+extUrl;		
	}
	location.href=hrefURL;
	return false;
}

function getObject(objectId) {
	if (document.all && !document.getElementById) {
		return document.all(objectId);
	} else {
		return document.getElementById(objectId);
	}
}


/** ENH-215 the end */

/** ENH-221 Expandable outline */
/*
    Name   : showIndexOutline
    Input  : URL and the Section Number
    Function called when an index link is clicked
*/
function showIndexOutline(section,indexUrl)
{
	location.href = indexUrl+"&sc="+section;
	return false;
}

/*
    Name   : expandindex
    Input  : Querystring
	Function reads the sc parameter and expands corresponding section. 
*/
function expandindex(querystring) {	
	var sc= "";
	if (querystring.indexOf("&sc") != -1) {
		   sc = querystring.substring(querystring.indexOf("&sc")+ 4); 
	} 
	exp_coll(sc);
}

//Rotate Image
function runIMGSlideShow()
{

}
/** ENH-221 End */

/** ENH-229 Nc Expandable Outline */
function ncexpcoll(ind,countnc1) 
{			
	s = document.getElementById("sp_" + ind);
 	i = document.getElementById("im_" + ind); 	
 	if (s.style.display == 'none') { 		
 	   var index = ind.toString();
 	   var zero = "00000";
	   var div1 = 1; 		  		
	   index = index.substring(5); 	 		  	  
	   if(index == zero)
	   { 		
	   	var collapseIndex = 1001000000;  	
	  	while(div1 <= countnc1)	
	  	{	
			nccollapse(collapseIndex);
			collapseIndex+=1000000;
			div1++;					
		}
	   } 		  	  		  
	   getObject("im_"+ind).className="wb-exp-heading-minus";
	   classString="wb-exp-heading-minus";
	   s.style.display = 'block';
	}
	else if (s.style.display == 'block') {
	    s.style.display = 'none';
	    getObject("im_"+ind).className="wb-exp-heading-plus";
	    classString="wb-exp-heading-plus";
	}
}

function nccollapse(collInd)
{	
   collS = document.getElementById("sp_" + collInd);
   collI = document.getElementById("im_" + collInd);  	
   if (collS.style.display == 'block') {	 	
      collS.style.display = 'none';
      getObject("im_"+collInd).className="wb-exp-heading-plus";
      classString="wb-exp-heading-plus";
   }
}

/** ENH-246 Image page changes */ 
/*
    Name   : changeLayout
    Input  : theMainImage
    Function called when the image page is loaded. If the image width is greater than 949, then the container dimension
    are altered accordingly
*/
/*************		BEGIN FUNCTION TO EXPAND THE MAIN CONTAINER IF THE IMAGE IS LARGER THAN IT NEEDS TO BE 	*************/
function changeLayout(theMainImage){
	var thecontainer = document.getElementById('container'); // THIS IS THE MAIN CONTAINER THAT WE WILL NEED TO RESIZE
	var thetwocolumnbody = document.getElementById('two-column-body'); // THIS IS THE CONTAINER AROUND THE CONTENT OF THE PAGE
	var thebodycontainer = document.getElementById('two-column-body-container'); // THIS IS THE CONTAINER AROUND RIGHT SIDE CONTENT
	var themainimagebyid = document.getElementById(theMainImage); // THIS IS THE IMAGE
	
	//HERE WE ARE MAKING SURE THAT THIS FUNCTION WILL NOT MAKE THIS PAGE SMALLER THAN THE REST OF THE SITE
	//IF THIS FUNCTION DOES MAKE IT SMALLER, THEN DON'T DO ANYTHING
	if((themainimagebyid.width + 246) < 949){
		//do nothing
	} else {
		thetwocolumnbody.style.border = "1px solid #1c438a"; //SETTING A BORDER AROUND THE CONTAINER TO MATCH THE REST OF THE SITE
		thebodycontainer.style.borderLeft = "1px solid #1c438a"; //SETTING A LEFT SIDE BORDER TO SEPERATE THE LEFT AND RIGHT SIDES
		
		if(navigator.appName != "Microsoft Internet Explorer"){ //IF THEY ARE NOT IN IE, LETS DO THIS
			thetwocolumnbody.style.background = "none"; //REMOVE THE BACKGROUND OF THE CONTAINER
			thebodycontainer.style.marginLeft = "0px"; //GIVE THE CONTAINER A 0 MARGIN LEFT
			thebodycontainer.style.width = (themainimagebyid.width + 20) + "px"; //LETS CHANGE THE WIDTH OF THE RIGHT SIDE CONTENT CONTAINER
			thecontainer.style.width = (themainimagebyid.width + 244) + "px"; //LETS CHANGE THE WIDTH OF THE MAIN CONTAINER
		} else {
			//IF THE USER IS USING IE, LETS DO THE FOLLOWING
			thetwocolumnbody.style.background = "#ffffff"; //SET A WHITE BACKGROUND ON THE MAIN CONTENT
			thebodycontainer.style.marginLeft = "-1px"; //GIVE THE RIGHT SIDE A NEGATIVE MARGIN SO THAT IT WILL COVER ENY EXTRA LINES
			thebodycontainer.style.width = (themainimagebyid.width + 20) + "px"; //LETS CHANGE THE WIDTH OF THE RIGHT SIDE CONTENT CONTAINER
			thecontainer.style.width = (themainimagebyid.width + 243) + "px"; //LETS CHANGE THE WIDTH OF THE MAIN CONTAINER
		}
	}	
}
/*************		END FUNCTION TO EXPAND THE MAIN CONTAINER IF THE IMAGE IS LARGER THAN IT NEEDS TO BE 	*************/	
	
/** End of enh-229 */


/** ENH-259: Display Summary tag.
	Read the summary tag from source xml files and display first 50 chars with a "More" Link.
	Click on the "More" Link should lead to display of all the characters in the same place.
**/


function showfullsummary(){
	var summary = document.getElementById("summary");
	var fullsummary = document.getElementById("full_summary");	
	summary.style.display = 'none';
	fullsummary.style.display = 'block';
}
/*End of ENH-259**/

