function test(theLink, sMessage)
{
	return confirm(sMessage);
}

function disable(obj, value)
{
	if(obj) {
		obj.disabled = value;
	}
}

var selected_city = 0;
function ChangeCountry(obj, obj_city)
{
  var country_id = obj.options[obj.selectedIndex].value;
  var count = 0;
  if( obj_city != null) {
	obj_city.length=0;
	for(var j=0; j < cities.length; j++)
  	{
	    if((cities[j][2] == country_id || cities[j][2] == 0) || country_id == 0)
	    {
      		obj_city.options[count] = new Option(cities[j][1], cities[j][0]);
	    	if(cities[j][0] == selected_city) obj_city.options[count].selected = true;
	      	count++;
	    }
	}
  }
}

var selected_c1 = 0;
function ChangeMainCatalog(obj, obj_cat, obj_user)
{
  if(obj == null || obj_cat == null) return false;
  var main_id = obj.options[obj.selectedIndex].value;
  var count = 0;
  obj_cat.length=0;
  for(var j=0; j < c1.length; j++)
  {
    if((c1[j][2] == main_id || c1[j][2] == 0) || main_id == 0)
    {
      obj_cat.options[count] = new Option(c1[j][1], c1[j][0]);
      if(c1[j][0] == selected_c1) obj_cat.options[count].selected = true;
      count++;
    }
  }
  ChangeSecCatalog(obj_cat, obj_user);
}

var selected_c2 = 0;
function ChangeSecCatalog(obj, obj_user)
{
  if(obj == null || obj_user == null) return false;
  var sec_id = obj.options[obj.selectedIndex].value;
  var count = 0;
  obj_user.length=0;
  for(var j=0; j < c2.length; j++)
  {
    if(c2[j][2] == sec_id || c2[j][2] == 0)
    {
      obj_user.options[count] = new Option(c2[j][1], c2[j][0]);
      if(c2[j][0] == selected_c2) obj_user.options[count].selected = true;
      count++;
    }
  }
}


/***********************************************
* Textarea Maxlength script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
function ismaxlength(obj)
{
	var mlength = obj.getAttribute ? parseInt(obj.getAttribute("maxlength")) : "";
	if (obj.getAttribute && obj.value.length > mlength) {
		obj.value = obj.value.substring(0, mlength);
	}
}
