function hvr(el) {
    el.className='hover';
}

function uhvr(el) {
    el.className='';
}

//---------------------------------------
function resizeWindowToFit( elementName) 
{
	var pc = document.getElementById(elementName);	
	if (window.innerWidth)
    {
		iWidth = window.innerWidth;		
		iHeight = window.innerHeight;		
	}
        else
    {
		iWidth = document.body.clientWidth;
		iHeight =document.body.clientHeight;
	}
	window.resizeBy(pc.offsetWidth-iWidth,pc.offsetHeight-iHeight);
}

function showMore(url, width, height, scroll, name, noreturn) {
  var winName = (typeof(name)!='undefined' ? name : "PopUpWin");
  var leftScreen=50;
  var topScreen=10;
  winStats='toolbar=no,location=no,directories=no,menubar=no,';
  if(scroll) winStats+='scrollbars=yes,resizable=yes,'
    else winStats+='scrollbars=no,resizable=no,';
  winStats+='width='+width+',height='+height;
  winStats+=',left='+leftScreen+',top='+topScreen;
  PopUpWin=window.open(url, winName, winStats);
  PopUpWin.focus();                                         
  if (!noreturn)
  	return (typeof(PopUpWin) != 'object');
} 


//--- field hints

function formHints(frm, activeColor, hintColor) {
	this.frm = frm;
	this.activeColor = activeColor;
	this.hintColor = hintColor;
	this.add = formHints_add;	
	this.init = formHints_show;      
	if (this.frm.onsubmit) {
		frmonsub = this.frm.onsubmit;
		this.frm.onsubmit = function() {frmonsub(); formHints_clear(frm);}
	} else {                
		this.frm.onsubmit = function() {formHints_clear(frm);}
	}
}       

function formHints_add(el, msg, activeColor, hintColor) {
	hcol = hintColor?hintColor:this.hintColor;
	acol = activeColor?activeColor:this.activeColor;
	if (typeof(el)!='object') {               
		var elm = this.frm.elements[el]?this.frm.elements[el]:document.getElementById(el);
		if (elm) {
			elm.onfocus = function() { formHints_clearHint(elm, msg, acol); }
			elm.onblur = function() { formHints_showHint(elm, msg, hcol); }
		}
	} else {
		var elm = el;
		elm.onfocus = function() { formHints_clearHint(elm, msg, acol); }
		elm.onblur = function() { formHints_showHint(elm, msg, hcol); }
	}                  
	formHints_showHint(elm, msg, hcol);
}

function formHints_showHint(h_el, h_val, h_col) {
	if (h_el.value == '') {
		h_el.value = h_val;     
		h_el.style.color = h_col;
	}
}

function formHints_clearHint(h_el, h_val, h_col) {
	if (h_el.value == h_val) {
		h_el.value = '';      
		h_el.style.color = h_col;
	}
}  

function formHints_show(frm) {
	for (i=0; i<frm.elements.length; i++) {
		if (frm.elements[i].onblur) {
			frm.elements[i].onblur();
		}
	}
}

function formHints_clear(frm) {
	for (i=0; i<frm.elements.length; i++) {
		if (frm.elements[i].onfocus) {      
			frm.elements[i].onfocus();
		}
	}
}
