function changeClass(obj, new_class)
{
    obj.className = new_class;
}

function changeBgColor(obj, new_color)
{
	obj.style.backgroundColor=new_color;
}

function changePic(name, pic)
{
	name.src = pic;
}

function popup(url, name, width, height)
{
	left_pos = (screen.width / 2) - (width / 2);
	top_pos = (screen.height / 2) - (height / 2);
	window.open(url, name, 'width=' + width + ',height=' + height + ',left=' + left_pos + ',top=' + top_pos);	
}

function popup (url)
{
	var sizeX=520;
	var sizeY=540;
	window.open(url, 'NovoOkno', 'resizable=yes,scrollbars=no, width='+sizeX+', height='+sizeY+', screenX=0, screenY=0, top=0, left=0');
	return false;
}

function resizeHeight()
{
	var footer = document.getElementById('footer');
	footer.style.marginTop = (document.body.clientHeight - document.getElementById('img_postaja').offsetTop + 12) + 'px';
}

function SearchBox()
{
	var input = $('search_form_string');
	if (input) {
		if (input.value == '') {
			input.value = input.title;
		}
		input.observe('focus', function(event) {
			if (input.value == input.title) {
				input.value = '';
			}
		});
		input.observe('blur', function(event) {
			if (input.value == '') {
				input.value = input.title;
			}
		});
		var form = input.up('form');
		form.observe('submit', function(event) {
			if (input.value == input.title) {
				input.value = '';
			}
		});
	}
}
Event.observe(document, 'dom:loaded', SearchBox);

function ExternalLinks()
{
	$$('a[rel="external"]').each(function(link) {
		link.observe('click', function(event) {
			event.stop();
			open(this.href);
		});
	});
}
Event.observe(document, 'dom:loaded', ExternalLinks);

function ApplyPNGHacks()
{
	$$('.png').each(function(item) {
		item.pngHack();
	})
}
Event.observe(document, 'dom:loaded', ApplyPNGHacks);

function ChangeImgWithFlash()
{
	$$('img[src$=".swf"]').each(function(item) {
		var p = item.up('p');
		var a = item.up('a');
		if (p && a) {
			var id = 'swf_'+ Math.ceil(100*Math.random());
			p.id = id;
			var size = item.getAttribute('alt').split('|');
			var fo = new FlashObject(item.src, id, size[0], size[1], "8", "#ffffff");
			fo.addParam("wmode", "transparent");
			fo.addVariable("clickTAG", a.href);
			fo.addVariable("target", "_self");
			fo.write(id);
		}
	})
}
Event.observe(document, 'dom:loaded', ChangeImgWithFlash);