/************************************************************************
 *
 *  DOM Behaviours - common routines and functions for adding
 *  a behaviour layer to an (X)HTML document.
 *
 ***********************************************************************/



/************************************************************************
 *
 *  Attaching events to element nodes
 *  from http://www.sitepoint.com/article/structural-markup-javascript
 *   * addEvent
 *   * removeEvent
 *
 ***********************************************************************/

function addEvent(obj, evType, fn, useCapture){
  if (obj.addEventListener){
    obj.addEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be attached");
  }
}


/************************************************************************
 *
 *	Description
 * 	@param
 *  @return
 *   
 *
 ***********************************************************************/
 
$(document).ready(function()
{ 
	
	$('#category').change
	(
		function() 
		{
			//$('formname').submit();
			$('form[id="download_claimform"]').submit();
			//alert('Handler for .change() called.');
		}
	);
	
	$("input[name='question']").change
	(
		function ()
		{
		   //alert('Wassup.');
		   $('form[id="download_claimform"]').submit();	
		}
	
	);
	
	$('#selectCategory, #selectQuestion').css({"display":"none"});
	
	//$('#category').removeAttr("helper"); 
	
	/*alert( $('select[name="category"]').attr('helper') );

	
	$('select[name="category"]').attr( { helper: "tinker,tailor" } );  
	
	//$('select[name="category"]').removeAttr("helper");
	
	alert( $('select[name="category"]').attr('helper') );
	*/
	// Remove html element "br" form the claim from
	$('li label[for=question-Y]').nextAll('br').remove();
	
});
