function getObj(id)
{
	var obj = document.getElementById(id);
	if (obj)return obj;
}
	
function show_obj(obj)
{
	getObj(obj).style.display = 'block';
}

function hide_obj(obj)
{
	getObj(obj).style.display = 'none';
}

function getselected(obj)
{
	return obj.options[obj.selectedIndex].value;
}

function clearForm(form, sel) {
	$('#'+form+' :input').each(function() {
		var type = this.type;
		var tag = this.tagName.toLowerCase(); // normalize case
		if (type == 'text' || type == 'password' || tag == 'textarea' || type == 'file')
			this.value = "";
		else if (type == 'checkbox' || type == 'radio')
			this.checked = false;
		else if (tag == 'select' && !sel)
			this.selectedIndex = 0;
	});
};

function discardElement(element) 
	{
    var garbageBin = document.getElementById('IELeakGarbageBin');
    if (!garbageBin) 
		{
        garbageBin = document.createElement('DIV');
        garbageBin.id = 'IELeakGarbageBin';
        garbageBin.style.display = 'none';
        document.body.appendChild(garbageBin);
	    }

    garbageBin.appendChild(element);
    garbageBin.innerHTML = '';
	document.body.removeChild(garbageBin);
	}

function clearFileInputField(Id) {
  document.getElementById(Id).innerHTML = document.getElementById(Id).innerHTML;
}

function show_w(id, middle)
{
	$("#hover").show();
	var block = $("#" + id);
	block.show();
	if(!middle)
	{
		var height = $(document).height() / 2 - block.height() / 2;
		block.css({'top': height, 'position': 'relative'});
	}
}

function close_w(id)
{
	$("#" + id).hide();
	$('#big_img').attr('src','/DESIGN/SITE/images/35.gif');
	$("#hover").hide();
}

function setCookie (name, value, expires, path, domain, secure) {  
       document.cookie = name + "=" + escape(value) +  
         ((expires) ? "; expires=" + expires : "") +  
         ((path) ? "; path=" + path : "") +  
         ((domain) ? "; domain=" + domain : "") +  
         ((secure) ? "; secure" : "");  
 }

function select_onpage(num, path)
	{
	var today = new Date(); 
	var expires = 180 * 1000 * 60 * 60 * 24; 
	var expires_date = new Date( today.getTime() + (expires) ); 
	var a = expires_date.toGMTString();
	setCookie('onpage',num,a,path);	
	window.location = path;//location.reload('path');
	}

function close_timer(id, sec, clear)
{
	if(sec == 0) { if(clear) clear_pu_form(id); close_w(id); clearTimeout(timer); }
	else { var timer = setTimeout("close_timer('"+id+"', "+ (sec - 1) +", "+clear+")",1000); }
}

function clear_pu_form(form)
{
	$('#'+form+'_ok').hide(); $('#'+form+'_content').show(); clearForm(form+'_form', true);
}

function setsplav(id, val)
{
	$('#splav'+id).attr('value', val);
	$('#splavs'+id+' a').removeClass('ssel');
}

DD_roundies.addRule('.banner', 5, true);

$(document).ready(
	function()
	{
	$('.diam').keypress(
		function (event) {
    		if(( event.which > 47 && event.which < 58 ) || event.which == 8) return true;
			else return false;
	  });
	}
);
