function setHc(x) {var expires=new Date(); expires.setTime(expires.getTime()+24 * 5 * 60 * 60 * 1000);setCookie("_homeActiveTab",x,expires,appContentPath);}
 function showHomeActiveTab(x) {
 setHc(x); f=document.forms[0];
 var productsSpan=document.getElementById("products_span");
 var companiesSpan=document.getElementById("companies_span");
 //var classificationSpan=document.getElementById("classification_span");
 var searchSpan=document.getElementById("search_span");
 productsSpan.style.display=(x=='2' ? "" : "none");
 //classificationSpan.style.display=(x=='3' ? "" : "none");
 companiesSpan.style.display=(x=='1' ? "" : "none");
 f.tabKompanije.value= x=='1' ? 'tabAktivan':'tab';
 f.tabProizvodi.value=x=='2' ? 'tabAktivan':'tab';
 //f.tabOglasi.value=x=='3' ? 'tabAktivan':'tab';
 f.tabRegistracija.value=x=='4' ? 'tabAktivan':'tab';
 izlazTab();
}
function izlazTab() {
 document.getElementById("kompanijeTab").className=document.forms[0].tabKompanije.value;
 document.getElementById("proizvodiTab").className=document.forms[0].tabProizvodi.value;
 //document.getElementById("oglasiTab").className=document.forms[0].tabOglasi.value;
}

