// ..::LvL - Tig, cleaned: Thu Jul 22 13:21:20 EST 2010
var cPos = 0;
var bustCache = 1;
var bustCacheParam = ''
var loadMsg = 'Processing ...';
var processingImg = '<img src="/rc/img/processing2.gif" width="71" height="66" border="0" alt="Processing, please wait..." title="Processing, please wait..." />';
var now = new Date();
var nowSec = Date.parse(now);
var months = { '01':'Jan','02':'Feb','03':'Mar','04':'Apr','05':'May','06':'Jun','07':'Jul','08':'Aug','09':'Sep','10':'Oct','11':'Nov','12':'Dec' };
var mPos;
var datePreviewAlt = false;
function divShow(id) {
if (document.getElementById(id)) document.getElementById(id).style.display = 'block';
}
function divHide(id) {
if (document.getElementById(id)) document.getElementById(id).style.display = 'none';
}
function getH(id) {
if (document.getElementById(id)) return document.getElementById(id).innerHTML;
}
function getV(id) {
if (document.getElementById(id)) return document.getElementById(id).value;
}
function setH(id,str) {
if (document.getElementById(id)) document.getElementById(id).innerHTML = str;
}
function setV(id,str) {
if (document.getElementById(id)) document.getElementById(id).value = str;
}
function toggle(id) {
if (document.getElementById(id).style.display == 'none') divShow(id);
else divHide(id);
}
function getMPos(ev){
ev = ev || window.event;
if(ev.pageX || ev.pageY) { mPos = { x:ev.pageX, y:ev.pageY };
} else {
t = document.body.scrollTop || document.documentElement.scrollTop;
l = document.body.scrollLeft || document.documentElement.scrollLeft;
mPos = { x:ev.clientX + l - 2 - document.body.clientLeft, y:ev.clientY + t - 2 - document.body.clientTop };
}
}
function loadPage(http, id, url){
if ( (http.readyState == 4) && (http.status == 200 || window.location.href.indexOf("http") == -1) ) {
setH(id,http.responseText);
}
}
function page(url, id, pData, pBytes){
var http = false;
setH(id,loadMsg);
if (window.XMLHttpRequest) { // if Mozilla, Safari etc
http = new XMLHttpRequest()
} else if (window.ActiveXObject){ // if IE
try {
http = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e) {
try {
http = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e) {}
}
} else {
return false;
}
if (bustCache) bustCacheParam=(url.indexOf("?")!=-1)? "&"+ new Date().getTime() : "?"+ new Date().getTime();
if (pData) {
http.open('POST', url+bustCacheParam, true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.setRequestHeader("Content-length", pBytes);
http.setRequestHeader("Connection", "close")
http.onreadystatechange = function(){
loadPage(http, id, url)
}
http.send(pData);
} else {
http.open('GET', url+bustCacheParam, true);
http.onreadystatechange = function(){
loadPage(http, id, url)
}
http.send(null);
}
}
function cleanUp() {
if (document.getElementById('processing')) {
divHide('processing');
divShow('processingBlank');
}
}
function stepSubmit(url) {
var f = document.getElementById('step');
if (url) f.action = url;
if (f['txtAbove']) f['formTxtAbove'].value = f['txtAbove'].value;
if (f['colorCustomHex']) f['formBgColor'].value = f['colorCustomHex'].value;
for(i=0; i < tickerTypes.length;i++) {
if (f['txtPrefix'+ tickerTypes[i]]) {
f['formTxtPrefix'+ tickerTypes[i]].value = f['txtPrefix'+ tickerTypes[i]].value;
}
if (f['txtSuffix'+ tickerTypes[i]]) {
f['formTxtSuffix'+ tickerTypes[i]].value = f['txtSuffix'+ tickerTypes[i]].value;
}
}
if (document.getElementById('processing')) {
divHide('processingBlank');
divShow('processing');
}
f.submit();
}
function moreBg(dir,max) {
var C = parseInt(document.getElementById('BG').style.left);
var S = 400;
var nPos = 0;
if (dir) nPos = (cPos + 1);
else nPos = (cPos - 1);
if (nPos > max) nPos = 0;
if (nPos < 0) nPos = max;
pageClassActive(nPos);
cPos = nPos;
nPos = (nPos * S * -1);
slideMe('BG',delayBG,nPos);
}
function jumpTo(j) {
if (cPos != j) {
pageClassActive(j);
cPos = j;
slideMe('BG',delayBG,(j * 400 * -1));
}
}
function pageClassActive(p) {
document.getElementById('g'+ cPos).className = 'sSlot';
document.getElementById('g'+ p).className = 'sSlot sActive';
}
function updateDate() {
var future = false;
var thisTTid = '';
for(i=0; i < tickerTypes.length;i++) {
if (this.id.indexOf(tickerTypes[i]) != -1) {
thisTTid = tickerTypes[i];
break;
}
}
if (document.getElementById('year'+ thisTTid).options)  {
var y = document.getElementById('year'+ thisTTid);
var dateSelected = Date.parse(months[getV('month'+ thisTTid)] +' '+ getV('day'+ thisTTid) +', '+ getV('year'+ thisTTid));
if (now.getFullYear() < y.options[1].value) {
future = true;
}
if (! future) {
if (dateSelected > nowSec) {
y.value = y.options[1].value;
}
} else {
if (dateSelected < (nowSec - 86400000)) {
y.value = y.options[1].value;
}
}
}
setV('formDate'+ thisTTid, getV('year'+ thisTTid) +'-'+ getV('month'+ thisTTid) +'-'+ getV('day'+ thisTTid));
}
function colorCustomRestrict() {
var h = document.getElementById('colorCustomHex');
var hex = h.value.replace(/([^0-9a-fA-F])/g,'');
if (h.value != hex) h.value = hex;
}
function colorCustomChk() {
var loadOLD = loadMsg;
var hex = document.getElementById('colorCustomHex').value;
if (hex.length == 3) {
var r = hex.charAt(0);
var g = hex.charAt(1);
var b = hex.charAt(2);
hex = r + r + g + g + b + b;
document.getElementById('colorCustomHex').value = hex;
} else if (hex.length != 6) {
alert('The hex color value must be 6 characters long.\nFor example: 6dc3ff');
return false;
}
document.getElementById('colorSample').style.background = '#'+ hex;
loadMsg = getH('colorSample');
page('/customColorTxt.php?h='+ hex,'colorSample');
loadMsg = loadOLD;
}
function colorOption(c) {
if (c) {
divShow('colorCustom');
divShow('colorOpt2');
divHide('colorPreselect');
divHide('colorOpt1');
} else {
divShow('colorPreselect');
divShow('colorOpt1');
divHide('colorCustom');
divHide('colorOpt2');
}
}
function colorPic(hex,alt) {
document.getElementById('colorCustomHex').value = hex;
document.getElementById('colorSample').style.background = '#'+ hex;
document.getElementById('colorSampleTxt').style.color = '#'+ alt;
}
function displayType(id) {
divHide('question');
divShow('questionChange');
divShow('optional');
for(i=0; i < tickerTypes.length;i++) {
divHide(tickerTypes[i] +'Count');
divHide(tickerTypes[i] +'Txt');
divHide(tickerTypes[i] +'Extra');
}
divShow(id +'Count');
divShow(id +'Txt');
divShow(id +'Extra');
if (typeof langDefault != 'undefined') {
for(i in langDefault) { divHide(i +'flags'); }
divShow(id +'flags');
if (getV('formLang')) {
langOp(getV('formLang'),id,true);
} else {
langOp('en',id);
}
}
setH('qTypeNow',getH('qType'+ id));
tickerType = id;
setV('formType',id);
}
function changeType() {
divHide('questionChange');
divHide('optional');
divShow('question');
for(i=0; i < tickerTypes.length;i++) {
divHide(tickerTypes[i] +'Count');
divHide(tickerTypes[i] +'Txt');
}
}
function slideMe(id,dely,posEnd) {
var pos = parseInt(document.getElementById(id).style.left);
var x = (posEnd - pos) / stepDiv;
if (dely) clearTimeout(dely);
slideMeNow(id,dely,pos,posEnd,x,1,0);
}
function slideMeNow(id,dely,posStart,posEnd,x,step,decel) {
var tmp = (step * x);
var posNew = tmp + posStart;
var rmd = (posEnd - posNew);
if (dely) clearTimeout(dely);
if ( (rmd < 2) && (rmd > -2) ) {
posNew = posEnd;
}
document.getElementById(id).style.left = posNew +'px';
if (posNew == posEnd) return false;
if (decel) {
step = (step / 2);
} else {
if ((stepDiv / 4) == step) {
decel = 1;
} else {
step = (step * 2);
}
}
if (step < 1) step = 1;
dely = setTimeout('slideMeNow("'+ id +'",'+ dely +','+ posNew +','+ posEnd +','+ x +','+ step +','+ decel +')',fTime);
}
var fTime = 20;
var stepDiv = 1024;
var delayBG = null;
var selectMe = {
load: function(id) {
C = document.getElementById(id);
var i = 0;
var b = (sldBase) ? '/slider/' : '/bg/'+ C.getElementsByTagName('img')[0].width +'/' ;
b += getV('formBase');
for (i in C.getElementsByTagName('img')) {
D = C.getElementsByTagName('img')[i];
if ( (D.src) && (D.title.indexOf('blank') == -1) ) {
D.onclick = selectMe.click;
D.onmouseover = selectMe.over;
D.src = b +'/'+ D.title +'.jpg';
}
}
},
over: function() {
this.style.cursor = 'pointer';
},
click: function() {
var P = document.getElementById('PREVIEWIMG');
if (bgBase) {
P.src = bgBase + this.title + getV('formSlider') +'.png';
P.title = this.title;
setV('formBg',this.title);
} else if (sldBase) {
P.src = sldBase + this.title +'.png';
P.title = this.title;
setV('formSlider',this.title);
} else {
P.src = this.src;
P.title = this.title;
setV('formBg',this.title);
}
}
}
var selectTable = {
load: function() {
var t1 = '', t2 = '';
for(i=0; i < tickerTypes.length;i++) {
if (document.getElementById(tickerTypes[i] +'SelectCount')) {
t1 = document.getElementById(tickerTypes[i] +'SelectCount');
t2 = document.getElementById(tickerTypes[i] +'SelectCount2');
t1.onmouseover = selectTable.over;
t1.onmouseout = selectTable.out;
t1.onclick = selectTable.click;
t2.onmouseover = selectTable.over;
t2.onmouseout = selectTable.out;
t2.onclick = selectTable.click;
}
}
},
over: function() {
var v = this.id.substring(0,4);
this.style.cursor='pointer';
document.getElementById(v +'SelectCount').className = 'pad8 qBoxOver';
document.getElementById(v +'SelectCount2').className = 'fRight pad8 qBoxOver';
},
out: function() {
var v = this.id.substring(0,4);
document.getElementById(v +'SelectCount').className = 'pad8';
document.getElementById(v +'SelectCount2').className = 'fRight pad8';
},
click: function() {
var v = this.id.substring(0,4);
displayType(v);
}
}
var selectDate = {
load: function(id) {
var S = document.getElementById(id).getElementsByTagName('select');
for(i=0;i<S.length;i++) {
S[i].onchange = updateDate;
}
}
}
var myTicker = {
load: function(u,c) {
if (document.getElementById('myTickers')) {
var d = document.getElementById('myTickers').getElementsByTagName('div');
var tz = getH('tz');
for(i=0;i<d.length;i++) {
if ( (d[i].id.length == 8) && (c == false) && (d[i].id.substr(0,1) != 't' ) ) {
page('/myTickerLoad.php?id='+ d[i].id +'&u='+ u +'&z='+ tz,d[i].id);
} else if ( (d[i].id.length == 6) && (c == true) && (classicShown == false) ) {
page('/myTickerLoad.php?id='+ d[i].id +'&u='+ u +'&z='+ tz,d[i].id);
}
}
}
}
}
function showCode(t,noscroll) {
var s = 0;
var loadOLD = loadMsg;
setH('code',getH('code'+ t));
setH('codeOpType',getH('code'+ t +'Title'));
divShow('codeOpBox');
loadMsg = getH('codeTip');
page('/stepcodeHelp.php?id='+ t,'codeTip');
loadMsg = loadOLD;
if (! noscroll) {
d = document.getElementById('ticker');
while (d.offsetParent) {
s += d.offsetTop;
d = d.offsetParent;
}
s += d.offsetTop;
window.scroll(0,s);
}
}
function contact(id) {
if (id == 'form') {
divHide('contactIdx');
divHide('contactAnswer');
divShow('contactForm');
} else if (id == 'idx') {
divHide('contactAnswer');
divHide('contactForm');
divShow('contactIdx');
} else {
divHide('contactIdx');
divHide('contactForm');
document.getElementById('subject').value = getH(id +'Sub');
setH('contactAnswer',getH(id));
divShow('contactAnswer');
}
}
function divSelect(id) {
if (document.selection) {
var d = document.body.createTextRange();
d.moveToElementText(document.getElementById(id));
d.select();
} else {
var d = document.createRange();
d.setStartBefore(document.getElementById(id));
d.setEndAfter(document.getElementById(id));
window.getSelection().addRange(d);
}
}
function sKey(key,input) {
var loadOLD = loadMsg;
loadMsg = '';
if (input) {
page('/skey.php?i=1&k='+ key,'sKey');
} else {
page('/skey.php?k='+ key,'sKey');
}
loadMsg = loadOLD;
}
function postSafe(s) {
if (s) {
s = s.replace(/%/g,'%25');
s = s.replace(/&/g,'%26');
s = s.replace(/\+/g,'%2B');
s = s.replace(/=/g,'%3D');
}
return s;
}
function credentials(signup) {
var loadOLD = loadMsg;
var mode = 'l';
var pageChk = '/login.php';
if (signup) {
mode = 's';
pageChk = '/signupStep.php';
}
divShow(mode +'FormContent');
if ( (getV(mode +'Email') == '') && (getV(mode +'Pass') == '') ) {
alert('An email address and password are required.');
} else if (getV(mode +'Email') == '') {
alert('An email address is required.');
} else if (getV(mode +'Pass') == '') {
alert('A password is required.');
} else if ( (mode == 's') && (getV('sPass') != getV('sPassChk')) ) {
alert('The password and password check did not match. Please re-enter them.');
setV('sPass','');
setV('sPassChk','');
} else {
loadMsg = '<div class="mid" style="height:200px">'+ processingImg +'</div>';
divHide(mode +'FormContent');
divShow('sFormConfirm');
page(pageChk +'?s32='+ getH('s32') +'&sMD5='+ getH('sMD5') +'&e='+ postSafe(getV(mode +'Email')) +'&p='+ postSafe(getV(mode +'Pass')) +'&t='+ getV('formID') +'&s='+ getV('formSrv') +'&z='+ getV('formTZoffset'),'sFormConfirm');
loadMsg = loadOLD;
}
}
function passReset() {
var loadOLD = loadMsg;
var e = getV('pEmail');
if (! e) {
alert('An email address is required.');
} else {
loadMsg = '<div class="mid" style="height:200px">'+ processingImg +'</div>';
divHide('lFormContent');
divHide('sFormContent');
divHide('pFormContent');
divShow('sFormConfirm');
page('/resetPassword.php?e='+ postSafe(e),'sFormConfirm');
loadMsg = loadOLD;
}
}
function signupClean(id) {
divHide('sFormConfirm');
divHide('lFormContent');
divHide('sFormContent');
setV('lPass','');
setV('sPassChk','');
setV('sPass','');
if (id) divShow(id);
}
function closeForm() {
if (document.getElementById('addToMyResult')) {
var r = getH('addToMyResult');
switch(r) {
case 'confirm sent':
case 'logged in':
setH('addToMy','<img src="/rc/img/addToMyBlnk.gif" width="218" height="66" border="0" alt=" " />');
break;
}
}
divHide('sForm');
divHide('sFormConfirm');
divHide('lFormContent');
divHide('pFormContent');
divShow('sFormContent');
setV('lEmail','');
setV('pEmail','');
setV('sEmail','');
setV('lPass','');
setV('sPass','');
setV('sPassChk','');
}
function myPicRemove(k,id,pid,c) {
divHide(pid);
divHide(pid +'Edit');
setH(pid +'Pic','<img src="/rc/img/sPhoto.gif" width="101" height="72" border="0" alt="Pic" title="Upload your picture" />');
setV('formPic','');
setV('form'+ id +'Pic','');
page('/myPicRemove.php?id='+ id +'&pid='+ pid +'&k='+ k +'&c='+ c,pid +'Edit');
}
function contactChk() {
if ( (getV('msg')) && (! getV('subject')) ) {
alert('A subject line is required.');
return false;
} else if ( (! getV('msg')) && (getV('subject')) ) {
alert('A message body is required.');
return false;
} else if ( (! getV('msg')) && (! getV('subject')) ) {
return false;
}
return true;
}
function newsletterChk() {
if (! getV('email')) {
alert('Your email address is required.');
return false;
}
return true;
}
function autoCompleteClr(id) {
if (document.getElementById(id)) {
if (getV(id) != '') setV(id,'');
document.getElementById(id).setAttribute('autocomplete','off');
setTimeout('setV("'+ id +'","")',500);
}
}
function autoCompleteChk(id,mode) {
if ( (getH('sKey') == '') && (getV(id) != '') ) {
setV(id,'');
if (mode == 'pass') { alert('Please enter your password first.'); }
return false;
} else {
return true;
}
}
function langOp(id,tp,tpChg) {
var langCur = getV('formLang');
var l = langDefault[tp];
var cDate = new Date();
cDate.setDate(cDate.getDate() + 30);
if (id == false) id = 'en';
for(x in l) { divShow(tp +'flag'+ x); }
divHide(tp +'flag'+ id);
if (getV('txtSuffix'+ tp) == l[langCur]['txtSuffix']) { setV('txtSuffix'+ tp,l[id]['txtSuffix']); }
if (getV('txtPrefix'+ tp) == l[langCur]['txtPrefix']) { setV('txtPrefix'+ tp,l[id]['txtPrefix']); }
if (tpChg) {
for(x in l) {
if (getV('txtSuffix'+ tp) == l[x]['txtSuffix']) { setV('txtSuffix'+ tp,l[id]['txtSuffix']); }
if (getV('txtPrefix'+ tp) == l[x]['txtPrefix']) { setV('txtPrefix'+ tp,l[id]['txtPrefix']); }
}
}
setV('formLang',id);
if ((datePreviewAlt) && (l[id]['previewTxtAlt'])) {
setH('datePreview'+ tp,l[id]['previewTxtAlt']);
} else {
setH('datePreview'+ tp,l[id]['previewTxt']);
}
if (document.getElementById('langOpImg'+ tp)) { document.getElementById('langOpImg'+ tp).src = '/rc/img/'+ l[id]['flag'] +'.gif'; }
document.cookie = 'lang='+ id + ';expires='+ cDate.toUTCString();
}

