function imagizeMenuElement() {
	ulArray = document.getElementsByTagName('ul');
	
	for (index = ulArray.length-1 ; index >= 0 ; index--) {
		if (hasClassName(ulArray[index], 'menu')) {
			liArray = ulArray[index].getElementsByTagName('li');
			for (liIndex = liArray.length -1 ; liIndex >= 0 ; liIndex-- ) {
				linkElement = liArray[liIndex].getElementsByTagName('a').item(0);
				tempString = linkElement.innerHTML;
				tempString = tempString.replace('ț', 't');
				linkElement.innerHTML = '<img src="http://'+document.domain+'/wp-content/themes/ewc-h/menuTextImg.php?text='+tempString+'" class="reflect ropacity33 rheight50" alt="'+tempString+'" />';
			}
		}
	}
}

function htmlentities (string, quote_style) {
    // Convert all applicable characters to HTML entities 
    //
    // version: 909.322
    // discuss at: http://phpjs.org/functions/htmlentities
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: nobbler
    // +    tweaked by: Jack
    // +   bugfixed by: Onno Marsman
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    bugfixed by: Brett Zamir (http://brett-zamir.me)
    // +      input by: Ratheous
    // -    depends on: get_html_translation_table
    // *     example 1: htmlentities('Kevin & van Zonneveld');
    // *     returns 1: 'Kevin &amp; van Zonneveld'
    // *     example 2: htmlentities("foo'bar","ENT_QUOTES");
    // *     returns 2: 'foo&#039;bar'
    var hash_map = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
     
    if (false === (hash_map = this.get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    hash_map["'"] = '&#039;';
    for (symbol in hash_map) {
        entity = hash_map[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
     
    return tmp_str;
}

function hasClassName(element, className) {
	return (element.className.search(className) != -1);
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

addLoadEvent(imagizeMenuElement);