function siteShowUrl(url) {window.location=appContentPath+url;}
function countNoOfSelected(selObj) {var o =selObj.options; n=0; for (i=0;i<o.length;i++) { if (o[i].selected) n++; }; return n;}
function trimAll(theForm) {for (var i=0;i<theForm.elements.length;i++) { var e=theForm.elements[i];var eName=e.type;if (eName == 'text') {e.value=trim(e.value)}}}
function trim(str) { 
 if (str != null) {var i; 
 for (i=0; i<str.length; i++) {if (str.charAt(i)!=" ") {str=str.substring(i,str.length); break;}} 
 for (i=str.length-1; i>=0; i--) {if (str.charAt(i)!=" ") {str=str.substring(0,i+1); break;}} 
 if (str.charAt(0)==" ") {return ""; } else {return str; }
 }
}
function submitAndDisable(form, validateFunction) {var returnValue=false; if (appFormSubmitted) return;if ((typeof(validateFunction)=="undefined" ) || eval(validateFunction)) {trimAll(form); appFormSubmitted=true; form.submit(); returnValue=true;};return returnValue;}
function endsWith(s, suffix) {var startPos=s.length - suffix.length;if (startPos < 0) {return false;};return (s.lastIndexOf(suffix, startPos) == startPos);}
function checkPictureType(x,selObjName) {
 var xx='';
 if (endsWith(x.value, "swf")) {
 xx=PICTURE_TYPE_FLASH;
 } else {
 xx=PICTURE_TYPE_IMG;
 }
 selObj=document.getElementById(selObjName);
 var sel=selObj.options;
 for (i=0;i<sel.length;i++) {
 if (sel[i].value==xx) {
 sel[i].selected=true;
 break;
 }
 }
}
function histGoBack() {history.back(1);}
function updateDiv(divName, divValue) { MWJ_findObj(divName).innerHTML=divValue;}
function MWJ_findObj( oName, oFrame, oDoc ) {
 if( !oDoc ) { if( oFrame ) { oDoc=oFrame.document; } else {
 oDoc=window.document; } }
 if( oDoc[oName] ) { return oDoc[oName]; }
 if( oDoc.all && oDoc.all[oName] ) { return oDoc.all[oName]; }
 if( oDoc.getElementById && oDoc.getElementById(oName) ) {
 return oDoc.getElementById(oName); }
 for( var x=0; x < oDoc.forms.length; x++ ) {
 if( oDoc.forms[x][oName] ) { return oDoc.forms[x][oName]; } }
 for( var x=0; x < oDoc.anchors.length; x++ ) {
 if( oDoc.anchors[x].name == oName ) {
 return oDoc.anchors[x]; } }
 for( var x=0; document.layers && x < oDoc.layers.length; x++ ) {
 var theOb=MWJ_findObj( oName, null, oDoc.layers[x].document );
 if( theOb ) { return theOb; } }
 if( !oFrame && window[oName] ) { return window[oName]; }
 if( oFrame && oFrame[oName] ) { return oFrame[oName]; }
 for( var x=0; oFrame && oFrame.frames &&
 x < oFrame.frames.length; x++ ) {
 var theOb=MWJ_findObj( oName, oFrame.frames[x],
 oFrame.frames[x].document ); if( theOb ) { return theOb; } }
 return null;
}
function _sws(x) {if (!x) x=""; else x=" - "+x;window.status='Marketing Srbija'+x;return true;}
function _rws() {window.status='Marketing Srbija';return true;}
function getCookie(name) {
 var prefix=name+"=" 
 var start=document.cookie.indexOf(prefix) 
 if (start==-1) {return null;}
 var end=document.cookie.indexOf(";", start+prefix.length) 
 if (end==-1) {end=document.cookie.length;}
 var value=document.cookie.substring(start+prefix.length, end) 
 return unescape(value);
}
function setCookie(name,value,expires,path,domain,secure) { document.cookie=name+"="+escape (value)+((expires) ? "; expires="+expires.toGMTString() : "")+((path) ? "; path="+path : "")+((domain) ? "; domain="+domain : "")+((secure) ? "; secure" : "");}
function deleteCookie(name,path,domain) { if (getCookie(name)) { document.cookie=name+"="+((path) ? "; path="+path : "")+((domain) ? "; domain="+domain : "")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"; }}
function doHome() {siteShowUrl("/home.html");}
function openCenterPopup(url, winTitle) {
var sw=parseInt(screen.availWidth) - 250;
var sh=parseInt(screen.availHeight) - 250;
var levo=screen.availWidth/2-sw/2;
var gore=screen.availHeight/2-sh/2;
openWindow(url, winTitle, "width="+sw+",height="+sh+",top="+gore+",left="+levo+",toolbar=no,scrollbars=auto,resizable=yes,status=yes");
}
function openWindow(url, winTitle, winParams) {winName=window.open(url, winTitle, winParams); winName.focus();}
function getShowDataImg() {return appThemeRootPath+"/img/errorPlus.gif";}
function getHideDataImg() {return appThemeRootPath+"/img/errorMinus.gif";}
function openNextRow() {
 var eSrc=window.event ? window.event.srcElement : event.which;
 eSrc.src=getHideDataImg();
 eSrc.onclick=closeNextRow;
 if (eSrc.parentElement && eSrc.parentElement.parentElement) {
 var eNext=eSrc.parentElement.parentElement;
 if (eNext.nextSibling) {
 eNext=eNext.nextSibling;
 eNext.style.display='';
 }
 }
}
function closeNextRow() {
 var eSrc=window.event ? window.event.srcElement : event.which;
 eSrc.src=getShowDataImg();
 eSrc.onclick=openNextRow;
 if (eSrc.parentElement && eSrc.parentElement.parentElement) {
 var eNext=eSrc.parentElement.parentElement;
 if (eNext.nextSibling) {
 eNext=eNext.nextSibling;
 eNext.style.display='none';
 }
 }
}
function goToTablePage(url) {window.location.href=url;}
function goToTableSort(url) {window.location.href=url;}
function getMaxCatByPaket(pak) {if (pak==1) return 1;else if (pak==2) return 3;else if (pak==3) return 5;return 1;}
TypingText=function(element, interval, cursor, finishedCallback) {if((typeof document.getElementById == "undefined") || (typeof element.innerHTML == "undefined")) {this.running=true;return;}this.element=element;this.finishedCallback=(finishedCallback ? finishedCallback : function() { return; });this.interval=(typeof interval == "undefined" ? 100 : interval);this.origText=this.element.innerHTML;this.unparsedOrigText=this.origText;this.cursor=(cursor ? cursor : "");this.currentText="";this.currentChar=0;this.element.typingText=this;if(this.element.id == "") this.element.id="typingtext"+TypingText.currentIndex++;TypingText.all.push(this);this.running=false;this.inTag=false;this.tagBuffer="";this.inHTMLEntity=false;this.HTMLEntityBuffer="";}
TypingText.all=new Array();TypingText.currentIndex=0;TypingText.runAll=function() {for(var i=0; i < TypingText.all.length; i++) TypingText.all[i].run();setTimeout("TypingText.runAll()",5000);}
TypingText.prototype.run=function() {if(this.running) return;if(typeof this.origText == "undefined") {setTimeout("document.getElementById('"+this.element.id+"').typingText.run()", this.interval);return;};if(this.currentText == "") this.element.innerHTML="";if(this.currentChar < this.origText.length) {if(this.origText.charAt(this.currentChar) == "<" && !this.inTag) {this.tagBuffer="<";this.inTag=true;this.currentChar++;this.run();return;} else if(this.origText.charAt(this.currentChar) == ">" && this.inTag) {this.tagBuffer += ">";this.inTag=false;this.currentText += this.tagBuffer;this.currentChar++;this.run();return;} else if(this.inTag) {this.tagBuffer += this.origText.charAt(this.currentChar);this.currentChar++;this.run();return;} else if(this.origText.charAt(this.currentChar) == "&" && !this.inHTMLEntity) {this.HTMLEntityBuffer="&";this.inHTMLEntity=true;this.currentChar++;this.run();return;} else if(this.origText.charAt(this.currentChar) == ";" && this.inHTMLEntity) {this.HTMLEntityBuffer += ";";this.inHTMLEntity=false;this.currentText += this.HTMLEntityBuffer;this.currentChar++;this.run();return;} else if(this.inHTMLEntity) {this.HTMLEntityBuffer += this.origText.charAt(this.currentChar);this.currentChar++;this.run();return;} else {this.currentText += this.origText.charAt(this.currentChar);}this.element.innerHTML=this.currentText;this.element.innerHTML += (this.currentChar < this.origText.length - 1 ? (typeof this.cursor == "function" ? this.cursor(this.currentText) : this.cursor) : "");this.currentChar++;setTimeout("document.getElementById('"+this.element.id+"').typingText.run()", this.interval);} else {this.currentText="";this.currentChar=0;this.running=false;this.finishedCallback();}}

