	// D FRAMEWORK by Luka Uzel 1.2008
	// 
	// JavaScript funkcije korisne za rad
	//
	// ova datoteka sastavni je dio d_core.php


	function d_basename(path) {
		return path.replace(/\\/g,'/').replace( /.*\//, '' );
	}
 
	function d_dirname(path) {
		return path.replace(/\\/g,'/').replace(/\/[^\/]*$/, '');;
	}


  // citaj cookie vrijednost
  function d_getCookie(c_name)
  {
	if (document.cookie.length>0)
	{
	c_start=document.cookie.indexOf(c_name + "=");
	  if (c_start!=-1)
	  { 
	  c_start=c_start + c_name.length+1; 
	  c_end=document.cookie.indexOf(";",c_start);
	  if (c_end==-1) c_end=document.cookie.length;
	  return unescape(document.cookie.substring(c_start,c_end));
	  } 
	}
  return "";
  }
  
  
  // postavi cookie vrijednost
  function d_setCookie(c_name,value,expiredays)
  {
  var exdate=new Date();
  exdate.setDate(exdate.getDate()+expiredays);
  document.cookie=c_name+ "=" +escape(value)+
  ((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
  }
  
  
  // confirm box
  function d_confirm(txt)
  {
  var r=confirm(txt);
	if (r==false)
	{
	history.back();
	}
  }
  
  // alert box
  function d_alert(txt)
  {
  alert(txt);
  }
  
  // ukljuci JS datoteku u head
  function d_loadJS(url)
  {
  var headID = document.getElementsByTagName("head")[0];
  var newScript = document.createElement('script');
  newScript.type = 'text/javascript';
  newScript.src = url;
  headID.appendChild(newScript);
  }
  
  // ukljuci CSS u head
  function d_loadCSS(url)
  {
  var headID = document.getElementsByTagName("head")[0]; 
  var newScript = document.createElement('link');
  newScript.type = 'text/css';
  newScript.rel = "stylesheet";
  newScript.href = url;
  headID.appendChild(newScript);
  }
  
  var d_URL = d_dirname(document.URL,'');

