// These are status codes to be returned by showhide() which will indicate the current status
// of the McKesson drop down.
//document.write("<script type='text/javascript' src='/mck/js/fsrscripts/triggerParams.js'></script>");
//document.write("<script type='text/javascript' src='/mck/js/fsrscripts/stdLauncher.js'></script>");
//Forsee Survey Includes

document.write("<script type='text/javascript' src='/mck/js/foresee/foresee-analytics-1e609.js'></script>");
document.write("<script type='text/javascript' src='/mck/js/foresee/foresee-trigger.js'></script>");


//document.write("<script type='text/javascript' src='/mck/js/fsrscripts/stdLauncher.js'></script>");

document.write("<script type='text/javascript' src='/mck/js/pagination.js'></script>");
document.write("<script type='text/javascript' src='/mck/js/mckvoice.js'></script>");

var MCK_DROP_DOWN_VISIBLE = 1;
var MCK_DROP_DOWN_HIDDEN = 2;

var browser,filteredOs,filteredBrowsers;
var stage1 = 0;
var stage2 = 0;
var flashVersion = 6;
var prefix = "";
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;

var plusImage = null;
var minusImage = null;

if ( plugin ) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i])))
			continue;
		var flashPlug = words[i];
	}
	var gotFlash = flashPlug >= flashVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('gotFlash = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & flashVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
}

var dropmenuobj;
var noOs = navigator.userAgent.indexOf("Mac") != -1;
var noBrowser = navigator.userAgent.indexOf("Safari") != -1 ;
var noCombo = noOs && navigator.userAgent.indexOf("MSIE") != -1 

if (noBrowser) filter = false;
else if (noCombo) filter = false;
else filter = true;


function openPopup(url,height,width) {
	// check to see if the window is at least 500 wide and 300 high
	if (height == null || height < "300") {
		height="300";
	} else {
		height = height;
	}
	
	if (width == null || width < "500") {
		width="500";
	} else {
		width = width;
	}
	popup = window.open(url,"pop_win","height="+height+",width="+width+",location=no,menubars=no,scrollbars=yes,toolbars=no,resizable=yes")
}
	
function snapT(id,_objName){
	if (document.getElementById) {
		if (document.getElementById(_objName).style.display==''){
			document.getElementById(_objName).style.display='none'
			document.getElementById(id).src= prefix + "/mck/img/pl.gif";
		} else {
			document.getElementById(_objName).style.display=''
			document.getElementById(id).src= prefix + "/mck/img/pm.gif";
		}
	}
}

function setSignup(name,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"=mcksession"+expires+"; path=/";
}

function getSignup(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function checkSignup(signup,name) {
	var signup = escape(signup);
	var theValue = getSignup(name);
	if (!theValue) {
		location.replace(unescape(signup));
	}
}

// place this at the end of the signup process or the success part.
// setSignup(name,days);
// name is the name of cookie
// days is the length of the cookie
// is you remove the days then the cookie will be session based

// to see if the cookie excists use the following
// checkSignup("url","name")
// url is the redirectin URL
// name is the name of the cookie you set above

//var menu1=new Array()
//menu1[0]='<a href="" class="bluelink" onmouseover="empty()">McKesson Pharmaceutical</a>'
//menu1[1]='<a href="" class="bluelink" onmouseover="empty()">McKesson Provider Technologies</a>'
//menu1[2]='<a href="" class="bluelink" onmouseover="empty()">McKesson Medical-Surgical</a>'
//menu1[3]='<a href="" class="bluelink" onmouseover="empty()">McKesson Prescription Systems</a>'
//menu1[4]='<a href="" class="bluelink" onmouseover="empty()">McKesson Pharmacy Systems</a>'
//menu1[5]='<a href="" class="bluelink" onmouseover="empty()">McKesson Health Solutions</a>'
//menu1[6]='<a href="" class="bluelink" onmouseover="empty()">McKesson Specialty</a>'
//menu1[7]='<a href="" class="bluelink" onmouseover="empty()">McKesson Medical management</a>'
//menu1[8]='<a href="" class="bluelink" onmouseover="empty()">Zee Medical</a>'
//menu1[9]='<a href="" class="bluelink" onmouseover="empty()">McKesson International</a>'
//menu1[10]='<a href="" class="bluelink" onmouseover="empty()">View All</a>'

var menuwidth='305px' //default menu width

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
	document.write('<div id="globalnav" style="visibility:hidden;width:'+menuwidth+';background-color:#FFF" onMouseover="empty()" onMouseout="doHide(this,event)"></div>')

function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
		totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}

