/* addEvent function found at http://www.scottandrew.com/weblog/articles/cbs-events */ function addEvent(obj, evType, fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent) { var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } /* createElement function found at http://simon.incutio.com/archive/2003/06/15/javascriptWithXML */ function createElement(element) { if (typeof document.createElementNS != 'undefined') { return document.createElementNS('http://www.w3.org/1999/xhtml', element); } if (typeof document.createElement != 'undefined') { return document.createElement(element); } return false; } function getStyle(el, style) { if(!document.getElementById) return; var value = el.style[toCamelCase(style)]; if (!value) { if (document.defaultView && typeof (document.defaultView.getComputedStyle) == "function") { // DOM value = document.defaultView.getComputedStyle(el, "").getPropertyValue(style); } else if (el.currentStyle) { // IE value = el.currentStyle[toCamelCase(style)]; } else { // Safari hack var foo = toCamelCase("client-"+style); value = el[foo]; } } return value; } function setStyle(obj, style, value) { obj.style[style] = value; } function toCamelCase( sInput ) { var oStringList = sInput.split('-'); if(oStringList.length == 1) { return oStringList[0]; } var ret = sInput.indexOf("-") == 0 ? oStringList[0].charAt(0).toUpperCase() + oStringList[0].substring(1) : oStringList[0]; for(var i = 1, len = oStringList.length; i < len; i++) { var s = oStringList[i]; ret += s.charAt(0).toUpperCase() + s.substring(1); } return ret; } function popup(url, w, h) { var options = 'width=' + w + ',height=' + h + ','; options += 'resizable=yes,scrollbars=yes,status=no,'; options += 'menubar=no,toolbar=no,location=no,directories=no'; var newWin = window.open(url, 'newWin', options); newWin.focus(); } function getStyleObject(objectId) { if (document.getElementById && document.getElementById(objectId)) { // W3C DOM return document.getElementById(objectId).style; } else if (document.all && document.all(objectId)) { // MSIE 4 DOM return document.all(objectId).style; } else if (document.layers && document.layers[objectId]) { // NN 4 DOM.. note: this won't find nested layers return document.layers[objectId]; } else { return false; } } function toggle( el ) { var vis = toggleVis(el); } function toggleVis( el ) { var obj = document.getElementById(el); var style = getStyle(obj, 'display'); if (style=='none') { setStyle(obj, 'display', 'block'); return 1; } else { setStyle(obj, 'display', 'none'); return 0; } } function toggleAdv(formname) { var vis = toggleVis('advsearch'); toggle('search_adv'); toggle('search_simple'); var field = document.forms[formname].elements['search_adv']; field.value = vis; } function dl(file,loc,template) { if ( (window.navigator.userAgent.indexOf("SV1") != -1 ) || (window.navigator.userAgent.indexOf("MSIE 7.") != -1 ) ) { var options = 'width=0,height=0,resizable=no,scrollbars=no,' + 'status=no,menubar=no,toolbar=no,location=no,directories=no'; var dlWin = window.open(file, 'dlWin', options); loc = loc + '/dlp/'; } if (template) { loc = loc + '?template=' + template; } location.href = loc; } function submit(formname) { document.forms[formname].submit(); } function cfe(f,e) { var k; if (window.event) { k = window.event.keyCode; } else if (e) { k = e.which; } else return true; if (k==13) { f.form.submit(); return false; } else return true; } function sws(w) { window.status = w; return true; } function cws() { window.status=''; return true; } function contactForm(value) { var step2 = document.getElementById('step2'); if (value=="domain") { document.location = 'http://helpcenter.tucows.com/Email.php'; } else if (value==0) { setStyle(step2, 'display', 'none'); } else { setStyle(step2, 'display', 'block'); } }