//shaded border /** * RUZEE.ShadedBorder 0.6.2 * (c) 2006 Steffen Rusitschka * * RUZEE.ShadedBorder is freely distributable under the terms of an MIT-style license. * For details, see http://www.ruzee.com/ */ var RUZEE = window.RUZEE || {}; RUZEE.ShadedBorder = { create: function(opts) { var isie = /msie/i.test(navigator.userAgent) && !window.opera; var isie6 = isie && !window.XMLHttpRequest; function sty(el, h) { for(k in h) { if (/ie_/.test(k)) { if (isie) el.style[k.substr(3)]=h[k]; } else el.style[k]=h[k]; } } function crdiv(h) { var el=document.createElement("div"); el.className = "sb-gen"; sty(el, h); return el; } function op(v) { v = v<0 ? 0 : v; if (v>0.99999) return ""; return isie ? " filter:alpha(opacity=" + (v*100) + ");" : " opacity:" + v + ';'; } var sr = opts.shadow || 0; var r = opts.corner || 0; var bor = 0; var bow = opts.border || 0; var boo = opts.borderOpacity || 1; var shadow = sr != 0; var lw = r > sr ? r : sr; var rw = lw; var th = lw; var bh = lw; if (bow > 0) { bor = r; r = r - bow; } var cx = r != 0 && shadow ? Math.round(lw/3) : 0; var cy = cx; var cs = Math.round(cx/2); var iclass = r > 0 ? "sb-inner" : "sb-shadow"; var sclass = "sb-shadow"; var bclass = "sb-border"; var edges = opts.edges || "trlb"; if (!/t/i.test(edges)) th=0; if (!/b/i.test(edges)) bh=0; if (!/l/i.test(edges)) lw=0; if (!/r/i.test(edges)) rw=0; var p = { position:"absolute", left:"0", top:"0", width:lw + "px", height:th + "px", ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" }; var tl = crdiv(p); delete p.left; p.right="0"; p.width=rw + "px"; var tr = crdiv(p); delete p.top; p.bottom="0"; p.height=bh + "px"; var br = crdiv(p); delete p.right; p.left="0"; p.width=lw + "px"; var bl = crdiv(p); var tw = crdiv({ position:"absolute", width:"100%", height:th + "px", ie_fontSize:"1px", top:"0", left:"0", overflow:"hidden", margin:"0", padding:"0" }); var t = crdiv({ position:"relative", height:th + "px", ie_fontSize:"1px", margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" }); tw.appendChild(t); var bw = crdiv({ position:"absolute", left:"0", bottom:"0", width:"100%", height:bh + "px", ie_fontSize:"1px", overflow:"hidden", margin:"0", padding:"0" }); var b = crdiv({ position:"relative", height:bh + "px", ie_fontSize:"1px", margin:"0 "+ rw + "px 0 " + lw + "px", overflow:"hidden", padding:"0" }); bw.appendChild(b); var mw = crdiv({ position:"absolute", top:(-bh)+"px", left:"0", width:"100%", height:"100%", overflow:"hidden", ie_fontSize:"1px", padding:"0", margin:"0" }); function corner(el,t,l) { var w = l ? lw : rw; var h = t ? th : bh; var s = t ? cs : -cs; var dsb = []; var dsi = []; var dss = []; var xp=0; var xd=1; if (l) { xp=w-1; xd=-1; } for (var x=0; x=0 && !finished; --y) { var div = '
'); } else if (d=r-1 && xc>=0 && yc>=0) { var dd = div; if (d>=bor-1) { dd += op((bor-d)*boo); doShadow = true; } else dd += op(boo); dsb.push(dd + '" class="' + bclass + '">'); } // draw inner var dd = div + ' z-index:2;' + (t ? 'background-position:0 -' + (r-yc-1) + 'px;' : 'background-image:none;'); var finish = function() { if (!t) dd = dd.replace(/top\:\d+px/, "top:0px"); dd = dd.replace(/height\:1px/, "height:" + (y+1) + "px"); dsi.push(dd + '" class="' + iclass + '">'); finished = true; }; if (xc < 0 && yc < r || yc < 0 && xc < r) { finish(); } else if (d=0 && yc>=0) { if (d>=r-1) { dd += op(r-d); doShadow = true; dsi.push(dd + '" class="' + iclass + '">'); } else { finish(); } } else doShadow = true; } else doShadow = true; // draw shadow if (sr > 0 && doShadow) { d = Math.sqrt(x*x+y*y); if (d'); } } yp += yd; } xp += xd; } el.innerHTML = dss.concat(dsb.concat(dsi)).join(''); } function mid(mw) { var ds = []; ds.push('
'); var dd = '
'); } for (var x=0; x'); } } if (bow > 0) { var su = ' width:' + bow + 'px;' + op(boo) + '" class="' + bclass + '">'; ds.push(dd + ' left:' + (lw-bor-cx) + 'px;' + su); ds.push(dd + ' right:' + (rw-bor-cx) + 'px;' + su); } mw.innerHTML = ds.join(''); } function tb(el, t) { var ds = []; var h = t ? th : bh; var dd = '
'); } if (y >= bow) { ds.push(dd + (t ? 'top:' : 'bottom:') + (y - bow) + 'px;' + op(boo) + ' height:' + bow + 'px;" class="' + bclass + '">'); } ds.push(dd + (t ? 'background-position-y:0; top:' : 'background-image:none; bottom:') + y + 'px;' + ' height:' + (r+cy+s) + 'px;" class="' + iclass + '">'); el.innerHTML = ds.join(''); } corner(tl, true, true); corner(tr, true, false); corner(bl, false, true); corner(br, false, false); mid(mw); tb(t, true); tb(b, false); needsCloning = false; return { render: function(el) { if (typeof el == 'string') el = document.getElementById(el); if (el.length != undefined) { for (var i=0; i\ .sb, .sbi, .sb *, .sbi * { position:relative; z-index:1; }\ * html .sb, * html .sbi { height:1%; }\ .sbi { display:inline-block; }\ .sb-inner { background:#ddd; }\ .sb-shadow { background:#000; }\ .sb-border { background:#bbb; }\ \ '); //graph /* --------------------------------------------------------------- Javascript CSS Bar Graph (v1.0) Copyright (C) 2007 Nicholas Cook Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------- */ var JSGraph = Class.create(); JSGraph.prototype = { defaultBackgrounds: ['#415180', '#5A4180', '#417680', '#0052A3', '#806641', '#418042'], initialize: function(id, width, height, w_pad) { this.el = $(id); this.width = (typeof(width) != 'undefined') ? width : 798; this.height = (typeof(height) != 'undefined') ? height : 200; this.pad = (typeof(w_pad) != 'undefined') ? w_pad : 30; this.items = []; this.backgroundImage = null; this.el.style.width = this.addPx(this.width); }, addItem: function() { var obj = []; for(var i = 0; i < arguments.length; i++) { if(typeof(arguments[i]) == 'object') { for(var j = 0; j < arguments[i].length; j++) { obj.push(arguments[i][j]); if(j == arguments[i].length - 1) { this.items.push(obj); obj = []; } } } else obj.push(arguments[i]); } if(obj.length > 0) this.items.push(obj); }, setBackground: function() { for(var i = 0; i < arguments.length; i++) { var arg = this.formatImage(arguments[i]) if ( arguments.length == 1 && typeof(arg) == 'object' ) this.backgroundImage = arg; else this.defaultBackgrounds[i] = arg; } }, buildBarGraph: function() { var columns = this.items.length; var li_width = Math.floor((this.width - (this.pad * columns)) / columns); // create the ULs var bar_ul = document.createElement('ul'); var legend_ul = document.createElement('ul'); bar_ul.className = 'bar'; legend_ul.className = 'legend'; for( var col = 0; col < columns; col++ ) { // get values var title = this.items[col][0]; var votes = this.items[col][1]; var value = this.items[col][2]; var backColor = (typeof(this.items[col][3]) != 'undefined') ? this.formatImage(this.items[col][3]) : this.defaultBackgrounds[3]; // create the bar LI and style var li = document.createElement('li'); var div = document.createElement('div'); var li_height = Math.round(value * .01 * this.height, 0); li.style.width = this.addPx(li_width); div.style.marginTop = this.addPx(this.height - li_height); div.style.height = this.addPx(li_height); // set background image or color if(this.backgroundImage){ div.style.background = 'url(' + this.backgroundImage.filename + '-' + parseInt(col + 1) + this.backgroundImage.ext + ') repeat-x'; } else if(typeof(backColor) == 'object') { div.style.background = 'url(' + backColor.filename + backColor.ext + ') repeat-x'; } else { div.style.background = backColor; } // no votes? if ( value == 0 ) { div.className = 'no-results'; div.style.marginTop = this.addPx(this.height - 22); div.style.height = this.addPx(22); div.style.background = 'none'; votes = '0'; } // failsafe: if height of div is too small to display label // display it above if ( li_height < 25 && value != 0 ) { div.style.marginTop = 0; var span = document.createElement('span'); span.appendChild(document.createTextNode(votes)); span.style.marginTop = this.addPx(this.height - li_height - 15); li.appendChild(span); } // append vote count if (li_height == 0 || li_height > 24) div.appendChild(document.createTextNode(votes)); li.appendChild(div); bar_ul.appendChild(li); // create and append legend LI var legend_li = document.createElement('li'); legend_li.style.width = this.addPx(li_width) legend_li.appendChild(document.createTextNode(title)); legend_ul.appendChild(legend_li); } // append survey to DIV this.el.appendChild(bar_ul); this.el.appendChild(legend_ul); }, addPx: function(line) { return line + 'px' }, formatImage: function(string) { var matches = string.match(/([a-zA-Z0-9\/\-_]+)|\.(png|gif|jpg|jpeg)$/g); if( typeof(matches[1]) != 'undefined') return { filename: matches[0], ext: matches[1] } else return (matches) ? matches[0] : string; } } //fabtabulous /* * Fabtabulous! Simple tabs using Prototype * http://tetlaw.id.au/view/blog/fabtabulous-simple-tabs-using-prototype/ * Andrew Tetlaw * version 1.1 2006-05-06 * http://creativecommons.org/licenses/by-sa/2.5/ */ var Fabtabs = Class.create(); Fabtabs.prototype = { initialize : function(element) { this.element = $(element); var options = Object.extend({}, arguments[1] || {}); this.menu = $A(this.element.getElementsByTagName('a')); this.show(this.getInitialTab()); this.menu.each(this.setupTab.bind(this)); }, setupTab : function(elm) { Event.observe(elm,'click',this.activate.bindAsEventListener(this),false) }, activate : function(ev) { var elm = Event.findElement(ev, "a"); Event.stop(ev); this.show(elm); this.menu.without(elm).each(this.hide.bind(this)); }, hide : function(elm) { $(elm).removeClassName('active-tab'); $(this.tabID(elm)).removeClassName('active-tab-body'); }, show : function(elm) { $(elm).addClassName('active-tab'); $(this.tabID(elm)).addClassName('active-tab-body'); }, tabID : function(elm) { return elm.href.match(/#(\w.+)/)[1]; }, getInitialTab : function() { if(document.location.href.match(/#(\w.+)/)) { var loc = RegExp.$1; var elm = this.menu.find(function(value) { return value.href.match(/#(\w.+)/)[1] == loc; }); return elm || this.menu.first(); } else { return this.menu.first(); } } } Event.observe(window,'load',function(){ new Fabtabs('tabs'); },false); //ajax object function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } //rel = "external" javascript code 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.getAttribute("rel") == "external nofollow" || anchor.getAttribute("rel") == "nofollow external" ) ) anchor.target = "_blank"; } } window.onload = function() { externalLinks(); } //login box javascript function changeBoxUsername() { document.getElementById('username_box_temp').style.display='none'; document.getElementById('username_box').style.display=''; document.getElementById('username').focus(); } function restoreBoxUsername() { if(document.getElementById('username').value=='') { document.getElementById('username_box_temp').style.display=''; document.getElementById('username_box').style.display='none'; } } function changeBoxPassword() { document.getElementById('password_box_temp').style.display='none'; document.getElementById('password_box').style.display=''; document.getElementById('password').focus(); } function restoreBoxPassword() { if(document.getElementById('password').value=='') { document.getElementById('password_box_temp').style.display=''; document.getElementById('password_box').style.display='none'; } } function changeBoxBrand() { document.getElementById('brand_boxx_temp').style.display='none'; document.getElementById('brand_boxx').style.display=''; document.getElementById('brand').focus(); } function restoreBoxBrand() { if(document.getElementById('brand').value=='') { document.getElementById('brand_boxx_temp').style.display=''; document.getElementById('brand_boxx').style.display='none'; } } //ajax for add status function add_status(brand,user_id) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com//includes/ajax_files/ajax_status.php" url=url+"?status=" + encodeURIComponent ( document.getElementById("status").value ) + "&user_id=" + user_id xmlHttp.onreadystatechange=stateChanged1 xmlHttp.open("GET",url,true) xmlHttp.send(null) function stateChanged1() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("add_status_form_response").innerHTML=xmlHttp.responseText document.add_status_form.reset(); } } //start another one xmlHttp2=GetXmlHttpObject() if (xmlHttp2==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com/includes/ajax_files/ajax_status_delete.php" url=url+"?status_id=0" + "&user_id=" + user_id + "&action=delete" xmlHttp2.onreadystatechange=stateChanged2 xmlHttp2.open("GET",url,true) xmlHttp2.send(null) function stateChanged2() { if (xmlHttp2.readyState==4 || xmlHttp2.readyState=="complete") { document.getElementById("profile_statuses").innerHTML=xmlHttp2.responseText } } } function delete_status(status_id,user_id) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com/includes/ajax_files/ajax_status_delete.php" url=url+"?status_id=" + status_id + "&user_id=" + user_id xmlHttp.onreadystatechange=stateChanged3 xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged3() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("profile_statuses").innerHTML=xmlHttp.responseText document.add_status_form.reset(); } } //ajax for add_brand function add_assoc(brand,user_id,tag_ref_id) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com//includes/ajax_files/ajax_assoc.php" url=url+"?assoc=" + encodeURIComponent ( document.getElementById("assoc").value ) + "&user_id=" + user_id + "&tag_ref_id=" + tag_ref_id xmlHttp.onreadystatechange=stateChanged4 xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged4() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("add_assoc").innerHTML=xmlHttp.responseText } } function changeAssocBrand() { document.getElementById('assoc_boxx_temp').style.display='none'; document.getElementById('assoc_boxx').style.display=''; document.getElementById('assoc').focus(); } function restoreAssocBrand() { if(document.getElementById('assoc').value=='') { document.getElementById('assoc_boxx_temp').style.display=''; document.getElementById('assoc_boxx').style.display='none'; } } //add brand function add_brand(tag_ref_id,user_id,category_id) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com/includes/ajax_files/add_brand.php" url=url+"?brand="+ tag_ref_id + "&user_id=" + user_id + "&category_id=" + category_id xmlHttp.onreadystatechange=stateChanged5 xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged5() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("add_this_brand").innerHTML=xmlHttp.responseText } } //remove suggestion function no_thanks(user_id,second_user_id) { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="http://brand2tag.com/includes/ajax_files/suggested_users.php" url=url+"?user_id="+ user_id + "&second_user_id=" + second_user_id xmlHttp.onreadystatechange=stateChanged6 xmlHttp.open("GET",url,true) xmlHttp.send(null) } function stateChanged6() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById("suggested").innerHTML=xmlHttp.responseText } }