function digit(e)
	{
	if (document.all)
				{
				var key = e.keyCode;
				var ch = String.fromCharCode(key);
				var obj = e.srcElement;
				}
	else
				{
				var key = e.which;
				var ch = String.fromCharCode(key);
				var obj = e.target;
				}

	
	if(ch == '.' && obj.value.indexOf('.') !=-1 ) return false;
	if(ch.match(/[^0-9\.]{1}/) && key!=8 && key!=0 ) return false;
	
	}

function show_hide(id)
 {
 try{
	 if(gid(id).style.display == 'none')
		 {
		 	gid(id).style.display = '';
		 }
	 else{
	 	gid(id).style.display = 'none';
		 }
 	}
	 catch(e){
	 alert(e.message);
	 }
 }


//POST
  function post(hf,url, parameters) {
      http_request = false;
      if (window.XMLHttpRequest) { // Mozilla, Safari,...
         http_request = new XMLHttpRequest();
         if (http_request.overrideMimeType) {
            http_request.overrideMimeType('text/xml');
         }
      } else if (window.ActiveXObject) { // IE
         try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
         } catch (e) {
            try {
               http_request = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (e) {}
         }
      }
      if (!http_request) {
         alert('Cannot create XMLHTTP instance');
         return false;
      }
      
      http_request.onreadystatechange = eval(hf);
      http_request.open('POST', url, true);
      http_request.setRequestHeader("Accept-Charset", "windows-1251");
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      //http_request.setRequestHeader("Content-Transfer-Encoding","binary");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "keep-alive");
      http_request.send(parameters);
   }


function fake_post(address_target,params)
	{

	var adrt = address_target.split('|');
	var url = adrt[0];
	var target = adrt[1];

	//napravi nova forma 
	var form = document.createElement( "form" );
	form.method = 'POST';
	form.action = url;

	if(target)
		{
		form.target  = target;
		}

	//Zapochi da nabivash vytre inputcheta
	

	var params_array = params.split(',');
	for (i=0;i<params_array.length;i++)
		{
		pma = params_array[i].split('=');
		name = pma[0];
		value = pma[1];

		//JS TRIM :)
		name = name.replace(/^[\s]+/,'');
		value = value.replace(/^[\s]+/,'');

		name = name.replace(/[\s]+$/,'');
		value = value.replace(/[\s]+$/,'');
		
		input_el = document.createElement( "input" );
		input_el.type = 'hidden';
		input_el.name = name;
		input_el.value = value;

		form.appendChild(input_el);
		
		}

	//skrii shibanata forma ot shibani FF
	form.style['display'] = 'none';

	//NAII FORMATA U DOKUMENTO
	document.body.appendChild(form);

	//ARE ZAMINAVAY
	form.submit();
	}


function gid(id)
	{
	return document.getElementById(id);
	}

function clk(id)
	{
	gid('menu_dot'+id).style.background = 'black';
	}

function unclk(id)
	{
	gid('menu_dot'+id).style.background = '#EDC623';
	}



function ipop(url) {
  window.open(url,'ipop','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}



function insert_option()
	{
	var all_options = gid('all_options');
	var options = gid('options');

	if(!(all_options.value>0))
		{
		alert('No option selected');
		}
	
	var found = 0;

	if(options.length>0)
		{
		for(key=0;key<options.length;key++)
			{
			if(options.options[key].value == all_options.value)
				found = 1;
			}
		}



	if(found!=1)
		{
		options.options[options.options.length] = new Option(all_options.options[all_options.selectedIndex].text,all_options.options[all_options.selectedIndex].value);	
		}

	}


function delete_option()
	{
	var options = gid('options');
	if(options.length>0)
		{
		for(key=0;key<options.length;key++)
			{
			if(options.options[key].selected)
				{
				options.options[key] = null;
				}
			}
		}
	}



function select_all(obj)
{	
	for (i=0 ;i < obj.options.length; i++)
	{
	obj.options[i].selected = true;
	}
}






