
function top() {
  window.scrollTo(0, 0);
}

function back() {
  history.back();
}

function fillBasket() {
  document.form_narudzba.submit();
}

function deleteItemBasket( nVar ) {
  document.form_narudzba.del.value = nVar;
  document.form_narudzba.submit();
}

function submitSearch() {
  if ( document.search_main.search_field.value == '' ) {
    alert( 'Upišite traženi pojam!' );
  }
  else {
    if ( document.search_main.search_field.value.length < 3 ) {
      alert( 'Traženi pojam mora sadržavati barem tri znaka.!' );
    }
    else {
      document.search_main.submit();
    }    
  }
}


function checkFormPonuda() {
  fali = "";
  document.form_ponuda.ime.style.borderColor = document.form_ponuda.tvrtka.style.borderColor = document.form_ponuda.adresa.style.borderColor = document.form_ponuda.mjesto.style.borderColor = document.form_ponuda.telefon.style.borderColor = document.form_ponuda.tvrtka_broj.style.borderColor = '#666666';
  if ((document.form_ponuda.ime.value == "")&&(document.form_ponuda.tvrtka.value == "")) { fali = fali + "\n- Ime i prezime ili naziv tvrtke"; document.form_ponuda.ime.style.borderColor = '#F39500';  document.form_ponuda.tvrtka.style.borderColor = '#F39500';}
  if ((document.form_ponuda.tvrtka.value != "")&&(document.form_ponuda.tvrtka_broj.value == "")) { fali = fali + "\n- Matični broj tvrtke"; document.form_ponuda.tvrtka_broj.style.borderColor = '#F39500';}
  if (document.form_ponuda.adresa.value == "") { fali = fali + "\n- Adresu"; document.form_ponuda.adresa.style.borderColor = '#F39500';}
  if (document.form_ponuda.mjesto.value == "") { fali = fali + "\n- Mjesto"; document.form_ponuda.mjesto.style.borderColor = '#F39500';}
  if (document.form_ponuda.telefon.value == "") { fali = fali + "\n- Broj telefona"; document.form_ponuda.telefon.style.borderColor = '#F39500';}
  if (document.form_ponuda.mail.value == "") { fali = fali + "\n- E-mail adresu"; document.form_ponuda.mail.style.borderColor = '#F39500';}
  
  if (fali != "")
    alert("Niste upisali sve potrebne podatke!" + "\n\n" + "Molimo upišite:" + fali)
  else
    document.form_ponuda.submit();
}


function printPonuda() {
  eval("var f=window.open('ponuda_print.asp','New','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=650 ,height=450');f.focus();");
}

function namjestiDiv() {
  /*if( document.obrazac.payment_method.value == 5 ) { document.getElementById( 'card_data' ).style.display = 'block'; }
  else { document.getElementById( 'card_data' ).style.display = 'none'; }*/
}

function openCard() {
  /*if( document.form_ponuda.placanje.value == 'American Express Card' ) { document.getElementById( 'card_data' ).style.display = 'block'; }
  else { document.getElementById( 'card_data' ).style.display = 'none'; }*/
}

function checkFormPretplata(){
  var fali = '';
  if( document.obrazac.subscription_type.value == '' ) fali = fali + "\n- vrstu pretplate";
  if( document.obrazac.name.value == '' ) fali = fali + "\n- ime i prezime";
  if( document.obrazac.address.value == '' ) fali = fali + "\n- adresu";
  if( document.obrazac.city.value == '' ) fali = fali + "\n- pošt. br. i grad";
  if( (document.obrazac.telephone.value == '') && ((document.obrazac.email.value == "") || (document.obrazac.email.value == "@")) ) fali += "\n- broj telefona ili e-mail";
  if( fali != '' ) fali = "\nMolimo Vas, upišite:" + fali;
  if( fali != '' ) { alert( 'Niste upisali sve potrebne podatke!' + fali ); } 
  else { document.obrazac.submit(); }
}

function checkFormPretplataEng(){
  var fali = '';
  if( document.obrazac.subscription_type.value == '' ) fali = fali + "\n- subscription type";
  if( document.obrazac.name.value == '' ) fali = fali + "\n- name";
  if( document.obrazac.address.value == '' ) fali = fali + "\n- address";
  if( document.obrazac.city.value == '' ) fali = fali + "\n- city, country";
  if( (document.obrazac.telephone.value == '') && ((document.obrazac.email.value == "") || (document.obrazac.email.value == "@")) ) fali += "\n- telephone or e-mail";
  if( fali != '' ) fali = "\n\nPlease fill-in:" + fali;
  if( fali != '' ) { alert( 'You didn\'t enter all the necessary data!' + fali ); } 
  else { document.obrazac.submit(); }
}

function checkFormKontakt(){
	fali = "";
	document.obrazac.ime.style.borderColor = document.obrazac.email.style.borderColor = document.obrazac.poruka.style.borderColor = '#666666';
	if (document.obrazac.ime.value == "") { fali = fali + "\n- Ime"; document.obrazac.ime.style.borderColor = '#F39500';}
	if (document.obrazac.email.value == "") { fali = fali + "\n- E-mail adresu"; document.obrazac.email.style.borderColor = '#F39500';}
	if (document.obrazac.poruka.value == "") { fali = fali + "\n- Poruku"; document.obrazac.poruka.style.borderColor = '#F39500';}
	if (fali != "")
	   alert("Niste upisali sve potrebne podatke!" + "\n\n" + "Molimo upišite:" + fali)
	else
	 document.obrazac.submit();
}


function openImg( sVar, nWidth, nHeight )
{
  eval("var f=window.open('slika.asp?id=" + sVar + "','gallery','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="+ nWidth +" ,height="+ nHeight +"');f.focus();");
}

function openGal( sVar )
{
  eval("var f=window.open('galleryPic.asp?id=" + sVar + "','gallery','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500 ,height=400');f.focus();");
}

function openGalleryImg ( nID ) {
  eval("var f=window.open('gallPic.asp?id=" + nID + "','gallery','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width=500 ,height=400');f.focus();");
}


if (!document.all && document.getElementById) document.all = document.getElementById;

function sl(layername) { // show layer 
  if (document.all) document.all(layername).style.display = "block";
}

function hl(layername) { // hide layer
  if (document.all) document.all(layername).style.display = "none";
}


function switchBanners(_param){
  var trenutnaStolica=_param;
  if (trenutnaStolica == 1) {
    hl("banner02");
    sl("banner01");
    s = 2;
  } else {
    hl("banner01");
    sl("banner02");
    s = 1;
  }
  setTimeout("switchBanners("+ s +")",6000);
}


function getEl(sId) {
  return (document.all? document.all(sId): (document.getElementById? document.getElementById(sId): null));
};



function prilagodi() {
  nContentWidth    = getEl('contentPic').clientWidth;
  nContentHeight   = getEl('contentPic').clientHeight;
  if ( navigator.appName == 'Netscape' ) {
   	self.resizeTo( nContentWidth+8, nContentHeight+45 );
  }
  else {
   	self.resizeTo( nContentWidth+8, nContentHeight+28 );
  }
}