/*
Description: WPWORKS JS CORE
Author: wpworks.net
Author URI: http://wpworks.net
*/

var WPW = WPW || {}; 
WPW.Core = function(){
	var main = this;
	var functions = [];
	var ON = false;
	var exec = function(fn){if(WPW[fn]){WPW[fn].call()} else {if (window[fn])window[fn].call()}}
	main.register = function(fn){ if(!ON){functions.push(fn);} else {exec(fn);}}
	// main.init = function(){	
		// ON = true;
		// $.each(functions, function(index, fn){exec(fn)});
	// }
	
	WPW.isTouchDevice = (/iPhone|iPod|iPad|Android/i).test(navigator.userAgent);
	
	jQuery(document).ready(function($){
		ON = true;
		$.each(functions, function(index, fn){exec(fn)});
				
	});	
}
WPW.Core = new WPW.Core();


//indexOf
if (!Array.prototype.indexOf) {
  Array.prototype.indexOf = function (obj, fromIndex) {
    if (fromIndex == null) {
        fromIndex = 0;
    } else if (fromIndex < 0) {
        fromIndex = Math.max(0, this.length + fromIndex);
    }
    for (var i = fromIndex, j = this.length; i < j; i++) {
        if (this[i] === obj)
            return i;
    }
    return -1;
  };
}


