﻿function setButtonImage(dataContainer, imageName)
{
    if(dataContainer==null)
        return;
     
    if(dataContainer.src.indexOf("_2") != -1)
        dataContainer.src = dataContainer.src.replace(imageName + "_2", imageName);
    else
        dataContainer.src = dataContainer.src.replace(imageName, imageName + "_2");
}

function checkLength(dataContainer, length)
{   
  var text =dataContainer.value
  if(text.length>length)
    dataContainer.value = dataContainer.value.substring(0,length)  
}

/* function $(id)
{
    return document.getElementById(id);
} */
 
function showPopup(url, w, h)
{
    window.open(url, '', 'width=' + w + ', height=' + h + ', scrollbars=yes, resizable=no');
}

function showPopup(url, w, h, scroll, resize)
{
    window.open(url, '', 'width=' + w + ', height=' + h + ', scrollbars=' + scroll + ', resizable=' + resize + '');
}

//Add hover to nutritional submenu
$(function() {
    $('.nut_menus a img:not([src*="_on"])')
        .mouseover(function() {
            //if ($(this).attr("src").indexOf("_on") <= 0)
                $(this).attr("src", $(this).attr("src").replace(".png", "_on.png")); 
        })
        .mouseout(function() {
            $(this).attr("src", $(this).attr("src").replace("_on", "")); 
        });
});
