function openAWindow( pageToLoad, winName, width, height, center)
{	 
    xposition=0; yposition=0;
    if ((parseInt(navigator.appVersion) >= 4 ) && (center)){
        xposition = (screen.width - width) / 2;
        yposition = (screen.height - height) / 2;
    }
    args = "width=" + width + "," 
    + "height=" + height + "," 
    + "location=0," 
    + "menubar=0,"
    + "resizable=1,"
    + "scrollbars=1,"
    + "status=0," 
    + "titlebar=0,"
    + "toolbar=0,"
    + "hotkeys=0,"
    + "title=dfsd,"
    + "screenx=" + xposition + ","  //NN Only
    + "screeny=" + yposition + ","  //NN Only
    + "left=" + xposition + ","     //IE Only
    + "top=" + yposition;           //IE Only
    window.open( pageToLoad,winName,args );
}

function changeCaptcha()
{
ran = Math.floor(Math.random()*10000);
document.getElementById('captcha').src = 'captcha.php?rand='+ran;
}

function klik_showhide(t)
{
var t=document.getElementById(t);
if (t.style.display=="none") t.style.display="block"; else t.style.display="none";
}

function klik_poizvedba_oglas()
{
b=document.form_poizvedba.uporabnik.value!='';
if (b==false)
{
window.alert('Vnesite priimek in ime.');
return false;
}
b=document.form_poizvedba.naslov.value!='';
if (b==false)
{
window.alert('Vnesite naslov.');
return false;
}
b=document.form_poizvedba.kraj.value!='';
if (b==false)
{
window.alert('Vnesite poštno št. in kraj.');
return false;
}
b=document.form_poizvedba.telefon.value!='';
if (b==false)
{
window.alert('Vnesite telefon.');
return false;
}

b=document.form_poizvedba.email.value!='';
if (b==false)
{
window.alert('Vnesite e-poštni naslov.');
return false;
}
b=document.getElementById('sporocilo').value!='';
if (b==false)
{
window.alert('Vnesite sporočilo.');
return false;
}

document.form_poizvedba.submit();
}

function klik_zloraba_oglas()
{
b=document.form_zloraba.uporabnik.value!='';
if (b==false)
{
window.alert('Vnesite priimek in ime.');
return false;
}
b=document.form_zloraba.telefon.value!='';
if (b==false)
{
window.alert('Vnesite telefon.');
return false;
}

b=document.form_zloraba.email.value!='';
if (b==false)
{
window.alert('Vnesite e-poštni naslov.');
return false;
}

b=document.getElementById('sporocilo').value!='';
if (b==false)
{
window.alert('Vnesite svoje razloge.');
return false;
}

document.form_zloraba.submit();
}

function klik_narocilnica()
{
b=document.form_narocilnica.ime.value!='';
if (b==false)
{
window.alert('Vnesite ime in priimek.');
return false;
}
b=document.form_narocilnica.ulica.value!='';
if (b==false)
{
window.alert('Vnesite ulico in hišno št.');
return false;
}
b=document.form_narocilnica.kraj.value!='';
if (b==false)
{
window.alert('Vnesite poštno št. in kraj.');
return false;
}
b=document.form_narocilnica.telefon.value!='';
if (b==false)
{
window.alert('Vnesite telefon.');
return false;
}

document.form_narocilnica.submit();
}

function klik_narocilnica1()
{
b=document.form_narocilnica.naziv.value!='';
if (b==false)
{
window.alert('Vnesite naziv podjetja.');
return false;
}
b=document.form_narocilnica.kontakt.value!='';
if (b==false)
{
window.alert('Vnesite kontaktno osebo.');
return false;
}
b=document.form_narocilnica.naslov.value!='';
if (b==false)
{
window.alert('Vnesite naslov.');
return false;
}
b=document.form_narocilnica.kraj.value!='';
if (b==false)
{
window.alert('Vnesite poštno št. in kraj.');
return false;
}

b=document.form_narocilnica.davcna.value!='';
if (b==false)
{
window.alert('Vnesite davčno številko.');
return false;
}

b=document.form_narocilnica.telefon.value!='';
if (b==false)
{
window.alert('Vnesite telefon.');
return false;
}

b=document.form_narocilnica.code.value!='';
if (b==false)
{
window.alert('Vnesite verifikacijsko kodo.');
return false;
}

document.form_narocilnica.submit();
}

function klik_comments()
{
b=document.form_comments.ime.value!='';
if (b==false)
{
window.alert('Vnesite vaše ime in priimek.');
return false;
}
b=(document.form_comments.email.value!='');
if (b==false)
{
window.alert('Vnesite vaš e-poštni naslov.');
return false;
}
b=(document.form_comments.tekst.value!='');
if (b==false)
{
window.alert('Vnesite vaše sporočilo.');
return false;
}
document.form_comments.submit();
}

function klik_geslo()
{
b=document.form_geslo.email.value!='';
if (b==false)
{
window.alert('Vnesite vaš E-mail naslov.');
return false;
}
document.form_geslo.submit();
}

function klik_oglas()
{
b=document.form_oglas.tekst.value!='';
if (b==false)
{
window.alert('Vnesite tekst oglasa.');
return false;
}
document.form_oglas.submit();
}

function izbrisi_oglas(link)
{
if (confirm("Ali res želite izbrisati izbrani oglas?")) document.location.href=link;
}

function klik_navodila()
{
if (t_navodila.style.display=="none")
{t_navodila.style.display="block";} else
{t_navodila.style.display="none";}
}

