// funkcija otvara nov prozor 
function check_delete(mess){
  return confirm(mess);
}
function bookmark(url, description)
{
    if (navigator.appName=='Microsoft Internet Explorer')
      {
	window.external.AddFavorite(url, description);
      }
    else if (navigator.appName=='Netscape')
      {
	alert(netscape_users_click);
      }
}

/* pokupio sam kao pomoc na ES-u */
/* valjda ce pomoci */
function reloadIfPopupClosed ()
{
   // _reloadIfPopupClosed ();
  //  alert('reload');
  //  var a=3+3;
  setTimeout ('_reloadIfPopupClosed ()',1000);
}
function _reloadIfPopupClosed ()
{
  //  alert('reload');
  //  try{
  //  windowReference=second;
    if (windowReference == 'undefined' ||
	typeof (windowReference.document) == 'unknown' || 
	windowReference.document == null ||
	windowReference==null)

    {
      window.location.reload();
      //alert('reload');
    }

}



function set_my_cookie(key,value){
  setCookie(key,value,"Thu, 28-May-20 20:20:20 GMT","/");
}

function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + value +
        ((expires) ? "; expires=" + expires : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

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 ) );
}


function set_language(value){
  set_my_cookie('language',value);
  window.location.reload();
}
function set_currency(value){
  set_my_cookie('currency',value);
  window.location.reload();
}




function mail(to,subject){
  new_win=window.open("mail.php?to="+to+"&s="+subject,"","scrollbars=yes,toolbars=no,statusbar=no,locationbar=no"+
	      "width=775,height=490,top=0,left=0");
  new_win.focus();
}



function details(id){
  windowReference = 
    window.open("details.php?id="+id,"second",
"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width=775,height=490");
  if (!windowReference.opener)
    windowReference.opener = self;
  windowReference.focus();
}

function gift_detail(id,alone){
  windowReference = 
    window.open("giftdetail.php?id="+id+"&alone="+alone,"second",
"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width=775,height=490");
		
  if (!windowReference.opener)
    windowReference.opener = self;
  windowReference.focus();
}
function gift_page(){
  windowReference = 
    window.open("gift.php?alone=1","second",
		"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width=775,height=490");

  if (!windowReference.opener)
    windowReference.opener = self;
  windowReference.focus();
}

function cart(){
  windowReference = 
    window.open("cart.php","second",
		"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width=775,height=490");
  if (!windowReference.opener)
    windowReference.opener = self;
  windowReference.focus();
}




function payment_instructions(){
	 windowReference = 
    window.open("instructions.php","",
"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width=775,height=490");
}

function changeStyle(obj, new_style) {
	obj.className = new_style;
}
function toggle(id, show) {
	if(show != undefined){
		document.getElementById(id).style.display=show;
		return;
	}
	if ( document.getElementById(id).style.display=="none" )
		document.getElementById(id).style.display="";
	else
		document.getElementById(id).style.display="none";
}


/**/
function prazanProzor(page,w,h){
window.open(page,"",
		"resizable=yes,scrollbars=yes,toolbar=no,status=yes,"+
"top=0,left=0,"+
"location=no,width="+w+",height="+h);

}

function checkPhoto(){
	var f=document.forms.setForm;
	var me=f.elements['medium_id'];
	var ma=f.elements['material_id'];
	//	var tm=document.getElementById('t_material');
	ma.disabled=false;
	if(me.options[me.selectedIndex].value==53){
		for(i in ma.options){
			if(ma.options[i].value==2){
				ma.options[i].selected=true;
				toggle('t_material','none');
				//ma.disabled=true;
				return;
			}
		}
	}
	else{
		toggle('t_material','');
	}
}
