function returnObjById(id) {
   if(document.getElementById)
      returnVar = document.getElementById(id);
   else if(document.all) 
      returnVar = document.all[id]; 
   else if(document.layers) 
      returnVar = document.layers[id]; 
   return returnVar; 
}

function closeExitPopup() {
   window.parent.returnObjById('popupbox').style.display='none'
}

function doTncDiv(){
var tmpDiv = returnObjById('tncDiv')
if(tmpDiv.style.display=='inline'){
   tmpDiv.style.display = 'none'; 
   tmpDiv.style.visibility='hidden';
} else {
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible';
}
setTimeout('resizeIFramePopup()',100)
}


function doTextDiv(thisBox){
var tmpDiv = returnObjById('textDiv')
if(thisBox.checked==true){
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible'
   tmpDiv = returnObjById('messageDiv')
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible';
   tmpDiv = returnObjById('dncDiv')
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible'
   tmpDiv = returnObjById('submitDiv')
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible'
   tmpDiv = returnObjById('phoneDiv')
   tmpDiv.style.display = 'none'; 
   tmpDiv.style.visibility='hidden'
} else {
   var selBox = returnObjById("questionAbout");
   selBox.selectedIndex = 0
   tmpDiv.style.display = 'none'; 
   tmpDiv.style.visibility='hidden'
   tmpDiv = returnObjById('phoneDiv')
   tmpDiv.style.display = 'none'; 
   tmpDiv.style.visibility='hidden'
   tmpDiv = returnObjById('submitDiv')
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible'
   tmpDiv = returnObjById('dncDiv')
   tmpDiv.style.display = 'inline'; 
   tmpDiv.style.visibility='visible'
}
setTimeout('resizeIFramePopup()',100)
}


function resizeIFramePopup(){
var ie=document.all && !window.opera
if(ie) { 
   h=parent.document.getElementById("_iframe-popupbox").contentWindow.document.body.scrollHeight;
   w=parent.document.getElementById("_iframe-popupbox").contentWindow.document.body.scrollWidth;
} else {
   h=parseInt(parent.document.getElementById("_iframe-popupbox").contentDocument.height)+16
   w=parseInt(parent.document.getElementById("_iframe-popupbox").contentWindow.innerWidth)+parseInt(parent.document.getElementById("_iframe-popupbox").contentWindow.scrollMaxX)
}
parent.document.getElementById('dhtmlwindowholder').lastChild.setSize(w,h);
}

function toggleDivs() {
   var selBox = returnObjById("questionAbout");
   var tmpDiv = returnObjById('submitDiv')
   if(selBox.options[selBox.selectedIndex].value == 'Repairs'){
      tmpDiv.style.display = 'none';
      tmpDiv.style.visibility = 'hidden'
      tmpDiv = returnObjById('messageDiv')
      tmpDiv.style.display = 'none';
      tmpDiv.style.visibility = 'hidden'
      tmpDiv = returnObjById('dncDiv')
      tmpDiv.style.display = 'none';
      tmpDiv.style.visibility = 'hidden'
      tmpDiv = returnObjById('phoneDiv')
      tmpDiv.style.display = 'inline'; 
      tmpDiv.style.visibility='visible'
      resizeIFramePopup();
   } else {
      tmpDiv.style.display = 'inline'; 
      tmpDiv.style.visibility='visible';
      tmpDiv = returnObjById('messageDiv')
      tmpDiv.style.display = 'inline'; 
      tmpDiv.style.visibility='visible';
      tmpDiv = returnObjById('dncDiv')
      tmpDiv.style.display = 'inline'; 
      tmpDiv.style.visibility='visible'
      tmpDiv = returnObjById('phoneDiv')
      tmpDiv.style.display = 'none'; 
      tmpDiv.style.visibility='hidden'
   }
   setTimeout('resizeIFramePopup()',100)
}

function getParm(pname){  
   name = pname.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");  
   var regexS = "[\\?&]"+name+"=([^&#]*)";  
   var regex = new RegExp( regexS );  
   var ret = regex.exec(window.location.href);  
   if( ret == null )    
      return "";  
   else    
      return ret[1];
}

function getAarfDiv() {
   if(getParm('tyc').toLowerCase().indexOf('resi') > -1) {
      return 'Resi'
   } else if(getParm('tyc').toLowerCase().indexOf('smbiz') > -1) {
      return 'SmBiz'
   }
   return ''
}

function setSSLAction(this_form) {
  this_form.action = "https://"+document.domain+"/wps/portal/adt/for_your_home/products_services/security_systems/store" 
}
