// JavaScript Document
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function registerMyFlash(){
	//console.log("FlashIDsmallcarte");
	//swfobject.registerObject("FlashIDsmallcarte");
}

function goAdminHome(){
	window.location.href = 'http://www.chalets.qc.ca/admin/';
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
/*
window.addEvent('domready', function(){
	if($('CBQ_Carrouselslides')){
		new SimpleCarousel($('CBQ_Carrouselslides'), $$('#CBQ_Carrouselslides div'), $$('div.CBQ_Carrouselbutton'), {
			slideInterval: 5000,
			rotateAction: 'click',
			buttonOnClass: "CBQ_CarrouselbuttonActive",
			buttonOffClass: "CBQ_Carrouselbutton"
		});
	}
});
*/
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/

uniqid = (function () {
	var id = 0;
	return function () {
		var mystr = String((new Date()).getTime()).replace(/\D/gi,'');
		return mystr+'_'+id++;
	};
})();



function strpos( haystack, needle, offset){
    // *     example 1: strpos('Kevin van Zonneveld', 'e', 5);
    // *     returns 1: 14
 
    var i = (haystack+'').indexOf( needle, offset ); 
    return i===-1 ? false : i;
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function get_html_translation_table(table, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // %          note: Table from http://www.the-art-of-web.com/html/character-codes/
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
    
    // Map numbers to strings for compatibilty with PHP constants
    if (!isNaN(useTable)) {
        useTable = constMappingTable[useTable];
    }
    if (!isNaN(useQuoteStyle)) {
        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
    }
    
    if (useQuoteStyle != 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
 
    if (useQuoteStyle == 'ENT_QUOTES') {
        entities['39'] = '&#039;';
    }
 
    if (useTable == 'HTML_SPECIALCHARS') {
        // ascii decimals for better compatibility
        entities['38'] = '&amp;';
        entities['60'] = '&lt;';
        entities['62'] = '&gt;';
    } else if (useTable == 'HTML_ENTITIES') {
        // ascii decimals for better compatibility
      entities['38']  = '&amp;';
      entities['60']  = '&lt;';
      entities['62']  = '&gt;';
      entities['160'] = '&nbsp;';
      entities['161'] = '&iexcl;';
      entities['162'] = '&cent;';
      entities['163'] = '&pound;';
      entities['164'] = '&curren;';
      entities['165'] = '&yen;';
      entities['166'] = '&brvbar;';
      entities['167'] = '&sect;';
      entities['168'] = '&uml;';
      entities['169'] = '&copy;';
      entities['170'] = '&ordf;';
      entities['171'] = '&laquo;';
      entities['172'] = '&not;';
      entities['173'] = '&shy;';
      entities['174'] = '&reg;';
      entities['175'] = '&macr;';
      entities['176'] = '&deg;';
      entities['177'] = '&plusmn;';
      entities['178'] = '&sup2;';
      entities['179'] = '&sup3;';
      entities['180'] = '&acute;';
      entities['181'] = '&micro;';
      entities['182'] = '&para;';
      entities['183'] = '&middot;';
      entities['184'] = '&cedil;';
      entities['185'] = '&sup1;';
      entities['186'] = '&ordm;';
      entities['187'] = '&raquo;';
      entities['188'] = '&frac14;';
      entities['189'] = '&frac12;';
      entities['190'] = '&frac34;';
      entities['191'] = '&iquest;';
      entities['192'] = '&Agrave;';
      entities['193'] = '&Aacute;';
      entities['194'] = '&Acirc;';
      entities['195'] = '&Atilde;';
      entities['196'] = '&Auml;';
      entities['197'] = '&Aring;';
      entities['198'] = '&AElig;';
      entities['199'] = '&Ccedil;';
      entities['200'] = '&Egrave;';
      entities['201'] = '&Eacute;';
      entities['202'] = '&Ecirc;';
      entities['203'] = '&Euml;';
      entities['204'] = '&Igrave;';
      entities['205'] = '&Iacute;';
      entities['206'] = '&Icirc;';
      entities['207'] = '&Iuml;';
      entities['208'] = '&ETH;';
      entities['209'] = '&Ntilde;';
      entities['210'] = '&Ograve;';
      entities['211'] = '&Oacute;';
      entities['212'] = '&Ocirc;';
      entities['213'] = '&Otilde;';
      entities['214'] = '&Ouml;';
      entities['215'] = '&times;';
      entities['216'] = '&Oslash;';
      entities['217'] = '&Ugrave;';
      entities['218'] = '&Uacute;';
      entities['219'] = '&Ucirc;';
      entities['220'] = '&Uuml;';
      entities['221'] = '&Yacute;';
      entities['222'] = '&THORN;';
      entities['223'] = '&szlig;';
      entities['224'] = '&agrave;';
      entities['225'] = '&aacute;';
      entities['226'] = '&acirc;';
      entities['227'] = '&atilde;';
      entities['228'] = '&auml;';
      entities['229'] = '&aring;';
      entities['230'] = '&aelig;';
      entities['231'] = '&ccedil;';
      entities['232'] = '&egrave;';
      entities['233'] = '&eacute;';
      entities['234'] = '&ecirc;';
      entities['235'] = '&euml;';
      entities['236'] = '&igrave;';
      entities['237'] = '&iacute;';
      entities['238'] = '&icirc;';
      entities['239'] = '&iuml;';
      entities['240'] = '&eth;';
      entities['241'] = '&ntilde;';
      entities['242'] = '&ograve;';
      entities['243'] = '&oacute;';
      entities['244'] = '&ocirc;';
      entities['245'] = '&otilde;';
      entities['246'] = '&ouml;';
      entities['247'] = '&divide;';
      entities['248'] = '&oslash;';
      entities['249'] = '&ugrave;';
      entities['250'] = '&uacute;';
      entities['251'] = '&ucirc;';
      entities['252'] = '&uuml;';
      entities['253'] = '&yacute;';
      entities['254'] = '&thorn;';
      entities['255'] = '&yuml;';
    } else {
        throw Error("Table: "+useTable+' not supported');
        return false;
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal)
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function htmlentities (string, quote_style) {
 
    var histogram = {}, symbol = '', tmp_str = '', entity = '';
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(symbol).join(entity);
    }
    
    return tmp_str;
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
if (!Array.slice) { // Mozilla already supports this
	Array.slice = function(array) {
		// Slice an array-like object.
		var slice = Array.prototype.slice;
		return slice.apply(array, slice.call(arguments, 1));
	};
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function each(arr) {
    // %        note 1: Uses global: window.php_js to store the array pointer
    // *     example 1: each({a: "apple", b: "balloon"});
    // *     returns 1: {0: "a", 1: "apple", key: "a", value: "apple"}
 
    //  Will return a 4-item object unless a class property 'returnArrayOnly'
    //  is set to true on this function if want to only receive a two-item
    //  numerically-indexed array (for the sake of array destructuring in
    //  JavaScript 1.7+ (similar to list() in PHP, but as PHP does it automatically
    //  in that context and JavaScript cannot, we needed something to allow that option)
    //  See https://developer.mozilla.org/en/New_in_JavaScript_1.7#Destructuring_assignment
    
    if (!window.php_js) window.php_js = {
        pointers:[]
    };
    var pointers = window.php_js.pointers;
    if (pointers.indexOf(arr) === -1) {
        pointers.push(arr, 0);
    }
    var arrpos = pointers.indexOf(arr);
    var cursor = pointers[arrpos+1];
    if (!(arr instanceof Array)) {
        var ct = 0;
        for (var k in arr) {
            if (ct === cursor) {
                pointers[arrpos+1] += 1;
                if (each.returnArrayOnly) {
                    return [k, arr[k]];
                } else {
                    return {
                        1:arr[k],
                        value:arr[k],
                        0:k,
                        key:k
                    };
                }
            }
            ct++;
        }
        return false; // Empty
    }
    if (arr.length === 0 || cursor === arr.length) {
        return false;
    }
    pos = cursor;
    pointers[arrpos+1] += 1;
    if (each.returnArrayOnly) {
        return [pos, arr[pos]];
    } else {
        return {
            1:arr[pos],
            value:arr[pos],
            0:pos,
            key:pos
        };
    }
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function count( mixed_var, mode ) {
    // *     example 1: count([[0,0],[0,-4]], 'COUNT_RECURSIVE');
    // *     returns 1: 6
    // *     example 2: count({'one' : [1,2,3,4,5]}, 'COUNT_RECURSIVE');
    // *     returns 2: 6
 
    var key, cnt = 0;
 
    if( mode == 'COUNT_RECURSIVE' ) mode = 1;
    if( mode != 1 ) mode = 0;
 
    for (key in mixed_var){
        cnt++;
        if( mode==1 && mixed_var[key] && (mixed_var[key].constructor === Array || mixed_var[key].constructor === Object) ){
            cnt += count(mixed_var[key], 1);
        }
    }
 
    return cnt;
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function isEmptyObject(ob){
   for(var i in ob){ return false;}
  return true;
}

/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function utf8_decode ( str_data ) {
    // *     example 1: utf8_decode('Kevin van Zonneveld');
    // *     returns 1: 'Kevin van Zonneveld'
 
    var tmp_arr = [], i = ac = c1 = c2 = c3 = 0;
 
    str_data += '';
 
    while ( i < str_data.length ) {
        c1 = str_data.charCodeAt(i);
        if (c1 < 128) {
            tmp_arr[ac++] = String.fromCharCode(c1);
            i++;
        } else if ((c1 > 191) && (c1 < 224)) {
            c2 = str_data.charCodeAt(i+1);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 31) << 6) | (c2 & 63));
            i += 2;
        } else {
            c2 = str_data.charCodeAt(i+1);
            c3 = str_data.charCodeAt(i+2);
            tmp_arr[ac++] = String.fromCharCode(((c1 & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
            i += 3;
        }
    }
 
    return tmp_arr.join('');
}
/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/
function base64_decode( data ) {
    // -    depends on: utf8_decode
    // *     example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
    // *     returns 1: 'Kevin van Zonneveld'
 
    // mozilla has this native
    // - but breaks in 2.0.0.12!
    //if (typeof window['btoa'] == 'function') {
    //    return btoa(data);
    //}
 
    var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
    var o1, o2, o3, h1, h2, h3, h4, bits, i = ac = 0, dec = "", tmp_arr = [];
 
    data += '';
 
    do {  // unpack four hexets into three octets using index points in b64
        h1 = b64.indexOf(data.charAt(i++));
        h2 = b64.indexOf(data.charAt(i++));
        h3 = b64.indexOf(data.charAt(i++));
        h4 = b64.indexOf(data.charAt(i++));
 
        bits = h1<<18 | h2<<12 | h3<<6 | h4;
 
        o1 = bits>>16 & 0xff;
        o2 = bits>>8 & 0xff;
        o3 = bits & 0xff;
 
        if (h3 == 64) {
            tmp_arr[ac++] = String.fromCharCode(o1);
        } else if (h4 == 64) {
            tmp_arr[ac++] = String.fromCharCode(o1, o2);
        } else {
            tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
        }
    } while (i < data.length);
 
    dec = tmp_arr.join('');
    dec = utf8_decode(dec);
 
    return dec;
}

/*¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤~¤*/

function serialize( mixed_value ) {
    // %          note: We feel the main purpose of this function should be to ease the transport of data between php & js
    // %          note: Aiming for PHP-compatibility, we have to translate objects to arrays
    // *     example 1: serialize(['Kevin', 'van', 'Zonneveld']);
    // *     returns 1: 'a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}'
    // *     example 2: serialize({firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'});
    // *     returns 2: 'a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}'
 
    var _getType = function( inp ) {
        var type = typeof inp, match;
        var key;
        if (type == 'object' && !inp) {
            return 'null';
        }
        if (type == "object") {
            if (!inp.constructor) {
                return 'object';
            }
            var cons = inp.constructor.toString();
            if (match = cons.match(/(\w+)\(/)) {
                cons = match[1].toLowerCase();
            }
            var types = ["boolean", "number", "string", "array"];
            for (key in types) {
                if (cons == types[key]) {
                    type = types[key];
                    break;
                }
            }
        }
        return type;
    };
    var type = _getType(mixed_value);
    var val, ktype = '';
    
    switch (type) {
        case "function": 
            val = ""; 
            break;
        case "undefined":
            val = "N";
            break;
        case "boolean":
            val = "b:" + (mixed_value ? "1" : "0");
            break;
        case "number":
            val = (Math.round(mixed_value) == mixed_value ? "i" : "d") + ":" + mixed_value;
            break;
        case "string":
            val = "s:" + mixed_value.length + ":\"" + mixed_value + "\"";
            break;
        case "array":
        case "object":
            val = "a";
            /*
            if (type == "object") {
                var objname = mixed_value.constructor.toString().match(/(\w+)\(\)/);
                if (objname == undefined) {
                    return;
                }
                objname[1] = serialize(objname[1]);
                val = "O" + objname[1].substring(1, objname[1].length - 1);
            }
            */
            var count = 0;
            var vals = "";
            var okey;
            var key;
            for (key in mixed_value) {
                ktype = _getType(mixed_value[key]);
                if (ktype == "function" && ktype == "object") { 
                    continue; 
                }
                
                okey = (key.match(/^[0-9]+$/) ? parseInt(key) : key);
                vals += serialize(okey) +
                        serialize(mixed_value[key]);
                count++;
            }
            val += ":" + count + ":{" + vals + "}";
            break;
    }
    if (type != "object" && type != "array") val += ";";
    return val;
}
function unserialize(data){
    // %            note: We feel the main purpose of this function should be to ease the transport of data between php & js
    // %            note: Aiming for PHP-compatibility, we have to translate objects to arrays 
    // *       example 1: unserialize('a:3:{i:0;s:5:"Kevin";i:1;s:3:"van";i:2;s:9:"Zonneveld";}');
    // *       returns 1: ['Kevin', 'van', 'Zonneveld']
    // *       example 2: unserialize('a:3:{s:9:"firstName";s:5:"Kevin";s:7:"midName";s:3:"van";s:7:"surName";s:9:"Zonneveld";}');
    // *       returns 2: {firstName: 'Kevin', midName: 'van', surName: 'Zonneveld'}
    try{
		var error = function (type, msg, filename, line){
			if(console){
				console.log('ERREUR: ');
				console.log('FUNCTION: unserialize');
				console.log('MESSAGE: ');
				console.log(msg);
				console.log('LINE: '+line);				
				console.log('filename: '+filename);
				console.log('');
				//throw new window[type](msg, filename, line);
		}};
		var read_until = function (data, offset, stopchr){
			var buf = [];
			var chr = data.slice(offset, offset + 1);
			var i = 2;
			while(chr != stopchr){
				if((i+offset) > data.length){
					error('Error', 'Invalid');
				}
				buf.push(chr);
				chr = data.slice(offset + (i - 1),offset + i);
				i += 1;
			}
			return [buf.length, buf.join('')];
		};
		var read_chrs = function (data, offset, length){
			buf = [];
			for(var i = 0;i < length;i++){
				var chr = data.slice(offset + (i - 1),offset + i);
				buf.push(chr);
			}
			return [buf.length, buf.join('')];
		};
		var _unserialize = function (data, offset){
			if(!offset) offset = 0;
			var buf = [];
			var dtype = (data.slice(offset, offset + 1)).toLowerCase();
			
			var dataoffset = offset + 2;
			var typeconvert = new Function('x', 'return x');
			var chrs = 0;
			var datalength = 0;
			
			switch(dtype){
				case "i":
					typeconvert = new Function('x', 'return parseInt(x)');
					var readData = read_until(data, dataoffset, ';');
					var chrs = readData[0];
					var readdata = readData[1];
					dataoffset += chrs + 1;
				break;
				case "b":
					typeconvert = new Function('x', 'return (parseInt(x) == 1)');
					var readData = read_until(data, dataoffset, ';');
					var chrs = readData[0];
					var readdata = readData[1];
					dataoffset += chrs + 1;
				break;
				case "d":
					typeconvert = new Function('x', 'return parseFloat(x)');
					var readData = read_until(data, dataoffset, ';');
					var chrs = readData[0];
					var readdata = readData[1];
					dataoffset += chrs + 1;
				break;
				case "n":
					readdata = null;
				break;
				case "s":
					var ccount = read_until(data, dataoffset, ':');
					var chrs = ccount[0];
					var stringlength = ccount[1];
					dataoffset += chrs + 2;
					
					var readData = read_chrs(data, dataoffset+1, parseInt(stringlength));
					var chrs = readData[0];
					var readdata = readData[1];
					dataoffset += chrs + 2;
					if(chrs != parseInt(stringlength) && chrs != readdata.length){
						error('SyntaxError', 'String length mismatch');
					}
				break;
				case "a":
					var readdata = {};
					
					var keyandchrs = read_until(data, dataoffset, ':');
					var chrs = keyandchrs[0];
					var keys = keyandchrs[1];
					dataoffset += chrs + 2;
					
					for(var i = 0;i < parseInt(keys);i++){
						var kprops = _unserialize(data, dataoffset);
						var kchrs = kprops[1];
						var key = kprops[2];
						dataoffset += kchrs;
						
						var vprops = _unserialize(data, dataoffset);
						var vchrs = vprops[1];
						var value = vprops[2];
						dataoffset += vchrs;
						
						readdata[key] = value;
					}
					
					dataoffset += 1;
				break;
				default:
					error('SyntaxError', 'Unknown / Unhandled data type(s): ' + dtype);
				break;
			}
			return [dtype, dataoffset - offset, typeconvert(readdata)];
		};
		return _unserialize(data, 0)[2];
	}catch(ex){}
}
/*********************************************************************************************************************************/
jQuery.fn.reset = function () {
  $(this).each (function() { this.reset(); });
}



jQuery.extend({
  executeHook: function(hookName) {
    if (typeof window[hookName] == 'function') {
      window[hookName]();
    } else {
      //debug
    }
  }
});