function showhide(obj, e, visible, hidden){
	if ( (ie4||ns6) && dropmenuobj ) {
		dropmenuobj.style.left=dropmenuobj.style.top=-500
		dropmenuobj.widthobj=dropmenuobj.style
		dropmenuobj.widthobj.width=menuwidth
	}
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover") {
		obj.visibility=visible;
		return MCK_DROP_DOWN_VISIBLE;
	}
	else if (e.type=="click") {
		obj.visibility=hidden;
		return MCK_DROP_DOWN_HIDDEN;
	}
}

function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge" && dropmenuobj){
		var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
		if (dropmenuobj && windowedge-dropmenuobj.x < dropmenuobj.contentmeasure) {
			edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
		}
	}
	else{
		var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
		var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-10 : window.pageYOffset+window.innerHeight-18
		
		if (dropmenuobj) {
			dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
			if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){
				edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
				if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) {
					edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
				}
			}
		}
	}
	return edgeoffset
}

function populatemenu(what){
	if ((ie4||ns6) && dropmenuobj)
		dropmenuobj.innerHTML=what.join("")
}

function mckMenu(obj, e, stuff, newPrefix, width){
	if (newPrefix != null) {
		prefix = newPrefix;
	}
	
	if (window.event)
		event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
		empty()
	
	if (dropmenuobj == null) {
		createImages(prefix);
	}
	
	dropmenuobj=document.getElementById ? document.getElementById("globalnav") : globalnav;
	populatemenu(stuff)
	
	if ((ie4||ns6) && dropmenuobj){
		var dropDownStatus = showhide(dropmenuobj.style, e, "visible", "hidden");
		if (dropDownStatus == MCK_DROP_DOWN_VISIBLE) {
			var imgs = document.getElementById('globalnavrow').getElementsByTagName('img');
			for( var i = 0; i < imgs.length; i++ )
			{
				imgs[i].src = plusImage.src;
			}

			//document.getElementById('icn').src = minusImage.src;
			obj.parentNode.getElementsByTagName("img")[0].src = minusImage.src;
		}
		else {
			//document.getElementById('icn').src = plusImage.src;
			obj.parentNode.getElementsByTagName("img")[0].src = plusImage.src;
		}
		
		dropmenuobj.x=getposOffset(obj, "left")-13
		dropmenuobj.y=getposOffset(obj, "top")-1
		dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
		dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
		dropmenuobj.style.width=width+"px";
	}
	return goThere()
}

function createImages(pPrefix)
{
	plusImage = new Image();
	plusImage.src = pPrefix+'/mck/img/pl.gif';
	minusImage = new Image();
	minusImage.src = pPrefix+'/mck/img/pm.gif';
}

function goThere(){
	if (ie4||ns6) return false
	else return true
}

function doHide(obj, e,prefix){
	if (ie4 && dropmenuobj && !dropmenuobj.contains(e.toElement))
		doHideNow(obj, prefix)
	else if (ns6&&e.currentTarget!= e.relatedTarget)
		doHideNow(obj, prefix)
}

function hideMe(obj, prefix){
	//alert(prefix+'/mck/img/pl.gif');
	//document.getElementById('icn').src = plusImage.src;
	var imgs = document.getElementById('globalnavrow').getElementsByTagName('img');
	for( var i = 0; i < imgs.length; i++ )
	{
		imgs[i].src = plusImage.src;
	}
	if (typeof dropmenuobj!="undefined"){
		if (ie4||ns6) {
			dropmenuobj.style.visibility="hidden";
		}
	}
}

function doHideNow(obj, prefix){
	// delayhide=setTimeout("hideMe('" + prefix + "')",333)
	delayhide=setTimeout( function() { hideMe( obj, prefix ); } ,333);
}

function empty(prefix){
	if (typeof delayhide!="undefined") {
		clearTimeout(delayhide);
	}
}

function getSelectedValues(selectElement) {
    var selectedValue;
    for (i=0; i<selectElement.options.length; i++) {
        if (selectElement.options[i].selected) {
            selectedValue = selectElement.options[i].value;
            break;
        }
    }
    return selectedValue;
}

