function changeClass(obj, new_class)
{
    obj.className = new_class;
}


/* drop down menu functions */

activeMenu = null;
timerId = 0;

function showSubMenu(id) 
{
  if (!document.getElementById) {
      return;
  }
  clearTimeout(timerId);
  if (activeMenu == id) {
	  return;
  }      
  if (activeMenu != null) {
      menuOff();
  }
  activeMenu = id ;
  posLeft = getXYcoord( 'menu_left_' + id );
  posRight = getXYcoord( 'menu_right_' + id );
  document.getElementById('drop_down_menu_' + id).style.top = posLeft.y + 1;
  document.getElementById('drop_down_menu_' + id).style.left = posLeft.x - 1;
  document.getElementById('drop_down_table_' + id).style.width = posRight.x - posLeft.x + 3;	
  document.getElementById('drop_down_menu_' + id).style.display = "block";
}


function subMenuOff()
{
  if (!document.getElementById) {
      return;
  }
  if (activeMenu == null) {
      return;
  }
  document.getElementById('drop_down_menu_' + activeMenu).style.display = "none";  		
  activeMenu = null;
}


function getXYcoord ( nvn )
{
   var elm = document.images[nvn];
   if ( document.layers ) return elm;

   var rd = { x:0 ,y:0 };
   do { rd.x += parseInt( elm.offsetLeft );
        rd.y += parseInt( elm.offsetTop );
        elm = elm.offsetParent;
   } while ( elm );
   return rd;
} 


function emptyfield (field, defaultval, blur)
{
	if ( blur == true ) {
		if (field.value == '') {
			field.value = defaultval;
		}
	} else {
		if (field.value == defaultval) {
			field.value = '';
		}
	}

	return true;
}
function checkField (id_name, post_value, dictionary_value)
{
	if (post_value)		document.getElementById(id_name).value = post_value;
	else				document.getElementById(id_name).value = dictionary_value;
}
function checkFieldValue (id_name, dictionary_value)
{
	//alert(id_name+' : '+dictionary_value);
	if (dictionary_value == document.getElementById(id_name).value)
		document.getElementById(id_name).value = '';
}

function checkValues (ime, priimek, form_signup_kraj, od, doStr)
{
	checkFieldValue('ime_modela', ime);
	checkFieldValue('priimek_modela', priimek);
	checkFieldValue('kraj_modela', form_signup_kraj);
	checkFieldValue('starost_od', od);
	checkFieldValue('starost_do', doStr);
}