// Copyright opiniac.com // version 1.9, 10.07.2009 function _Opiniac() { if (arguments.length < 1) return null; this.opiniac_hash = arguments[0]; this.add_params = new Object(); this.link_text = ''; this.pictogram_location = '/opiniac/opiniac_pictogram.gif'; this.remove_after_click = true; //-------------------------------------------------------------------- this.getLinkText = function(_escape) { if (_escape) return this.link_text.replace(/"/g,'"'); return this.link_text + ''; } //-------------------------------------------------------------------- this.setLinkText = function(txt) { this.link_text = txt; } //-------------------------------------------------------------------- this.segment = function(segment) { this.addParam('segment', segment); } //-------------------------------------------------------------------- this.addParam = function(key, val) { if (key in {'s':'', 'c':'', 'r':'', 'u':'', 't':''}) return; this.add_params[key] = val; } //-------------------------------------------------------------------- this.onclick = function() { var p = ''; if (window.screen) { p += "/s/"+window.screen.width+"x"+window.screen.height; if (!isNaN(screen.pixelDepth) && (screen.pixelDepth) != 0) { p += "/c/"+screen.pixelDepth; } else { p += "/c/"+screen.colorDepth; } } if (document.referrer) p += "/r/"+encodeURIComponent((document.referrer).substring(0,299)); if (document.URL) p += "/u/"+encodeURIComponent((document.URL).substring(0,299)); p += "/t/"+(new Date()).getTime(); for (var i in this.add_params) { p+= "/" + i + "/" + encodeURIComponent((this.add_params[i]).substring(0,128)); } window.open('http://polls.opiniac.com/s/' + this.opiniac_hash+p+'/t2/'+(new Date()).getTime(), 'opiniac', 'width=700,height=600,innerWidth=700,innerHeight=600,titlebar=0,scrollbars=1,status=0,location=0,toolbar=0,menubar=0'); if (this.remove_after_click) document.getElementById('opiniac_blk').style.display = 'none'; return false; } //-------------------------------------------------------------------- this.run = function(mode) { var that = this, s = '', b_add = ''; mode = mode || 'standard'; if (mode == 'standard') { s = "\n"; s += ""; document.writeln(s); } else if (mode == 'link') { s = "\n"; b_add = ' style="display: inline;"' document.writeln(s); } var a = '
' + a + '>' + this.getLinkText(false) + ' ' + a + 'style="position: relative; top: 4px;">'+ this.getLinkText(true) +'
'; document.writeln(b); var tab = document.getElementById('opiniac_blk').getElementsByTagName('a'); for (var i = 0; i < tab.length; i++) { tab[i].onclick = function () { that.onclick(); return false; } } } return this; }