/*
 * jQuery Styled Select Boxes
 * version: 1.0 (2008/10/16)
 * @requires jQuery v1.2.6 or later
 *
 * Examples and documentation at: http://code.google.com/p/lnet/wiki/jQueryStyledSelectOverview
 *
 * Copyright (c) 2008 Lasar Liepins, liepins.org, liepins@gmail.com
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 */
jQuery.fn.styledSelect=function(a){a=jQuery.extend({selectClass:"styledSelect",openSelectClass:"open",optionClass:"option",selectedOptionClass:"selected",closedOptionClass:"closed",firstOptionClass:"first",lastOptionClass:"last",zIndexApply:false,zIndexStart:250,closedHeight:0,openHeight:0},a);var b=a.zIndexStart;this.each(function(){var h=jQuery(this);var g=jQuery("<div></div>").attr("class",a.selectClass);if(a.zIndexApply){g.css("z-index",b-2);}var d=jQuery("<ul></ul>");if(a.zIndexApply){d.css("z-index",b-1);}g.append(d);h.hide(0).after(g);g=h.next();jQuery("option",h).each(function(){if(jQuery(this).attr("value")==undefined){jQuery(this).attr("value",jQuery(this).text());}});var c=function(){var k=jQuery("ul",g);var j=jQuery(":selected",h);k.html("");if(a.closedHeight){k.height(a.closedHeight);}f(h.val(),j.text(),e,j.attr("class"));g.removeClass(a.openSelectClass);jQuery("ul li",g).removeClass(a.selectedOptionClass).removeClass(a.optionClass).addClass(a.closedOptionClass);};var e=function(j){var k=jQuery("ul",g);k.empty();if(a.openHeight){k.height(a.openHeight);}jQuery("option",h).each(function(l){f(jQuery(this).val(),jQuery(this).text(),i,jQuery(this).attr("class"));});g.addClass(a.openSelectClass);jQuery("li:first-child",k).addClass(a.firstOptionClass);jQuery("li:last-child",k).addClass(a.lastOptionClass);j.cancelBubble=true;if(j.stopPropagation){j.stopPropagation();}};var i=function(){var j=jQuery(this).attr("rel");h.val(j);h.change();c();};var f=function(k,n,l,j){var m=jQuery("<li></li>").attr("rel",k).text(n).click(l).addClass(a.optionClass);if(j){m.addClass(j);}if(a.zIndexApply){m.css("z-index",b);}if(h.val()==k){m.addClass(a.selectedOptionClass);}jQuery("ul",g).append(m);};c();h.change(c);b-=3;$(document).click(c);});return this;};$(document).ready(function(){var d=$("div#editions");var b=$("#editionSelect");var c=d.offset();var a=null;b.styledSelect({closedHeight:21,openHeight:101,selectClass:"styled-edition",zIndexApply:true});b.change(function(){self.location.href="/"+$(this).val();});a=$("div.styled-edition ul");a.css("position","absolute");if($.browser.safari){a.css("top",c.top+$("body").css("margin-top")+"px");}else{a.css("top",c.top+"px");}});$(document).ready(function(){var a=function(b){return b.substring(b.lastIndexOf("-")+1);};$("#nav ul:first-child li a.parent").each(function(){var b=a(this.id);$("#menu-children-"+b+" li").click(function(){self.location.href=document.getElementById(this.id+"-a").href;});$("#menu-"+b).hover(function(){var c=a(this.id);var e=$(this).offset();var d=$("#menu-children-"+c);if(d.css("left")=="0px"){d.css("left",(e.left+2)+"px");d.css("top",(e.top+$(this).outerHeight())+"px");}d.show();},function(){$("#menu-children-"+a(this.id)).hide();});});});$(document).ready(function(){$("a[@rel = 'external']").attr("target","_blank");});function google_ad_request_done(b){var c="";if(b.length==0){$("#googleAdwordsModule").remove();return;}for(var a=0;a<b.length;++a){c+='<div class="ad"><div class="title"><a href="'+b[a].url+'" target="_blank">'+b[a].line1+'</a></div><div class="description"><a href="'+b[a].url+'" target="_blank">'+b[a].line2+'</a></div><div class="url"><a href="'+b[a].url+'" target="_blank">'+b[a].visible_url+"</a></div></div>";}c+='<div class="ads-by-google">Ads by <strong>Google</strong></div>';$("#googleAdwordsModule").html(c);}$(document).ready(function(){$("img").bind("contextmenu",function(a){return false;});});