// 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("http://www.serbianaart.rs/sr/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("http://www.serbianaart.rs/sr/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("http://www.serbianaart.rs/sr/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("http://www.serbianaart.rs/sr/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("http://www.serbianaart.rs/sr/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("http://www.serbianaart.rs/sr/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 popup(page,w,h){
window.open(page,"",
		"resizable=no,scrollbars=yes,toolbar=yes,status=yes,"+
"top=0,left=0,"+
"location=yes,width="+w+",height="+h);
}

function PopWin(url,name,options){
  var ContextWindow = window.open(url,name,options);
  ContextWindow.focus();
  return false;
}

function NewPopup(url,windowname,w,h,x,y){
  var ContextWindow = window.open(url,windowname,"resizable=no,toolbar=no,scrollbars=no,menubar=no,status=no,directories=no,width="+w+",height="+h+",left="+x+",top="+y+"");
  ContextWindow.focus();
}

var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail(e){

var returnval=emailfilter.test(e.value)
if (returnval==false){
  // alert('forms_valid_email_address')
  alert('ERROR - Greska')
e.select()
}
return returnval
}


<!--
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;
}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20
}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=yes,menubar=no,toolbar=yes,resizable=no';
win=window.open(mypage,myname,settings);
}
// -->


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','');
	}
}
