var hidden = 0;
function msg(no, msg) {
document.getElementById('fl_coverall').style.display = 'none';
document.getElementById('fl_bar').style.display = 'inline';
document.getElementById('fl_msgbar').style.backgroundRepeat = 'repeat-x';
if(no == 1) {
var sect = 'Error';
document.getElementById('fl_msgbar').style.backgroundColor = '#903';
document.getElementById('fl_msgbar').style.backgroundImage = 'url(http://smartgeographics.com/gfx/msg_1.gif)';
}
else if(no == 2) {
var sect = 'Alert';
document.getElementById('fl_msgbar').style.backgroundColor = '#39c';
document.getElementById('fl_msgbar').style.backgroundImage = 'url(http://smartgeographics.com/gfx/msg_2.gif)';
}
else if(no == 3) {
var sect = 'Success';
document.getElementById('fl_msgbar').style.backgroundColor = '#096';
document.getElementById('fl_msgbar').style.backgroundImage = 'url(http://smartgeographics.com/gfx/msg_3.gif)';
}
else {
var sect = no;
document.getElementById('fl_msgbar').style.backgroundColor = '#333';
document.getElementById('fl_msgbar').style.backgroundImage = 'url(http://smartgeographics.com/gfx/msg_4.gif)';
}
document.getElementById('fl_msgbar').innerHTML = '
' + sect + '
' + msg;
msgshow();
var hidetime = 1000 * 7;
if(hidetime != 0) setTimeout("msghide()", hidetime);
}
function msgshow() {
hidden = 0;
for(var x = "-80"; x <= 0; x++) {
var y = 7 * (x + 80);
if(y < 0) y = 0;
setTimeout("document.getElementById('fl_bar').style.marginTop = \"" + x + "px\"", y);
}
}
function msghide() {
if(hidden != 1) {
for(var x = 0; x >= "-80"; x = x - 1) {
var y = 7 * (80 - x);
if(y < 0) y = 0;
setTimeout("document.getElementById('fl_bar').style.marginTop = \"" + x + "px\"", y);
}
hidden = 1;
}
}
function addcomm() {
if(document.getElementById('fl_commsreg')) document.getElementById('fl_commsreg').style.display = "none";
document.getElementById('fl_commsadd').style.display = "inline";
document.getElementById('fl_commsaddline').style.display = "none";
}
function register() {
document.getElementById('fl_commsreg').style.display = "inline";
if(document.getElementById('fl_commsadd')) {
document.getElementById('fl_commsadd').style.display = "none";
document.getElementById('fl_commsaddline').style.display = "inline";
}
}
function removecookies() {
var date = new Date();
document.cookie = 'commuser="";expires=' + date.toGMTString() + ';path="/"';
document.cookie = 'commpass="";expires=' + date.toGMTString() + ';path="/"';
document.getElementById('fl_coverall').innerHTML = window.location;
var curadd = document.getElementById('fl_coverall').innerHTML;
while(curadd.indexOf("&") != "-1") {
curadd = curadd.replace(/&/, "&");
}
var newadd = curadd.split("#");
var quescheck = curadd.split("?");
if(quescheck[1]) {
if(newadd[1]) window.location = newadd[0] + "&msg='3',+'You have been logged out.'#" + newadd[1];
else window.location = window.location + "&msg='3',+'You have been logged out.'";
}
else {
if(newadd[1]) window.location = newadd[0] + "?msg='3',+'You have been logged out.'#" + newadd[1];
else window.location = window.location + "?msg='3',+'You have been logged out.'";
}
}
function smile(element, chars) {
insertAtCursor(document.getElementById(element), chars + " ");
document.getElementById(element).focus();
}
function insertAtCursor(myField, myValue) {
// IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
// Mozilla/others support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
myField.selectionStart = endPos + myValue.length;
myField.selectionEnd = endPos + myValue.length;
}
else {
myField.value += myValue;
}
}
function charcount(element, showbox, maxlen) {
if(element == 'filecont1') var length = document.getElementById('filecont1').value.length + document.getElementById('filecont2').value.length;
else var length = document.getElementById(element).value.length;
document.getElementById(showbox).innerHTML = "Chars: " + length + "/" + maxlen;
if(length > maxlen) document.getElementById(showbox).style.backgroundColor = "#f00";
else document.getElementById(showbox).style.backgroundColor = "transparent";
}