// JavaScript Document
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function show_submenu(id)
{
	if (document.getElementById(id).style.display == "none") 
	{
		document.getElementById(id).style.display = "";
	}
	else
	{
		document.getElementById(id).style.display = "none";
	}
}

function show_klik(id, num_of_divs)
{
	document.getElementById("donji_div_" + id).style.display = "";
	document.getElementById("dugme_" + id).style.backgroundImage = "url(pics/naslov_pravougaoni_active.gif)";
	document.getElementById("dugme_" + id).style.color = "#ffffff";

	for (i = 0; i < num_of_divs ; i++)
	{
		//alert("donji_div_" + i);
		if (i != id)
		{
			document.getElementById("donji_div_" + i).style.display = "none";
			document.getElementById("dugme_" + i).style.backgroundImage = "url(pics/naslov_pravougaoni_pasive.gif)";
			document.getElementById("dugme_" + i).style.color = "#003851";
		}
	}
}

function mouseover_dugme(id)
{
		document.getElementById("dugme_" + id).style.backgroundImage = "url(pics/naslov_pravougaoni_active.gif)";
	document.getElementById("dugme_" + id).style.color = "#ffffff";
}
function mouseout_dugme(id)
{
		if (document.getElementById("donji_div_" + id).style.display == "none")
		{
		document.getElementById("dugme_" + id).style.backgroundImage = "url(pics/naslov_pravougaoni_pasive.gif)";
	document.getElementById("dugme_" + id).style.color = "#003851";
		}
}



function prikazi_ovaj(id)
{
document.getElementById('menu_vozila').style.display = "none";
document.getElementById('menu_vlasnici').style.display = "none";
document.getElementById('menu_go_beyond').style.display = "none";
document.getElementById('menu_o_nama').style.display = "none";
document.getElementById(id).style.display = "";
// gornja slika mora da bude active
if (id == "menu_vlasnici") 
{
	picture = "Image13";
	sors = "pics/meni_posle_kupovine_active.gif";
}
if (id == "menu_vozila") 
{
	picture = "Image11";
	sors = "pics/meni_vozila_active.gif";
}
if (id == "menu_go_beyond") 
{
	picture = "Image12";
	sors = "pics/meni_go_beyond_active.gif";
}
if (id == "menu_o_nama") 
{
	picture = "Image14";
	sors = "pics/meni_o_nama_active.gif";
}

document.getElementById(picture).src = sors;
}

function sakri_ovaj(id, id_vrati)
{
document.getElementById(id).style.display = "none";
document.getElementById(id_vrati).style.display = "";
if (id == "menu_vlasnici") 
{
	picture = "Image13";
	sors = "pics/meni_posle_kupovine.gif";
}
if (id == "menu_vozila") 
{
	picture = "Image11";
	sors = "pics/meni_vozila.gif";
}
if (id == "menu_go_beyond") 
{
	picture = "Image12";
	sors = "pics/meni_go_beyond.gif";
}
if (id == "menu_o_nama") 
{
	picture = "Image14";
	sors = "pics/meni_o_nama.gif";
}
document.getElementById(picture).src = sors;

if (id_vrati == "menu_vozila")
{
	sors_vrati = "pics/meni_vozila_active.gif";
	picture_vrati = "Image11";
}
if (id_vrati == "menu_vlasnici") 
{
	sors_vrati = "pics/meni_posle_kupovine_active.gif";
	picture_vrati = "Image13";
}
if (id_vrati == "menu_go_beyond") 
{
	sors_vrati = "pics/meni_go_beyond_active.gif";
	picture_vrati = "Image12";
}
if (id_vrati == "menu_o_nama")
{
	sors_vrati = "pics/meni_o_nama_active.gif";
	picture_vrati = "Image14";
}
document.getElementById(picture_vrati).src = sors_vrati;
}

function gallery_prikazi_gore(model, koja_galerija, fajl)
{
	document.getElementById("vozilo_gallery").src = "pics/vozila/" + model + "/" + koja_galerija + "/manje/" + fajl;	
}

