//Specify affected tags. Add or remove from list:
var tgs = new Array('div', 'td', 'h4');

//Specify spectrum of different font sizes:
var fontSizes = new Array('11px', '13px', '15px');
var startfontSize = 0;

//Loops through the DOM tag types indicated in the tgs array to 
//modify the text sizes to the size chosen from the fontSizes array.
//PARAM: trgt - The target DOM container object, typically 'body'.
//PARAM: inc  - The element number (0,1,2,etc.) in the fontSizes array to switch the font size to.
function ts(trgt, inc){
	
	//Check the DOM is valid
	if (!document.getElementById) return
	
	//Var declarations and initializations
	var d = document, cEl = null, fontSize = startfontSize, i, j, cTags;
	
	//Set the fontSize var to save the passed element number
	fontSize = inc;
	
	//Check that the passed fontSize is within proper range
	if ( fontSize < 0 ) fontSize = 0;
	if ( fontSize > 6 ) fontSize = 6;
	startfontSize = fontSize;
		
    //Check that the passed DOM container object is valid
	if ( !( cEl = d.getElementById(trgt) ) ) 
	    cEl = d.getElementsByTagName(trgt)[0]; //Save the container object

    //Set the fontSize of the entire container object
	cEl.style.fontSize = fontSizes[fontSize];

    //Loop through each tag type in the tgs array
	for(i = 0 ; i < tgs.length ; i++){
	
	    //Get the first element of the tag type
		cTags = cEl.getElementsByTagName(tgs[i]);
		
		//Loop through any children
		for(j = 0; j < cTags.length; j++)
		    cTags[j].style.fontSize = fontSizes[fontSize]; //Set the fontSize
		    
	}
	
	//Resets the text sizes for all elements excepted from the text resizing
	resetExceptionFontSizes();
	
}

//Resets the font sizes for the exception elements.
function resetExceptionFontSizes(){

    var arrDivs = document.getElementsByTagName("div"); //Get all div elements
    var i, j; //Counters
    
    //Loop through all divs
    for(i = 0; i < arrDivs.length; i++){
    
        //Check if this is an exception div
        if(isFontSizeExceptionDiv(arrDivs[i].id)){
        
            arrDivs[i].style.fontSize = fontSizes[0]; //Set the fontSize back to default for the parent element
     
            //Loop through each tag type in the tgs array
	        for(j = 0 ; j < tgs.length; j++){
        	
	            //Get the first element of the tag type
		        cTags = arrDivs[i].getElementsByTagName(tgs[j]);
        		
		        //Loop through any children
		        for(k = 0; k < cTags.length; k++)
		           cTags[k].style.fontSize = fontSizes[0]; //Set the fontSize back to default for the child element
        		    
	        }
        
        }

    }

}

//Checks to see if the passed ID matches one of the exception divs.
//PARAM: elementId - The ID of the element to check.
//RETURNS: True if passed ID matches one of the elements to check, otherwise false.
function isFontSizeExceptionDiv(elementId){

    switch(elementId){
		    
        case "advil-products":
            return true;
        case "advil-cold-sinus":
            return true;
        case "childrens-advil-products":
            return true;
        case "article-name-wrapper":
            return true;
        case "divMoreInfo":
            return true;
        case "pnlMoreDetails":
            return true;
            
        default:
        
            //if(elementId.length>0)
                //alert(elementId.substring(elementId.length-4, elementId.length));
        
            if(elementId.substring(elementId.length-4, elementId.length) == "_tip")
                return true
            else
                return false;
            
    }

}