var taggedIds=new Array("btnTakeQuiz","btnShowScore","showGetTipsTab","showAnswerTalking","btnPrintOABAnswers");
var tagMap=[];
tagMap['btnTakeQuiz']="DD_Take the Quiz";
tagMap['btnShowScore']="DD_OAB Symptom Quiz Tab_Show My Score";
tagMap['showGetTipsTab']="DD_OAB Symptom Quiz Results Tab_Now Learn How to Talk to YourDoctor";
tagMap['showAnswerTalking']="DD_Tips for Talking to Your Doctor Tab_Transform My Answers into Talking Points";
tagMap['btnPrintOABAnswers']="DD_OAB Cheat Sheet Tab_Print My OAB Quiz Answers and Cheat Sheet";

function trackingObject(key, suffix) {
	this.key=key;
	this.suffix=suffix;
}
function attachEventForTracking(ids){
	if(isArray(ids)){
		for(var i=0; i<ids.length;i++){
		 	var alink=$("#"+ids[i]);
		 	var omnObject= new trackingObject(ids[i], "");
		 
		 	if( alink !=null){
		 	//alert(" id form array"+ids[i]+" alink for mouse up?"+alink.attr("id"));
		 		//YAHOO.util.Event.addListener(ids[i], "mouseup",doTracking);
		 		$("#"+ids[i]).click(function(e){
		            doTracking(e);
		        });
		 	} 
         }
	}else{
			var alink=$("#"+ids);
			if( alink !=null){
				var omnObject= new omnitureObject(ids, "");
				if(alink.attr('omnid')!= null){
	 				omnObject.key = alink.attr('omnid');
	 			}
	 		$("#"+ids).click(function(e){
		            //s.tl(e,"o","Optional Info Skip This Page")
		            doTracking(e);
		        });
		//		YAHOO.util.Event.addListener(ids, "mouseup",doTracking);
		 	}
		}

}
function doTracking(e){
try{
        var omnObject= new trackingObject(e.target.id, "");
		 if(e.target.getAttribute('omnid')!= null){
	 				omnObject.key= e.target.getAttribute('omnid')+LoggedinStatus;
	 			}
      // alert(" in doTracking() omnObject.key:"+ omnObject.key);
    
	    var lkupKey=omnObject.key;
	    var friendlyName="";
	  
      
	    if(omnObject.suffix == null ||  omnObject.suffix == "")
		    friendlyName=tagMap[lkupKey] ;
	     else
		     friendlyName=tagMap[lkupKey]+ omnObject.suffix;
	 //   alert(" in doTracking()lkupKey"+lkupKey+">>"+friendlyName);
	    s=s_gi(s_account);	   
	    s.tl(e,"o",friendlyName);
	    return true;
	    }catch(ee){
	  //alert(ee.message);
	};
}
$(document).ready(function() { 
  try{
    attachEventForTracking(taggedIds);
    }catch(ee){  alert(ee.message);}
});
function isArray(obj) {
	   if (obj.constructor.toString().indexOf("Array") == -1)
	      return false;
	   else
	      return true;
	}