// JQUERY Functions - Webtrends 
// Created: 03-Jun-2010

function getPathAsArray() {
	var sPath = window.location.pathname;
        var wtRegex = new RegExp ("(^.*\/)([^\/]+)(\.aspx)$", "g");   
	var aMatches = wtRegex.exec(sPath);
	return aMatches;
}

//** Event Handler for javascript call to Print() **/
$(document).ready(function() {
        $('a[href*=javascript:window.print()]').click(function() {
	   var aMatches = getPathAsArray();
	   if (aMatches[3]!=null) {
	   	var wtUri = aMatches[1] + aMatches[2] + "-print";
	   	var wtPage = aMatches[2]
	   	var wtTitle = wtPage + "-print";
	   	//Assign a PI value depending on Page Context
	   	var wtPI ="";
	   	switch (wtPage)
			{
			case "questionnaire": wtPI = "SQP";
			  break;
			case "talktoyourdoctor": wtPI = "DIP";
			  break;
			case "treatment" : wtPI = "TPP";
			}	   	
	        dcsMultiTrack("DCS.dcsuri", wtUri, "WT.ti", wtTitle, "WT.dl", "22","WT.pi", wtPI);  	 	
	   }
})});

//** Event Handler for javascript call to Email() **/
$(document).ready(function() {
        $('img.noprint[alt=Email],img.noprint[alt=Courriel]').click(function() {
         var aMatches = getPathAsArray();
	   if (aMatches[3]!=null) {
	   	var wtUri = aMatches[1] + aMatches[2] + "-emailopen"; 
	   	var wtTitle = aMatches[2] + "-emailopen";
	        dcsMultiTrack("DCS.dcsuri", wtUri, "WT.ti", wtTitle, "WT.dl", "22","WT.pi", "");	   	 	
	   }
})});
