/* Stylish Select 0.4.1007 - $ plugin to replace a select drop down box with a stylable unordered list http://scottdarby.com/ Requires: jQuery 1.3 or newer Contributions from Justin Beasley: http://www.harvest.org/ & Anatoly Ressin: http://www.artazor.lv/ Dual licensed under the MIT and GPL licenses. ////Modded By 007css to act l ike niceforms/// Changes: from 0.4.1: added ie6 compatibility, auto iframe height+width, auto width for wrapper plus extra wrapping div for auto bg handling. Decreasing z-indexing for each wrapper. Compressed by google's Closure compiler v3 fixed ie6 bug adding extra space on wrapper */ (function(a){a("html").addClass("stylish-select");Array.prototype.indexOf=function(l,r){for(var j=r||0;jparseInt(o.ddMaxHeight))m=parseInt(o.ddMaxHeight);b-=i;if(b+m>=e){f.css({top:"-"+m+"px",height:m,width:p+"px"});g.onTop=true}else{f.css({top:B+"px",height:m,width:p+"px"});g.onTop=false}}function w(){d.css("position","relative")}function k(b,e){h.removeClass("hiLite").eq(b).addClass("hiLite");f.is(":visible")&&h.eq(b).focus();var i=h.eq(b).text(),s=h.eq(b).parent().data("key");if(e==true){g.val(s);n.text(i);return false}g.val(s);g.change();n.text(i)}function x(b){b.onkeydown= function(e){e=e==null?event.keyCode:e.which;t=true;switch(e){case 40:case 39:if(c0){--c;k(c)}return false;case 33:case 36:c=0;k(c);return false;case 34:case 35:c=y-1;k(c);return false;case 13:case 27:v();f.hide();w();return false}keyPressed=String.fromCharCode(e).toLowerCase();if(typeof q.indexOf(keyPressed)!="undefined"){++c;c=q.indexOf(keyPressed,c);if(c==-1||c==null||z!=keyPressed)c=q.indexOf(keyPressed);k(c);z=keyPressed;return false}}}var o=a.extend({defaultText:"--Choose--", animationSpeed:0,ddMaxHeight:""},r),g=a(this),n=a('
'),d=a('
'),u=a('
'),f=a(''),A=-1,c=-1,q=[],z=false,t=false,h;a(this).data("ssOpts",r);var v=function(){d.siblings("iframe").hide()};g.wrap('
');d.insertAfter(g);u.appendTo(d);n.appendTo(u);f.appendTo(d);u=a(".newListSelected ul");var C=a(".selectedTxt"),p=g.outerWidth()-2; a.browser.msie&&jQuery.browser.version<7&&d.before(a('').css({height:u.height()-4+"px",width:p+"px","padding-top":C.height()+"px"}));d.css({width:p+"px"});d.parent().css({width:p+"px"});v();g.hide();if(g.children("optgroup").length==0){g.children().each(function(b){var e=a(this).text(),i=a(this).val();q.push(e.charAt(0).toLowerCase());if(a(this).attr("selected")== true){o.defaultText=e;c=b}f.append(a('
  • '+e+"
  • ").data("key",i))});h=f.children().children()}else{g.children("optgroup").each(function(){var b=a(this).attr("label");b=a('
  • '+b+"
  • ");b.appendTo(f);var e=a("");e.appendTo(b);a(this).children().each(function(){++A;var i=a(this).text(),s=a(this).val();q.push(i.charAt(0).toLowerCase());if(a(this).attr("selected")==true){o.defaultText=i;c=A}e.append(a('
  • '+ i+"
  • ").data("key",s))})});h=f.find("ul li a")}var m=f.height(),B=d.height(),y=h.length;c!=-1?k(c,true):n.text(o.defaultText);j();a(window).resize(function(){j()});a(window).scroll(function(){j()});n.click(function(){var b=a(this).parent().parent().siblings("iframe");f.slideToggle();b.slideToggle();d.css("position","relative");h.eq(c).focus()});h.click(function(b){b=a(b.target);c=h.index(b);t=true;k(c);f.slideToggle();d.css("position","relative")});h.hover(function(b){a(b.target).addClass("newListHover")}, function(b){a(b.target).removeClass("newListHover")});g.change(function(b){$targetInput=a(b.target);if(t==true)return t=false;$currentOpt=$targetInput.find(":selected");c=$targetInput.find("option").index($currentOpt);k(c,true)});d.click(function(){x(this)});d.focus(function(){a(this).addClass("newListSelFocus");x(this)});d.blur(function(){a(this).removeClass("newListSelFocus")});a("body").click(function(){d.removeClass("newListSelFocus");f.hide();v();w()});n.hover(function(b){a(b.target).parent().addClass("newListSelHover")}, function(b){a(b.target).parent().removeClass("newListSelHover")});f.css("left","0").hide()})}})(jQuery);$(document).ready(function(){$(".jNice select").sSelect();$(".formWrapper").each(function(a){$(this).css({zIndex:"200"-a})})});