function openCustomerLoginPopup(selectElement) {
    url = getSelectedValues(selectElement);
    if ( url && (url!="") ) {
        window.open(url);
    }
}

function openRequestInfoPopup(urlPrefix,title, email) {
    url = urlPrefix+"/request_info.aspx?title="+title+"&email="+email;
    openPopup(url,'700','800');
}

function openContactUsPopup(urlPrefix,title, email) {
    url = urlPrefix+"/contact_us.aspx?title="+title+"&email="+email;
    openPopup(url,'700','800');
}

function openEventCalendarUrl(urlPrefix) {
    url = urlPrefix+"/event_calendar.aspx";
    document.location.href(url);
}

function openProductsServicesUrl(urlPrefix, buId) {
    url = urlPrefix+"/bu_product_list_body.aspx?buid="+buId;
    document.location.href(url);
}

function openOfferingA2ZUrl(urlPrefix) {
    url = urlPrefix+"/offerings_a2z.aspx";
    document.location.href(url);
}

// Validate content access for a page
// This function is called on the target page for checking on user access
function validateContentAccess4(urlPrefix, from, email, to) {
	var fromURL = null;
	var toURL = null;
	var theURL = "/content_access.aspx";

	if (urlPrefix == null || urlPrefix == "") {
		urlPrefix = "/mck";
	}
	theURL = urlPrefix + theURL;
	if (from != null && from != "") {
		fromURL = from;
	}
	else {
		fromURL = document.referrer;
	}
	if (email == null || email == "") {
		alert("No email address for validateContentAccess().");
		return;
	}
	if (to != null && to != "") {
		toURL = to;
	}
	else {
		toURL = location.href;
	}
	if (location.search == null || location.search == "") {
		theURL += "?";
	}
	else {
		theURL += location.search + "&";
	}
	theURL += "from="+escape(fromURL)+"&email="+email+"&to="+escape(toURL);
	checkSignup(theURL, "McKesson_SignUp");
}

// Validate content access for a page
// This function is called on the target page for checking on user access
function validateContentAccessById(urlPrefix, type, id) {
	var fromURL = document.referrer;
	var toURL = location.href;
	var theURL = "/content_access.aspx";

	if (urlPrefix == null || urlPrefix == "") {
		urlPrefix = "/mck";
	}
	theURL = urlPrefix + theURL;
	if (location.search == null || location.search == "") {
		theURL += "?";
	}
	else {
		theURL += location.search + "&";
	}
	theURL += "from="+escape(fromURL)+"&to="+escape(toURL)+"&type="+type+"&id="+id;
	checkSignup(theURL, "McKesson_SignUp");
}

// validate content access for the current page
function validateContentAccess2(urlPrefix, email) {
	validateContentAccess4(urlPrefix, null, email, null);
}

// validate content access for the current page
function validateContentAccess(email) {
	validateContentAccess4(null, null, email, null);
}

// Email a page
function emailPage(urlPrefix, title, url) {
	var pageTitle = null;
	var pageURL = null;
	var theURL = "/email_page.aspx";

	if (urlPrefix == null || urlPrefix == "") {
		urlPrefix = "/mck";
	}
	theURL = urlPrefix + theURL;
	if (title != null && title != "") {
		pageTitle = title;
	}
	else {
		pageTitle = document.title;
	}
	if (url != null && url != "") {
		pageURL = url;
	}
	else {
		pageURL = location.href;
	}
	theURL += "?title=" + pageTitle + "&page=" + pageURL;
	openPopup(theURL,'400','500');
}

// Email the current page
function emailThisPage() {
	emailPage(null, null, null);
}

function emailThisPage1(urlPrefix) {
	emailPage(urlPrefix, null, null);
}

function hiliteHeaderNav( hilitedItem )
{
	var hilitedItemLower = hilitedItem.toLowerCase();
	var navItems = document.getElementById('headerNav').getElementsByTagName('td');
	var navItem;
	var anchor;
	for( var i = 0; i < navItems.length; i++ )
	{
		navItem = navItems[i];
		anchor = navItem.getElementsByTagName('a')[0];
		if( anchor != null && anchor.childNodes[0].nodeValue.toLowerCase() == hilitedItemLower )
		{
			navItem.className = "btnoff";
			anchor.className  = "btninactive";
		}
	}
}

