/*
 * jQuery CreateNode Plugin (v1.1)
 * By Sylvain MATHIEU (www.sylvain-mathieu.com) for Zenexity (zenexity.fr)
 * MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
jQuery.createDomNodes={virtualBracket:0,currentBracket:0,starter:false,cond:true,basicTags:["div","span","h1","h2","h3","h4","h5","h6","p","ul","li","a","br","img","strong","em","form","label","input","select","option","textarea","button","table","tr","th","td","dl","dt","dd"],addTag:function(){var a=this;if(!jQuery.fn["_"+a+"_"]){jQuery.fn["_"+a+"_"]=function(b){return this._tag_(a,b)};jQuery.fn["_"+a]=function(b){return this._tag(a,b)};jQuery.fn[a+"_"]=function(){return this.tag_()};jQuery["_"+a+"_"]=function(b){jQuery.createDomNodes.starter=true;return jQuery(document.createElement(a)).applyAttrs(b)};jQuery["_"+a]=function(b){jQuery.createDomNodes.starter=true;return jQuery(document.createElement(a)).applyAttrs(b)}}},createTags:function(a){jQuery(a).each(jQuery.createDomNodes.addTag)}};jQuery.fn.applyAttrs=function(a){return this.each(function(){var b;for(b in a){jQuery(this).attr(b,a[b])}})};jQuery.fn._tag_=function(c,b,a){if(jQuery.createDomNodes.cond){if(jQuery.createDomNodes.virtualBracket>jQuery.createDomNodes.currentBracket||jQuery.createDomNodes.starter){jQuery.createDomNodes.starter=false;jQuery.createDomNodes.currentBracket=jQuery.createDomNodes.virtualBracket;return jQuery(document.createElement(c)).applyAttrs(b).appendTo(this)}else{jQuery.createDomNodes.currentBracket=jQuery.createDomNodes.virtualBracket;return jQuery(document.createElement(c)).applyAttrs(b).appendTo(this.parent())}}else{return this}};jQuery.fn._tag=function(c,a){if(jQuery.createDomNodes.cond){var b=this._tag_(c,a);jQuery.createDomNodes.virtualBracket++;return b}else{return this}};jQuery.fn.tag_=function(){if(jQuery.createDomNodes.cond){jQuery.createDomNodes.virtualBracket--;return this.parent()}else{return this}};jQuery.fn._append_=function(a){if(jQuery.createDomNodes.cond){this.parent().append(a);return this}else{return this}};jQuery.fn._if=function(a){jQuery.createDomNodes.cond=a;return this};jQuery.fn.if_=function(){jQuery.createDomNodes.cond=true;return this};jQuery._if=function(a){jQuery.createDomNodes.cond=a;return this};jQuery.if_=function(){jQuery.createDomNodes.cond=true;return this};jQuery(document).ready(function(){jQuery.createDomNodes.createTags(jQuery.createDomNodes.basicTags)});