function setImage(img,filename) {
	img.src = root_path+'_images/'+filename+'.png';
}
function setImageConditional(img,filename,allow) {
	if (allow) {
		img.src = root_path+'_images/'+filename+'.png';
	}
}
function openWindow(src,width,height){
	  var windowID = window.open(root_path+src,'defaultWin','scrollbars,resizable,WIDTH='+width+',HEIGHT='+height);
	  windowID.focus();
}

function sampleWindow(sample){
	  openWindow('samples/sample-'+sample+'.php?report',900,600);
	  return false;
}

function maybeResetClass(identity) {
	if (identity.indexOf('_') != -1) {
		compareIdentity = identity.substring(0,identity.indexOf('_'));
	} else {
		compareIdentity = identity;
	}
	if (currentPage != compareIdentity) {
		document.getElementById('subpageButton_'+identity).className = 'submenuDynamic';
	}
}

function makeShareLink(target) {
	fullTarget = target.replace("[title]",escape(document.title));
	location.href = fullTarget;
}
function toggleShareBox(){
	var shareBox = document.getElementById('shareBox');
	if (shareBox.style.display == 'block') {
		shareBox.style.display = 'none';
		document.getElementById('shareButton').src = root_path+'_images/button_share_up_highlight.png';
	} else {
		shareBox.style.display = 'block';
		document.getElementById('shareButton').src = root_path+'_images/button_share_down_highlight.png';
	}
}

function highlightShareImage(){
	var shareBox = document.getElementById('shareBox');
	if (shareBox.style.display == 'block') {
		return root_path+'_images/button_share_down_highlight.png';
	} else {
		return root_path+'_images/button_share_up_highlight.png';
	}
}

function inactiveShareImage(){
	var shareBox = document.getElementById('shareBox');
	if (shareBox.style.display == 'block') {
		return root_path+'_images/button_share_down.png';
	} else {
		return root_path+'_images/button_share_up.png';
	}
}

// Functions used by report pages to show report content

function hideSamplePage() {
	document.getElementById('sampleWindow').style.display	= 'none';
}

function showSamplePage(samplePage) {
	if (samplePage.substr(0,10) == 'reference_') {
		document.getElementById('sampleHolder').style.left	= '100px';
		document.getElementById('sampleHolder').style.top	= '70px';
	} else {
		document.getElementById('sampleHolder').style.left	= '0px';
		document.getElementById('sampleHolder').style.top	= '0px';
	}	
	document.getElementById('sampleHolder').src = '../_images/report_pages/'+samplePage+'.png';
	document.getElementById('sampleWindow').style.display = 'block';
}


