Corbiz.prototype.createCustomDropdowns = function(element,usejq,callchangeevent) {
	element = element.getElementsByTagName('form')[0]; //Get the form inside the element (parameter)
	var selectboxes = element.getElementsByTagName('select'); //Get the select elements inside the form
	
	/*
		The zindex parameter is used to set the css z-index property on the selectbox div, the selectedoption div, the optionholder div and option divs
		
		In IE7 the parent element of the element that has to be shown above something else need to have an even higher z-index.
		In this case the parent element of the optionholder is the selectbox div.
	*/
	
	var zindex = '9999';
	
	for (var a = 0; a < selectboxes.length; a++) { //Loop through all the select elements
		var currentselectbox = selectboxes[a];
		currentselectbox.style.display = 'none';
		
		var divselectbox = document.createElement('div'); //Create the new div selectbox and insert it before the current select element
		divselectbox.className = 'selectbox';
		divselectbox.style.zIndex = zindex;
		zindex--;
		element.insertBefore(divselectbox,currentselectbox);
		
		var optionholder = document.createElement('div'); // Create a div to hold all the option elements, set the classname and insert it just below the new div selectbox and hide it
		optionholder.className = 'options';
		optionholder.style.top = divselectbox.style.minHeight;
		optionholder.style.display = 'none';
		optionholder.style.zIndex = zindex;
		zindex--;
		divselectbox.appendChild(optionholder);
		
		var options = currentselectbox.getElementsByTagName('option'); //Get all the option elements in the current selectbox
		
		for (var b = 0; b < options.length; b++) { //Loop through all the select elements
			var currentoption = options[b];
			var optiontext = document.createTextNode(currentoption.text);
			
			if (currentoption.selected) { //If the option is selected create a new div option and place it inside the new div selectbox just before the optionholder div
				var selectedoption = document.createElement('div');
				selectedoption.className = 'selectedoption';
				selectedoption.setAttribute('optionvalue',currentoption.value);
				selectedoption.setAttribute('optiontext',currentoption.text);
				selectedoption.style.zIndex = zindex;
				
				selectedoption.appendChild(optiontext);
				divselectbox.insertBefore(selectedoption,optionholder);
				
				corbiz.addEventHandler(selectedoption,'click',function() { //Add a clickevent to the new selected option div
					var currdivsbox = corbiz.getElementsByClassName(element,'selectbox','div')[arguments[0]];
					var curroptholder = corbiz.getElementsByClassName(currdivsbox,'options','div')[0];
					
					if (usejq) { //If usejq then show or hide the optionholder div with jQuery slideDown/slideUp animations
						if (curroptholder.style.display == 'none') {
							$(curroptholder).slideDown(300);
						} else {
							$(curroptholder).slideUp(300);
						} //if-else
					} else { //If not usejq show or hide the optionholder div by setting the style.display to block/none
						if (curroptholder.style.display == 'none') {
							curroptholder.style.display = 'block';
						} else {
							curroptholder.style.display = 'none';
						} //if-else
					} //if-else
				}.bind(this,a)); //'a' is used to keep scope - use it to get the current select element or the new div selectbox
			} else { //If the option is not selected create a new div option and place it inside the optionholder
				var option = document.createElement('div');
				option.className = 'option';
				option.setAttribute('optionvalue',currentoption.value);
				option.setAttribute('optiontext',currentoption.text);
				option.style.zIndex = zindex;
				
				option.appendChild(optiontext);
				optionholder.appendChild(option);
				
				corbiz.addEventHandler(option,'click',function() { //Add a clickevent to the new option div
					var currsbox = element.getElementsByTagName('select')[arguments[0]];
					var currdivsbox = corbiz.getElementsByClassName(element,'selectbox','div')[arguments[0]];
					var curroptholder = corbiz.getElementsByClassName(currdivsbox,'options','div')[0];
					var clickedopt = corbiz.getElementsByClassName(curroptholder,'option','div')[arguments[1]-1];
					var newselectedopttext = document.createTextNode(clickedopt.attributes['optiontext'].value);
					var prevselectedopt = corbiz.getElementsByClassName(currdivsbox,'selectedoption','div')[0];
					
					prevselectedopt.removeChild(prevselectedopt.childNodes[0]);
					prevselectedopt.removeAttribute('optionvalue');
					prevselectedopt.removeAttribute('optiontext');
					
					prevselectedopt.appendChild(newselectedopttext);
					prevselectedopt.setAttribute('optionvalue',clickedopt.attributes['optionvalue'].value);
					prevselectedopt.setAttribute('optiontext',clickedopt.attributes['optiontext'].value);
					
					if (usejq) { //If usejq hide the optionholder div with jQuery slideUp animation
						$(curroptholder).slideUp(300);
					} else { //If not usejq hide the optionholder div by setting style.display to none
						curroptholder.style.display = 'none';
					} //if-else
					
					var opts = currsbox.getElementsByTagName('option');
					
					for (var c = 0; c < opts.length; c++) { //Run through all options in the original select element and set the selected option to the same as the selected option in the new div selectbox.
						var opt = opts[c];
						
						if (opt.value == clickedopt.attributes['optionvalue'].value) {
							opt.selected = true;
						} else {
							opt.selected = false;
						} //if-else
					} //for
					
					if (callchangeevent) { //If the selectbox has autopostback (server call) then call the change event of the current selectbox element
						currsbox.onchange();
					}
				}.bind(this,a,b)); //'a' and 'b' is used to keep scope - use 'a' to get the current select element or the new div selectbox, use'b' to get the clicked div option
			} //if-else
			
			zindex--;
		} //for
		
		zindex--;
	} //for
} //createCustomDropdowns
