function bookmark(url,title)
{
  if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4))
  {
  window.external.AddFavorite(url,title);
  } 
  else if (navigator.appName == "Netscape")
  {
    window.sidebar.addPanel(title,url,"");
  } 
  else 
  {
    alert("Pritisnite CTRL-D (Netscape) ili CTRL-T (Opera) da bi zapamtili stranicu");
  }
}


function newWindow(newContent)
  {
winContent = window.open(newContent, 'korpa', 'right=0,top=20,width=520,height=500,toolbar=0,scrollbars=yes,resizable=0')

winContent.focus()
  }

    function prikazi_veliku_sliku(imageName,imageWidth,imageHeight,alt,posLeft,posTop) {  // v4.01
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\" title=\"'+alt+'\" />');  newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}



function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



  function ValidacijaForme() {
    var pass=true;
    for (i=0;i<document.forms.registracija.length;i++) {
      var tempobj=document.forms.registracija.elements[i];
      if ((tempobj.type=='text') && (tempobj.value=='')) {
        pass=false;
        break;
      }
    }
    if (!pass) {
      alert("Niste uneli sva obavezna polja!");
      document.forms.registracija.elements[i].focus();
    } else { document.forms.registracija.submit(); }
  } 

  
    
   function Validacija_Logovanje() 
 {
    var forma = document.forms.login;
    
    if (forma.reg_broj.value == '' || forma.lozinka.value == '') 
    {
      pass = false; 
      alert('Niste uneli potrebna polja!'); 
      forma.reg_broj.focus();     
      return false;
    }
               
     return true;    
  }  
  
  
     
   function Validacija_Newsletter() 
 {
    var pass = true;
    var forma = document.forms.newsletter;
    
    if (forma.email.value == '' || forma.kod.value == '' || forma.operacija.value == '') 
    {
      pass = false; 
      alert('Niste ispunili sva obavezna polja!'); 
      forma.email.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  

   function Validacija_Lozinka() 
 {
    var pass = true;
    var forma = document.forms.lozinka;
    
    if (forma.email.value == '' || forma.kod.value == '' || forma.reg_broj.value == '') 
    {
      pass = false; 
      alert('Niste ispunili obavezna polja!'); 
      forma.reg_broj.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  
  
   function ValidacijaFormeKontakt() 
 {
    var pass = true;
    var forma = document.forms.kontakt;
    
    if (forma.ime.value == '' || forma.prezime.value == '' || forma.email.value == '' || forma.mesto.value == '' || forma.pismo.value == '' || forma.kod.value == '' )  
    {
      pass = false; 
      alert('Niste uneli potrebna polja!'); 
      forma.kontakt.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  
     function ValidacijaFormeRadeci() 
 {
    var pass = true;
    var forma = document.forms.Radeci;
    
    if (forma.ime.value == '' || forma.prezime.value == '' || forma.mjesto.value == '' || forma.email.value == '' || forma.telefon.value == '' || forma.kod.value == '' )  
    {
      pass = false; 
      alert('Niste uneli potrebna polja!'); 
      forma.Radeci.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  
   function ValidacijaFormeRegistra() 
 {
    var pass = true;
    var forma = document.forms.Registra;
    
    if (forma.clanska.value == '' || forma.clanska.value == '' || forma.ime.value == '' || forma.prezime.value == '' || forma.email.value == '' || forma.ulica.value == '' || forma.broj.value == '' || forma.mjesto.value == '' || forma.posta.value == '' || forma.drzava.value == '' || forma.telefon.value == '' )  
    {
      pass = false; 
      alert('Niste uneli potrebna polja!'); 
      forma.Registra.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  
     function ValidacijaFormeInfo() 
 {
    var pass = true;
    var forma = document.forms.info;
    
    if (forma.ime.value == '' || forma.prezime.value == '' || forma.town.value == '' || forma.email.value == '' || forma.tel.value == '' || forma.kod.value == '' )  
    {
      pass = false; 
      alert('Niste uneli potrebna polja!'); 
      forma.info.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
  
  function ValidacijaObrazac() 
 {
    var pass = true;
    var forma = document.forms.obrazac;
    
    if (forma.ulica.value == '' || forma.broj.value == '' || forma.ptt.value == '' || forma.mesto.value == '') 
    {
      pass = false; 
      alert('Niste ispunili obavezna polja!'); 
      forma.ulica.focus();     
    }
               
    if (pass == true) 
    forma.submit(); 
    
  }  
   
function setAsHome(myLink)
{
	
        if(navigator.appName.indexOf('Microsoft')!=-1)
        {
               // IE
               myLink.style.behavior='url(#default#homepage)';
               myLink.setHomePage("http://www.fmgroup.ba");
        }
        else if(navigator.appName.indexOf('Netscape')!=-1)
        {
               // Netscape / firefox browsers
               var msg = "Samo prevucite link ka 'home' ";
               msg += "tasteru da bi ste podesili ovaj sajt ";
               msg += "kao defaultni homepage!";
               alert(msg);
        }
        else if(navigator.appName.indexOf('Opera')!=-1)
        {
               // Opera
               var msg = "Izaberite opciju Tools - Preferences ";
               msg += "- General i kliknite na  'Use current' ";
               msg += "da bi ste podesili ovaj sajt kao homepage! ";
               alert(msg);
        }
        else
        {
               // Other browsers
               var msg = "Izvinite, Vas browser ne dozvoljava ";
               msg += "skriptu da postavi nas sajt za homepage. ";
               msg += "Koristite 'options' dialog ";
               msg += "u Vasem browseru da uradite to! Hvala na strpljenju!. ";
               alert(msg);
        }
}


  function Validacija_Korpa_Dodaj() 
 {    
    var forma = document.forms.dodaj_proizvod;
    
   if(forma.kolicina.value == '') 
   { 
      alert('Niste uneli kolicinu!') 
      forma.kolicina.focus(); 
      return false; 
   } 
 
 
   if (!IsNumeric(forma.kolicina.value)) 
   { 
      alert('Niste uneli ispravan broj!') 
      forma.kolicina.focus(); 
      return false; 
   }     

   return true; 
    
  }  

  
  function Validacija_Korpa_Osvezi() 
 {    
 	
    var pass = true;
    
 	var forma = document.forms.osvezi_korpu;
     
    for (var i=0;i<forma.length;i++) 
    {
    	var tempobj=forma.elements[i];
         
 		if ((tempobj.type=='text') && (!IsNumeric(tempobj.value))) 
        {
        	alert('Niste uneli ispravan broj!') 
        	forma.elements[i].focus(); 
        	pass=false;        	
        	break;
        }               
    }
    
   return pass; 
    
  }  

   
  
  
  
  
  function Validacija_Eula() 
 {    
    var forma = document.forms.eula;

    if(forma.eula.checked==false) 
    {
    	alert('Morate potvrditi da prihvatate sporazum o licenci!')         	
    	return false; 
    }
    
   return true; 
    
  }  
  
  

  function Validacija_Korpa_Osvezi_Staro() 
 {
    var pass = true;
    
     for (i=0;i<document.forms.osvezi_korpu.length;i++) 
     {
      var tempobj=document.forms.osvezi_korpu.elements[i];
      if ((tempobj.type=='text') && (IsNumeric(tempobj.value)== false))
      {
        pass=false;
        break;
      }
     } 
               
    if (pass == true) 
    document.forms.osvezi_korpu.submit();     
    else
    {
      alert('Niste uneli ispravnu vrednost!'); 
      document.forms.osvezi_korpu.elements[0].focus();     
    }
 }      
 
 function IsNumeric(strString)
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;


   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   
   
   }