function addLanguage(lang) {
	lang = lang || "";
	skipHref			= ["lang=","javascript:","mailto:","#"]; // if the element has one of these values in the 'href' attributes the item is skipped
	skipClasses			= ["thickbox","smoothbox","nolang"]; // skip elements who have one of these classes

	$$("a[target!=_blank],form").each(function(item){
		keep = true;
		
		skipClasses.each(function(iClass){
			if (item.hasClass(iClass)) keep = false;
		});
		
		skipHref.each(function(iHref){
			switch(item.tagName.toLowerCase()){
				case "a":
					_attribute = "href";
					break;

				case "form":
					_attribute = "action";
					break;
					
				default:
					keep = false;
					_attribute = "";
			}
			
			if(_attribute != "") {
				value = item.get(_attribute);
				if (value == null || value.indexOf(iHref) > -1) keep = false;
			}
		});
		
		if (keep) {
			newValue = value + ((value.indexOf("?") > -1) ? "&lang="+lang : "?lang="+lang);
			item.set(_attribute,newValue);
		}
	});	
}
