// links that require leaving this domain will be opened in a new window

function outLinks() 
{
var dbg = 0;
	if (document.getElementsByTagName('a')) 
	{
		var a = document.getElementsByTagName("a");
		for (var i = 0; i < a.length;i++) 
		{
			anchor = a[i];

			// leave mailto: and tel: links alone!
			if ( (anchor.href.indexOf("mailto:") != -1) || (anchor.href.indexOf("tel:") != -1) ) continue;

			// leave pinterest links alone!
			if (anchor.href.indexOf("pinterest") != -1) continue;

			
			if ( ("{pv_site_version}" == "mobile") && (window.navigator.standalone == false) )
			{
				
				anchor.setAttribute('onclick', 'window.location = this.getAttribute("href"); return false;');
			}

			
			else if (
				( (anchor.href.indexOf("nopalitosf.") == -1)  && (anchor.href.indexOf("nupalitosf.") == -1) && (anchor.href.indexOf("localhost") == -1)  && (anchor.href.substr(0,1) != "/") /* && (anchor.href.indexOf("fcgrx") == -1) */ )
				|| (anchor.getAttribute("rel") == "external") 
				|| (anchor.href.indexOf(".pdf") != -1) 
			   )
			{

				anchor.setAttribute('target', '_blank');
				anchor.setAttribute('onclick', 'event.cancelBubble=true;');
			}
			
			

			else if ( ("{pv_site_version}" == "mobile") && (window.navigator.standalone == true) )
			{
// if (dbg == 0) {dbg=1; alert ("links3"); }
				
				anchor.setAttribute('onclick', 'window.location = this.getAttribute("href"); return false;');
			}
		}
	}
}

window.onload = function() {outLinks();}

(function(d){
  var f = d.getElementsByTagName('SCRIPT')[0], p = d.createElement('SCRIPT');
  p.type = 'text/javascript';
  p.async = true;
  p.src = '//assets.pinterest.com/js/pinit.js';
  f.parentNode.insertBefore(p, f);
}(document));

