
function menuOn(obj, objID)
{
	var _GET = readGet();
	if (_GET['m'] == 'product')
		_GET['m'] = 'categorylist';
	if (_GET['m'] == 'reductedproduct')
		_GET['m'] = 'reductedlist';
	if (_GET['m'] == 'usedproduct')
		_GET['m'] = 'usedlist';
	if (_GET['m'] == 'specialproduct')
		_GET['m'] = 'speciallist';
	if (_GET['m'] != objID)
		obj.style.background = "url(images/design/hu/" + objID + "_b.jpg) top left no-repeat;";
}

function menuOff(obj, objID)
{
	var _GET = readGet();
	if (_GET['m'] == 'product')
		_GET['m'] = 'categorylist';
	if (_GET['m'] == 'reductedproduct')
		_GET['m'] = 'reductedlist';
	if (_GET['m'] == 'usedproduct')
		_GET['m'] = 'usedlist';
	if (_GET['m'] == 'specialproduct')
		_GET['m'] = 'speciallist';
	if (_GET['m'] != objID)
		obj.style.background = "url(images/design/hu/" + objID + "_a.jpg) top left no-repeat;";
}

function validateForm(formname)
{
  var valid = true;
  for (var i=0; i < formname.elements.length; i++)
  {
    if (formname.elements[i].id.indexOf("req") > -1)
    {
      if (isElementEmpty(formname.elements[i]))
         valid = false;
    }
  }
  if (!valid)
     alert('A csillaggal jelzett mezők kitöltése kötelező!');
  return valid;
}

function isElementEmpty(elmnt)
{
  with (elmnt)
  {
    if (value=='' || value==null)
       return true;
    else
       return false;
  }
}

function setActiveMenu()
{
	document.getElementById('categorylist').style.width = "114px";
	document.getElementById('reductedlist').style.width = "143px";
	document.getElementById('services').style.width = "139px";
	document.getElementById('speciallist').style.width = "167px";
	document.getElementById('usedlist').style.width = "141px";
	var menupontok = Array('services','categorylist','reductedlist','speciallist','usedlist');
	var _GET = readGet();
	if (_GET['m'] == 'product')
		_GET['m'] = 'categorylist';
	if (_GET['m'] == 'reductedproduct')
		_GET['m'] = 'reductedlist';
	if (_GET['m'] == 'usedproduct')
		_GET['m'] = 'usedlist';
	if (_GET['m'] == 'specialproduct')
		_GET['m'] = 'speciallist';
	for (num in menupontok)
	{
		if (menupontok[num] == _GET['m'])
	  	document.getElementById(_GET['m']).style.background = "url(images/design/hu/" + _GET['m'] + "_b.jpg) top left no-repeat";
	  else  
	  	document.getElementById(menupontok[num]).style.background = "url(images/design/hu/" + menupontok[num] + "_a.jpg) top left no-repeat";
	
	}
}

function readGet()
{
  var _GET    = new Array();
  var uriStr  = window.location.href.replace(/&amp;/g, '&');
  var paraArr, paraSplit;

  if (uriStr.indexOf('?') > -1)
  {
    var uriArr  = uriStr.split('?');
    var paraStr = uriArr[1];
  }
  else
  {
    return _GET;
  }

  if (paraStr.indexOf('&') > -1)
  {
    paraArr = paraStr.split('&');
  }
  else
  {
    paraArr = new Array(paraStr)
  }

  for(var i = 0; i < paraArr.length; i++)
  {
    paraArr[i] = paraArr[i].indexOf('=') > -1
               ? paraArr[i]
               : paraArr[i] + '=';
    paraSplit  = paraArr[i].split('=')
    _GET[paraSplit[0]] = decodeURI(paraSplit[1].replace(/\+/g, ' '));
  }
  return _GET;
}