function meni(komentar)
{
document.meni_komentar.value=komentar;
}

function preracunaj_objava()
{
skupaj=0;
var f=document.form_artikli;

if (f.oglas_tisk.checked)
{
skupaj+=parseFloat(f.oglas_tisk.value);
if (f.oglas_tisk_znak.checked) skupaj+=parseFloat(f.oglas_tisk_znak.value)*parseFloat(f.oglas_tisk_znak_kolicina.value);
}
/*
if (f.oglas_tisk_50.checked) skupaj+=parseFloat(f.oglas_tisk_50.value);
if (f.oglas_tisk_100.checked) skupaj+=parseFloat(f.oglas_tisk_100.value);
if (f.oglas_tisk_150.checked) skupaj+=parseFloat(f.oglas_tisk_150.value);
if (f.oglas_tisk_200.checked) skupaj+=parseFloat(f.oglas_tisk_200.value);
if (f.oglas_tisk_250.checked) skupaj+=parseFloat(f.oglas_tisk_250.value);
                                               */
if (f.oglas_poudarjen.checked) skupaj+=parseFloat(f.oglas_poudarjen.value);
if (f.oglas_okvirjen.checked) skupaj+=parseFloat(f.oglas_okvirjen.value);
if (f.oglas_vrocoglas.checked) skupaj+=parseFloat(f.oglas_vrocoglas.value);
if (f.oglas_vrhrubrike.checked) skupaj+=parseFloat(f.oglas_vrhrubrike.value);

var eur = new NumberFormat(skupaj);
eur.setPlaces(2);
eur.setSeparators(true,".",",");
f.objava_skupaj.value=eur.toFormatted();
}

function klik_objava()
{
a=document.form_artikli.objava_skupaj.value;
if (a=='0,00' || a=='0.00')
{
window.alert('Najprej izberite vsaj eno izmed možnosti.');
return false;
}
document.form_artikli.submit();
}

function preracunaj_oglasevanje()
{
var f=document.form_oglasevanje;

skupaj=0;
var eur=new NumberFormat();
eur.setPlaces(2);
eur.setSeparators(false);//true,".",",");

splet_oglasi=0;
if (f.oglasuj_splet.checked)
{
if (f.splet_trgovina.checked) skupaj+=parseFloat(f.splet_trgovina.value)*parseFloat(f.splet_trgovina_kolicina.value);
if (f.splet_logo.checked) skupaj+=parseFloat(f.splet_logo.value)*parseFloat(f.splet_logo_kolicina.value);
if (f.splet_predstavitev.checked) skupaj+=parseFloat(f.splet_predstavitev.value)*parseFloat(f.splet_predstavitev_kolicina.value);
if (f.splet_vrh.checked) {a=parseFloat(f.splet_vrh.value)*parseFloat(f.splet_vrh_kolicina.value);skupaj+=a;splet_oglasi+=a;}
if (f.splet_obstrani.checked) {a=parseFloat(f.splet_obstrani.value)*parseFloat(f.splet_obstrani_kolicina.value);skupaj+=a;splet_oglasi+=a;}
if (f.splet_obstrani_desno.checked) {a=parseFloat(f.splet_obstrani_desno.value)*parseFloat(f.splet_obstrani_desno_kolicina.value);skupaj+=a;splet_oglasi+=a;}
if (f.splet_medoglasi.checked) {a=parseFloat(f.splet_medoglasi.value)*parseFloat(f.splet_medoglasi_kolicina.value);skupaj+=a;splet_oglasi+=a;}
}

if (f.oglasuj_tisk.checked)
{

malioglasi=parseFloat(f.paket_oglasi.options[f.paket_oglasi.selectedIndex].getAttribute('cena'));

tisk=0;
if (f.naslovnica.selectedIndex>0) tisk+=parseFloat(f.naslovnica.options[f.naslovnica.selectedIndex].getAttribute('cena'));
if (f.zadnja.selectedIndex>0) tisk+=parseFloat(f.zadnja.options[f.zadnja.selectedIndex].getAttribute('cena'));
if (f.predzadnja.selectedIndex>0) tisk+=parseFloat(f.predzadnja.options[f.predzadnja.selectedIndex].getAttribute('cena'));
if (f.notranje.selectedIndex>0) tisk+=parseFloat(f.notranje.options[f.notranje.selectedIndex].getAttribute('cena'));

if ((tisk+splet_oglasi)>malioglasi) malioglasi=0; else malioglasi-=(tisk+splet_oglasi);
skupaj+=malioglasi+tisk;
}

eur.setNumber(skupaj);
f.skupaj.value=eur.toFormatted();

popust=parseFloat(f.placilo_obdobje.options[f.placilo_obdobje.selectedIndex].getAttribute('popust'));
f.popustprocent.value=popust;
popust=skupaj*popust/100;
eur.setNumber(popust);
f.popust.value=eur.toFormatted();

osnova=skupaj-popust;
eur.setNumber(osnova);
f.osnovaddv.value=eur.toFormatted();

eur.setNumber(osnova*0.2);
f.ddv.value=eur.toFormatted();

eur.setNumber(osnova*1.2);
f.skupajddv.value=eur.toFormatted();
}

function addToFavorites()
{
var urlAddress="http://www.mojoglas.si";
var pageName="moj OGLAS - brezplačni mali oglasi, spletni in tiskani oglasnik";
window.external.AddFavorite(urlAddress,pageName);
}

function setHome()
{
//this.style.behavior='url(#default#homepage)';
document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.mojoglas.si');
//this.setHomePage('http://www.mojoglas.si');
}