/* Author: Jake Bresnehan
   Date: 12-1-2011
*/

$(document).ready(function(){
 		
/* setup ul.tabs to work as tabs for each div directly under div.panes */
$("ul.tabs").tabs("div.panes > div");

/*
  Sets the height of the #main-nav background colour on
  the fly by referencing the height of the #main-content height or #main-content-sub
*/
	
$('#main-nav').css('height', $('#main-content').css('height'));
	
$('#main-nav').css('height', $('#main-content-sub').css('height'));

 $('#coda-slider').codaSlider({
     autoSlide: true,
     autoHeight: false,
     autoSlideInterval: 4000,
     autoSlideStopWhenClicked: true,
     dynamicArrows: false,
     dynamicTabsAlign: "left",
     dynamicTabsPosition: "bottom"
 });


 $('#main-content-sub a.print').click(function() {
  window.print();
  return false;
 });


});


/* PDF to HTML script added by jalomes @ 18/2/11 */

/*
PDF Accessibility Fix 1.0
Adds a link next to each PDF link on a page which passes the document to the Adobe website for conversion to HTML
by Phil McPhee (phil.mcphee@dpac.tas.gov.au), Tasmanian Department of Premier and Cabinet, November 2009


var pageLinks = document.getElementsByTagName('a');
var containsPDF = new RegExp('.pdf$','i');

for (var i=0; i<pageLinks.length; i++) {
  var url = pageLinks[i].href;

  if (containsPDF.test(url) === true){
    var adobeURL = 'http://access.adobe.com/access/convert.do?acceptLanguage=en&srcPdfUrl=' + url + '&convertTo=html&visuallyImpaired=preferhtml&platform=Windows&comments=null';
    convertLink = document.createElement('a');
    convertLink.setAttribute('href', encodeURI(adobeURL));
    convertLink.setAttribute('class', 'pdfHtmlConverter');
    convertLink.setAttribute('id', 'pdfwidth');
    convertLink.setAttribute('style', 'width: 40px !important; height: 16px !important;');
    convertLink.innerHTML = "<img src='/.?a=137420' style='width: 40px !important; height: 16px !important; padding: 0px !important;' alt='Convert this PDF to HTML' title='Convert this PDF to HTML' /> ";
    var parent = pageLinks[i].parentNode;
    parent.insertBefore(convertLink, pageLinks[i].nextSibling);
    i++;
  }
  
  else {

  };

};
*/

