function setActiveStyleSheet(e) {
	// if the print button is clicked
   //append stylesheet to the bottom of the document
	if(this.id == 'printBtn') {
		//loop through header to find the print style
		theLinks = document.getElementsByTagName("link");		
		for(i=0; i<theLinks.length; i++){		
			if(theLinks[i].media == 'print') {
				printStyle = theLinks[i];
			}
		}
		
		//check to see if helperStyle exists 
		if(!document.getElementById("helperStyle")) {
			//create a new element to act as print style
			newStyle = document.createElement('link');
			newStyle.id = 'helperStyle';
			newStyle.media = 'all';
			newStyle.href = printStyle.href;
			newStyle.type = printStyle.type;
			newStyle.title = printStyle.title;
			newStyle.rel = printStyle.rel;
			newStyle.disabled = true;
			
			//get the body object
			theBody = document.getElementsByTagName("BODY");
			
			//apply the new style to the head object
			theBody[0].appendChild(newStyle);
			
			window.setTimeout(function() {
				document.getElementById("helperStyle").disabled = false;
			}, 500);
		} else {
			//helper style exists, simply enable it
			document.getElementById("helperStyle").disabled = false;
		}
	}
	
	// if the normal button is clicked, delete the print stylesheet node
	if(this.id == 'normalBtn') {
			//delete the helper print style that was created
			
			helpStyle = document.getElementById("helperStyle");
			helpStyle.media = 'all';
			helpStyle.disabled = true;
	}
}

function initSwitcher (){ 
	btn1 = document.getElementById("printBtn");
    if(btn1 && !btn1.onclick)
    {
        btn1.onclick = setActiveStyleSheet;
        
        regBtn = document.getElementById("normalBtn");
        regBtn.onclick = setActiveStyleSheet;
    }
	// we need continue monitoring because Ajax call may create new print button after full page load    
   	window.setTimeout(initSwitcher, 1000);
}

window.setTimeout(initSwitcher, 1000);