(function ($) {
  Drupal.behaviors.manipulateFormElements = {
    attach: function(context, settings) {
    // give the login form some love
    $('#user-login-form .login-submit-link').click(function(){
    	$('#user-login-form').submit();
    	return false;
    });
    }
  };
  Drupal.behaviors.correctActiveTrails = {
    attach: function(context, settings) {
      // fix menus that don't respect active trail because drupal links are stoopid
    $('#region-menu ul li.active').parents('li').addClass('active-trail');
    }
  };
})(jQuery);
;
(function ($) {
  Drupal.behaviors.customOmegaSubthemeJS = {
    attach: function(context, settings) {
      // you can implement your custom javascript/jquery here,
      // and also create other attached behaviors
      
    }
  };
})(jQuery);

window.onload = setCharacterLimit;
//document.getElementById('edit-submitted-email-address').onclick = clearEmailField;


function setCharacterLimit(){
	var div = document.getElementsByTagName('div');
	
	for (var i=0; i<div.length; i++) {
		if (div[i].getAttribute('class') == 'attributes') {
			if (document.getElementById('edit-attributes-4') != null) {
				document.getElementById('edit-attributes-4').setAttribute('maxlength','18');}
			if (document.getElementById('edit-attributes-20') != null) {
				document.getElementById('edit-attributes-20').setAttribute('maxlength','20');}
			if (document.getElementById('edit-attributes-21') != null) {
				document.getElementById('edit-attributes-21').setAttribute('maxlength','25');}
			if (document.getElementById('edit-attributes-22') != null) {
				document.getElementById('edit-attributes-22').setAttribute('maxlength','30');}
			if (document.getElementById('edit-attributes-23') != null) {
				document.getElementById('edit-attributes-23').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-24') != null) {
				document.getElementById('edit-attributes-24').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-25') != null) {
				document.getElementById('edit-attributes-25').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-27') != null) {
				document.getElementById('edit-attributes-27').setAttribute('maxlength','25');}
			if (document.getElementById('edit-attributes-29') != null) {
				document.getElementById('edit-attributes-29').setAttribute('maxlength','30');}
			if (document.getElementById('edit-attributes-31') != null) {
				document.getElementById('edit-attributes-31').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-32') != null) {
				document.getElementById('edit-attributes-32').setAttribute('maxlength','25');}
			if (document.getElementById('edit-attributes-33') != null) {
				document.getElementById('edit-attributes-33').setAttribute('maxlength','30');}
			if (document.getElementById('edit-attributes-34') != null) {
				document.getElementById('edit-attributes-34').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-35') != null) {
				document.getElementById('edit-attributes-35').setAttribute('maxlength','30');}
			if (document.getElementById('edit-attributes-36') != null) {
				document.getElementById('edit-attributes-36').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-37') != null) {
				document.getElementById('edit-attributes-37').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-38') != null) {
				document.getElementById('edit-attributes-38').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-40') != null) {
				document.getElementById('edit-attributes-40').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-41') != null) {
				document.getElementById('edit-attributes-41').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-44') != null) {
				document.getElementById('edit-attributes-44').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-45') != null) {
				document.getElementById('edit-attributes-45').setAttribute('maxlength','4');}
			if (document.getElementById('edit-attributes-48') != null) {
				document.getElementById('edit-attributes-48').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-54') != null) {
				document.getElementById('edit-attributes-54').setAttribute('maxlength','4');}
			if (document.getElementById('edit-attributes-57') != null) {
				document.getElementById('edit-attributes-57').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-58') != null) {
				document.getElementById('edit-attributes-58').setAttribute('maxlength','40');}
			if (document.getElementById('edit-attributes-59') != null) {
				document.getElementById('edit-attributes-59').setAttribute('maxlength','40');}
			if (document.getElementById('edit-attributes-66') != null) {
				document.getElementById('edit-attributes-66').setAttribute('maxlength','8');}	
			if (document.getElementById('edit-attributes-62') != null) {
				document.getElementById('edit-attributes-62').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-63') != null) {
				document.getElementById('edit-attributes-63').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-64') != null) {
				document.getElementById('edit-attributes-64').setAttribute('maxlength','20');}
			if (document.getElementById('edit-attributes-65') != null) {
				document.getElementById('edit-attributes-65').setAttribute('maxlength','25');}
			if (document.getElementById('edit-attributes-66') != null) {
				document.getElementById('edit-attributes-66').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-67') != null) {
				document.getElementById('edit-attributes-67').setAttribute('maxlength','45');}
			if (document.getElementById('edit-attributes-68') != null) {
				document.getElementById('edit-attributes-68').setAttribute('maxlength','10');}
			if (document.getElementById('edit-attributes-72') != null) {
				document.getElementById('edit-attributes-72').setAttribute('maxlength','18');}
			if (document.getElementById('edit-attributes-73') != null) {
				document.getElementById('edit-attributes-73').setAttribute('maxlength','12');}
			if (document.getElementById('edit-attributes-74') != null) {
				document.getElementById('edit-attributes-74').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-75') != null) {
				document.getElementById('edit-attributes-75').setAttribute('maxlength','18');}
			if (document.getElementById('edit-attributes-79') != null) {
				document.getElementById('edit-attributes-79').setAttribute('maxlength','20');}
			if (document.getElementById('edit-attributes-80') != null) {
				document.getElementById('edit-attributes-80').setAttribute('maxlength','20');}
			if (document.getElementById('edit-attributes-84') != null) {
				document.getElementById('edit-attributes-84').setAttribute('maxlength','8');}
			if (document.getElementById('edit-attributes-87') != null) {
				document.getElementById('edit-attributes-87').setAttribute('maxlength','10');}
			if (document.getElementById('edit-attributes-88') != null) {
				document.getElementById('edit-attributes-88').setAttribute('maxlength','10');}
			if (document.getElementById('edit-attributes-89') != null) {
				document.getElementById('edit-attributes-89').setAttribute('maxlength','10');}
			if (document.getElementById('edit-attributes-90') != null) {
				document.getElementById('edit-attributes-90').setAttribute('maxlength','10');}	
			if (document.getElementById('edit-attributes-91') != null) {
				document.getElementById('edit-attributes-91').setAttribute('maxlength','10');}								
			if (document.getElementById('edit-attributes-92') != null) {
				document.getElementById('edit-attributes-92').setAttribute('maxlength','10');}					
			if (document.getElementById('edit-attributes-93') != null) {
				document.getElementById('edit-attributes-93').setAttribute('maxlength','20');}
			if (document.getElementById('edit-attributes-96') != null) {
				document.getElementById('edit-attributes-96').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-97') != null) {
				document.getElementById('edit-attributes-97').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-98') != null) {
				document.getElementById('edit-attributes-98').setAttribute('maxlength','15');}
			if (document.getElementById('edit-attributes-99') != null) {
				document.getElementById('edit-attributes-99').setAttribute('maxlength','8');}
		}
	}
}
;

