function is_object (mixed_var){
    // http://kevin.vanzonneveld.net
    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Legaev Andrey
    // +   improved by: Michael White (http://getsprink.com)
    // *     example 1: is_object('23');
    // *     returns 1: false
    // *     example 2: is_object({foo: 'bar'});
    // *     returns 2: true
    // *     example 3: is_object(null);
    // *     returns 3: false

    if (mixed_var instanceof Array) {
        return false;
    } else {
        return (mixed_var !== null) && (typeof( mixed_var ) == 'object');
    }
}
function isset(varname)  {
  if(typeof( window[ varname ] ) != "undefined") return true;
  else return false;
}

function  is_string(op)
{
    return typeof op == 'string';
}
function in_array (needle, haystack, argStrict) {

    var key = '', strict = !!argStrict; 
    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {
                return true;            }
        }
    } else {
        for (key in haystack) {
            if (haystack[key] == needle) {    
            	return true;
            }
        }
    }
     return false;
}

function rand (min, max) {
  var argc = arguments.length;
  if (argc === 0) {
      min = 0;
      max = 2147483647;    } else if (argc === 1) {
      throw new Error('Warning: rand() expects exactly 2 parameters, 1 given');
  }
  return Math.floor(Math.random() * (max - min + 1)) + min;
}

$(function(){
	$.fn.extend({
		defaultText: function(sText)
		{
			return this.each(function() {
				$(this).focus(function()
				{
					if ($(this).val() == sText)
					{
						$(this).val('').removeClass('soft');
					}
				})
				.blur(function()
				{
					if ($(this).val() == '')
					{
						$(this).addClass('soft').val(sText);
					}
					else if ( $(this).val() == sText )
					{
						$(this).addClass('soft');
					}
				})
				.trigger('blur');
			});
		},
		disableTextSelect : function() {
			return this.each(function(){
				if($.browser.mozilla){//Firefox
					$(this).css('MozUserSelect','none');
				}else if($.browser.msie){//IE
					$(this).bind('selectstart',function(){return false;});
				}else{//Opera, etc.
					$(this).mousedown(function(){return false;});
				}
			});
		}
	});
});