/*
 * Inserts a Flash movie into the page, circumventing IE6 "click to
 * activate" message. Cannot be done with DOM scripting, because IE6
 * does not allow appendChild on an object node. Cannot be done with
 * innerHTML, because IE6 may throw an "Operation Aborted" error when
 * modifying innerHTML inside a table cell.
 */
function insertFlash( params )
{
            var markup = "";
            markup += "<OBJECT ";
            if( params.id != null ) { markup += "id='" + params.id + "' "; }
            markup += "codeBase='" + params.codebase + "' ";
            markup += "height='" + params.height + "' ";
            markup += "width='" + params.width + "' ";
            markup += "align='" + params.align + "' ";
            markup += "classid='" + params.classid + "' ";
            markup += ">"

            markup += "<PARAM NAME='allowScriptAccess' VALUE='sameDomain'/>";
            markup += "<PARAM NAME='movie' VALUE='" + params.movie + "'/>";
            markup += "<PARAM NAME='quality' VALUE='" + params.quality + "'/>";
            markup += "<PARAM NAME='bgcolor' VALUE='" + params.bgcolor + "'/>";
            
            markup += "<embed ";
            markup += "src='" + params.movie + "' ";
            markup += "quality='" + params.quality + "' ";
            markup += "bgcolor='" + params.bgcolor + "' ";
            markup += "width='" + params.width + "' ";
            markup += "height='" + params.height + "' ";
            if( params.id != null ) { markup += "name='" + params.id + "' "; }
            markup += "align='" + params.align + "' ";
            markup += "allowScriptAccess='sameDomain' ";
            markup += "type='application/x-shockwave-flash' ";
            markup += "pluginspage='http://www.macromedia.com/go/getflashplayer' ";
            markup += ">";
            
            markup += "</OBJECT>";
            
            document.write(markup);
}

function switchLoginSegment( segmentId )
{
	var i;
	
	// deselect all tabs
	var tabs = document.getElementById("loginSegmentTabs").childNodes;
	var tab;
	for( i = 0; i < tabs.length; i++ )
	{
		tab = tabs[i];
		if( "DIV" == tab.nodeName )
		{
			tab.className = 'nav';
		}
	}
	
	// select this tab
	tab = document.getElementById( "loginSegmentTab_" + segmentId );
	tab.className = 'navon';

	// hide all descriptions
	hideAllLoginSites();

	// hide all segments
	var container = document.getElementById('loginSegments');
	var bodies = container.childNodes;
	var body;
	for( i = 0; i < bodies.length; i++ )
	{
		body = bodies[i];
		if( "UL" == body.nodeName )
		{
			body.style.visibility = 'hidden';
		}
	}
	
	// show selected body
	body = document.getElementById( 'loginSegment_' + segmentId );
	body.style.visibility = '';
}

function switchLoginSite( segmentId, siteId )
{
	// hide all descriptions
	hideAllLoginSites();
	
	// show selected description
	body = document.getElementById( 'loginSite_' + segmentId + '_' + siteId );
	body.style.display = '';
}

function hideAllLoginSites()
{
	var container = document.getElementById('loginSites');
	var descriptions = container.childNodes;
	var description;
	for( var i = 0; i < descriptions.length; i++ )
	{
		description = descriptions[i];
		if( "DIV" == description.nodeName )
		{
			description.style.display = 'none';
		}
	}
}

function hideAddthisLink(){
//alert('hide');
//var addthisRow = document.getElementById("printtable_addthisrow");
//document.getElementById("printtable").deleteRow(addthisRow.rowIndex);
}

function ShowAddthis(){
try{
	document.getElementById("at15s_foot").innerHTML = '<A style="color:gray;text-decoration:none" href="http://www.mckesson.com/addthis">What are these?</a><span title="AddThis.com" onclick="window.open(\'http://www.addthis.com/\',\'mckwindow\',\'height=600,width=800,status=1,toolbar=1,scrollbars=auto,resizable=1,location=1	\')"/>';
}
catch(err){
	//alert('fail');
}
try{
var x = addthis_open(ShowAddthis.arguments[0],ShowAddthis.arguments[1],ShowAddthis.arguments[2],ShowAddthis.arguments[3]);
document.getElementById("at15s_foot").innerHTML = '<A style="color:gray;text-decoration:none" href="http://www.mckesson.com/addthis">What are these?</a><span title="AddThis.com" onclick="window.open(\'http://www.addthis.com/\',\'mckwindow\',\'height=600,width=800,status=1,toolbar=1,scrollbars=auto,resizable=1,location=1	\')"/>';
addthis_close();
document.getElementById("at15s_foot").style.display = "block";
addthis_open(ShowAddthis.arguments[0],ShowAddthis.arguments[1],ShowAddthis.arguments[2],ShowAddthis.arguments[3]);
}
catch(err1){
}
return true;
}
 
