// Triggers exit popup with NCT survey
// if variable q is true when the page unloads, a popup window will open (set q to true on the page if you want it to have a popup)
// call exitpopup_win() onunload and pass it the popup url. call qToFalseOnclick() onload and pass it the name of an image (such as the continue shopping image) that indicates an empty cart)


// WDL pop-up function.  Called from SO438 if set to 'DISPLAY'.
function popup_win(){
		if(q==true){
    	window.name="Parent";
    	newWindow=window.open("/v2.0-img/operations/symantfr/site/popup/wdl_popup_49954.html","newWin","toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=no,resizable=no,width=310,height=275");
	 	}
	}	 

function qToFalseOnclick(continueShoppingImage) {
  
  var allImages = document.getElementsByTagName('img'); // find all the images, put them in a variable called allImages
  for (i = 0; i<allImages.length; i++) { // apply the following to each image
    var re = '/.+\/' + continueShoppingImage;
    if (allImages[i].src.match(re)) { // if the image is continueShoppingImage...
      q = false; // ...set q to false
    }
  }
  
  var allLinks = document.getElementsByTagName('a'); // find all the links, put them in a variable called allLinks
  for (i = 0; i<allLinks.length; i++) { // apply the following to each link
    allLinks[i].onclick = function() { // when a link is clicked...
      q = false; // ...set q to false
    }
  }
  
  var allInputs = document.getElementsByTagName('input');
  for (i = 0; i<allInputs.length; i++) {
    if (allInputs[i].type == 'image' || allInputs[i].type == 'button' || allInputs[i].type == 'submit') {
      allInputs[i].onclick = function() {
        q = false; // ...set q to false
      }
    }
  }

}
