/**
 * Methoden zum Setzen, Auslesen und Löschen von Cookies
 *
 * @authors		Martin Widemann
 * @copyright	Copyright 2008 - Netigo GmbH
 * @version		1.0
 * @modified	2008-10-24
 */
Html = {

	/**
	 * Elemente anhand ihrer Klasse (class) finden
	 *
	 * @param String class_name Name der Klasse
	 */
	getElementsByClassName: function(class_name){
		return Html.getElementsByAttribute('className', class_name);
	}, // function

	/**
	 * Elemente anhand ihrers Namens (name) finden
	 *
	 * @param String name Name
	 */
	getElementsByName: function(name){
		return Html.getElementsByAttribute('name', name);
	}, // function

	/**
	 * Elemente anhand ihrer Attribute finden
	 *
	 * @param String attribute Name des Attributes
	 * @param String value Wert des Attributes
	 */
	getElementsByAttribute: function(attribute, value){
		var all_obj;
		var ret_obj = new Array();
		var j = 0;
		var teststr;

		if(document.all){
			all_obj = document.all;
		}else if(document.getElementsByTagName && !document.all){
			all_obj = document.getElementsByTagName('*');
		} // if
		
		for(var i = 0; i < all_obj.length; i++){
			if(all_obj[i][attribute]){
				if(all_obj[i][attribute].indexOf(value) != -1){
					teststr = ',' + all_obj[i][attribute].split(' ').join(',') + ',';
		
					if(teststr.indexOf(',' + value + ',') != -1){
						ret_obj[j] = all_obj[i];
						j++;
					} // if
				} // if
			} // if
		} // for
		
		return ret_obj;
	} // function

} // class

