// http://jdbartlett.github.com/innershiv | WTFPL License
window.innerShiv=(function(){var d,r;return function(h,u){if(!d){d=document.createElement('div');r=document.createDocumentFragment();/*@cc_on d.style.display = 'none'@*/}var e=d.cloneNode(true);/*@cc_on document.body.appendChild(e);@*/e.innerHTML=h.replace(/^\s\s*/, '').replace(/\s\s*$/, '');/*@cc_on document.body.removeChild(e);@*/if(u===false)return e.childNodes;var f=r.cloneNode(true),i=e.childNodes.length;while(i--)f.appendChild(e.firstChild);return f}}());
jQuery.fn.loadShiv=function(url,params,callback){var off,selector,self,type;if(!this.length||typeof url!=='string'){return this}off=url.indexOf(' ');if(off>=0){selector=url.slice(off,url.length);url=url.slice(0,off)}type='GET';if(params){if(jQuery.isFunction(params)){callback=params;params=null}else if(typeof params==='object'){params=jQuery.param(params,jQuery.ajaxSettings.traditional);type='POST'}}self=this;jQuery.ajax({url:url,type:type,dataType:'html',data:params,complete:function(res,status){var shivved;if(status==='success'||status==='notmodified'){shivved=jQuery(innerShiv((selector?'<div>':'')+res.responseText,false));if(selector){shivved=shivved.find(selector)}self.empty().append(shivved)}if(callback){self.each(callback,[res.responseText,status,res])}}});return this}