//news filter functions
function filterNews(clickSource,obj){ 

		
		
		//alert('bebug 1 ');
	 
	
		//var prs = document.getElementById('articleList').getElementsByTagName('table');
		var artTeampTables= new Array(prs.length); 
		var selectedBu = document.getElementById('ddlBusinessUnit').value;
		var selectedTopic = document.getElementById('ddlTopic').value;
		var selectedCustSeg = document.getElementById('ddlCustSegment').value;
		var selectedNews='';
		var filterRecordsCount=0;
		for (i=0;i<prs.length;i++)
		{
			var filterPassed= false;
			if (selectedBu=='' || arr_pr_bu[i].indexOf(',' + selectedBu + ',')>-1){
				if (selectedTopic=='' || arr_pr_topic[i].indexOf(',' + selectedTopic + ',')>-1){
					if (selectedCustSeg=='' || arr_pr_custseg[i].indexOf(',' + selectedCustSeg + ',')>-1){
						filterPassed = true;
					}
				}
			}
			if (filterPassed==true){
				
				if(prs[i]!=null){
				artTeampTables[filterRecordsCount]=prs[i];				
				
				}
				//alert("passed: pr-->"+prs[i]);
				filterRecordsCount++;
				
				
			}
			else{
				
				if(prs[i]!=null){
				prs[i].style.display="none";
				
				}
				
			}
		}
		
		
	
	
	
	var artTables= new Array(filterRecordsCount); 
	
	
	if(filterRecordsCount==0)
	{
       		//alert("No Results Found");
       		document.getElementById('NoResults').innerHTML = "<br/><br/><br/>There are no News that match your Search Criteria.";
        }
        else
        {
        	document.getElementById('NoResults').innerHTML = "";
        	
        	for (i=0;i<filterRecordsCount;i++)
			{
			artTables[i]=artTeampTables[i];
			
			}
	        
        
        } 
        
        
        //alert("artTables-->"+artTables);
        //alert("artTables-->len"+artTables.length);
        initializeValue(25,100,filterRecordsCount,artTables);
        DisplayRecordsByPage(1,25,5,1);		
        	
        
        
	}
	
	//MM filter functions
	function filterMM(clickSource,obj){ 
	
		 prs = document.getElementById('articleList').getElementsByTagName('span');
		  //alert("in"+inWhichPage);
		   var len =   prs.length; 
		   var temp = new Array(len);
		   var counter=0;
		   var tempValue = new Array(len);
		 var finalFilterValues;
		 var tempCounter=0;
			if(inWhichPage=='IMAGES')
				{
					for (i=0;i<len;i++)
						{
							if (arr_mm_img[i].indexOf(',' + imageValue + ',')>-1){
								if(prs[i]!=null){
									temp[counter]= 	prs[i];
									counter++;
									tempValue[tempCounter++]=i;
									}
							}
						}
			   var newTags = new Array(counter);
			   finalFilterValues= new Array(counter);
 					for (i=0;i<counter;i++)
					{
					newTags[i]=temp[i];
						finalFilterValues[i]=tempValue[i];
					}
				//alert("in images: prs-before>"+prs);
				prs = newTags;			
			  //alert("in images: prs->"+prs);
				}
			else if(inWhichPage=='PRESSKITS')
				{
						for (i=0;i<len;i++)
						{
							if (arr_mm_pk[i].indexOf(',' + PKValue + ',')>-1){
								if(prs[i]!=null){
									temp[counter]= 	prs[i];
									counter++;
									tempValue[tempCounter++]=i;
									}
							}
						}
			   var newTags = new Array(counter);
			   finalFilterValues= new Array(counter);
 					for (i=0;i<counter;i++)
					{
					newTags[i]=temp[i];
					finalFilterValues[i]=tempValue[i];
					}
					prs = newTags;			
			 //alert("in PK: prs->"+prs);
			
				}else if(inWhichPage=='VIDEOAUDIO')
				{
			
					for (i=0;i<len;i++)
						{
							if (arr_mm_va[i].indexOf(',' + VAvalue + ',')>-1||arr_mm_va[i].indexOf(',' + Webcast + ',')>-1 ){
								if(prs[i]!=null){
									temp[counter]= 	prs[i];
									counter++;
									tempValue[tempCounter++]=i;
									}
							}
						}
			   var newTags = new Array(counter);
			   finalFilterValues= new Array(counter);
 					for (i=0;i<counter;i++)
					{
					newTags[i]=temp[i];
					finalFilterValues[i]=tempValue[i];
					}
				prs = newTags;	
			//alert("in VA & webcast: prs->"+prs);
				}
			
			///prs = document.getElementById('articleList').getElementsByTagName('table');
			var artTeampTables= new Array(prs.length); 
			var selectedBu = document.getElementById('ddlBusinessUnit').value;
			var selectedTopic = document.getElementById('ddlTopic').value;
			var selectedCustSeg = document.getElementById('ddlCustSegment').value;
			var selectedNews='';
			var filterRecordsCount=0;
			
			for (i=0;i<prs.length;i++)
			{
				var filterPassed= false;
				
				if(inWhichPage=='IMAGES') {
					
					if (selectedBu=='' || arr_pr_bu[finalFilterValues[i]].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[finalFilterValues[i]].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[finalFilterValues[i]].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}					
				}
				else if(inWhichPage=='PRESSKITS') {
					if (selectedBu=='' || arr_pr_bu[finalFilterValues[i]].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[finalFilterValues[i]].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[finalFilterValues[i]].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
				}
				else if(inWhichPage=='VIDEOAUDIO'){
					
					if (selectedBu=='' || arr_pr_bu[finalFilterValues[i]].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[finalFilterValues[i]].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[finalFilterValues[i]].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
				}
				else {
						
					if (selectedBu=='' || arr_pr_bu[i].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[i].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[i].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
			 }
				if (filterPassed==true){
					
					if(prs[i]!=null){
					artTeampTables[filterRecordsCount]=prs[i];				
					
					}
					//alert("passed: pr-->"+prs[i]);
					filterRecordsCount++;
					
					
				}
				else{
					
					if(prs[i]!=null){
					prs[i].style.display="none";
					
					}
					
				}
			}
		
		var artTables= new Array(filterRecordsCount); 
		
		if(filterRecordsCount==0)
		{
	       		//alert("No Results Found");
	       		document.getElementById('NoResults').innerHTML = "<br/><br/><br/>There are no Multimedia Assets that match your Search Criteria.";
	        }
	        else
	        {
	        	document.getElementById('NoResults').innerHTML = "";
	        	
	        	for (i=0;i<filterRecordsCount;i++)
						{
						artTables[i]=artTeampTables[i];
				
						}
		      } 
	        //alert("artTables-->"+artTables);
	        //alert("artTables-->len"+artTables.length);
	        initializeValue(25,100,filterRecordsCount,artTables);
	        DisplayRecordsByPage(1,25,5,1);		
        
	}
	
	
	//Mckesson voice filter functions
		function filterMCK(clickSource,obj){ 
			 
	       
			 prs = document.getElementById('articleList').getElementsByTagName('table');
		   var tempValue = new Array(len);
		   var finalFilterValues;
		   var tempCounter=0;
		   var len =   prs.length; 
		   var temp = new Array(len);
		   var counter=0;     
				if(inWhichPage=='SPEECH')
				{
							for (i=0;i<len;i++)
									{
										if (arr_mck_sp[i].indexOf(',' + spValue + ',')>-1){
											if(prs[i]!=null){
												temp[counter]= 	prs[i];
												counter++;
												tempValue[tempCounter++]=i;
												}
										}
									}
					 var newTags = new Array(counter);
					 finalFilterValues= new Array(counter);
			 			for (i=0;i<counter;i++)
								{
								newTags[i]=temp[i];
								finalFilterValues[i]=tempValue[i];
							}
						//alert("in speeches: prs-before>"+prs);
						prs = newTags;			
					  //alert("in speeches: prs->"+prs);
				   //alert("finalFilterValues->"+finalFilterValues);
				   
				   

				
				}
				else if(inWhichPage=='EDITORIAL')
				{
						for (i=0;i<len;i++)
									{
										if (arr_mck_ed[i].indexOf(',' + edValue + ',')>-1){
											if(prs[i]!=null){
												temp[counter]= 	prs[i];
												counter++;
												tempValue[tempCounter++]=i;
												}
										}
									}
					 var newTags = new Array(counter);
					 finalFilterValues= new Array(counter);
			 			for (i=0;i<counter;i++)
								{
								newTags[i]=temp[i];
								finalFilterValues[i]=tempValue[i];
							}
						//alert("in editorial: prs-before>"+prs);
						prs = newTags;			
					 // alert("in editorial: prs->"+prs);
				
				}
				
				
				
				///prs = document.getElementById('articleList').getElementsByTagName('table');
				var artTeampTables= new Array(prs.length); 
				var selectedBu = document.getElementById('ddlBusinessUnit').value;
				var selectedTopic = document.getElementById('ddlTopic').value;
				var selectedCustSeg = document.getElementById('ddlCustSegment').value;
				var selectedNews='';
				var filterRecordsCount=0;
				for (i=0;i<prs.length;i++)
				{
					
					
					
					var filterPassed= false;
					
					if(inWhichPage=='SPEECH')		{
						if (selectedBu=='' || arr_pr_bu[finalFilterValues[i]].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[finalFilterValues[i]].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[finalFilterValues[i]].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
					
					} else if(inWhichPage=='EDITORIAL'){
						
						if (selectedBu=='' || arr_pr_bu[finalFilterValues[i]].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[finalFilterValues[i]].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[finalFilterValues[i]].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
						
						}
					
					else {
					
					if (selectedBu=='' || arr_pr_bu[i].indexOf(',' + selectedBu + ',')>-1){
						if (selectedTopic=='' || arr_pr_topic[i].indexOf(',' + selectedTopic + ',')>-1){
							if (selectedCustSeg=='' || arr_pr_custseg[i].indexOf(',' + selectedCustSeg + ',')>-1){
								filterPassed = true;
							}
						}
					}
				}
					
					
					if (filterPassed==true){
						
						if(prs[i]!=null){
						artTeampTables[filterRecordsCount]=prs[i];			
						}
						//alert("passed: pr-->"+prs[i]);
						filterRecordsCount++;
						
						
					}
					else{
						
						if(prs[i]!=null){
						prs[i].style.display="none";
						
						}
						
					}
				}
		
			var artTables= new Array(filterRecordsCount); 
			if(filterRecordsCount==0)
			{
		       		//alert("No Results Found");
		       	 
		       		document.getElementById('NoResults').innerHTML = "<br/><br/><br/>There are no McKesson&#39;s Voice Items that match your Search Criteria.";

		        }
		        else
		        {
		        	document.getElementById('NoResults').innerHTML = "";
		        	
		        	for (i=0;i<filterRecordsCount;i++)
					{
					artTables[i]=artTeampTables[i];
					
					}
			        
		        
		        } 
		        
		        
		        //alert("artTables-->"+artTables);
		        //alert("artTables-->len"+artTables.length);
		        initializeValue(25,100,filterRecordsCount,artTables);
		        DisplayRecordsByPage(1,25,5,1);		
		        	
		        
		        
		}
	

	function resetFilter(){
		document.getElementById('ddlBusinessUnit').selectedIndex = 0;
		document.getElementById('ddlTopic').selectedIndex = 0;
		document.getElementById('ddlCustSegment').selectedIndex = 0;
	}


	function showAll(){
		resetFilter();
		filterNews('showall');
	}

//end of news filter functions

//function to sort items in a html dropdown

function sortList(idOfSelect) { 
var selectControl = document.getElementById(idOfSelect); 
selectArray = new Array(); 

for (i = 1; i < selectControl.length; i++) { 
selectArray[i] = new Array(); 
selectArray[i][0] = selectControl.options[i].text; 
selectArray[i][1] = selectControl.options[i].value; 
} 

selectArray.sort(); 

for (j = 0; j < selectControl.length - 1; j++) { 
selectControl.options[j+1].text = selectArray[j][0]; 
selectControl.options[j+1].value = selectArray[j][1]; 
} 
}

