function toggle3(obj,sel) {
	var se = document.getElementById(sel);
	var el = document.getElementById(obj);
  if (se.value == 'other') {
    el.style.display = 'block';
  } else {
    el.style.display = 'none';
  }
}
function toggle2(obj) {
	var el = document.getElementById(obj);
  var status = el.style.display;
  for (i=1; i<=30; i++) {
    tmp = document.getElementById('oe_details'+i);
  	if(tmp != null) tmp.style.display = 'none';
  }
	if (status != 'block') {
    el.style.display = 'block';
  } else {
    el.style.display = 'none';
  }
}
function toggle(obj) {
	var el = document.getElementById(obj);
	if (el.style.display != 'block') {
    el.style.display = 'block';
  } else {
    el.style.display = 'none';
  }
}
function trback(txt) {
  var yes = confirm(txt);
  if (yes) {
    window.location.replace("/instant-estimates/trtype/cancel.html");
  } 
  /*else {
    top.location.replace("/instant-estimates/trtype.html");
  }*/
}
function totalcount() {
  var total=0;
  total1 = parseInt(document.getElementById("tm_repetitions").value);
  total2 = parseInt(document.getElementById("tm_100").value);
  total3 = parseInt(document.getElementById("tm_95").value);
  total4 = parseInt(document.getElementById("tm_85").value);
  total5 = parseInt(document.getElementById("tm_75").value);
  total6 = parseInt(document.getElementById("tm_50").value);
  total7 = parseInt(document.getElementById("tm_nomatch").value);
  if ( !isNaN(total1) ) total += total1;
  if ( !isNaN(total2) ) total += total2;
  if ( !isNaN(total3) ) total += total3;
  if ( !isNaN(total4) ) total += total4;
  if ( !isNaN(total5) ) total += total5;
  if ( !isNaN(total6) ) total += total6;
  if ( !isNaN(total7) ) total += total7;
  document.getElementById("tm_total").value = total;
}
function popup(sURL) {
  window.open(sURL,"PayPal","menubar=no,width=430,height=360,toolbar=no");
}
var upl = 0;
var UP = function() {
    
    /* private variables */
    
    var ifr = null;
    
    var startTime = null;
    
    var infoUpdated = 0;
    
    var writeStatus = function(text) {
        var statDiv = document.getElementById("oe_status");
        statDiv.innerHTML = text;
        if (text != "Uploading&nbsp;...") { statDiv.style.width = text; statDiv.style.color = 'white';}
        else {statDiv.style.color = 'black';}
    }
    
    
    return {
        start: function() {
           ifr = document.getElementById("oe_ifr");
           startTime = new Date();
           infoUpdated = 0;
           this.requestInfo();
        },
        stop: function(files) {
           writeStatus('100%');
           startTime = null;
        },
        requestInfo: function() {
                ifr.src="http://www.idioma.com/iport/info.php?ID=<?php echo $id_upload;?>&"+new Date();
        },
        
        updateInfo: function(percent, estimatedSeconds) {
            if (startTime) {
                if (percent) {
                    infoUpdated++;
                    
                    writeStatus(Math.floor(percent * 100) + "%"); 
                } else {
                    writeStatus("Uploading&nbsp;...");
                }
                window.setTimeout("UP.requestInfo()",500);
            }
        }
        
        
    }

}()

var casovac; 
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

