

$(document).ready(function() {


if ( $('h3#RightTop').length > 0 ) // if quicklinks present
    { 
    
        if( $('h3#AudioRightTop').length > 0) // if Audio Link present change it to heading 4
          {
            var h3quicklinks = $('h3#AudioRightTop');
            var h4quicklinks = $('<h4 id="AudioRightTop" class="heading">' + $('h3#AudioRightTop').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }  
    
    
          if( $('h3#QuickLinks').length > 0) // if Releated links present change it to heading 4
          {
            var h3quicklinks = $('h3#QuickLinks');
            var h4quicklinks = $('<h4 id="QuickLinks" class="heading">' + $('h3#QuickLinks').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }  
    
          if( $('h3#RelatedTopics').length > 0) // if Releated links present change it to heading 4
          {
            var h3 = $('h3#RelatedTopics');
            var h4 = $('<h4 id="RelatedTopics" class="heading">' + $('h3#RelatedTopics').text() + '</h4>');
            h3.replaceWith(h4);            
          }
          
          if( $('h3#AvailableDownloads').length > 0) // if Available downloads present change it to heading 4
          {
            var h3availabledownloads = $('h3#AvailableDownloads');
            var h4availabledownloads = $('<h4 id="AvailableDownloads" class="heading">' + $('h3#AvailableDownloads').text() + '</h4>');
            h3availabledownloads.replaceWith(h4availabledownloads);            
          }   
          
          if( $('h3#AudioRightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#AudioRightBottom');
            var h4quicklinks = $('<h4 id="AudioRightBottom" class="heading">' + $('h3#AudioRightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }         
              
    }
    
    
 if ( $('h3#AudioRightTop').length > 0 ) // if quicklinks present
    { 
    
          if( $('h3#QuickLinks').length > 0) // if Releated links present change it to heading 4
          {
            var h3quicklinks = $('h3#QuickLinks');
            var h4quicklinks = $('<h4 id="QuickLinks" class="heading">' + $('h3#QuickLinks').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }  
    
          if( $('h3#RelatedTopics').length > 0) // if Releated links present change it to heading 4
          {
            var h3 = $('h3#RelatedTopics');
            var h4 = $('<h4 id="RelatedTopics" class="heading">' + $('h3#RelatedTopics').text() + '</h4>');
            h3.replaceWith(h4);            
          }
          
          if( $('h3#AvailableDownloads').length > 0) // if Available downloads present change it to heading 4
          {
            var h3availabledownloads = $('h3#AvailableDownloads');
            var h4availabledownloads = $('<h4 id="AvailableDownloads" class="heading">' + $('h3#AvailableDownloads').text() + '</h4>');
            h3availabledownloads.replaceWith(h4availabledownloads);            
          }  
          
         
          if( $('h3#RightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#RightBottom');
            var h4quicklinks = $('<h4 id="RightBottom" class="heading">' + $('h3#RightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }                
              
    }   



 if ( $('h3#QuickLinks').length > 0 ) // if quicklinks present
    { 
          if( $('h3#RelatedTopics').length > 0) // if Releated links present change it to heading 4
          {
            var h3 = $('h3#RelatedTopics');
            var h4 = $('<h4 id="RelatedTopics" class="heading">' + $('h3#RelatedTopics').text() + '</h4>');
            h3.replaceWith(h4);            
          }
          
          if( $('h3#AvailableDownloads').length > 0) // if Available downloads present change it to heading 4
          {
            var h3availabledownloads = $('h3#AvailableDownloads');
            var h4availabledownloads = $('<h4 id="AvailableDownloads" class="heading">' + $('h3#AvailableDownloads').text() + '</h4>');
            h3availabledownloads.replaceWith(h4availabledownloads);            
          } 
          
           if( $('h3#RightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#RightBottom');
            var h4quicklinks = $('<h4 id="RightBottom" class="heading">' + $('h3#RightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }   
          
           if( $('h3#AudioRightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#AudioRightBottom');
            var h4quicklinks = $('<h4 id="AudioRightBottom" class="heading">' + $('h3#AudioRightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }           
              
    }
    
    if ($('h3#RelatedTopics').length > 0) // Check if the Related links present
    { 
                
          if( $('h3#AvailableDownloads').length > 0) // if Available downloads present change it to heading 4
          {
            var h3 = $('h3#AvailableDownloads');
            var h4 = $('<h4 id="AvailableDownloads" class="heading">' + $('h3#AvailableDownloads').text() + '</h4>');
            h3.replaceWith(h4);            
          }       
          
           if( $('h3#RightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#RightBottom');
            var h4quicklinks = $('<h4 id="RightBottom" class="heading">' + $('h3#RightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }       
          
           if( $('h3#AudioRightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#AudioRightBottom');
            var h4quicklinks = $('<h4 id="AudioRightBottom" class="heading">' + $('h3#AudioRightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }    
              
    }
    
    if ($('h3#AvailableDownloads').length > 0) // Check if the Related links present
    {    
          
         if( $('h3#RightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#RightBottom');
            var h4quicklinks = $('<h4 id="RightBottom" class="heading">' + $('h3#RightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }     
          
           if( $('h3#AudioRightBottom').length > 0) // if Bottm video present change it to heading 4
          {
            var h3quicklinks = $('h3#AudioRightBottom');
            var h4quicklinks = $('<h4 id="AudioRightBottom" class="heading">' + $('h3#AudioRightBottom').text() + '</h4>');
            h3quicklinks.replaceWith(h4quicklinks);            
          }      
              
    }
    
    if ($('h3.extraHeading').length > 0) // Check if the Related links present
    { 
                
          if( $('h3#RightBottom').length > 0) // if Available downloads present change it to heading 4
          {
            var h3 = $('h3#RightBottom');
            var h4 = $('<h4 id="RightBottom" class="heading">' + $('h3#RightBottom').text() + '</h4>');
            h3.replaceWith(h4);            
          }       
          
          
              
    }
    
    $('td.ms-sbgo a').html('GO &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
    
    
    $('a').each(function(i){
	   var urltitle = $(this).attr('title');
	   if(urltitle.toUpperCase() ==  'LIVE HELP')
	      {
	        $(this).click(function() {chat();return false;});
	        $(this).attr('href', '#');	        
	        $(this).attr('target', 'chat4821167');
	        }
	    });
	    
});