function overview_over(id)
{
		document.getElementById(id).style.backgroundImage = "url(pics/vozilo_overview_active.gif)";
}
function spoljasnjost_out(id)
{
	if (document.getElementById("thumbs_exterior").style.display == "none")
	{
		document.getElementById(id).src = "pics/spoljasnjost_pasive.gif";
	}
}
function unutrasnjost_out(id)
{
	if (document.getElementById("thumbs_interior").style.display == "none")
	{
		document.getElementById(id).src = "pics/unutrasnjost_pasive.gif";
	}
}

function overview_change(id, vozilo, fajl)
{

	if (id == "unutrasnjost")
	{
		document.getElementById("thumbs_interior").style.display = "";
		document.getElementById("thumbs_exterior").style.display = "none";
		document.getElementById("Image30").src = "pics/spoljasnjost_pasive.gif";
		document.getElementById("Image31").src = "pics/unutrasnjost_active.gif";
		sors = "pics/vozila/" + vozilo + "/interior/" + fajl;
		document.getElementById("vozilo_gallery").src = sors;		
	}
	if (id == "spoljasnjost")
	{
		document.getElementById("thumbs_interior").style.display = "none";
		document.getElementById("thumbs_exterior").style.display = "";
		document.getElementById("Image31").src = "pics/unutrasnjost_pasive.gif";
		document.getElementById("Image30").src = "pics/spoljasnjost_active.gif";
		sors = "pics/vozila/" + vozilo + "/exterior/" + fajl;
		document.getElementById("vozilo_gallery").src = sors;
	}
}




function opacity(id, srcNew, opacStart, opacEnd, millisec) {
    //speed for each frame
    var speed = Math.round(millisec / 100);
    var timer = 0;

    //determine the direction for the blending, if start and end are the same nothing happens
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }
/*	
	// change the picture
	document[id].src = srcNew;

    // now backwards with new id
	pom = opacEnd;
	opacEnd = opacStart;
	opacStart = pom;
	
    if(opacStart > opacEnd) {
        for(i = opacStart; i >= opacEnd; i--) {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    } else if(opacStart < opacEnd) {
        for(i = opacStart; i <= opacEnd; i++)
            {
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
            timer++;
        }
    }*/	
	
	
}

function changeOpac(opacity, id) {
    var object = document.getElementById(id).style;
    object.opacity = (opacity / 100);
    object.MozOpacity = (opacity / 100);
    object.KhtmlOpacity = (opacity / 100);
    object.filter = "alpha(opacity=" + opacity + ")";
}







<!-- Begin
function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email adresa je nepravilna (proveri @ i .)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Email adresa sadrzi nedozvoljene karaktere.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ime domena u email-u sadrzi nedozvoljene karaktere.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("Korisnicko ime u email adresi sadrzi nedozvoljene karaktere.");
return false;
}

/* if the e-mail address is at an IP address (as opposed to a symbolic
host name) make sure the IP address is valid. */

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("IP adresa sadrzi nedozvoljene karaktere!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("Ime domena u email adresi sadrzi nedozvoljene karaktere.");
return false;
   }
}

/* domain name seems valid, but now make sure that it ends in a
known top-level domain (like com, edu, gov) or a two-letter word,
representing country (uk, nl), and that there's a hostname preceding 
the domain or country. */

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("Email adresa se ne zavrsava na dozvoljenni nacin");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("Pre domena u email adresi, mora da stoji host name");
return false;
}

// If we've gotten this far, everything's valid!
return true;
}

//  End -->



