//*********************************************************************************
// Scripts coded and deleoped by artMedias.net. All rights reserved
//*********************************************************************************
function checkBrowser(){ 
	this.ver=navigator.appVersion; this.dom=document.getElementById?1:0; this.op=(navigator.userAgent.indexOf("Opera")!=-1)?1:0
	this.moz1=(navigator.userAgent.indexOf("Mozilla")!=-1&&!this.op)?1:0; this.ie4=(document.all && !this.dom && !this.op)?1:0;
	this.ie=(document.all && !this.op)?1:0; this.ns6=(!this.ie && this.dom && parseInt(this.ver)>= 5)?1:0; this.ns7=(!this.ie && this.dom && parseInt(this.ver)>= 7)?1:0}
var bw = new checkBrowser();



function getObj(id){ if (bw.ie4) return document.all[id]; else return document.getElementById(id) }
function writeLayer(id,text) { if(bw.op) writeLayerText(id,text); getObj(id).innerHTML = text }
function writeLayerText(id,text) { getObj(id).innerText = text }

function printPage(){	
	document.printThis.docTitle.value=document.title;
	document.printThis.docCont.value=getObj('mainCon').innerHTML;
	MM_openBrWindow('','printPg','menubar=yes,scrollbars=yes,resizable=yes','580','500','false');
	document.printThis.submit();
}
function add2Fav(loc,nam){ if (bw.ie) window.external.AddFavorite(loc,nam);
	else if (bw.ns6 && (typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function"))  window.sidebar.addPanel (nam,loc,'');}
	
function getInnHtml(id){ return getObj(id).innerHTML; if(bw.op) return getObj(id).innerText }

var nrImg=0; var rbImg=3
function topImgSwap(){	
	nrImg=nrImg+1; rbImg=rbImg+1
	if (nrImg==4) nrImg=1
	if (rbImg==11) rbImg=1
	document.images['topIlus'+nrImg].src='../images/design/top-anim/' +rbImg+ '.jpg'
	setTimeout('topImgSwap()',2300)
}

//*********************************************************************************
// v1.11, Marja Ribbers-de Vroed, FlevOOware
//*********************************************************************************
function flevDivPositionValue(sDiv, sProperty) {
    var sValue = ""; docObj = eval("getObj('" + sDiv + "')"); if (docObj == null) {return 0;}
	if ((sProperty == "left") || (sProperty == "top")) { docObj = docObj.style; sValue = eval("docObj." + sProperty);
		if ((bw.ie) && (sValue == "")) { if (sProperty == "top") { sValue = eval(sDiv + ".offsetTop"); } 
			else { sValue = eval(sDiv + ".offsetLeft"); } }
	} else { if (bw.op) { docObj = docObj.style;
			if (sProperty == "height") { sValue = docObj.pixelHeight; } 
			else if (sProperty == "width") { sValue = docObj.pixelWidth; } 
		} else if (bw.ns6) {sValue = document.defaultView.getComputedStyle(docObj, "").getPropertyValue(sProperty); } 
	    else if (bw.ie) { if (sProperty == "width") { sValue = eval(sDiv + ".offsetWidth"); } 
			else if (sProperty == "height") { sValue = eval(sDiv + ".offsetHeight"); } }
   	} sValue = (sValue == "") ? 0 : sValue;  if (isNaN(sValue)) { if (sValue.indexOf('px') > 0) { sValue = sValue.substring(0,sValue.indexOf('px')); } } 
	return parseInt(sValue);  }
function flevMoveDiv(sDivID, sLeft, sTop){
	var docObj = eval("getObj('" + sDivID + "')"), sSuffix=""; docObj = docObj.style; if(bw.ie&&!bw.op) {sSuffix="px";}
	if (sLeft != "") {eval("docObj.left = '" + sLeft + sSuffix + "'");} if (sTop != "") {eval("docObj.top = '" + sTop + sSuffix + "'");} }
function flevAutoScrollDivs() {
	var iArgs = flevAutoScrollDivs.arguments.length; var docObj = getObj('newsRoll'); if (!docObj) {return;}
	if (docObj.scrollTimeout != null) {clearTimeout(docObj.scrollTimeout);}; var sContainerDivID = 'newsRoll'; var sContentDivID = 'newsRollCon';
	var iStartScrolling = (iArgs > 0) ? parseInt(flevAutoScrollDivs.arguments[0]) : 1; var iPixels = (iArgs > 1) ? parseInt(flevAutoScrollDivs.arguments[1]) : 1;   
	var iDelay = (iArgs > 2) ? parseInt(flevAutoScrollDivs.arguments[2]) : 50; var iCurrentTop = flevDivPositionValue(sContentDivID, 'top');   
	var iScrollTop = (-1 * flevDivPositionValue(sContentDivID, 'height')); var iScrollBottom = flevDivPositionValue(sContainerDivID, 'height');   
	var iCurrentLeft = flevDivPositionValue(sContentDivID, 'left');  
	if (iStartScrolling) { if (iCurrentTop >= iScrollTop) {flevMoveDiv(sContentDivID, String(iCurrentLeft), String(iCurrentTop-iPixels));}
	else {flevMoveDiv(sContentDivID, String(iCurrentLeft), String(iScrollBottom));}
	docObj.scrollTimeout = setTimeout("flevAutoScrollDivs(" + iStartScrolling + "," + iPixels + "," + iDelay + ")", iDelay);} 
}
//*********************************************************************************
// Modified Macromedia Functions v3.0
//*********************************************************************************
function MM_preloadImages() { //Macromedia 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_swapImage() { 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=getObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} }
function MM_swapImgRestore() { 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_validateForm() {
  var item=''; var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) {
  	test=args[i+2]; val=getObj(args[i]); item=getObj(args[i]);
    if (val) { nm=val.id; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+=' * '+nm+' is not a valid e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+=' * '+nm+' mora sadržavati odgovarajući poštanski broj  \n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+=' * '+nm+' mora sadržavati odgovarajući poštanski broj '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') {
    		errors += ' * '+nm+ '\n';
    		item.className="textinputError" }
    	}
  } if (errors) alert('The required information is incomplete or contains errors:\n'+errors);
  document.MM_returnValue = (errors == '')}
function MM_openBrWindow(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+=',left='+myLeft+',top='+myTop;
  }window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}
