function hide(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) {
		el.style.display = 'none';
	}
}
function show(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != '' ) {
		el.style.display = '';
	}
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
var keyCode = (isNN) ? e.which : e.keyCode; 
var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
if(input.value.length >= len && !containsElement(filter,keyCode)) {
input.value = input.value.slice(0, len);
input.form[(getIndex(input)+1) % input.form.length].focus();
}
function containsElement(arr, ele) {
var found = false, index = 0;
while(!found && index < arr.length)
if(arr[index] == ele)
found = true;
else
index++;
return found;
}
function getIndex(input) {
var index = -1, i = 0, found = false;
while (i < input.form.length && index == -1)
if (input.form[i] == input)index = i;
else i++;
return index;
}
return true;
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function numbersonly(myfield, e, dec)
{
var key;
var keychar;
if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) ) {
   return true;
	 
// numbers
} else if ((("0123456789").indexOf(keychar) > -1)) {
	return true;
	
// decimal point jump
} else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   
   }
else {
   return false;
  }
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function pviiClassNew(obj, new_style) {
    obj.className = new_style;
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function getElementsByClassName(oElm, strTagName, strClassName) {
	var arrElements = (strTagName == "*" && document.all)? document.all : oElm.getElementsByTagName(strTagName),
	arrReturnElements = new Array();
	strClassName = strClassName.replace(/\-/g, "\\-");
	var oRegExp = new RegExp("(^|\\s)" + strClassName + "(\\s|$)");
	for(var i=0; i<arrElements.length; i++)
	if(oRegExp.test(arrElements[i].className))
	arrReturnElements.push(arrElements[i]);
	return (arrReturnElements);
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function setClassSwitch(o, f, a) {
	var e = getElementsByClassName(document, "*", o);
	for(var i=0;i<e.length;i++) {
		e[i].origClass = o;
		e[i].newClass = f;
		if (a == 'of') {
			e[i].onfocus = function() {
				this.className = this.newClass;
			}
			e[i].onblur = function() {
				this.className = this.origClass;
			}
		}
		if (a == 'om') {
			e[i].onmouseover = function() {
				this.className = this.newClass;
			}
			e[i].onmouseout = function() {
				this.className = this.origClass;
			}
		}
		if (a == 'oc') {
			e[i].onclick = function() {
				this.className = this.newClass;
			}
		}				
	}
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function eventAdder(objAttrib,handler,addFunction){
     
   if ((!document.all)&&(document.getElementById)){
       objAttrib.setAttribute(handler,addFunction);
   }    
   //workaround for IE 5.x
   if ((document.all)&&(document.getElementById)){
       objAttrib[handler]=new Function(addFunction);
   }
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
isFade = true;
toolTip = {timer : null, current : null};
toolTip.getStyle = function(name){
	if(document.getElementById) return document.getElementById(name).style;
	else if(document.all) return document.all[name].style;
	else if(document.layers) return document.layers[name];
}
toolTip.show = function(name){
	if(this.timer) clearTimeout(this.timer);
	this.getStyle(name).display = "";
	this.current = name;
	if( isFade )
	{
	opacity(this.current, 0, 100, 200)
	}
	isFade = false;
}
toolTip.hide = function(){
	this.timer = setTimeout("toolTip.doHide()",400);
}
toolTip.doHide = function(){
	if(this.current){
		this.getStyle(this.current).display = "none";
		changeOpac(0,this.current)
		this.current = null;
		isFade = true;
	}
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function chgActiveToolTip(title,tip) {
	toolTip.doHide();
	document.getElementById('fieldTitle').innerHTML = title;
	document.getElementById('fieldInfo').innerHTML = tip;
	toolTip.show('toolTip');
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function positionStuff() {
	f = document.getElementById('friendBox');
	t = document.getElementById('loader');
	scrollX = (document.all)?document.body.scrollLeft:window.pageXOffset;
	scrollY = (document.all)?document.body.scrollTop:window.pageYOffset;
	winWidth = document.body.clientWidth;
	winHeight = document.body.clientHeight;
	if (f) {
		f.style.left = (scrollX + (winWidth / 2)) - 285;
		f.style.top = (scrollY + 50);
	}	
	if (t) {
		t.style.top = scrollY;
	}		
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function checkMail()
{
	var x = document.forms[0].email.value;
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(x)) return true;
	else return false;
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function showLoader() {
	l = document.getElementById('loader');
	if (l) {		
		changeOpac(0, 'loader')
		show('loader');
		currentOpac('loader', 80, 300);
	}
}
// ||||||||||||||||||||||||||||||||||||||||||||||||||
function hideLoader() {
	l = document.getElementById('loader');
	if (l) {		
		currentOpac('loader', 0, 600);
		t = setTimeout("hide('loader')",700);
	}
}