function validate_form()
{
    alert_message = "";
	valid = true;

	
	if ( document.test_voznja.model1.checked == false && document.test_voznja.model2.checked == false && document.test_voznja.model3.checked == false && document.test_voznja.model4.checked == false && document.test_voznja.model5.checked == false)
	{
		alert_message = "Morate izabrati bar jedan model";
        valid = false;	
	}

	
	
    if ( document.test_voznja.ime.value == "" )
    {
        alert_message = "Morate napisati ime" ;
        valid = false;
    }	
    if ( document.test_voznja.prezime.value == "" )
    {
        alert_message = "Morate napisati prezime" ;
        valid = false;
    }	
    if ( document.test_voznja.naziv_kompanije.value == "" )
    {
        alert_message = "Morate napisati naziv kompanije" ;
        valid = false;
    }
    if ( document.test_voznja.adresa.value == "" )
    {
        alert_message = "Morate napisati adresu" ;
        valid = false;
    }	
    if ( document.test_voznja.grad.value == "" )
    {
        alert_message = "Morate napisati grad" ;
        valid = false;
    }
    if ( document.test_voznja.postanski_broj.value == "" )
    {
        alert_message = "Morate napisati postanski broj" ;
        valid = false;
    }
	if ( document.test_voznja.telefon.value == "" && document.test_voznja.uvece.value == "" &&document.test_voznja.mobilni.value == "")
	{
		
		alert_message = "Morate upisati bar jedan broj telefona";
        valid = false;	
	}
	
	email_str = this.document.test_voznja.email.value;
	
/*    {
        alert_message = "Greska u email-u" ;
        valid = false;
    }
	*/
	
	
	if (alert_message == "") 
	{
		if (!(emailCheck(email_str)))
		{
			//alert("pozvao email");
			valid = false;
		}
	}
	else
	{
	alert(alert_message)
	}
	return valid;
}



function validate_form2()
{
    alert_message = "";
	valid = true;

	
	if ( document.test_voznja.model1.checked == false && document.test_voznja.model2.checked == false && document.test_voznja.model3.checked == false && document.test_voznja.model4.checked == false && document.test_voznja.model5.checked == false && document.test_voznja.info_o_modelima[0].checked == true)
	{
		alert_message = "Morate izabrati bar jedan model";
        valid = false;	
	}

	
	
    if ( document.test_voznja.ime.value == "" )
    {
        alert_message = "Morate napisati ime" ;
        valid = false;
    }	
    if ( document.test_voznja.prezime.value == "" )
    {
        alert_message = "Morate napisati prezime" ;
        valid = false;
    }	

    if ( document.test_voznja.godina.value == "" )
    {
        alert_message = "Morate napisati godinu zamene" ;
        valid = false;
    }	
    if ( document.test_voznja.mesec.value == "" )
    {
        alert_message = "Morate napisati mesec zamene" ;
        valid = false;
    }
	
	email_str = this.document.test_voznja.email.value;
	
/*    {
        alert_message = "Greska u email-u" ;
        valid = false;
    }
	*/
	
	
	if (alert_message == "") 
	{
		if (!(emailCheck(email_str)))
		{
			//alert("pozvao email");
			valid = false;
		}
	}
	else
	{
	alert(alert_message)
	}
	return valid;
}

function info_ne()
{
	document.test_voznja.model1.checked = false;
	document.test_voznja.model2.checked = false;
	document.test_voznja.model3.checked = false;
	document.test_voznja.model4.checked = false;
	document.test_voznja.model5.checked = false;
	
	document.test_voznja.model1.disabled = true;
	document.test_voznja.model2.disabled = true;
	document.test_voznja.model3.disabled = true;
	document.test_voznja.model4.disabled = true;
	document.test_voznja.model5.disabled = true;
}
function info_da()
{
	
	document.test_voznja.model1.disabled = false;
	document.test_voznja.model2.disabled = false;
	document.test_voznja.model3.disabled = false;
	document.test_voznja.model4.disabled = false;
	document.test_voznja.model5.disabled = false;
}


function opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
} 

function zatvori_pop_up()
{
	//document.getElementById("pop-up").style.display = "none"
	opacity('pop-up', 100, 0, 500);
	document.getElementById("darkBackgroundLayer").style.display = "none";
	setTimeout("document.getElementById('pop-up').style.display = 'none'", 800)
}

function prikazi_pop_up()
{
	//document.getElementById("pop-up").style.display = "visible";
	//opacity('pop-up', 0, 100, 500);
}




































