// SWF fix
var bo_noscript_id = 0;
function isIE() {
  var strBrowser = navigator.userAgent.toLowerCase();
  return ((strBrowser.indexOf("msie") > -1 || strBrowser.indexOf("opera") > -1) && strBrowser.indexOf("mac") < 0);
}

function startFix() {
  if (isIE()) {
   document.write('<div style="display: none;" id="bo_noscript_id_' + bo_noscript_id + '">');
  }
}

function endFix() {
  if (isIE()) {
   document.write('</div>');
   var theObject = document.getElementById("bo_noscript_id_" + bo_noscript_id++);
   theObject.outerHTML = theObject.innerHTML;
  }
}
// SWF fix END

// mail too antispams :)
function m2(ne,ht) {
      window.location.href = "mailto:"+ne+"@"+ht;
}

function hidediv(id) {
	// atskirigo parluku drosa funkcija, kas pasleps div slanus
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	// atskirigo parluku drosa funkcija, kas paradiis konkreeto div slaani

	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}


function clean4Ajax(id){
 ob = document.getElementById(id);
 var h = ob.value;
 var n = "&"; var r = "[AND]"; var t = h.split(n); ob.value = t.join(r);
}

function ajxLoadingSym(layer){
    document.getElementById(layer).innerHTML = '<div class="ajxLoading"><img src="/img/des/loading16.gif" alt="Ielāde.."></div>';
}
function ajxLoadingSymLrg(layer){
    document.getElementById(layer).innerHTML = '<div class="ajxLoading" align="center"><img src="/img/des/loading.gif" alt="Ielāde.." width="32" height="32" style="background: #FFFFFF; padding:10px;"></div>';
}
function ajxboxLoadingSym(){
    ajxLoadingSymLrg('ajxBoxCont');
}
function getajxbox(link,wi,he){
    ajxboxLoadingSym(); showLbox('ajx',wi,he); get_ajax(link,'ajxBoxCont');
}
function postajxbox(link,form){
    var wi, he; showLbox('ajx',wi,he); post_ajax(link,form,'ajxBoxCont'); ajxboxLoadingSym();
}
function loadajxbox(link){
    ajxboxLoadingSym(); get_ajax(link,'ajxBoxCont');
}
function closeajxbox(){
    ajxboxLoadingSym(); closeLbox('ajx');
}
function write_a_Message(){
    ajxboxLoadingSym();
    getajxbox('/moduleajax/inc/contacts2/8/?ajxlbox=1&',500,360);
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}

function ajxRegEmailcheck(){
   if(document.regFrm.reg_epasts.value.length >= 6){
       ajxLoadingSym('reguserchecke');
       get_ajax('/pubajax/regusercheck/email/?chk='+document.regFrm.reg_epasts.value,'reguserchecke');
   }else{
       document.getElementById("reguserchecke").innerHTML = '';
   }
}
function ajxRegLogincheck(){
   if(document.regFrm.reg_logins.value.length >= 4){
       ajxLoadingSym('regusercheckl');
       get_ajax('/pubajax/regusercheck/login/?chk='+document.regFrm.reg_logins.value,'regusercheckl');
   }else{
       document.getElementById("regusercheckl").innerHTML = '';
   }
}
function chkRegFields(a1){
    var rnot = document.getElementById("rnot");
    if(rnot.checked==false){
        alert(a1);
        return false;
    }else{
        return true;
    }
}
function showHide(id){
    var o = document.getElementById(id);
    if(o){
     if(o.style.display){
        if(o.style.display=="block"){ hidediv(id); }else{ showdiv(id); }
     }else{
        hidediv(id);
     }
    }
}

