//Commenting out until deemed necessary to include /channel.js
//window.onload=template_init;
//function template_init(){
//    channel_init();
//}

//adRefresh
function adRefresh() {
var adSpots = '0';
try {
if (pgAdSpots != null && pgAdSpots != 'undefined' && pgAdSpots != '') {
adSpots = pgAdSpots;
}
} catch(e) {
adSpots = '0';
}
try {
top.ch_refresher.refresh_ads_by_spot(adSpots);
} catch(e) { }
return true;
} 

//URL Parser
function getParam(paramName,defaultValue) {
  var q = (location.search.replace(/\?/,"")).split("&");
  var i = q.length;
  while(i-->0) {
    var t = q[i].split("=");
    if(t[0] == paramName) return t[1];
  }
  return defaultValue;
}

// Header2.0
function p_o(o){return document.getElementById(o);}

function ai_posX(obj){
 var left=0;
 if(obj.offsetParent){
  while(obj.offsetParent){
   left+=obj.offsetLeft;
   obj=obj.offsetParent;
  }
 }else if(obj.x)left+=obj.x;
 return left;
}
function ai_posY(obj){
 var top=0;
 if(obj.offsetParent){
  while(obj.offsetParent){
   top+=obj.offsetTop;
   obj=obj.offsetParent;
  }
 } else if(obj.x)top+=obj.y;
 return top;
}

function togMore(e,state){
 var oDiv=p_o('smore');
 if(state=='show'){
  posMore(e);
  oDiv.style.zIndex=99999999;
  oDiv.style.display='block';
 } else {
  oDiv.style.display='none';
 }
 return false;
}
function posMore(e){
  var oDiv=p_o('smore');
  var oLnk=p_o('smorea');
  posY = findMousePos(e);
  oDiv.style.left=(ai_posX(oLnk)+15)+'px';
  oDiv.style.top=(posY+oLnk.offsetHeight/2)+'px';
}
// Begin : Headers 2 code
String.prototype.trim = function() {
  return this.replace(/^\s+|\s+$/g,"");
}

function srchSub(ref){
  var frm=p_o("search");
  var queryval = frm.topquery.value.trim();
  queryval = queryval.replace( /\+/, " ");
  newurl = ref.href + queryval;
  window.location = newurl;
  return false;
}

