function togglePrinterFriendlyView(isPrintView) {
	if ( isPrintView ) {
		$('#primaryStylesheet').attr("href",prefixPath+"css/print.css");
		$('#primaryStylesheet').removeClass('forscreen');
		$('#primaryStylesheet').addClass('forprint');
		//disableAnchorElements();
		buildLinksSummary();
		//disableFormElements();
		if ( $('.wt-rotator').length ) {
			hideSlideshow();
		}
	} else {
		$('#primaryStylesheet').attr("href",prefixPath+"css/style1.css");
		$('#primaryStylesheet').removeClass('forprint');
		$('#primaryStylesheet').addClass('forscreen');
		//enableAnchorElements();
		unbuildLinksSummary();
		//enableFormElements();
		if ( $('.wt-rotator').length ) {
			showSlideshow();
		}
	}		
}

function buildLinksSummary() {

	var anchors = $(".content a[href*='.']");
	var links = "";
	for ( var i = 0; i < anchors.length; i++ ) {
		var counter = i + 1;
		var anchor = anchors[i];
		var currGraph = "<li>";
		var currSuperscript = " <sup class='supfootnote'>[" + counter + "]</sup>";
		var currHref = $(anchor).attr('href');
		if ( currHref.indexOf("site.cfm") == 0 || currHref.indexOf("documents/") == 0 || currHref.indexOf("taxforms/") == 0 || currHref.indexOf("ind/") == 0 ) {
			currHref = "http://www.tax.virginia.gov/" + currHref;	
		}
		var currTitle = $(anchor).attr('title');
		if ( currTitle != "" && currTitle != "undefined" && currTitle != null ) {
			currHref += " -- " + currTitle;
		}
		var currRel = $(anchor).attr('rel');
		if ( currRel != "" && currRel != "undefined" && currRel != null ) {
			currHref += " -- " + currRel;
		}
		var currAlt = $(anchor).attr('alt');
		if ( currAlt != "" && currAlt != "undefined" && currAlt != null ) {
			currHref += " -- " + currAlt;
		}
		currGraph += currHref;
		currGraph += "</li>";
		links += currGraph;
		$(anchor).after(currSuperscript);		
		
	}
	var linksSummary = "<div id='printurlslist' class='borderTopSolid2pxBlack'><p>URLs referenced in this document: </p><ol>";
	linksSummary += links;
	linksSummary += "</ol></div>";
	$('#printurlshook').after(linksSummary);
}

function hideSlideshow() {
	$('.thumbnails ul').clone().attr('id','clonedSlides').insertBefore('#postcontent');
	$('#clonedSlides li').removeAttr('style');
	$('#clonedSlides l1').removeAttr('class');
	$('#clonedSlides div').removeAttr('style');
	$('#clonedSlides div').removeAttr('class');
	$('.wt-rotator').addClass('positionOffScreen');

}

function showSlideshow() {
	$('#clonedSlides').remove();
	$('.wt-rotator').removeClass('positionOffScreen');

}

function unbuildLinksSummary() {
	$('sup.supfootnote').remove();
	$('div#printurlslist').remove();
}

function disableFormElements() {
	$('form :input').attr('disabled','disabled');
	$('form :submit').attr('disabled','disabled');
}

function enableFormElements() {
	
	
	$('form :input').removeAttr('disabled');
	$('form :submit').removeAttr('disabled');
}

function disableAnchorElements() {
	$('.content a :not(".printAction")').click(function() {
		return false;
	});
}

function enableAnchorElements() {
	$('.content a').unbind('click');
}

