/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 3.0.0b1
build: 1163
*/
YUI.add("selector-css3",function(A){A.Selector._reNth=/^(?:([-]?\d*)(n){1}|(odd|even)$)*([-+]?\d*)$/;A.Selector._getNth=function(C,L,N,G){A.Selector._reNth.test(L);var K=parseInt(RegExp.$1,10),B=RegExp.$2,H=RegExp.$3,I=parseInt(RegExp.$4,10)||0,M=[],E;var J=C.parentNode.children||A.Selector._children(C.parentNode);if(H){K=2;E="+";B="n";I=(H==="odd")?1:0;}else{if(isNaN(K)){K=(B)?1:0;}}if(K===0){if(G){I=J.length-I+1;}if(J[I-1]===C){return true;}else{return false;}}else{if(K<0){G=!!G;K=Math.abs(K);}}if(!G){for(var D=I-1,F=J.length;D<F;D+=K){if(D>=0&&J[D]===C){return true;}}}else{for(var D=J.length-I,F=J.length;D>=0;D-=K){if(D<F&&J[D]===C){return true;}}}return false;};A.mix(A.Selector.pseudos,{"root":function(B){return B===B.ownerDocument.documentElement;},"nth-child":function(C,B){return A.Selector._getNth(C,B[1]);},"nth-last-child":function(C,B){return A.Selector._getNth(C,B[1],null,true);},"nth-of-type":function(C,B){return A.Selector._getNth(C,B[1],C.tagName);},"nth-last-of-type":function(C,B){return A.Selector._getNth(C,B[1],C.tagName,true);},"last-child":function(C){var B=C.parentNode.children||A.Selector._children(C.parentNode);return B[B.length-1]===C;},"first-of-type":function(B){return A.DOM._childrenByTag(B.parentNode,B.tagName)[0];},"last-of-type":function(C){var B=A.DOM._childrenByTag(C.parentNode,C.tagName);return B[B.length-1];},"only-child":function(C){var B=C.parentNode.children||A.Selector._children(C.parentNode);return B.length===1&&B[0]===C;},"only-of-type":function(B){return A.DOM._childrenByTag(B.parentNode,B.tagName).length===1;},"empty":function(B){return B.childNodes.length===0;},"not":function(C,B){return !A.Selector.test(C,B[1]);},"contains":function(C,B){var D=C.innerText||C.textContent||"";return D.indexOf(B[1])>-1;},"checked":function(B){return B.checked===true;}});A.mix(A.Selector.operators,{"^=":"^{val}","$=":"{val}$","*=":"{val}"});A.Selector.combinators["~"]=function(D,C){var B=D.previousSibling;while(B){if(B.nodeType===1&&A.Selector._testToken(B,null,null,C.previous)){return true;}B=B.previousSibling;}return false;};},"3.0.0b1",{requires:["dom-base","selector"],skinnable:false});