var C4=C4||{};
C4.OO=(function($){var _getFunctionName=(function(_cache,_RegExp){return function(fn){var name=(fn.name!==undefined)?["",fn.name]:(fn+"").match(_RegExp)||["",""];
return(fn!=="unsupported")?((_cache[fn])?_cache[fn]:_cache[fn]=name[1]):_cache[fn]="UnsupportedFeatureException"
}
})({},/function +([\w$]*) *\(/);
var _insistTypeof=function insistTypeof(expected,actual,customException){var match=false,automatedException,caller=arguments.callee.caller||"unsupported",actualType=(actual===null||actual===undefined)?function nullOrUndefined(){}:actual.constructor;
if(typeof expected!="object"){expected=[expected]
}function raiseException(expectedType){function setExceptionType(){return(expectedType)?_getFunctionName(expectedType):(expectedType===null)?"Null":"Undefined"
}function buildException(exceptionType){automatedException={type:"InvalidArgNot"+exceptionType+"Exception",message:(function(name){return((name!=="")?name:"Anonymous function")+"() expected: "+exceptionType+", actual: "+_getFunctionName(actualType)
})(_getFunctionName(caller))}
}function augmentException(exceptionType){automatedException.type+=", InvalidArgNot"+exceptionType+"Exception";
automatedException.message+=", expected: "+exceptionType+", actual: "+_getFunctionName(actualType)
}if(automatedException===undefined){buildException(setExceptionType())
}else{augmentException(setExceptionType())
}}function compareObjects(expectedType){if((expectedType===undefined&&actual===undefined)||(expectedType===null&&actual===null)){match=true
}else{if((_getFunctionName(actualType)!=="nullOrUndefined")&&expectedType&&actual.constructor===expectedType){match=true
}else{if(expectedType===actual){match=true
}else{raiseException(expectedType)
}}}}testData:for(var i=0,l=expected.length;
i<l;
i++){if(!match){compareObjects(expected[i])
}else{break testData
}}if(!match){throw customException||automatedException
}};
var _getStringParamValue=(function(_cache){return function _getStringParamValue(key,str){_insistTypeof(String,key);
str=str||window.location.href;
if(!_cache[str]){_cache[str]={};
if(str.indexOf("?")!==-1){var pairs=(str.indexOf("&")===-1)?[str.split("?")[1]]:str.split("?")[1].split("&");
for(var i=0,len=pairs.length;
i<len;
i++){pairs[i]=pairs[i].split("=");
_cache[str][pairs[i][0]]=pairs[i][1]
}}}return(_cache[str][key])?_cache[str][key]:false
}
})({});
var _insistPropertyExist=function insistPropertyExist(key,obj){if(obj[key]===undefined){throw {type:"PropertyDoesntExistException",message:"Property not found on target object"}
}};
var _insistRequired=function insistRequired(){var exception=null;
for(var i=0,l=arguments.length;
i<l;
i++){var testObj=arguments[i];
if(testObj.object){for(var j=0,k=testObj.names.length;
j<k;
j++){var name=testObj.names[j];
if(!testObj.object[name]&&!$(document)[name]){if(exception){exception.type+=", "+name+"NotAvailableException"
}else{exception={type:name+"NotAvailableException",message:"Required dependencies missing from external interfaces"}
}}}}}if(exception!==null){throw exception
}};
var _createNamespace=(function(_validName){return function createNamespace(){for(var i=0,l=arguments.length;
i<l;
i++){var namespace=arguments[i];
C4.OO.insistTypeof(String,namespace);
if(!_validName.test(namespace)){throw {type:"InvalidNamespaceIdentifierException",message:"C4.OO.createNamespace() requires a namespace in dot notaion format, e.g. C4.My.Example.Deep.Namespace"}
}else{var spaces=namespace.split("."),context=window,space;
for(var j=0,k=spaces.length;
j<k;
j++){space=spaces[j];
context[space]=context[space]||{};
context=context[space]
}}}}
})(/^(?:[a-zA-Z_]\w*[.])*[a-zA-Z_]\w*$/);
return{insistTypeof:_insistTypeof,insistPropertyExist:_insistPropertyExist,insistRequired:_insistRequired,createNamespace:_createNamespace,bootstrap:function bootstrap(){if(!Boolean(_getStringParamValue("enhance"))){if(Boolean(_getStringParamValue("firebug"))){var lite=document.createElement("script");
lite.setAttribute("type","text/javascript");
lite.setAttribute("src","http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js");
document.getElementsByTagName("head")[0].appendChild(lite)
}try{for(var i=0,l=arguments.length;
i<l;
i++){arguments[i]()
}}catch(exception){if(Boolean(_getStringParamValue("debug"))&&console!==undefined){console.error(exception)
}}}}}
})(jQuery);