/*!
 * Helper library
 * http://www.sinteze.lt
 *
/* Copyright (c) 2007 Arunas Velicka (arunasvel@gmail.com || http://sinteze.lt)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Date: 2009-09-09 18:16:21
 * Revision: 1
 */
 
// Finds position of first occurrence of a string within another  
// 
// version: 909.322
// discuss at: http://phpjs.org/functions/strpos
// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// +   improved by: Onno Marsman    
// +   bugfixed by: Daniel Esteban
// *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
// *     returns 1: 14
function strpos (haystack, needle, offset) {
	var i = (haystack+'').indexOf(needle, (offset ? offset : 0));
	return i === -1 ? false : i;
}

// !No description available for empty. @php.js developers: Please update the function summary text file.
// 
// version: 911.1619
// discuss at: http://phpjs.org/functions/empty
// +   original by: Philippe Baumann
// +      input by: Onno Marsman
// +   bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// +      input by: LH
// +   improved by: Onno Marsman
// +   improved by: Francesco
// +   improved by: Marc Jansen
// +   input by: Stoyan Kyosev (http://www.svest.org/)
// *     example 1: empty(null);
// *     returns 1: true
// *     example 2: empty(undefined);
// *     returns 2: true
// *     example 3: empty([]);
// *     returns 3: true
// *     example 4: empty({});
// *     returns 4: true
// *     example 5: empty({'aFunc' : function () { alert('humpty'); } });
// *     returns 5: false
function empty (mixed_var) { 
    var key;
    
    if (mixed_var === "" ||
        mixed_var === 0 ||
        mixed_var === "0" ||
        mixed_var === null ||
        mixed_var === false ||
        typeof mixed_var === 'undefined'
    ){
        return true;
    }
 
    if (typeof mixed_var == 'object') {
        for (key in mixed_var) {
            return false;
        }
        return true;
    }
 
    return false;
}

// http://kevin.vanzonneveld.net
// +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// +   bugfixed by: Onno Marsman
// +   improved by: Brett Zamir (http://brett-zamir.me)
// *     example 1: ucfirst('kevin van zonneveld');
// *     returns 1: 'Kevin van zonneveld'
function ucfirst (str) {
    str += '';
    var f = str.charAt(0).toUpperCase();
    return f + str.substr(1);
}