//Text Resize
function changetext(size) {
text = document.getElementById('articleButb');
if (text != null){

text.className = "articleContainer "+size;

// set the cookie
createCookie("style", size, 365);
}

}
function createCookie(name,value,days) {

  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";

}
function readCookie(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 init(){

  var cookie = readCookie("style");
  var title = cookie ? cookie : "small";
  if (title == 'null') {
    title = "small";
  }

  changetext(title);
}

//Body Quiz
function trueFalse (arg1, arg2, arg3) {
  if(arg2 != "" || arg2 != null)
  {
    document.getElementById(arg2)?document.getElementById(arg2).style.display= "none":'';
  }
  if(arg3 != "" || arg3 != null )
  {

    document.getElementById(arg3)?document.getElementById(arg3).style.display= "none":'';
  }
  document.getElementById(arg1).style.display= "block";
  document.getElementById(arg1).style.position= "absolute";
}

function layerClose (aDiv) {
  document.getElementById(aDiv).style.display= "none";
}

//Slide Show
  function changeslides(a,b) {
    document.getElementById(a).style.display = "none";
    document.getElementById(b).style.display = "";
  }

//Body Hub Modules - Expandable/Collapsible Menus
/*var bodyMenus = {
  init: function() {
    var fn = function() {
      var healthLists = ["healthCatListBody","dietCatListBody","lifeCatListBody"]

      var j = healthLists.length;
      while (j-->0) {
        if (document.getElementById("healthCatListCont")) {
          var objDIV = document.getElementById(healthLists[j]).getElementsByTagName("DIV");

          var i = objDIV.length;
          while(i-->0) {
            if (objDIV[i].className.substr(0,4)=="menu"){
              objDIV[i].onclick = function() {switchMenu(this.id);}
            }
          }
        }
      }
    document.getElementById("topquery").name="q1";
document.getElementById("footer").getElementsByTagName("form")[0].getElementsByTagName("input")[0].name="q1"; }
    window.addEventListener?window.addEventListener("load",fn,false):window.attachEvent("onload",fn);
  }
}

bodyMenus.init();
*/
function switchMenu(obj){
  var subMenu = document.getElementById("sub"+obj.substr(4,5));

  if(subMenu.style.display == "none"){
    subMenu.style.display = "block";
    document.getElementById(obj).className = "menuOut1";
  }else{
    subMenu.style.display = "none";
    document.getElementById(obj).className = "menuOut2";
  }
}
// CrossPromo module functionality
var arrLen = 0;
var modSpan = 6;
var currId = 0;

function countCartridges() {
   var cartCount = 0;
   end = false;
   do {
      if(document.getElementById('cart'+cartCount)) {
         cartCount++;
      } else {
         end = true;
      }
   } while (end == false)
   arrLen = cartCount;
}

function showCartridges( startId ) {
  if(arrLen == 0) {
    countCartridges(); 
  }
  var i,j;
  for (i=0,j=startId; i < modSpan; i++,j++) {
     var strCart = j%arrLen;
     document.getElementById('cartridge'+i).innerHTML = document.getElementById('cart'+strCart).innerHTML;
  }
}

function isModFetched (modId) {
  if(document.getElementById('cart'+modId).innerHTML.length>0) {
      return true;
  } else {
      return false;
  }
}


function nextCartridge () {
  if(arrLen == 0) {
     countCartridges(); 
  }
  currId = currId + 1;
  if ( !isModFetched( (currId+modSpan)%arrLen ) ) {
      fetchModule((currId+modSpan)%arrLen);
  }
  showCartridges(currId);
}

function prevCartridge () {
  if(arrLen == 0) {
    countCartridges(); 
  }  
  if(currId!=0) {
      currId = currId - 1
  } else {
      currId=arrLen-1;
  }

  if ( !isModFetched( (currId+modSpan)%arrLen ) ) {
      fetchModule((currId+modSpan)%arrLen);
  }
  showCartridges(currId);
}

//BODY NEWS ARTICLE JS

//Photo gallery module.
//The functions for this module are in channels.js.
//picHostURL overrides the default set in the channels.js.
var picHostURL = "http://cdn.channel.aol.com/ch_sports/";
//END Photo gallery module.

// Top Videos
var AOLVS = null;
var theHTML =null;
var query = null;
var tab =0;
var tabtopic = null;
var numbertab = null;
var currentSlide = 0;
var vidArray = new Array();
var maxChar = null;

function handlePageLoad() {
    numbertab = document.getElementById("videotab").getElementsByTagName('li');
    AOLVS = new AOLVideoSearch('sskxzi7esi3tjgqvl');

    AOLVS.results = arguments[1];
  query = arguments[0];
  maxChar = arguments[2];
    AOLVS.attachEvent('onload', 'handleVSLoad(query, 0);');
    AOLVS.attachEvent('onupdate', 'handleUpdate();');
    AOLVS.initialize();
}

function loadVideo(){
    handleVSLoad(arguments[0],arguments[1]);
    initvideo = null;
    currentSlide=0;
    return initvideo;
}
 
function handleVSLoad() {
    displayMessage();
    tabtopic = arguments[1];
    param = arguments[0]; 
    AOLVS.getVideos(arguments[0]);  
    activeTab(arguments[1]);
    return tabtopic;
}
 
function activeTab(){
    for(var v=0; v<numbertab.length; v++){
        if (arguments[0] != v) {
            document.getElementById("tb."+v).className = '';
        }
    }
    document.getElementById("tb."+arguments[0]).className = 'selected';
}
  
function displayMessage() {
    theHTML = '<div style="text-align:center;clear:both;height:85px;width:308px;background-color:#f3f3f3;border-top:45px solid #f3f3f3;"><img src="http://myfeeds.aolcdn.com/vis/progress_animation.gif"> Loading...</div>';
    document.getElementById('video_results').innerHTML = theHTML;
}

function vidSlide(direct) {
    if (direct == 1){
        if (currentSlide + 1  == AOLVS.results){
            currentSlide = 0;
        } else if (currentSlide +1 < AOLVS.results){
            currentSlide += 1;
        }
    } else {
        if (currentSlide == 0) {
            currentSlide = AOLVS.results-1;
        } else if (currentSlide -1 >= 0) {
           currentSlide -=1;
        }
    }
    document.getElementById('tally').innerHTML = '      '+(currentSlide + 1)+ '  of  ' + '  '+AOLVS.results+'      ';
    document.getElementById('video').innerHTML = vidArray[currentSlide];
}

function intializeSeq() {
    initVidHTML = vidArray[0];  
    document.getElementById('video').innerHTML = initVidHTML;
}

function handleUpdate() {
    theHTML = '';
    initHTML ='';
    viewAllHTML = '';

    switch(tabtopic){   
        case 0:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22ABCNEWS.COM%22/familyFilter/0" target="_blank">See all ABC Videos</a>';
            break;
        case 1:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22CNN%22/familyFilter/0" target="_blank">See all CNN Videos</a>';
            break;
        case 2:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22CBS%22/familyFilter/0" target="_blank">See all CBS Videos</a>';
            break;
        case 3:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22AP%22/familyFilter/0" target="_blank">See all AP Videos</a>';
            break;
        case 4:
            viewAllHTML += '<a href="http://video.aol.com/video-search/query/category%3A%22News%22%20channel%3A%22AOL%20News%22%20sort%3AmostRecent%20distributor%3A%22Reuters%22/familyFilter/0" target="_blank">See all Reuters Videos</a>';
            break;
    }

    theHTML +='<div id="video">';

    if ( AOLVS.VideoSet.totalResultsReturned < AOLVS.results ) {  
        AOLVS.results = AOLVS.VideoSet.totalResultsReturned;
  }

    if ( AOLVS.VideoSet.totalResultsReturned > 0 ) {
        for (var i=0; i < AOLVS.VideoSet.totalResultsReturned; i++) {   
            var caption = AOLVS.VideoSet.Video[i].description;
            var charCount = new description(caption, maxChar);
            vidArray[i] ='<div id="vid.'+i+'" class="tab"><div class="video_content"><p class="news_title">'+ AOLVS.VideoSet.Video[i].title+'</p><div class="news_image"><a href="'+AOLVS.VideoSet.Video[i].videoUrl +'" target="_blank" class="img"><img src="'+ AOLVS.VideoSet.Video[i].thumbnailUrl +'" width="116" height="82"></a></div><p class="news_content">'+ charCount.characherCount() +'<span class="details">'+ viewAllHTML+'</span></p><div class="clear"></div></div></div>';         
        }
        theHTML += '</div>';
        theHTML += '<div class="top_ftr">';
        theHTML += '<span class="prev"><a href="javascript:void(0);" onClick="vidSlide();return false;">< Previous</a></span>';
        theHTML += '<span id="tally" class="count">'+'      1 of '+ '     '+AOLVS.results+'   </span>'; 
        theHTML += '<span class="nxt"><a href="javascript:void(0);" onClick="vidSlide(1);return false;">Next ></a></span>';
        theHTML += '</div>';
    
        document.getElementById('video_results').innerHTML = theHTML;
        intializeSeq();
    }
}

function countChar(){
    if (this.desclength > this.descmax){
        this.desc = this.desc.substring(0, this.descmax)+'...';
    }else{
        this.desc = this.desc;
    }
    return this.desc;
}
 
function description(caption, descriptionmax){
    this.desc = caption;
    this.desclength = caption.length;
    this.descmax = descriptionmax;
    this.characherCount = countChar;
}
// End: Top Videos

// Start:  SHARE THIS WIDGET JS

var sharePopFlag = true;                             //variable for onclick popup
  
function showShareThisPop(topDivId, botDivId)        //function to call the popup onclick
{
    if (sharePopFlag)
    {
        document.getElementById('shareLeftIDBB').style.borderBottom = "1px solid #000";
        document.getElementById(botDivId).style.display = "block";
        document.getElementById(topDivId).className = "share_right_on";
    }
    else 
    {
        document.getElementById('shareLeftIDBB').style.borderBottom = "none";
        document.getElementById(botDivId).style.display = "none";
        document.getElementById(topDivId).className = "share_right";
    }
    sharePopFlag = !sharePopFlag;
}

function shareOperation(iOperation, strUrl, strTitle)
{
    var staf_obj = new staf_SE();
    staf_obj.setLang("en-US");
    if (strUrl != "")
    {
        staf_obj.setURL(strUrl);
    }
    if (strTitle != "")
    {
        staf_obj.setTitle(strTitle);        
    }
    if (iOperation == 1) // IM This
    {
        staf_obj.sendIM();
    }
    else
    {
        staf_obj.sendEmail();
    }
}

function mouseoverup()
{
    document.getElementById("thumbsup").className="thumbsup_on";
}

function mouseoutup()
{
    document.getElementById("thumbsup").className="thumbsup";
} 

function mouseoverdown()
{
    document.getElementById("thumbsdown").className="thumbsdown_on";
}

function mouseoutdown()
{
    document.getElementById("thumbsdown").className="thumbsdown";
}

// End: SHARE THIS WIDGET JS

// Start: News Article - User Comments JS 
// rating
var xmlHttpRating;

function getRating(objectURI, category, type, score, appId) {
    var procName = "dms.trri.addRatingAndGet"
    var parameters = objectURI + ',' + category + ',' + type  + ',' + score + ',' + appId;

     if (window.ActiveXObject) {
        xmlHttpRating = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttpRating = new XMLHttpRequest();
    }
   
    xmlHttpRating.onreadystatechange = handleStateChange;
   
    var ourl = document.URL;
	var ourl = ourl.toLowerCase();
	
	if (ourl.match("aolhealth") =="aolhealth"){
		var ind = ourl.indexOf('aolhealth.com/');
    	var url = ourl.substring(0, ind+14);
   	 	url += 'httprequest.adp';
  	}else {
  		var ind = ourl.indexOf('aol.com/');
    	var url = ourl.substring(0, ind+8);
   		url += 'httprequest.adp';
  	}

    url = url + "?_pn=" + procName;
    if (parameters!="")
    {
          url = url + "&_pa=" + parameters;
    }

    url += '&date=' + new Date().getTime();

    //alert(url);
    xmlHttpRating.open("GET", url, true);
    xmlHttpRating.setRequestHeader("Accept", "text/xml");
    xmlHttpRating.send(null);
}
   
function handleStateChange() {
    if(xmlHttpRating.readyState == 4) {
        if(xmlHttpRating.status == 200) {
            if(xmlHttpRating.responseText.length) {
                var result = xmlHttpRating.responseText.substring(1, xmlHttpRating.responseText.length - 1 );
                var results = result.split(" ");
                document.getElementById('label').innerHTML = "Thanks";
                document.getElementById('thumbsup').innerHTML = '<img src="http://www.aolcdn.com/ch_news/news-icon-thumbup" title="Thumbs Up" border="0" class="images" />' + results[0] + ' %';
                document.getElementById('thumbsdown').innerHTML = '<img src="http://www.aolcdn.com/ch_news/news-icon-thumbdown" title="Thumbs Up" border="0" class="images" />' + results[1] + ' %';
                document.getElementById('total').innerHTML = results[2] + ' VOTES';
                mouseoutup();
                mouseoutdown();
            }
        }
    }
}


// comment

var xmlHttpComment;

function displayComments(start) {
    var uri = document.getElementById("cmmt_uri").value;
    var category = document.getElementById("cmmt_category").value;
    var assetType = document.getElementById("cmmt_assetType").value;
    var appID = document.getElementById("cmmt_appID").value;
    var numCmmt = document.getElementById("cmmt_numCmmt").value;
    var AddBtnLbl = document.getElementById("cmmt_AddBtnLbl").value;
    var CanBtnLbl = document.getElementById("cmmt_CanBtnLbl").value;
    var reportThis = document.getElementById("cmmt_reportThis").value;
    var thisurl = document.getElementById("cmmt_thisurl").value;

    var procName = "dms.trri.displayReviews"
    var del=',';
    var parameters = uri;
    parameters += del + category;
    parameters += del + assetType;
    parameters += del + appID;
    parameters += del + start;
    parameters += del + numCmmt;
    parameters += del + AddBtnLbl;
    parameters += del + CanBtnLbl;
    parameters += del + reportThis;
    parameters += del + thisurl;

    if (window.ActiveXObject) {
        xmlHttpComment = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttpComment = new XMLHttpRequest();
    }
   
    xmlHttpComment.onreadystatechange = readyForComments;
   
    var ourl = document.URL;
	var ourl = ourl.toLowerCase();
	
	if (ourl.match("aolhealth") =="aolhealth"){
		var ind = ourl.indexOf('aolhealth.com/');
    	var url = ourl.substring(0, ind+14);
   	 	url += 'httprequest.adp';
  	}else {
  		var ind = ourl.indexOf('aol.com/');
    	var url = ourl.substring(0, ind+8);
   		url += 'httprequest.adp';
  	}

    url = url + "?_pn=" + procName;
    if (parameters!="")
    {
          url = url + "&_pa=" + parameters;
    }

    url += '&date=' + new Date().getTime();

    //alert(url);
    xmlHttpComment.open("GET", url, true);
    xmlHttpComment.setRequestHeader("Accept", "text/xml");
    xmlHttpComment.send(null);
}
   
function readyForComments() {
    if(xmlHttpComment.readyState == 4) {
        if(xmlHttpComment.status == 200) {
            document.getElementById('cmmntBox').innerHTML = xmlHttpComment.responseText;
            //checks cookie for hide/show
          checkCookie('cmnt');
        }
    }
}


function submitComments()
{
  var sn = loginId;
  submitCommentsWithSN(sn);
}

var xmlHttpAddComment;
function submitCommentsWithSN(sn)
{
    var comment = document.getElementById("addCommentHere").value;
  if(comment == null || comment.length < 1 || comment == 'Type your own comment here')
    return;

    var uri = document.getElementById("cmmt_uri").value;
    var category = document.getElementById("cmmt_category").value;
    var assetType = document.getElementById("cmmt_assetType").value;
    var appID = document.getElementById("cmmt_appID").value;

    procName = "dms.trri.addReview";

    var del='|';
    parameters = uri;
    parameters += del + sn;
    parameters += del + comment;
    parameters += del + category;
    parameters += del + assetType;
    parameters += del + appID;

    if (window.ActiveXObject) {
        xmlHttpAddComment = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttpAddComment = new XMLHttpRequest();
    }
    
    xmlHttpAddComment.onreadystatechange = afterAddComments;
    
  
    var ourl = document.URL;
	var ourl = ourl.toLowerCase();
	
	if (ourl.match("aolhealth") =="aolhealth"){
		var ind = ourl.indexOf('aolhealth.com/');
    	var url = ourl.substring(0, ind+14);
   	 	url += 'httprequest.adp';
  	}else {
  		var ind = ourl.indexOf('aol.com/');
    	var url = ourl.substring(0, ind+8);
   		url += 'httprequest.adp';
  	}

    data = "_pn=" + procName;
    data += "&_pa=" + parameters;
    data += "&_del=" + del;

    xmlHttpAddComment.open("POST",url,true);
    xmlHttpAddComment.setRequestHeader("Accept", "text/xml");
    xmlHttpAddComment.send(data);
} 

function afterAddComments() 
{ 
     if(xmlHttpAddComment.readyState == 4) {
        if(xmlHttpAddComment.status == 200) { 
            var status = xmlHttpAddComment.responseText;
        if (status == '1') {
                displayComments(0);
            } else {   
                document.getElementById('ucMsg').innerHTML = "Your comment could not be successfully saved at this time. Please try again later."
            }
        }
    } 
}

//Enforce maxlength attribute of usercomments textarea.
function checkMaxLength(obj) {
  var maxLength = obj.getAttribute('maxlength');
  var currentLength = obj.value.length;

  if (currentLength > maxLength)
    obj.value=obj.value.substring(0,maxLength)

  var counter = getEl(obj.getAttribute('counter'));
  counter.firstChild.nodeValue = currentLength + '/' + maxLength;
  // not innerHTML
}

// Login Functions
function AsnsSignIn() {
  pSNS = getEl("snsMiniUI");
  pSNS.innerHTML = "";
  pSNS.innerHTML = _sns_var_;
  pSNS.style.display = 'block';
}

function getEl( id ){ 
    return document.getElementById( id ); 
}

function showToolTip(oCaller, ttID){
  document.getElementById(ttID).style.display = "block";
}

function hideToolTip(oCaller, ttID){
  document.getElementById(ttID).style.display = "none";
}
// End: News Article - User Comments JS

/*Start:  JS code for the News Photogallery*/
//global news photogallery object loaded with default values,
//needs to be overridden on per module instance basis
    
var pgGlbObject = function() {
    this.pgTotalImages = 0;
    this.pgGalleryId = 0;
    this.glbPgTimer = 0;
    this.glbCurrentImg = 1;
    this.navAction = '';
    this.omnitureURL = 'omni_track';
    this.xmlUrl = 'common/photogallery/response.xml?&id=3&index=2&feedtype=news&navAction=next';
    this.feedType = 'news';
    this.magicNumber = 0;
    this.adContinue = 'See More Pictures';
    this.adCaption = 'ADVERTISEMENT';
    this.isAd = 0;
    this.gallerySize = '';
    this.adSpot = '';
}

function appInit(modId){
    var debugMode = false;
    mI = window[modId];
    var queryParam = new Object();
    var requestParameters = new String();
    var today = new Date();
    
    if(mI.isAd == 0) {
       updateTallyNumber(modId);
    }
    
    queryParam['id'] = mI.pgGalleryId;
    queryParam['index'] = mI.glbCurrentImg;
    queryParam['feedtype'] = mI.feedType;
    queryParam['navAction'] = mI.navAction;
    queryParam['magicnumber'] = mI.magicNumber;
    queryParam['ts'] = today.getSeconds();
    queryParam['isAd'] = mI.isAd;
    queryParam['gallerySize'] = mI.gallerySize;
    url = mI.xmlUrl;

    reqType='GET';

    if(debugMode) {
        alert('id = '+mI.pgGalleryId + ' index= ' + mI.glbCurrentImg + ' feedtype= '+mI.feedType+' navAction= '+mI.navAction+' isAd= '+mI.isAd+' gallerySize= '+mI.gallerySize);
    }
    var objLap = new xL(url,reqType,true,queryParam);
                
    var serverErrorHandler = function(statusCode,statusMsg)
    {
        if(debugMode) {
            alert("Error Code : " + statusCode + " Message : " + statusMsg);
        }
    }
    
    var responseHandler = function(req) 
    {
        if(mI.glbPgTimer==0)
        {
            var timeOutErr = function() 
            {
                clearTimeout(mI.glbPgTimer);
                objLap.abortRequest();
            }
            mI.glbPgTimer = setTimeout(timeOutErr,5000);
        }
        // only if req shows "loaded"
        if (req.readyState == 4)
        {
            if (req.status == 200) 
            {
                resXML = req.responseXML;
                resTxt = req.responseText;
                uaStr = navigator.userAgent.toLowerCase();
               // Firefox has issue reading the xml returned from server
               if(uaStr.indexOf('firefox') != -1) {
                   if (document.implementation.createDocument && typeof(window.DOMParser) != "undefined") {
                       var parser = new DOMParser();
                       resXML = parser.parseFromString(resTxt, "text/xml");
                   }
               } 
                updateGallery(resXML,modId);
            } else {
                if(debugMode) {
                    alert("Error : "+req.getAllResponseHeaders());
                }
            }
        }
        //end main if else
    }       
    
    objLap.setResponseHandler(responseHandler);
    
    err=objLap.sendRequest();
    
    if(err.length>0 && debugMode==true)
    {
        alert(err);
    }
}

function updateGallery(resXML,modId) {
    var debugMode = false;
    var i = 0;
    var mod = "_" + modId;
    var mI = window[modId];
    var root = document.getElementById('newsmaker_'+modId);
 
    //only if the proper data is returned 
    if(resXML.getElementsByTagName("img")[0]) {
        document.getElementById('ad'+mod).style.display='none';

        //set the required values from xml fragment
        var isAd = getNodeValue(resXML.getElementsByTagName("isAd")[0]);
        if (isAd != "1") {
            var pgCredit = getNodeValue(resXML.getElementsByTagName("pgcredits")[0]);
            var photoCaption = getNodeValue(resXML.getElementsByTagName("photocaption")[0]);
            var imgSrc = resXML.getElementsByTagName("img")[0].getAttribute('src');
            var imgAlt = resXML.getElementsByTagName("img")[0].getAttribute('alt');

            if(debugMode) {
                alert('isAd='+isAd+'pgCredit='+pgCredit+'photoCaption='+photoCaption+'imgSrc='+imgSrc);
            }

            //update the dom information
            document.getElementById('pg_ImgMain'+ mod).style.display="block";
            document.getElementById('pg_ImgMain'+ mod).src = imgSrc;
            document.getElementById('pg_ImgMain'+ mod).alt = imgAlt;
            document.getElementById('pg_credits' + mod).innerHTML = pgCredit;
            document.getElementById('center_pic_cont' + mod).innerHTML = photoCaption;
            
            if(mI.navAction == 'next') {
                document.getElementById('newsmakerTally' + mod).innerHTML = mI.glbCurrentImg + " of " + mI.pgTotalImages;
                sendOmnitureData(resXML,modId);
            }

            if(mI.navAction == 'prev') {
                 sendOmnitureData(resXML,modId);
                 document.getElementById('newsmakerTally' + mod).innerHTML = mI.glbCurrentImg + " of " + mI.pgTotalImages;
            }

            //ad refresh on image change
            galleryAdRefresh(mI.adSpot);
        }
    }// end main if

   // if the isAd parameter in response xml is 1 
    if(getNodeValue(resXML.getElementsByTagName("isAd")[0])==1) {
        try { 
            document.getElementById('pg_ImgMain'+ mod).style.display="none";
            document.getElementById('pg_credits' + mod).innerHTML = mI.adCaption.toUpperCase();
            document.getElementById('newsmakerTally' + mod).innerHTML = mI.adContinue;
            document.getElementById('center_pic_cont' + mod).innerHTML = "";
            var adCont = document.getElementById('ad'+mod);
            
            if(!document.getElementById('ifr'+mod)) {
                var ifr = document.createElement('iframe');
                ifr.setAttribute('id','ifr'+mod);
                ifr.style.height='250px';
                ifr.style.widht='300px';
                ifr.style.overflow='hidden';
                ifr.frameBorder='0';
                if(ifr.scrolling){
                   ifr.scrolling='no';
                }
            } else{
              ifr = document.getElementById('ifr'+mod);
            }
            var adURL = mI.adURL + mI.magicNumber;
            ifr.src = adURL;
            adCont.appendChild(ifr);
            adCont.style.display='block';
        } catch(e) {
          if(debugMode)
             alert(e);
        }
        
    }

    //set the isAd value in module object, this is needed to prevent the ad fromo looping
    mI.isAd = getNodeValue(resXML.getElementsByTagName("isAd")[0]);
}// end updateGallery

// Ad Refresh on Image Change
function galleryAdRefresh(adSpot) {
    try {
        if (adSpot != null && adSpot != 'undefined' && adSpot != '') {
            top.ch_refresher.refresh_ads_by_spot(adSpot);
        }
    } catch(e) {}
    return true;
}

function updateTallyNumber(modId) {
    var mI = window[modId];
    if(mI.navAction == 'next') {
    
        if(mI.glbCurrentImg < mI.pgTotalImages) {
            ++mI.glbCurrentImg;
            mI.navAction = 'next';
        } else {
            mI.glbCurrentImg=1;
            mI.navAction = 'next';
        }
    
    } 

    if(mI.navAction == 'prev') {

        if(mI.glbCurrentImg > 1) {
             --mI.glbCurrentImg;
            mI.navAction = 'prev';
        }
        else 
        {
            mI.glbCurrentImg=mI.pgTotalImages;
            mI.navAction = 'prev';
        }

    }
} // end updateTallyNumber

function getNodeValue(node) {
    var val = "";

    if (node != undefined || node != null){ 
        if(node.nodeValue == null || node.nodeValue == undefined){
            try {
                val = node.firstChild.nodeValue;
        } catch (e){}
      }
  }

    return val;
}

 function sendOmnitureData(resXML,modId) {
    var mI = window[modId];
    var omniUrl = mI.omnitureURL;
    var reqType= "GET";
    var qp = new Object();
    str = "?";
    qp['id'] = mI.pgGalleryId;
    qp['index'] = mI.glbCurrentImg;
    qp['feedtype'] = mI.feedType;
    qp['navAction'] = mI.navAction;
    qp['debug'] = 0;
  // To capture the mmx variable for omniture tracking for both h and g code
 if(typeof(s_channel) != 'undefined') {
     qp['mmx'] = s_channel;
    } else if(typeof(s_265.channel) != 'undefined'){
       qp['mmx'] = s_265.channel;
 } 
    if(document.getElementById('pgOmniIframe'+modId)) {
        ifr = document.getElementById('pgOmniIframe'+modId);
    } else {
        ifr = document.createElement('iframe');
        ifr.setAttribute('id','pgOmniIframe'+modId);
        ifr.width=0;
        ifr.height = 0;
        ifr.border = 0;
        ifr.style.visibility = 'hidden';
        document.body.appendChild(ifr);
    } 
  
    for(var key in qp)
        str=str+"&"+key+"="+qp[key];
    
    omniUrl = omniUrl + str;
    ifr.src = omniUrl;
}

function nextImg(modId) {
    mI = window[modId];
    mI.navAction = 'next';
    appInit(modId);
    return false;
}

function prevImg(modId) {
    mI = window[modId];
    mI.navAction = 'prev';
    appInit(modId);
    return false;
}
/*End:  JS code for the News Photogallery*/

/* hide/show for TRRI Comment Module */
function createCookie() {
   if (arguments[2]) {
     var date = new Date();
     date.setTime(date.getTime()+(arguments[2]*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
   }
  else var expires = "";
  document.cookie = arguments[0]+"="+arguments[1]+expires+"; path=/; domain=.aol.com;";
}

function readCookie() {
  var nameEQ = arguments[0] + "=";
  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;
}

var hideCmntBtn ='Turn Off Comments';
var showCmntBtn ='Turn On Comments';
var hideCmntMsg = '<span>Comments are now disabled for all articles on AOL.</span> <a  href="javascript:void(0);" onclick="toggleCmnts(\'cmnt\', \'off\');" class="showCmntsBtn">'+ showCmntBtn +'</a>';


function toggleCmnts(){
  if (arguments[1] =='on' ){
    createCookie(arguments[0], 'on', 365);
       }else {
     createCookie(arguments[0], 'off', 365);
   }
   checkCookie(arguments[0]);
}

function toggleBtn(){
   var hide = document.getElementById('hideCmnt');
   var show = document.getElementById('showCmnt');
   var cmntBtn = document.getElementById('tglCmntBtn');
   var bgOverlay = document.getElementById('overlayBG');
     var pstBtn = document.getElementById('pstCmntBtn');
   var cmntPage = document.getElementById('cmntPagination');

   if (arguments[0]){
         if(show != null){
         show.style.display='none';
       if (cmntPage != null){cmntPage.style.display='none';}

             pstBtn.style.display='none';
         cmntBtn.innerHTML = showCmntBtn;
       cmntBtn.style.borderColor = '#fff';
         hide.innerHTML = hideCmntMsg;
         bgOverlay.style.display = 'block';
         cmntBtn.onclick = function () {
         toggleCmnts('cmnt', 'off');
         }
       }else{
      cmntBtn.style.display = 'none';
       }
   }else {
     if(show != null){
       show.style.display='block';
       if (cmntPage != null){cmntPage.style.display='block';}

             pstBtn.style.display='inline';
         cmntBtn.innerHTML = hideCmntBtn;
       cmntBtn.style.borderColor = '#000';
         hide.innerHTML ="";
         bgOverlay.style.display = 'none';
         cmntBtn.onclick = function () {
             toggleCmnts('cmnt', 'on');
         }

     }
     else{
      cmntBtn.style.display = 'none';
       }
   }
}

function checkCookie(){
   var cmtCookie = readCookie(arguments[0]);
   if (cmtCookie == 'on'){
       toggleBtn(true);}
  else {  
    toggleBtn(false);
   }
}


// ------------------Symptom-chechker JS stuff ----------------
var xmlHttpSC;

function createXMLHttpRequest() {
    if (window.ActiveXObject) {
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    } 
    else if (window.XMLHttpRequest) {
        xmlHttp = new XMLHttpRequest();
    }
}
    
function getSymptomCheckerAlphaList(alphabet) {
   
    
    var procName = "ch.symptom-checker.getSubBrowseList"
    var parameters = alphabet;
    
    createXMLHttpRequest();
    
    xmlHttp.onreadystatechange = handleStateChange;
    
    var ourl = document.URL;
	var ourl = ourl.toLowerCase();
	
	if (ourl.match("aolhealth") =="aolhealth"){
		var ind = ourl.indexOf('aolhealth.com/');
    	var url = ourl.substring(0, ind+14);
   	 	url += 'httprequest.adp';
  	}else {
  		var ind = ourl.indexOf('aol.com/');
    	var url = ourl.substring(0, ind+8);
   		url += 'httprequest.adp';
  	} 

    url = url + "?_pn=" + procName;
    if (parameters!="")
    {
          url = url + "&_pa=" + parameters;
    }

	

	
    xmlHttp.open("GET", url, true);
    xmlHttp.setRequestHeader("Accept", "text/html"); 
    xmlHttp.send(null);
}
    
function handleStateChange() {
  
    if(xmlHttp.readyState == 4) {
 
        if(xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            document.getElementById('dlPopulateDiv').innerHTML = result;
            
        }
    }
}




//if (document.URL == 'http://body.office.aol.com/symptom-checker') {
function initSC() {
var cookie = readCookie("alpha");
var alpha = cookie ? cookie : "a";
  if (alpha == 'null') {
    alpha = "a";
  }

  
 //window.onload=getSymptomCheckerAlphaList(alpha);
 createCookie("alpha", 'a', 365);
}


 if (document.addEventListener) {
       document.addEventListener("DOMContentLoaded", initSC, false);
   }
   
   
// for Internet Explorer (using conditional comments)
/*@cc_on @*/
/*@if (@_win32)
document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
    if (this.readyState == "complete") {
        initSC(); // call the onload handler
    }
};
/*@end @*/


//--------------------------------------------------------------
// BDC JS for Symptom Checker
var xmlUrl = "";
var xmlHttpSymp;
var personTypeSC = 'men';
var bodyPartType;
var bodyPart;
var bodyPartFlg;
var dehighlightFlag = true;
var ddAdSpot;
var supWrapDiv;

function showSymptoms(bodyPart) {

    var procName = "ch.symptom-checker.findSymptoms";
    var parameters = personTypeSC + "," + bodyPart + "," + xmlUrl;

    if(ddAdSpot!="" && supWrapDiv=="1") galleryAdRefresh(ddAdSpot);
    if (window.ActiveXObject) {
        xmlHttpSymp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    else if (window.XMLHttpRequest) {
        xmlHttpSymp = new XMLHttpRequest();
    }

    xmlHttpSymp.onreadystatechange = handleSymptomChange;

	var ourl = document.URL;
	var ourl = ourl.toLowerCase();
	
	if (ourl.match("aolhealth") =="aolhealth"){
		var ind = ourl.indexOf('aolhealth.com/');
    	var url = ourl.substring(0, ind+14);
   	 	url += 'httprequest.adp';
  	}else {
  		var ind = ourl.indexOf('aol.com/');
    	var url = ourl.substring(0, ind+8);
   		url += 'httprequest.adp';
  	}
  

    url = url + "?_pn=" + procName;
    if (parameters!="")
    {
        url = url + "&_pa=" + parameters;
        url = url + "&_del=,";
    }

    xmlHttpSymp.open("GET", url, true);
    xmlHttpSymp.setRequestHeader("Accept", "text/html"); 
    xmlHttpSymp.send(null);
}

function handleSymptomChange() {

    if(xmlHttpSymp.readyState == 4) 
    {
        if(xmlHttpSymp.status == 200) 
        {
            var result = xmlHttpSymp.responseText;
            document.getElementById('sympLstStp3').innerHTML = result;
            document.getElementById('sympLstStp3').style.display = "block";
        }
    }
}

function selector(bodyType) {

    if(ddAdSpot!="" && supWrapDiv=="1") galleryAdRefresh(ddAdSpot);
    bodyPartType = bodyPartFlg = bodyType;
    document.getElementById("bodyPartMan").style.display = "none";
    document.getElementById("bodyPartWoman").style.display = "none";
    document.getElementById("bodyPartChild").style.display = "none";
    document.getElementById("bodyPartInfant").style.display = "none";
    if(bodyType == "Infant")
    {
        document.getElementById("sympLstStp4").style.display = "block";
        document.getElementById("sympLstStp5").style.display = "none";
        document.getElementById("sympLstStp2").style.display = "none";
        document.getElementById("BodyParts1").style.display = "none";
    }
    else if (bodyType == "Child")
    {
        document.getElementById("sympLstStp4").style.display = "none";
        document.getElementById("sympLstStp2").style.display = "none";
        document.getElementById("sympLstStp5").style.display = "block";
        document.getElementById("BodyParts2").style.display = "none";
    }
    else 
    {
        document.getElementById("sympLstStp4").style.display = "none";
        document.getElementById("sympLstStp2").style.display = "block";    
        document.getElementById("BodyParts").style.display = "none";
        document.getElementById("sympLstStp5").style.display = "none";
    } 

    document.getElementById("bodyPart"+bodyPartType).style.display = "block";
    document.getElementById("WholeBody").style.display = "none";
    document.getElementById('stpMan').className = "sympLstLi";
    document.getElementById('stpWoman').className = "sympLstLi brdrTpNone";
    document.getElementById('stpChild').className = "sympLstLi";
    document.getElementById('stpInfant').className = "sympLstLi";
    document.getElementById("stp"+bodyType).className = "sympLstLi stpHumn";
	

}

function select(bodyType) {
    if(bodyPartFlg!=undefined && bodyPartType==bodyPartFlg) 
    {
        return;
    }
    bodyPartType = bodyType;
    document.getElementById("bodyPartMan").style.display = "none";
    document.getElementById("bodyPartWoman").style.display = "none";
    document.getElementById("bodyPartChild").style.display = "none";
    document.getElementById("bodyPartInfant").style.display = "none";
    document.getElementById("bodyPart"+bodyPartType).style.display = "block";
    document.getElementById("BodyParts").style.display = "block";
    document.getElementById("WholeBody").style.display = "none";
}

function deselect() {
    if(bodyPartFlg!=undefined && bodyPartType==bodyPartFlg) {return;}
   
    document.getElementById("bodyPartMan").style.display = "none";
    document.getElementById("bodyPartWoman").style.display = "none";
    document.getElementById("bodyPartChild").style.display = "none";
    document.getElementById("bodyPartInfant").style.display = "none";
    document.getElementById("bodyPart"+bodyPartType).style.display = "block";
    document.getElementById("WholeBody").style.display = "block";
    document.getElementById("WholeBody").src = 'http://www.aolcdn.com/symp_body/body_bg';
}


function highlight(elem) {

    dehighlightFlag = true;
    bodyPart = elem;
    index = elem;
    if (bodyPartType == 'Woman'){index += 9;}
    else if(bodyPartType == 'Child'){index += 18;}
    else if(bodyPartType == 'Infant'){index += 27;}
    for(i=0;i<=35;i++) {
        document.getElementById("BodyPart"+i).style.visibility = "hidden";
    }
    document.getElementById("BodyPart"+index).style.visibility = "visible";
}

function dehighlight(elem) {
    for(i=0;i<=35;i++) {
        document.getElementById("BodyPart"+i).style.visibility = "hidden";
    }
    if (dehighlightFlag == false)
    {
        bodyPart = elem;
        index = elem;
        if (bodyPartType == 'Woman'){index += 9;}
        else if(bodyPartType == 'Child'){index += 18;}
        else if(bodyPartType == 'Infant'){index += 27;}
        document.getElementById("BodyPart"+index).style.visibility = "visible";
    }
}

function gotoPatientType(elem) {
    bodyPart = elem;
    index = elem;
    highlight(elem);
    document.getElementById('sympLstStp2').style.display = "none";
    document.getElementById('sympLstStp1').style.display = "none";
	document.getElementById('sympLstStp4').style.display = "none";
	document.getElementById('sympLstStp5').style.display = "none";
    dehighlightFlag = false;
}

function mainpg() {
    bodyPart?document.getElementById("BodyPart"+bodyPart).style.visibility = "hidden":"";
	document.getElementById('stpMan').className = "sympLstLi brdrTpNone";
	document.getElementById('stpWoman').className = "sympLstLi";
	document.getElementById('stpChild').className = "sympLstLi";
	document.getElementById('stpInfant').className = "sympLstLi";
    for(i=0;i<=35;i++) {
        document.getElementById("BodyPart"+i).style.visibility = "hidden";
    }
    document.getElementById("bodyPartMan").style.display = "none";
    document.getElementById("bodyPartWoman").style.display = "block";
    document.getElementById("bodyPartChild").style.display = "none";
    document.getElementById("bodyPartInfant").style.display = "none";
    document.getElementById("WholeBody").style.display = "block";
    document.getElementById('sympLstStp3').style.display = "none";
    document.getElementById('sympLstStp4').style.display = "none";
    document.getElementById('sympLstStp5').style.display = "none";
    document.getElementById('sympLstStp2').style.display = "block";
    document.getElementById('sympLstStp1').style.display = "block";
    document.getElementById("BodyParts").style.display = "block";
}

function prevpg() {
    document.getElementById('sympLstStp3').style.display = "none";
    document.getElementById('sympLstStp1').style.display = "block";
    document.getElementById("BodyParts").style.display = "none";
	
    if(bodyPartType=="Infant")
    {
        document.getElementById('sympLstStp4').style.display = "block";
    }
    else if (bodyPartType=="Child")
    {
        document.getElementById('sympLstStp5').style.display = "block";
    }
    else
    {
        document.getElementById('sympLstStp2').style.display = "block";
    }
}



//xmlUrl = "http://xml.channel.office.aol.com/xmlrepository/fetch.adp?id=3757";
 xmlUrl = "http://xml.channel.aol.com/xmlrepository/fetch.adp?id=196008";
//-------------------------------------------------------------


// ---- HP PRINT JS CODE ----

  function __TABBLO_TPT_LOAD() {
   Tabblo.embedded.sites.SettingsObject.preprocess.apply({
    Properties:
    {
      template: 'news_large'
    },
    // content definition:
 FixedContent:
 {
  'logo': 'http://www.aolcdn.com/ch_body/print-logo'
 },
    Content:
    {
      'pagetitle':   { match: 'css', selector:'h1' },
      'text':        { match: 'css', selector:'#articleButb>h2,#articleButb>h3,#articleButb'}
    }
  }, []);
  Tabblo.embedded.printabulous();
}

function MakePDF() {
    // append tabblo print script on demand
    alert ("here");
    var _tpt_script_loaded = false;
    if (!_tpt_script_loaded) {
	    _tpt_script_loaded = true;
      var tpS = document.createElement('script');
      tpS.setAttribute('type','text/javascript');
      tpS.setAttribute('charset','utf-8');
      tpS.setAttribute('src','http://h30405.www3.hp.com/edit/tptboot/1.0');
      document.getElementsByTagName('body').item(0).appendChild(tpS);
    } else {
	Tabblo.embedded.detect.setup(Tabblo.embedded.printabulous.bind(null,false));
    }
}


// --- END OF HP PRINT JS CODE ----

//--------------------------------------------------------------

// BDC JS for Symptom Checker - DynaPub
var xmlHttpSympLocal;
var personTypeSCLocal;
var bodyPartTypeLocal;
var bodyPartLocal;
var bodyPartFlgLocal;
var dehighlightFlagLocal = true;
var ddAdSpotLocal;
var supWrapDivLocal;
var Alphabet;


function showSymptomsLocal(bodyPartLocal) {
	if (window.ActiveXObject) {
		xmlHttpSympLocal = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttpSympLocal = new XMLHttpRequest();
	}

	xmlHttpSympLocal.onreadystatechange = handleSymptomChangeLocal;

	var url = 'ajaxCallHandler.jsp?_personTypeSCLocal='+personTypeSCLocal+'&_bodyPartLocal='+bodyPartLocal;
	xmlHttpSympLocal.open("GET", url, true);
	xmlHttpSympLocal.setRequestHeader("Accept", "text/html");
	xmlHttpSympLocal.send(null);
}

function handleSymptomChangeLocal() {
	if(xmlHttpSympLocal.readyState == 4) {
		if(xmlHttpSympLocal.status == 200) {
			var result = xmlHttpSympLocal.responseText;
			document.getElementById('sympLstStp3').innerHTML = result;
			document.getElementById('sympLstStp3').style.display = "block";
		}
	}
}

function selectorLocal(bodyType) {
	if(ddAdSpot!="" && supWrapDiv=="1" && bodyPartFlgLocal!=bodyType) galleryAdRefresh(ddAdSpot);
	bodyPartTypeLocal = bodyPartFlgLocal = bodyType;
	document.getElementById("bodyPartMan").style.display = "none";
	document.getElementById("bodyPartWoman").style.display = "none";
	document.getElementById("bodyPartChild").style.display = "none";
	document.getElementById("bodyPartInfant").style.display = "none";
	if(bodyType == "Infant") {
		document.getElementById("sympLstStp4").style.display = "block";
		document.getElementById("sympLstStp5").style.display = "none";
		document.getElementById("sympLstStp2").style.display = "none";
		document.getElementById("BodyParts1").style.display = "none";
	} else if (bodyType == "Child") {
		document.getElementById("sympLstStp4").style.display = "none";
		document.getElementById("sympLstStp2").style.display = "none";
		document.getElementById("sympLstStp5").style.display = "block";
		document.getElementById("BodyParts2").style.display = "none";
	} else {
		document.getElementById("sympLstStp4").style.display = "none";
		document.getElementById("sympLstStp2").style.display = "block";    
		document.getElementById("BodyParts").style.display = "none";
		document.getElementById("sympLstStp5").style.display = "none";
	} 
	document.getElementById("bodyPart"+bodyPartTypeLocal).style.display = "block";
	document.getElementById("WholeBody").style.display = "none";
	document.getElementById('stpMan').className = "sympLstLi";
	document.getElementById('stpWoman').className = "sympLstLi brdrTpNone";
	document.getElementById('stpChild').className = "sympLstLi";
	document.getElementById('stpInfant').className = "sympLstLi";
	document.getElementById("stp"+bodyType).className = "sympLstLi stpHumn";
}

function selectLocal(bodyType) {
	if(bodyPartFlgLocal!=undefined && bodyPartTypeLocal==bodyPartFlgLocal) {
		return;
	}
	bodyPartTypeLocal = bodyType;
	document.getElementById("bodyPartMan").style.display = "none";
	document.getElementById("bodyPartWoman").style.display = "none";
	document.getElementById("bodyPartChild").style.display = "none";
	document.getElementById("bodyPartInfant").style.display = "none";
	document.getElementById("bodyPart"+bodyPartTypeLocal).style.display = "block";
	document.getElementById("BodyParts").style.display = "block";
	document.getElementById("WholeBody").style.display = "none";
}

function deselectLocal() {
	if(bodyPartFlgLocal!=undefined && bodyPartTypeLocal==bodyPartFlgLocal) {return;}

	document.getElementById("bodyPartMan").style.display = "none";
	document.getElementById("bodyPartWoman").style.display = "none";
	document.getElementById("bodyPartChild").style.display = "none";
	document.getElementById("bodyPartInfant").style.display = "none";
	document.getElementById("bodyPart"+bodyPartTypeLocal).style.display = "block";
	document.getElementById("WholeBody").style.display = "block";
	document.getElementById("WholeBody").src = 'http://www.aolcdn.com/symp_body/body_bg';
}

function highlightLocal(elem) {
	dehighlightFlagLocal = true;
	bodyPartLocal = elem;
	index = elem;
	if (bodyPartTypeLocal == 'Woman'){index += 9;}
	else if(bodyPartTypeLocal == 'Child'){index += 18;}
	else if(bodyPartTypeLocal == 'Infant'){index += 27;}
	for(i=0;i<=35;i++) {
		document.getElementById("BodyPart"+i).style.visibility = "hidden";
	}
	document.getElementById("BodyPart"+index).style.visibility = "visible";
}

function dehighlightLocal(elem) {
	for(i=0;i<=35;i++) {
		document.getElementById("BodyPart"+i).style.visibility = "hidden";
	}
	if (dehighlightFlagLocal == false) {
		bodyPartLocal = elem;
		index = elem;
		if (bodyPartTypeLocal == 'Woman'){index += 9;}
		else if(bodyPartTypeLocal == 'Child'){index += 18;}
		else if(bodyPartTypeLocal == 'Infant'){index += 27;}
		document.getElementById("BodyPart"+index).style.visibility = "visible";
	}
}

function gotoPatientTypeLocal(elem) {
	bodyPartLocal = elem;
	index = elem;

	highlightLocal(elem);

	document.getElementById('sympLstStp2').style.display = "none";
	document.getElementById('sympLstStp1').style.display = "none";
	document.getElementById('sympLstStp4').style.display = "none";
	document.getElementById('sympLstStp5').style.display = "none";
	dehighlightFlagLocal = false;
}

function mainpgLocal() {
	if(ddAdSpot!="" && supWrapDiv=="1") galleryAdRefresh(ddAdSpot);
	bodyPartLocal?document.getElementById("BodyPart"+bodyPartLocal).style.visibility = "hidden":"";
	document.getElementById('stpMan').className = "sympLstLi brdrTpNone";
	document.getElementById('stpWoman').className = "sympLstLi";
	document.getElementById('stpChild').className = "sympLstLi";
	document.getElementById('stpInfant').className = "sympLstLi";
	for(i=0;i<=35;i++) {
		document.getElementById("BodyPart"+i).style.visibility = "hidden";
	}
	document.getElementById("bodyPartMan").style.display = "none";
	document.getElementById("bodyPartWoman").style.display = "block";
	document.getElementById("bodyPartChild").style.display = "none";
	document.getElementById("bodyPartInfant").style.display = "none";
	document.getElementById("WholeBody").style.display = "block";
	document.getElementById('sympLstStp3').style.display = "none";
	document.getElementById('sympLstStp4').style.display = "none";
	document.getElementById('sympLstStp5').style.display = "none";
	document.getElementById('sympLstStp2').style.display = "block";
	document.getElementById('sympLstStp1').style.display = "block";
	document.getElementById("BodyParts").style.display = "block";
}

function prevpgLocal() {
	if(ddAdSpot!="" && supWrapDiv=="1") galleryAdRefresh(ddAdSpot);
	document.getElementById('sympLstStp3').style.display = "none";
	document.getElementById('sympLstStp1').style.display = "block";
	document.getElementById("BodyParts").style.display = "none";

	if(bodyPartTypeLocal=="Infant") {
		document.getElementById('sympLstStp4').style.display = "block";
	} else if (bodyPartTypeLocal=="Child") {
		document.getElementById('sympLstStp5').style.display = "block";
	} else {
		document.getElementById('sympLstStp2').style.display = "block";
	}
}



function Alpha(Alphabet)
	{
	if (window.ActiveXObject) {
		xmlHttpAlp = new ActiveXObject("Microsoft.XMLHTTP");
	} else if (window.XMLHttpRequest) {
		xmlHttpAlp = new XMLHttpRequest();
	}
	
	xmlHttpAlp.onreadystatechange=handleSymptombrowse;
	var alpa = 'ajaxCallHandler.jsp?browse='+Alphabet;

	xmlHttpAlp.open("GET", alpa, true);
	xmlHttpAlp.setRequestHeader("Accept", "text/html");
	xmlHttpAlp.send(null);
	}

function handleSymptombrowse()
	{
		if(xmlHttpAlp.readyState == 4) {
		if(xmlHttpAlp.status == 200) {
		var resultAlpha=xmlHttpAlp.responseText;
		
		document.getElementById('dlBAPopulateDiv').innerHTML=resultAlpha;
		document.getElementById('dlBAPopulateDiv').style.display = "block";
				}
		}
	}
//-------------------------------------------------------------	
