
function sinit() {

						
		$id("genreList").onchange = function() {
			requestSubGenre = new HttpRequest();
			requestSubGenre.addHeader("Content-Type", "text/html");
			requestSubGenre.onComplete = function(response) {

				$id("subGenreList").innerHTML = response.text;
			}
			requestSubGenre.get("/helper/genre/" + this.value);									
}						
					
		
}



 
 var ie7_Options = new Array(); // 

function optionsStringToHTMLElementsAndAttributes(str)
{
	// 14.06.2007 to workaround ie7 issue with setting city.innerHTML
	// dissect the string to create a collection of elements and attributes
	// this may be able to be done more efficiently using regular expressions
	
	// empty the array in case there are already values in here
	ie7_Options.length = 0;	
	
	var opts = str.split('<option');		

	for (var i=1; i<opts.length; i++)
	{

		ie7_Options[i] = new Array();
		
		ie7_Options[i].value = opts[i].split("value='")[1];

		
		
		ie7_Options[i].value = ie7_Options[i].value.substring(0, ie7_Options[i].value.indexOf("'"));
		
		if (opts[i].match('selected'))
		{
		//	cannot use split technique as lazy ie syntax: 'selected' rather than 'selected="selected"'
			ie7_Options[i].selected = 'selected';
		}
		
		ie7_Options[i].string = opts[i].split('>')[1];
		ie7_Options[i].string = ie7_Options[i].string.split('<')[0];				
	}
}
 
 
 
function createSelectOptions(selectEl, responseText)
{
	
	// 14.06.2007 to workaround ie7 issue with setting city.innerHTML	
	optionsStringToHTMLElementsAndAttributes(responseText)
	
	selectEl.innerHTML = '';		

	for (var i=1; i<ie7_Options.length; i++)
	{
		var myOption = document.createElement('option');
			myOption.value = ie7_Options[i].value;
		
		if (ie7_Options[i].selected)
		{
			myOption.selected = true;	
		}
		
		var myOptionString = document.createTextNode(ie7_Options[i].string);		
		myOption.appendChild(myOptionString);		
		
		selectEl.appendChild(myOption);		
	}	
}
