var ucitano = false;
var browserName=navigator.appName; 
if (browserName=="Netscape") {
	netscape = true;
} else {
	netscape = false;
} 

var doc_width = 800;
var leftPosition = 0;
var leftPosition = 268;

// pozicija za pozicioniranje layera
function getLeftPosition(layerID){
	if (netscape) {
		doc_width = self.innerWidth;
	} else {
		doc_width = document.body.clientWidth;
	}
	if (doc_width > 750){
		if (netscape){
			leftPosition = (doc_width/2) - 120;
		} else {
			leftPosition = (doc_width/2) - 108;
		}
		podMenuPosition = leftPosition - 7;
	} else {
		leftPosition = 268;
		podMenuPosition = 264;
	}
	document.getElementById(layerID).style.left = leftPosition;
	// tu ubacujemo i divove za padajuci meni
	document.getElementById('podmenu_primorje').style.left = podMenuPosition;
	document.getElementById('podmenu_otoci').style.left = podMenuPosition + 165;
	document.getElementById('podmenu_gorje').style.left = podMenuPosition + 330;		
	 
	
}

var ucitano = true;

//getLeftPosition('headSlika');

// funkcija za iskljucivanje u ukljucivanje layera na mouse evente
function showLayers(layer) {
	document.getElementById(layer).style.visibility = "visible"; 
}
function hideLayers(layer) {
	document.getElementById(layer).style.visibility = "hidden"; 	
}	
	
		
//funkcija za prikaz pop-up prozora
var prozor = "temp_prozor";
function open_prozor(koje,sirina,visina,bars,resize)
{
		if( prozor != "temp_prozor" ) 
			prozor.close();
		prozor = window.open(koje,"Pomocni","scrollbars=" + bars + ",resizable=" + resize + ",width=" + sirina + ",height=" + visina + ",top=20,left=10,dependent");

		prozor.focus();
}

var prozor2 = null;  
function popUpProzor(jpg, sirina, visina, marg){
         if (prozor2 != null){
                   prozor2 = temp.close();
         }
         if (marg == null) { marg = 0 };
         sirina_prozora = sirina + marg*2
         visina_prozora = visina + marg*2
         temp = window.open('popup_slika.asp?jpg=' + jpg + '&marg=' + marg, 'prozor','width=' + sirina_prozora + ',height=' + visina_prozora + ',status=no');
//         prozor2.focus()
         prozor2 = temp.document;

}


//funkcija koja provjerava ispravnost upisanog podatka u polje za e-mail
function badEmail(mailAdress) {
	var allowedCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-+_.@";
	var OKMail = false;

	atPosition = mailAdress.indexOf('@');
	if ((atPosition < 1) || (atPosition > mailAdress.length-6)) return true;

	if( mailAdress.charAt(mailAdress.length-1) == '.' ) return true;
	if( mailAdress.charAt(mailAdress.length-2) == '.' ) return true;
	if( mailAdress.charAt(mailAdress.length-3) == '.' ) OKMail=true;
	if( mailAdress.charAt(mailAdress.length-4) == '.' ) OKMail=true;
	if( mailAdress.charAt(mailAdress.length-5) == '.' ) OKMail=true;
	
	if(!OKMail) return true;
	
	OKMail = false;
			
	if (mailAdress.indexOf('.',atPosition) > atPosition+2) {
//	window.status = "::";
		for( i=0; i < mailAdress.length; i++ ) {
			for( j=0; j <= allowedCharacters.length; j++ ) {
				if( mailAdress.charAt(i) == allowedCharacters.charAt(j) ) {
					OKMail = true;
					break;
				}
				else
					OKMail = false;
			}
			if( ! OKMail )
				return true;

			OKMail = false;
		}
	}

	return false;
}

//funkcija koja omogucuje da drop-down meni na onChange radi redirekciju na stranicu koja je tom odabiru "value"
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
 }

