
/** Open external links in a new window */
function externalLinks() {
		if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("a");
		for (var i=0; i<anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external")
				anchor.target = "_blank";
		}
}

/** Block right click on photos*/
function protectImages(){

   	if (!document.getElementsByTagName) return;
		var anchors = document.getElementsByTagName("img");
		for (var i=0; i < anchors.length; i++) {
			var anchor = anchors[i];
			if (anchor.getAttribute("class") == "photo")
				anchor.oncontextmenu =  new Function ("return false");
		}
}
   
/** UserVoice Script */
var uservoiceOptions = {
  /* required */
  key: 'flickrooster',
  host: 'flickrooster.uservoice.com', 
  forum: '70423',
  showTab: true,  
  /* optional */
  alignment: 'right',
  background_color:'#000', 
  text_color: 'white',
  hover_color: '#06C',
  lang: 'en'
};
    
function loadUserVoice() {   
  var s = document.createElement('script');
  s.setAttribute('type', 'text/javascript');
  s.setAttribute('src', ("https:" == document.location.protocol ? "https://" : "http://") + "cdn.uservoice.com/javascripts/widgets/tab.js");
  document.getElementsByTagName('head')[0].appendChild(s);
}


/** Loading mecanism */
window.onload = function() {
   externalLinks();
   protectImages();
   loadUserVoice();
}
