
var tooltip = new Image();
tooltip.src = root_ + "_client/img/nletter_tooltip.png";

function onloadQueue(func) {

var oldonload = window.onload;
if (typeof window.onload != 'function') {
	window.onload = func;
	} else {
		window.onload = function() {
			if (oldonload) {
				oldonload();
				}
			func();
			}
		}
}

function is_array( mixed_var ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Legaev Andrey
    // +   bugfixed by: Cord
    // *     example 1: is_array(['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: true
    // *     example 2: is_array('Kevin van Zonneveld');
    // *     returns 2: false
 
    return ( mixed_var instanceof Array );
}

function array_keys( input, search_value, strict ) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: array_keys( {firstname: 'Kevin', surname: 'van Zonneveld'} );
    // *     returns 1: {0: 'firstname', 1: 'surname'}
 
    var tmp_arr = new Array(), strict = !!strict, include = true, cnt = 0;
 
    for ( key in input ){
        include = true;
        if ( search_value != undefined ) {
            if( strict && input[key] !== search_value ){
                include = false;
            } else if( input[key] != search_value ){
                include = false;
            }
        }
 
        if( include ) {
            tmp_arr[cnt] = key;
            cnt++;
        }
    }
 
    return tmp_arr;
}

function in_array(needle, haystack, strict) {
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: true
 
    var found = false, key, strict = !!strict;
 
    for (key in haystack) {
        if ((strict && haystack[key] === needle) || (!strict && haystack[key] == needle)) {
            found = true;
            break;
        }
    }
 
    return found;
}

onloadQueue(function() {
	$$('.toggle').each(function(e) {
		Event.observe(e, 'focus', function(f) {
			if (e.value == e.title) {
				e.removeClassName('toggle');
				e.value = '';
				}
			});
		Event.observe(e, 'blur', function(f) { 
			if ((e.value == '') || (e.value == e.title)) {
				e.addClassName('toggle');
				e.value = e.title;
				}
			});
		});	
	});