function createNamedElement(type, name) {
	var element = null;
	try {
		element = document.createElement('<'+type+' name="'+name+'">');
	} catch (e) {
	}
	if (!element || element.nodeName != type.toUpperCase()) {
		element = document.createElement(type);
		element.name = name;
	}
	return element;
}

function createIdElement(type, name) {
	var element = null;
	try {
		element = document.createElement('<'+type+' id="'+name+'">');
	} catch (e) {
	}
	if (!element || element.nodeName != type.toUpperCase()) {
		element = document.createElement(type);
		element.id = name;
	}
	return element;
}


   
try {
  document.execCommand('BackgroundImageCache', false, true);
} catch(e) {}
	
function event_date_togle() {
	$('').toggle();
}


function wo_str(url) {
	window.open(url,'str','width=490,height=400,scrollbars=yes,resizable=yes'); 
	return false;
}

function clanak_popup(url) {
	window.open(url,'clanak_popup','menubar=yes, scrollbars=yes, resizable=yes');
}

function fix_flash() {
	theObjects = document.getElementsByTagName("object");
	for (var i = 0; i < theObjects.length; i++) {
		theObjects[i].outerHTML = theObjects[i].outerHTML;
	}
}

var alreadyrunflag=0 

if (document.addEventListener)
  document.addEventListener("DOMContentLoaded", function(){alreadyrunflag=1; fix_flash()}, false)
else if (document.all && !window.opera){
  document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>')
  var contentloadtag=document.getElementById("contentloadtag")
  contentloadtag.onreadystatechange=function(){
    if (this.readyState=="complete"){
      alreadyrunflag=1
      fix_flash()
    }
  }
}


function ajax_delete(x,delete_id) {
	
	$.get('/ajax.php', {ajax:x+'-delete',id:delete_id},
		function (data) {
			
			if (data==1)  {
				$('#'+x+'-x-'+delete_id+'').fadeTo('slow',0);
				$('#'+x+'-x-'+delete_id+'').queue(function () {
					$(this).hide();
					$(this).dequeue( )
				})

			} else if (data==-1)  {
				alert('Nemate dozvolu za ovu akciju!');
			} else {
				alert('Došlo je do pogreške!');
			}
		}

	);
}
function feed_show(id) {
	
	h1=$('#index-feed').height();
	$('#index-feed').empty().height(h1).addClass('index-mediji-loading');
	
	$.get('/ajax.php?ajax=feed-load&id='+id,
		function (data) {
			$('#index-feed').html(data).removeClass('index-mediji-loading').height('auto');
			h2=$('#index-feed').height();
			$('#index-feed').height(h1).animate({height:h2},1000);
		}
	);
	
	
}


window.onload=function(){
  setTimeout("if (!alreadyrunflag) fix_flash()", 0)
}