function Set_Cookie( name, value, expires, path, domain, secure ) 
{
// set time, it's in milliseconds
var today = new Date();
today.setTime( today.getTime() );

/*
if the expires variable is set, make the correct 
expires time, the current script below will set 
it for x number of days, to make it for hours, 
delete * 24, for minutes, delete * 60 * 24
*/
if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}
                       
// this function gets the cookie, if it exists
function Get_Cookie( name ) {
        
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
             



// this deletes the cookie when called
function Delete_Cookie( name, path, domain ) {
if ( Get_Cookie( name ) ) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}










function povijest()
{
history.go(eval(0-Get_Cookie('test')));
}








function showhide(element_id){
	if(document.getElementById(element_id).style.display != 'block')
		document.getElementById(element_id).style.display = 'block';
	else
		document.getElementById(element_id).style.display = 'none';

}


function getElement(e,f){
    if(document.layers){
        f=(f)?f:self;
        if(f.document.layers[e]) {
            return f.document.layers[e];
        }
        for(W=0;i<f.document.layers.length;W++) {
            return(getElement(e,fdocument.layers[W]));
        }
    }
    if(document.all) {
        return document.all[e];
    }
    return document.getElementById(e);
}


// A simple function to write a value to a cookie. The hours parameter is optional; if hours is left out, the cookie value expires at the end of the visitor's browser session.
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
    expire = new Date((new Date()).getTime() + hours * 3600000);
    expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}

// A function that returns the value of a cookie given the cookie name.
// Example:
// alert( readCookie("myCookie") );
function readCookie(name)
{
  var cookieValue = "";
  var search = name + "=";
  if(document.cookie.length > 0)
  { 
    offset = document.cookie.indexOf(search);
    if (offset != -1)
    { 
      offset += search.length;
      end = document.cookie.indexOf(";", offset);
      if (end == -1) end = document.cookie.length;
      cookieValue = unescape(document.cookie.substring(offset, end))
    }
  }
  return cookieValue; 
}



function cross_frame_values(frame_name,variable_id,variable_value) {

	eval("var frame = top." + frame_name + ".document");
	frame.getElementById(variable_id).value = variable_value;
}


function status_line_msg(messagge) {
	cross_frame_values('frame_top','header_form',messagge);
		
}

function yes_no(ConfirmMessage) {
	if (confirm(ConfirmMessage)) {
		return true;
	}
	else {
		return false;
	}   
}


 function disableEnterKey(e)
 {
      var key; 
     if(window.event)
           key = window.event.keyCode;     //IE
      else
           key = e.which;     //firefox
     if(key == 13)
           return false;
      else
           return true;
 }
