﻿jQuery(document).ready(function($) {
        /** <html></html> **/

/* ---------------------------------------------
expandAll v.1.3
http://adipalaz.awardspace.com/experiments/jquery/expand.html
Requires: jQuery v1.3+
Copyright (c) 2009 Adriana Palazova
Dual licensed under the MIT (http://adipalaz.awardspace.com/docs/mit-license.txt) and GPL (http://adipalaz.awardspace.com/docs/gpl-license.txt) licenses.
------------------------------------------------ */

jQuery.fn.expandAll = function(options) {
    var defaults = {
         expTxt : '[Expand All]',
         cllpsTxt : '[Collapse All]',
         cllpsEl : '.collapse', // the collapsible element
         trigger : '.expand', // the element that triggers the toggle action
         ref : '.expand', // the switch 'Expand All/Collapse All' is inserted before the 'ref'
         showMethod : 'show',
         hideMethod : 'hide',
         state : 'hidden', // the collapsible elements are hidden by default
         speed : 0
    };
    var o = jQuery.extend({}, defaults, options);   
    
    var container;
    if(jQuery(this) && jQuery(this).length){
        if (jQuery(this).attr('id').length) {
            container = '#' + jQuery(this).attr('id');
        } else if (jQuery(this).attr('class').length){
            container = '.' + jQuery(this).attr('class');
        } else {
            container = '';
        }
        
        var toggleTxt = o.expTxt;
        if (o.state == 'hidden') {jQuery(this).find(o.cllpsEl).hide();} else {toggleTxt = o.cllpsTxt;}
        
        return this.each(function(index) {
            jQuery(this).find(o.ref + ':first').before('<p class="switch"><a href="#">' + toggleTxt + '</a></p>');
            jQuery(this).find('p.switch a').click(function() {
                var jQuerycllps = jQuery(this).closest(container).find(o.cllpsEl),
                    jQuerytr = jQuery(this).closest(container).find(o.trigger);
                if (jQuery(this).text() == o.expTxt) {
                    jQuery(this).text(o.cllpsTxt);
                    jQuerytr.addClass('open');
                    jQuerycllps[o.showMethod](o.speed);
                } else {
                    jQuery(this).text(o.expTxt);
                    jQuerytr.removeClass('open');
                    jQuerycllps[o.hideMethod](o.speed);
                }
                return false;
            });
        });
    }
};
/* ---------------------------------------------
Toggler
http://adipalaz.awardspace.com/experiments/jquery/expand.html
When using this script, please keep the above url intact.
------------------------------------------------ */
jQuery.fn.toggler = function(options) {
    var defaults = {
         cllpsEl : 'div.collapse',
         method : 'slideToggle',
         speed : 'slow'
    };
    var o = jQuery.extend({}, defaults, options);
    
    jQuery(this).wrapInner('<a style="display:block" href="#" title="Expand/Collapse" />');
    return this.each(function() {
    jQuery(this).click(function() {
        jQuery(this).toggleClass('open')
        .next(o.cllpsEl)[o.method](o.speed);
        return false;
    });
});};
//http://www.learningjquery.com/2008/02/simple-effects-plugins:
jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};
jQuery.fn.slideFadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle', height: 'toggle'}, speed, easing, callback);
};

////////////////////////////
/* ---
Sample usage:
jQuery(function() {
    jQuery("#container").expandAll({showMethod: "slideDown", hideMethod: "slideUp", speed: 400});
    jQuery("#container  h4.expand").toggler();
});
Sample markup:
<div id="container>
  <h4 class="expand">Title 1</h4>
  <div class="collapse">...</div>
  <h4 class="expand">Title 2</h4>
  <div class="collapse">...</div>
</div>
--- */
/* ------------------------------------------------------------------------------------------------------------------------------------
 * All plugin are made by Boris Strahija
 * Copyright 2009, Boris Strahija
 * http://www.creolab.hr/
 *
 * ------------------------------------------------------------------------------------------------------------------------------------ */
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Div link - searches the element for anchor tags and adds the first one as the click action
 * ------------------------------------------------------------------------------------------------------------------------------------ */

(function ($) {
    $.fn.divlink = function(params) {
        // Default options
        var params = jQuery.extend({
             
        }, params);
        
        $(this).each(function() {
            $(this).click(function() {
                document.location = $(this).find("a:eq(0)").attr("href");
            });
            $(this).css("cursor", "pointer");
            $(this).hover(
                 function() { $(this).addClass("hover"); }
                ,function() { $(this).removeClass("hover"); }
            );
        }); //end each()
        
    }; //end function()
})(jQuery);

/* ------------------------------------------------------------------------------------------------------------------------------------
 * Flash News
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.flashnews = function(params) {
        // Default options
        var options = jQuery.extend({
             speed:     2000
            ,timeout:     7000
        }, options);
        
        $(this).each(function() {
            var $el = $(this);
            $el.children(':gt(0)').css("width", "0px"); // Hide all except 1st
            
            var el_int = setInterval(function(){
                $el.children().eq(0).animate({width: "0px"}, options.speed, function() {
                    var $pel = $(this);
                    $(this).next().animate({width: "500px"}, options.speed, function() {
                        $pel.appendTo($el);
                    });
                });
            }, options.timeout);
        }); // end each()
    }; //end function()
})(jQuery);
 
 
 
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Simple SlideShow
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.slideshow = function(params) {
        // Default options
        var options = jQuery.extend({
             speed:     1500
            ,timeout:     6000
        }, options);
        
        $(this).each(function() {
            var $el = $(this);
            $el.children(':gt(0)').hide(); // Hide all except 1st
            
            var el_int = setInterval(function(){
                $el.children().eq(0).fadeOut(options.speed)
                    .next().fadeIn(options.speed)
                    .end().appendTo($el);
            }, options.timeout);
        }); // end each()
    }; //end function()
})(jQuery);
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Hover push - adds left padding and a background image
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.hoverpush = function(params) {
        // Default options
        var options = jQuery.extend({
             
        }, options);
        
        $(this).each(function() {
            var $el = $(this);
            
            $el.hover(
                 function() { $(this).animate({paddingLeft: "+=8px"}, 120); }
                ,function() { $(this).animate({paddingLeft: "-=8px"}, 120); }
            );
            
        }); // end each()
    }; //end function()
})(jQuery);
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Accordion
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.accordion = function(params) {
        // Default options
        var params = jQuery.extend({
             all_closed: false
        }, params);
        
        $(this).each(function() {
            var el = $(this);
            var current = 0;
            var animating = false;
            
            // Set the count
            var total = $(el).children(".acc").length;
            
            // Add special class to last element
            $(el).children(".acc:last").addClass("last");
            
            // Init content
            $(el).find(".acc .cont").hide();
            if (params.all_closed == true) {
                current = -1;
            } else {
                $(el).find("a.toggle:eq("+current+")").parent("li").addClass("open");
                $(el).find("a.toggle:eq("+current+")").addClass("open");
                $(el).find(".acc:eq("+current+") .cont").show();
            } //end if
            
            // Add click events
            $(el).find("a.toggle").css("outline", "none");
            $(el).find("a.toggle").each(function(num) {
                $(this).click(function() {
                    if (num != current) {
                        $(el).find("a.toggle").removeClass("open");
                        $(this).addClass("open");
                        
                        // Close current
                        $(el).find(".acc:eq("+current+") .cont").slideUp(330);
                        
                        // Open clicked
                        $(el).find(".acc:eq("+num+") .cont").slideDown(300);
                        
                        current = num;
                    } //end if
                    return false;
                }); //end click()
            }); //end each()
        }); // end each()
    }; //end function()
})(jQuery);
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Tabs
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.tabbed = function() {
        $(this).each(function() {
            var el = $(this);
            
            // Init marker
            $(el).find(".tabs a").css("outline", "none");
            $(el).find(".tabs a").removeClass("on");
            $(el).find(".tabs a:eq(0)").addClass("on");
            
            // Init content
            $(el).find(".content > div").hide();
            $(el).find(".content > div:eq(0)").show();
            
            // Fix tabs in IE6
            if ($.browser.msie) $(el).find(".tabs a em").wrapInner('<span></span>');
            
            // Add click events
            $(el).find(".tabs a").each(function(num) {
                $(this).click(function() {
                    // Marker
                    $(el).find(".tabs a").removeClass("on");
                    $(this).addClass("on");
                    
                    //content
                    $(el).find(".content > div").hide();
                    $(el).find(".content > div:eq("+num+")").show();
                    
                    return false;
                }); //end click()
            }); //end each()
        }); // end each()
    }; //end function()
})(jQuery);
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Align an element vertical
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
// VERTICALLY ALIGN FUNCTION
$.fn.vAlign = function() {
    return this.each(function(i){
        var ah = $(this).height();
        var ph = $(this).parent().height();
        var mh = (ph - ah) / 2;
        $(this).css('padding-top', mh);
    });
};
})(jQuery);
/* ------------------------------------------------------------------------------------------------------------------------------------
 * Add custom buttons
 * ------------------------------------------------------------------------------------------------------------------------------------ */
(function ($) {
    $.fn.customButton = function() {
        $(this).each(function() {
            var el = $(this);
            var tt = el.text() || el.val();
            
            if ($(':submit,:button',this)) {
                el.after('<a href="#" class="btn btn-'+el.attr("type")+'" alt="'+tt+'"><em>'+tt+'</em></a>'); new_el = el.next("a");
                
                // Add submit action
                if (el.attr("type") == "submit") {
                    new_el.click(function() {
                        var form = $(this).parents('form:first');
                        form.submit();
                        return false;
                    }); //end click
                    
                } else if (el.attr("type") == "submit") {
                    new_el.click(function() {
                        var form = $(this).parents('form:first');
                        form.reset();
                        return false;
                    }); //end click
                    
                } else {
                    new_el.click(function() { return false; });
                    
                } // end if
                
                // Add hover class
                $(new_el).hover(
                     function() { $(this).addClass("hover"); }
                    ,function() { $(this).removeClass("hover"); }
                );
                
                // Remove the button
                el.remove();
            } //end if
        }); // end each()
    }; //end function()
})(jQuery);

/* ------------------------------------------------------------------------------------------------------------------------------------
 * Equal height columns
 * ------------------------------------------------------------------------------------------------------------------------------------ */
$.fn.equalHeight = function(substract) {
    var tallest = 0;
    $(this).each(function() {
        var this_height = $(this).height();
        if (this_height > tallest) {
            tallest = this_height;
        } //end if
    });
    if (substract) tallest -= substract;
    $(this).height(tallest);
};

/* ------------------------------------------------------------------------
    prettyCheckboxes
    
    Developped By: Stephane Caron (http://www.no-margin-for-errors.com)
    Inspired By: All the non user friendly custom checkboxes solutions ;)
    Version: 1.1
    
    Copyright: Feel free to redistribute the script/modify it, as
               long as you leave my infos at the top.
------------------------------------------------------------------------- */
jQuery.fn.prettyCheckboxes=function(A){A=jQuery.extend({checkboxWidth:17,checkboxHeight:17,className:"prettyCheckbox",display:"list"},A);$(this).each(function(){$label=$('label[for="'+$(this).attr("id")+'"]');$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");if($(this).is(":checked")){$label.addClass("checked")}$label.addClass(A.className).addClass($(this).attr("type")).addClass(A.display);$label.find("span.holderWrap").width(A.checkboxWidth).height(A.checkboxHeight);$label.find("span.holder").width(A.checkboxWidth);$(this).addClass("hiddenCheckbox");$label.bind("click",function(){$("input#"+$(this).attr("for")).triggerHandler("click");if($("input#"+$(this).attr("for")).is(":checkbox")){$(this).toggleClass("checked");$("input#"+$(this).attr("for")).checked=true;$(this).find("span.holder").css("top",0)}else{$toCheck=$("input#"+$(this).attr("for"));$('input[name="'+$toCheck.attr("name")+'"]').each(function(){$('label[for="'+$(this).attr("id")+'"]').removeClass("checked")});$(this).addClass("checked");$toCheck.checked=true}});$("input#"+$label.attr("for")).bind("keypress",function(B){if(B.keyCode==32){if($.browser.msie){$('label[for="'+$(this).attr("id")+'"]').toggleClass("checked")}else{$(this).trigger("click")}return false}})})};checkAllPrettyCheckboxes=function(B,A){if($(B).is(":checked")){$(A).find("input[type=checkbox]:not(:checked)").each(function(){$('label[for="'+$(this).attr("id")+'"]').trigger("click");if($.browser.msie){$(this).attr("checked","checked")}else{$(this).trigger("click")}})}else{$(A).find("input[type=checkbox]:checked").each(function(){$('label[for="'+$(this).attr("id")+'"]').trigger("click");if($.browser.msie){$(this).attr("checked","")}else{$(this).trigger("click")}})}};

/*
 * jQuery Corners 0.3
 * Copyright (c) 2008 David Turnbull, Steven Wittens
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 */
jQuery.fn.corners=function(C){var N="rounded_by_jQuery_corners";var V=B(C);var F=false;try{F=(document.body.style.WebkitBorderRadius!==undefined);var Y=navigator.userAgent.indexOf("Chrome");if(Y>=0){F=false}}catch(E){}var W=false;try{W=(document.body.style.MozBorderRadius!==undefined);var Y=navigator.userAgent.indexOf("Firefox");if(Y>=0&&parseInt(navigator.userAgent.substring(Y+8))<3){W=false}}catch(E){}return this.each(function(b,h){$e=jQuery(h);if($e.hasClass(N)){return }$e.addClass(N);var a=/{(.*)}/.exec(h.className);var c=a?B(a[1],V):V;var j=h.nodeName.toLowerCase();if(j=="input"){h=O(h)}if(F&&c.webkit){K(h,c)}else{if(W&&c.mozilla&&(c.sizex==c.sizey)){M(h,c)}else{var d=D(h.parentNode);var f=D(h);switch(j){case"a":case"input":Z(h,c,d,f);break;default:R(h,c,d,f);break}}}});function K(d,c){var a=""+c.sizex+"px "+c.sizey+"px";var b=jQuery(d);if(c.tl){b.css("WebkitBorderTopLeftRadius",a)}if(c.tr){b.css("WebkitBorderTopRightRadius",a)}if(c.bl){b.css("WebkitBorderBottomLeftRadius",a)}if(c.br){b.css("WebkitBorderBottomRightRadius",a)}}function M(d,c){var a=""+c.sizex+"px";var b=jQuery(d);if(c.tl){b.css("-moz-border-radius-topleft",a)}if(c.tr){b.css("-moz-border-radius-topright",a)}if(c.bl){b.css("-moz-border-radius-bottomleft",a)}if(c.br){b.css("-moz-border-radius-bottomright",a)}}function Z(k,n,l,a){var m=S("table");var i=S("tbody");m.appendChild(i);var j=S("tr");var d=S("td","top");j.appendChild(d);var h=S("tr");var c=T(k,n,S("td"));h.appendChild(c);var f=S("tr");var b=S("td","bottom");f.appendChild(b);if(n.tl||n.tr){i.appendChild(j);X(d,n,l,a,true)}i.appendChild(h);if(n.bl||n.br){i.appendChild(f);X(b,n,l,a,false)}k.appendChild(m);if(jQuery.browser.msie){m.onclick=Q}k.style.overflow="hidden"}function Q(){if(!this.parentNode.onclick){this.parentNode.click()}}function O(c){var b=document.createElement("a");b.id=c.id;b.className=c.className;if(c.onclick){b.href="javascript:";b.onclick=c.onclick}else{jQuery(c).parent("form").each(function(){b.href=this.action});b.onclick=I}var a=document.createTextNode(c.value);b.appendChild(a);c.parentNode.replaceChild(b,c);return b}function I(){jQuery(this).parent("form").each(function(){this.submit()});return false}function R(d,a,b,c){var f=T(d,a,document.createElement("div"));d.appendChild(f);if(a.tl||a.tr){X(d,a,b,c,true)}if(a.bl||a.br){X(d,a,b,c,false)}}function T(j,i,k){var b=jQuery(j);var l;while(l=j.firstChild){k.appendChild(l)}if(j.style.height){var f=parseInt(b.css("height"));k.style.height=f+"px";f+=parseInt(b.css("padding-top"))+parseInt(b.css("padding-bottom"));j.style.height=f+"px"}if(j.style.width){var a=parseInt(b.css("width"));k.style.width=a+"px";a+=parseInt(b.css("padding-left"))+parseInt(b.css("padding-right"));j.style.width=a+"px"}k.style.paddingLeft=b.css("padding-left");k.style.paddingRight=b.css("padding-right");if(i.tl||i.tr){k.style.paddingTop=U(j,i,b.css("padding-top"),true)}else{k.style.paddingTop=b.css("padding-top")}if(i.bl||i.br){k.style.paddingBottom=U(j,i,b.css("padding-bottom"),false)}else{k.style.paddingBottom=b.css("padding-bottom")}j.style.padding=0;return k}function U(f,a,d,c){if(d.indexOf("px")<0){try{console.error("%s padding not in pixels",(c?"top":"bottom"),f)}catch(b){}d=a.sizey+"px"}d=parseInt(d);if(d-a.sizey<0){try{console.error("%s padding is %ipx for %ipx corner:",(c?"top":"bottom"),d,a.sizey,f)}catch(b){}d=a.sizey}return d-a.sizey+"px"}function S(b,a){var c=document.createElement(b);c.style.border="none";c.style.borderCollapse="collapse";c.style.borderSpacing=0;c.style.padding=0;c.style.margin=0;if(a){c.style.verticalAlign=a}return c}function D(b){try{var d=jQuery.css(b,"background-color");if(d.match(/^(transparent|rgba\(0,\s*0,\s*0,\s*0\))$/i)&&b.parentNode){return D(b.parentNode)}if(d==null){return"#ffffff"}if(d.indexOf("rgb")>-1){d=A(d)}if(d.length==4){d=L(d)}return d}catch(a){return"#ffffff"}}function L(a){return"#"+a.substring(1,2)+a.substring(1,2)+a.substring(2,3)+a.substring(2,3)+a.substring(3,4)+a.substring(3,4)}function A(h){var a=255;var d="";var b;var e=/([0-9]+)[, ]+([0-9]+)[, ]+([0-9]+)/;var f=e.exec(h);for(b=1;b<4;b++){d+=("0"+parseInt(f[b]).toString(16)).slice(-2)}return"#"+d}function B(b,d){var b=b||"";var c={sizex:5,sizey:5,tl:false,tr:false,bl:false,br:false,webkit:true,mozilla:true,transparent:false};if(d){c.sizex=d.sizex;c.sizey=d.sizey;c.webkit=d.webkit;c.transparent=d.transparent;c.mozilla=d.mozilla}var a=false;var e=false;jQuery.each(b.split(" "),function(f,j){j=j.toLowerCase();var h=parseInt(j);if(h>0&&j==h+"px"){c.sizey=h;if(!a){c.sizex=h}a=true}else{switch(j){case"no-native":c.webkit=c.mozilla=false;break;case"webkit":c.webkit=true;break;case"no-webkit":c.webkit=false;break;case"mozilla":c.mozilla=true;break;case"no-mozilla":c.mozilla=false;break;case"anti-alias":c.transparent=false;break;case"transparent":c.transparent=true;break;case"top":e=c.tl=c.tr=true;break;case"right":e=c.tr=c.br=true;break;case"bottom":e=c.bl=c.br=true;break;case"left":e=c.tl=c.bl=true;break;case"top-left":e=c.tl=true;break;case"top-right":e=c.tr=true;break;case"bottom-left":e=c.bl=true;break;case"bottom-right":e=c.br=true;break}}});if(!e){if(!d){c.tl=c.tr=c.bl=c.br=true}else{c.tl=d.tl;c.tr=d.tr;c.bl=d.bl;c.br=d.br}}return c}function P(f,d,h){var e=Array(parseInt("0x"+f.substring(1,3)),parseInt("0x"+f.substring(3,5)),parseInt("0x"+f.substring(5,7)));var c=Array(parseInt("0x"+d.substring(1,3)),parseInt("0x"+d.substring(3,5)),parseInt("0x"+d.substring(5,7)));r="0"+Math.round(e[0]+(c[0]-e[0])*h).toString(16);g="0"+Math.round(e[1]+(c[1]-e[1])*h).toString(16);d="0"+Math.round(e[2]+(c[2]-e[2])*h).toString(16);return"#"+r.substring(r.length-2)+g.substring(g.length-2)+d.substring(d.length-2)}function X(f,a,b,d,c){if(a.transparent){G(f,a,b,c)}else{J(f,a,b,d,c)}}function J(k,z,p,a,n){var h,f;var l=document.createElement("div");l.style.fontSize="1px";l.style.backgroundColor=p;var b=0;for(h=1;h<=z.sizey;h++){var u,t,q;arc=Math.sqrt(1-Math.pow(1-h/z.sizey,2))*z.sizex;var c=z.sizex-Math.ceil(arc);var w=Math.floor(b);var v=z.sizex-c-w;var o=document.createElement("div");var m=l;o.style.margin="0px "+c+"px";o.style.height="1px";o.style.overflow="hidden";for(f=1;f<=v;f++){if(f==1){if(f==v){u=((arc+b)*0.5)-w}else{t=Math.sqrt(1-Math.pow(1-(c+1)/z.sizex,2))*z.sizey;u=(t-(z.sizey-h))*(arc-w-v+1)*0.5}}else{if(f==v){t=Math.sqrt(1-Math.pow((z.sizex-c-f+1)/z.sizex,2))*z.sizey;u=1-(1-(t-(z.sizey-h)))*(1-(b-w))*0.5}else{q=Math.sqrt(1-Math.pow((z.sizex-c-f)/z.sizex,2))*z.sizey;t=Math.sqrt(1-Math.pow((z.sizex-c-f+1)/z.sizex,2))*z.sizey;u=((t+q)*0.5)-(z.sizey-h)}}H(z,o,m,n,P(p,a,u));m=o;var o=m.cloneNode(false);o.style.margin="0px 1px"}H(z,o,m,n,a);b=arc}if(n){k.insertBefore(l,k.firstChild)}else{k.appendChild(l)}}function H(c,a,e,d,b){if(d&&!c.tl){a.style.marginLeft=0}if(d&&!c.tr){a.style.marginRight=0}if(!d&&!c.bl){a.style.marginLeft=0}if(!d&&!c.br){a.style.marginRight=0}a.style.backgroundColor=b;if(d){e.appendChild(a)}else{e.insertBefore(a,e.firstChild)}}function G(c,o,l,h){var f=document.createElement("div");f.style.fontSize="1px";var a=document.createElement("div");a.style.overflow="hidden";a.style.height="1px";a.style.borderColor=l;a.style.borderStyle="none solid";var m=o.sizex-1;var j=o.sizey-1;if(!j){j=1}for(var b=0;b<o.sizey;b++){var n=m-Math.floor(Math.sqrt(1-Math.pow(1-b/j,2))*m);if(b==2&&o.sizex==6&&o.sizey==6){n=2}var k=a.cloneNode(false);k.style.borderWidth="0 "+n+"px";if(h){k.style.borderWidth="0 "+(o.tr?n:0)+"px 0 "+(o.tl?n:0)+"px"}else{k.style.borderWidth="0 "+(o.br?n:0)+"px 0 "+(o.bl?n:0)+"px"}h?f.appendChild(k):f.insertBefore(k,f.firstChild)}if(h){c.insertBefore(f,c.firstChild)}else{c.appendChild(f)}}};

/*************************************************
**  jQuery Masonry version 1.0.1
**  copyright David DeSandro, licensed GPL & MIT
**  http://desandro.com/resources/jquery-masonry
**************************************************/
;(function($){$.fn.masonry=function(options,callback){function placeBrick($brick,setCount,setY,setSpan,props){var shortCol=0;for(i=0;i<setCount;i++){if(setY[i]<setY[shortCol])shortCol=i}$brick.css({top:setY[shortCol],left:props.colW*shortCol+props.posLeft});for(i=0;i<setSpan;i++){props.colY[shortCol+i]=setY[shortCol]+$brick.outerHeight(true)}}function masonrySetup($wall,opts,props){props.$bricks=opts.itemSelector==undefined?opts.$brickParent.children():opts.$brickParent.find(opts.itemSelector);if(opts.columnWidth==undefined){props.colW=props.masoned?$wall.data('masonry').colW:props.$bricks.outerWidth(true)}else{props.colW=opts.columnWidth}props.colCount=Math.floor($wall.width()/props.colW);props.colCount=Math.max(props.colCount,1)}function masonryArrange($wall,opts,props){if(!props.masoned)$wall.css('position','relative');if(!props.masoned||opts.appendedContent!=undefined){props.$bricks.css('position','absolute')}var cursor=$('<div />');$wall.prepend(cursor);props.posTop=Math.round(cursor.position().top);props.posLeft=Math.round(cursor.position().left);cursor.remove();if(props.masoned&&opts.appendedContent!=undefined){props.colY=$wall.data('masonry').colY;for(i=$wall.data('masonry').colCount;i<props.colCount;i++){props.colY[i]=props.posTop}}else{props.colY=[];for(i=0;i<props.colCount;i++){props.colY[i]=props.posTop}}if(opts.singleMode){props.$bricks.each(function(){var $brick=$(this);placeBrick($brick,props.colCount,props.colY,1,props)})}else{props.$bricks.each(function(){var $brick=$(this);var colSpan=Math.ceil($brick.outerWidth(true)/props.colW);colSpan=Math.min(colSpan,props.colCount);if(colSpan==1){placeBrick($brick,props.colCount,props.colY,1,props)}else{var groupCount=props.colCount+1-colSpan;var groupY=[0];for(i=0;i<groupCount;i++){groupY[i]=0;for(j=0;j<colSpan;j++){groupY[i]=Math.max(groupY[i],props.colY[i+j])}}placeBrick($brick,groupCount,groupY,colSpan,props)}})}props.wallH=0;for(i=0;i<props.colCount;i++){props.wallH=Math.max(props.wallH,props.colY[i])}$wall.height(props.wallH-props.posTop);callback.call(props.$bricks);$wall.data('masonry',props)}function masonryResize($wall,opts,props){var prevColCount=$wall.data('masonry').colCount;masonrySetup($wall,opts,props);if(props.colCount!=prevColCount)masonryArrange($wall,opts,props)}return this.each(function(){var $wall=$(this);var props=$.extend({},$.masonry);props.masoned=$wall.data('masonry')!=undefined;var previousOptions=props.masoned?$wall.data('masonry').options:{};var opts=$.extend({},props.defaults,previousOptions,options);props.options=opts.saveOptions?opts:previousOptions;callback=callback||function(){};if(props.masoned&&opts.appendedContent!=undefined){opts.$brickParent=opts.appendedContent}else{opts.$brickParent=$wall}if(opts.$brickParent.children().length>0){masonrySetup($wall,opts,props);masonryArrange($wall,opts,props);var resizeOn=previousOptions.resizeable;if(!resizeOn&&opts.resizeable){$(window).bind('resize.masonry',function(){masonryResize($wall,opts,props)})}if(resizeOn&&!opts.resizeable)$(window).unbind('resize.masonry')}else{return this}})};$.masonry={defaults:{singleMode:false,columnWidth:undefined,itemSelector:undefined,appendedContent:undefined,saveOptions:true,resizeable:true},colW:undefined,colCount:undefined,colY:undefined,wallH:undefined,masoned:undefined,posTop:0,posLeft:0,options:undefined,$bricks:undefined,$brickParent:undefined}})(jQuery);

;(function($){var ua=navigator.userAgent;var moz=$.browser.mozilla&&/gecko/i.test(ua);var webkit=$.browser.safari&&/Safari\/[5-9]/.test(ua);var expr=$.browser.msie&&(function(){var div=document.createElement('div');try{div.style.setExpression('width','0+0');div.style.removeExpression('width');}
catch(e){return false;}
return true;})();function sz(el,p){return parseInt($.css(el,p))||0;};function hex2(s){var s=parseInt(s).toString(16);return(s.length<2)?'0'+s:s;};function gpc(node){for(;node&&node.nodeName.toLowerCase()!='html';node=node.parentNode){var v=$.css(node,'backgroundColor');if(v=='rgba(0, 0, 0, 0)')
continue;if(v.indexOf('rgb')>=0){var rgb=v.match(/\d+/g);return'#'+hex2(rgb[0])+hex2(rgb[1])+hex2(rgb[2]);}
if(v&&v!='transparent')
return v;}
return'#ffffff';};function getWidth(fx,i,width){switch(fx){case'round':return Math.round(width*(1-Math.cos(Math.asin(i/width))));case'cool':return Math.round(width*(1+Math.cos(Math.asin(i/width))));case'sharp':return Math.round(width*(1-Math.cos(Math.acos(i/width))));case'bite':return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));case'slide':return Math.round(width*(Math.atan2(i,width/i)));case'jut':return Math.round(width*(Math.atan2(width,(width-i-1))));case'curl':return Math.round(width*(Math.atan(i)));case'tear':return Math.round(width*(Math.cos(i)));case'wicked':return Math.round(width*(Math.tan(i)));case'long':return Math.round(width*(Math.sqrt(i)));case'sculpt':return Math.round(width*(Math.log((width-i-1),width)));case'dog':return(i&1)?(i+1):width;case'dog2':return(i&2)?(i+1):width;case'dog3':return(i&3)?(i+1):width;case'fray':return(i%2)*width;case'notch':return width;case'bevel':return i+1;}};$.fn.corner=function(options){if(this.length==0){if(!$.isReady&&this.selector){var s=this.selector,c=this.context;$(function(){$(s,c).corner(options);});}
return this;}
return this.each(function(index){var $this=$(this);var o=[options||'',$this.attr($.fn.corner.defaults.metaAttr)||''].join(' ').toLowerCase();var keep=/keep/.test(o);var cc=((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);var sc=((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);var width=parseInt((o.match(/(\d+)px/)||[])[1])||10;var re=/round|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;var fx=((o.match(re)||['round'])[0]);var edges={T:0,B:1};var opts={TL:/top|tl|left/.test(o),TR:/top|tr|right/.test(o),BL:/bottom|bl|left/.test(o),BR:/bottom|br|right/.test(o)};if(!opts.TL&&!opts.TR&&!opts.BL&&!opts.BR)
opts={TL:1,TR:1,BL:1,BR:1};if($.fn.corner.defaults.useNative&&fx=='round'&&(moz||webkit)&&!cc&&!sc){if(opts.TL)
$this.css(moz?'-moz-border-radius-topleft':'-webkit-border-top-left-radius',width+'px');if(opts.TR)
$this.css(moz?'-moz-border-radius-topright':'-webkit-border-top-right-radius',width+'px');if(opts.BL)
$this.css(moz?'-moz-border-radius-bottomleft':'-webkit-border-bottom-left-radius',width+'px');if(opts.BR)
$this.css(moz?'-moz-border-radius-bottomright':'-webkit-border-bottom-right-radius',width+'px');return;}
var strip=document.createElement('div');strip.style.overflow='hidden';strip.style.height='1px';strip.style.backgroundColor=sc||'transparent';strip.style.borderStyle='solid';var pad={T:parseInt($.css(this,'paddingTop'))||0,R:parseInt($.css(this,'paddingRight'))||0,B:parseInt($.css(this,'paddingBottom'))||0,L:parseInt($.css(this,'paddingLeft'))||0};if(typeof this.style.zoom!=undefined)this.style.zoom=1;if(!keep)this.style.border='none';strip.style.borderColor=cc||gpc(this.parentNode);var cssHeight=$.curCSS(this,'height');for(var j in edges){var bot=edges[j];if((bot&&(opts.BL||opts.BR))||(!bot&&(opts.TL||opts.TR))){strip.style.borderStyle='none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');var d=document.createElement('div');$(d).addClass('jquery-corner');var ds=d.style;bot?this.appendChild(d):this.insertBefore(d,this.firstChild);if(bot&&cssHeight!='auto'){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.bottom=ds.left=ds.padding=ds.margin='0';if(expr)
ds.setExpression('width','this.parentNode.offsetWidth');else
ds.width='100%';}
else if(!bot&&$.browser.msie){if($.css(this,'position')=='static')
this.style.position='relative';ds.position='absolute';ds.top=ds.left=ds.right=ds.padding=ds.margin='0';if(expr){var bw=sz(this,'borderLeftWidth')+sz(this,'borderRightWidth');ds.setExpression('width','this.parentNode.offsetWidth - '+bw+'+ "px"');}
else
ds.width='100%';}
else{ds.position='relative';ds.margin=!bot?'-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px':(pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';}
for(var i=0;i<width;i++){var w=Math.max(0,getWidth(fx,i,width));var e=strip.cloneNode(false);e.style.borderWidth='0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';bot?d.appendChild(e):d.insertBefore(e,d.firstChild);}}}});};$.fn.uncorner=function(){if(moz||webkit)
this.css(moz?'-moz-border-radius':'-webkit-border-radius',0);$('div.jquery-corner',this).remove();return this;};$.fn.corner.defaults={useNative:true,metaAttr:'data-corner'};})(jQuery);
/**
 * jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
 * @requires jQuery v1.2 or above
 *
 * http://gmarwaha.com/jquery/jcarousellite/
 *
 * Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 * Version: 1.0.1
 * Note: Requires jquery 1.2 or above from version 1.0.1
 */
/**
 * Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
 *
 * The HTML markup that is used to build the carousel can be as simple as...
 *
 *  <div class="carousel">
 *      <ul>
 *          <li><img src="image/1.jpg" alt="1"></li>
 *          <li><img src="image/2.jpg" alt="2"></li>
 *          <li><img src="image/3.jpg" alt="3"></li>
 *      </ul>
 *  </div>
 *
 * As you can see, this snippet is nothing but a simple div containing an unordered list of images.
 * You don't need any special "class" attribute, or a special "css" file for this plugin.
 * I am using a class attribute just for the sake of explanation here.
 *
 * To navigate the elements of the carousel, you need some kind of navigation buttons.
 * For example, you will need a "previous" button to go backward, and a "next" button to go forward.
 * This need not be part of the carousel "div" itself. It can be any element in your page.
 * Lets assume that the following elements in your document can be used as next, and prev buttons...
 *
 * <button class="prev">&lt;&lt;</button>
 * <button class="next">&gt;&gt;</button>
 *
 * Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
 * navigation buttons as options.
 *
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 *
 * That's it, you would have now converted your raw div, into a magnificient carousel.
 *
 * There are quite a few other options that you can use to customize it though.
 * Each will be explained with an example below.
 *
 * @param an options object - You can specify all the options shown below as an options object param.
 *
 * @option btnPrev, btnNext : string - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev"
 * });
 * @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
 *
 * @option btnGo - array - no defaults
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      btnGo: [".0", ".1", ".2"]
 * });
 * @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
 * the item number within the carousel, you can use this option. Just supply an array of selectors for each element
 * in the carousel. The index of the array represents the index of the element. What i mean is, if the
 * first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
 * will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
 * interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
 * any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
 * The best part is that, the tab will "slide" based on the provided effect. :-)
 *
 * @option mouseWheel : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      mouseWheel: true
 * });
 * @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
 * To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
 * Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
 * using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
 * as well. They complement each other. To use both together, just supply the options required for both as shown below.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      mouseWheel: true
 * });
 *
 * @option auto : number - default is null, meaning autoscroll is disabled by default
 * @example
 * $(".carousel").jCarouselLite({
 *      auto: 800,
 *      speed: 500
 * });
 * @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
 * The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
 * Specify this value and magically your carousel will start auto scrolling.
 *
 * @option speed : number - 200 is default
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      speed: 800
 * });
 * @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
 * different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
 *
 * @option easing : string - no easing effects by default.
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      easing: "bounceout"
 * });
 * @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
 * the carousel will slide based on the provided easing effect.
 *
 * @option vertical : boolean - default is false
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      vertical: true
 * });
 * @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
 * prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
 * display horizontally. The next and prev items will slide the items from left-right in this case.
 *
 * @option circular : boolean - default is true
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      circular: false
 * });
 * @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
 * element, you will automatically slide to the first element and vice versa. If you set circular to false, then
 * if you click on the "next" button after you reach the last element, you will stay in the last element itself
 * and similarly for "previous" button and first element.
 *
 * @option visible : number - default is 3
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      visible: 4
 * });
 * @desc This specifies the number of items visible at all times within the carousel. The default is 3.
 * You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
 * last item half visible. This gives you the effect of showing the user that there are more images to the right.
 *
 * @option start : number - default is 0
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      start: 2
 * });
 * @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
 * has a start of 0, and so on.
 *
 * @option scrool : number - default is 1
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      scroll: 2
 * });
 * @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
 * default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
 * 2 items when you click the next or previous buttons.
 *
 * @option beforeStart, afterEnd : function - callbacks
 * @example
 * $(".carousel").jCarouselLite({
 *      btnNext: ".next",
 *      btnPrev: ".prev",
 *      beforeStart: function(a) {
 *          alert("Before animation starts:" + a);
 *      },
 *      afterEnd: function(a) {
 *          alert("After animation ends:" + a);
 *      }
 * });
 * @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
 * register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
 * are visible at the time of callback.
 *
 *
 * @cat Plugins/Image Gallery
 * @author Ganeshji Marwaha/ganeshread@gmail.com
 */
(function($) {                                          // Compliant with jquery.noConflict()
$.fn.jCarouselLite = function(o) {
    o = $.extend({
        btnPrev: null,
        btnNext: null,
        btnGo: null,
        mouseWheel: false,
        auto: null,
        speed: 200,
        easing: null,
        vertical: false,
        circular: true,
        visible: 3,
        start: 0,
        scroll: 1,
        beforeStart: null,
        afterEnd: null
    }, o || {});
    return this.each(function() {                           // Returns the element collection. Chainable.
        var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
        var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
        if(o.circular) {
            ul.prepend(tLi.slice(tl-v-1+1).clone())
              .append(tLi.slice(0,v).clone());
            o.start += v;
        }
        var li = $("li", ul), itemLength = li.size(), curr = o.start;
        div.css("visibility", "visible");
        li.css({width: "227px", overflow: "hidden", float: o.vertical ? "none" : "left"});
        ul.css({margin: "0", top: "85px", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
        div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
        var liSize = o.vertical ? height(li) : width(li);   // Full li size(incl margin)-Used for animation
        var ulSize = liSize * itemLength;                   // size of full ul(total length, not just for the visible items)
        var divSize = liSize * v;                           // size of entire div(total length for just the visible items)
        var liMaxHeight = 0;
        li.each(function(){
         if($(this).height() > liMaxHeight){
          liMaxHeight=$(this).height();
         }
        });
        li.css({width: li.width(), height: liMaxHeight});
        ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
        div.css(sizeCss, divSize+"px");                     // Width of the DIV. length of visible images
        if(o.btnPrev) {
            if (o.start == 0 && !o.circular) $(o.btnPrev).addClass("disabled");
            $(o.btnPrev).click(function() {
                go(curr-o.scroll);
                return false;
            });
        }
        if(o.btnNext)
            $(o.btnNext).click(function() {
                go(curr+o.scroll);
                return false;
            });
        if(o.btnGo)
            $.each(o.btnGo, function(i, val) {
                $(val).click(function() {
                    return go(o.circular ? o.visible+i : i);
                });
            });
        if(o.mouseWheel && div.mousewheel)
            div.mousewheel(function(e, d) {
                return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
            });
        if(o.auto)
            setInterval(function() {
                go(curr+o.scroll);
            }, o.auto+o.speed);
        function vis() {
            return li.slice(curr).slice(0,v);
        };
        function go(to) {
            if(!running) {
                if(o.beforeStart)
                    o.beforeStart.call(this, vis());
                if(o.circular) {            // If circular we are in first or last, then goto the other end
                    if(to<=o.start-v-1) {           // If first, then goto last
                        ul.css(animCss, -((itemLength-(v*2))*liSize)+"px");
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be lesser depending on the number of elements.
                        curr = to==o.start-v-1 ? itemLength-(v*2)-1 : itemLength-(v*2)-o.scroll;
                    } else if(to>=itemLength-v+1) { // If last, then goto first
                        ul.css(animCss, -( (v) * liSize ) + "px" );
                        // If "scroll" > 1, then the "to" might not be equal to the condition; it can be greater depending on the number of elements.
                        curr = to==itemLength-v+1 ? v+1 : v+o.scroll;
                    } else curr = to;
                } else {                    // If non-circular and to points to first or last, we just return.
                    if(to<0 || to>itemLength-v) return;
                    else curr = to;
                }                           // If neither overrides it, the curr will still be "to" and we can proceed.
                running = true;
                ul.animate(
                    animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
                    function() {
                        if(o.afterEnd)
                            o.afterEnd.call(this, vis());
                        running = false;
                    }
                );
                // Disable buttons when the carousel reaches the last/first, and enable when not
                if(!o.circular) {
                    $(o.btnPrev + "," + o.btnNext).removeClass("disabled");
                    $( (curr-o.scroll<0 && o.btnPrev)
                        ||
                       (curr+o.scroll > itemLength-v && o.btnNext)
                        ||
                       []
                     ).addClass("disabled");
                }
            }
            return false;
        };
    });
};
function css(el, prop) {
    return parseInt($.css(el[0], prop)) || 0;
};
function width(el) {
    return  el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
    return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};
})(jQuery);
// Just a couple browser tests
var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase());
var is_win = /windows/.test(navigator.userAgent.toLowerCase());
var is_firefox = /firefox/.test(navigator.userAgent.toLowerCase());

jQuery(function() {
    
    // !Browsers
    if (jQuery.browser.safari)         jQuery("body").addClass("sfr");
    if (is_chrome)                 jQuery("body").addClass("chr");
    if (is_win && is_firefox)     jQuery("body").addClass("ffwin");
    
    
    // Navigation IE6 fix
    if (jQuery.browser.msie && jQuery.browser.version < 7) {
        jQuery("#nav > ul > li").each(function() {
            // Add rel
            var rel = jQuery(this).attr("rel", cl);
            var cl = jQuery(this).attr("class");
            cl = cl.split(" "); cl = cl[0];
            jQuery(this).attr("rel", cl);
            
            // Hover
            jQuery(this).hover(
                 function() { jQuery(this).addClass(jQuery(this).attr("rel")+"-hover");         jQuery(this).addClass("hover"); }
                ,function() { jQuery(this).removeClass(jQuery(this).attr("rel")+"-hover");     jQuery(this).removeClass("hover"); }
            );
        });
    } //end if
    
    
    // Home
    jQuery("#home .col:first").addClass("first");
    
    
    // Tripple cols
    jQuery(".tripple-col").each(function() {
        jQuery(this).children(".col:eq(0)").addClass("col1");
        jQuery(this).children(".col:eq(1)").addClass("col2");
        jQuery(this).children(".col:eq(2)").addClass("col3");
    });
    
    
    // Carousel
    jQuery("#home .news-slide-1").jCarouselLite({
         btnNext: ".news-slide-1 .next"
        ,btnPrev: ".news-slide-1 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');
    jQuery("#home .news-slide-2").jCarouselLite({
         btnNext: ".news-slide-2 .next"
        ,btnPrev: ".news-slide-2 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');
    jQuery("#home .news-slide-3").jCarouselLite({
         btnNext: ".news-slide-3 .next"
        ,btnPrev: ".news-slide-3 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');
    jQuery("#cont .tripple-col .news-slide-1").jCarouselLite({
         btnNext: ".news-slide-1 .next"
        ,btnPrev: ".news-slide-1 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');
    jQuery("#cont .tripple-col .news-slide-2").jCarouselLite({
         btnNext: ".news-slide-2 .next"
        ,btnPrev: ".news-slide-2 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');
    jQuery("#cont .tripple-col .news-slide-3").jCarouselLite({
         btnNext: ".news-slide-3 .next"
        ,btnPrev: ".news-slide-3 .prev"
        ,visible: 1
        ,circular: false
    }).css('position', 'absolute');       
    
    // !Flash News
    jQuery("#flash-news ul").flashnews();
    
    
    // Navigation hacks
    jQuery("#nav ul li ul").each(function() {
        jQuery(this).children("li:first").addClass("first");
        jQuery(this).children("li:last").addClass("last");
    });
    
    
    // !Sign-In drop down
    jQuery(document).ready(function(){
        jQuery("#meta .signin > a").click(function() {
            jQuery(this).blur();
            jQuery(this).parent().toggleClass("signin-open");
            return false;
        });
    });
    /*jQuery("body").not("#meta .signin > a").click(function() {
        jQuery("#meta .signin").removeClass("signin-open");
        //return false;
    });*/
    
    
    
    // !Input fields
    jQuery("input[type=text], input[type=password]").addClass("txt");
    jQuery("input[type=checkbox]").addClass("chk");
    if (jQuery.browser.msie) jQuery("select.error").wrap('<span class="error"></span>');
    
    
    
    // !Button hover
    jQuery("button, input[type=submit,button]").hover(
         function() { jQuery(this).addClass("hover"); }
        ,function() { jQuery(this).removeClass("hover"); }
    );
    jQuery("a.btn, a.btn em").hover(
         function() { jQuery(this).addClass("btnhover"); }
        ,function() { jQuery(this).removeClass("btnhover"); }
    );
    
    
    
    // !Div links
    jQuery("#home .promo").divlink();
    jQuery("#flash-news li, .related-videos li, #aside .promo, #aside .subscribe, #cont .pretext .promo").divlink();
    jQuery(".article-overview .article, .issues li").divlink();
    
    
    // Rounded corners
    jQuery("#subnav ul ul a.on").corners("2px");
    jQuery("table.stats").each(function() {
        jQuery(this).children("tbody tr.on:first th").corner("3px tl");
        jQuery(this).children("tbody tr.on:first td").corner("3px tr");
        jQuery(this).children("tbody tr.on:last th").corner("3px bl");
        jQuery(this).children("tbody tr.on:last td").corner("3px br");
    });
    
    
    
    // Sign in link hover
    jQuery(".signin ul li a").hoverpush();
    
    
    
    // Sidebar profiles
    jQuery("#aside li:last").addClass("last");
    
    
    
    // !Set custom buttons
    jQuery("input[type=submit], input[type=reset], input[type=button], button").customButton();
    
    
    
    // Masonry
    jQuery("ul.sitemap").masonry({
         columnWidth:     235
        ,itemSelector:     '.box'
        ,singleMode: true
    });

    jQuery(document).ready(function(){
        //jQuery(".issue .cover img").attr("title",jQuery(".issue .cover img").attr("alt"));
        jQuery(".issue .cover img").each(function(){
            jQuery(this).attr("title",jQuery(this).attr("alt"));
        });
        jQuery(".issues ul li img").each(function(){
            jQuery(this).attr("title",jQuery(this).attr("alt"));
        });
    
    });
    

    
});


function getUrlVars()
{
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?')+1).split('&');
    for(var i = 0; i<hashes.length; i++)
    {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]]=hash[1];
    }
    return vars;
}
jQuery("document").ready(function(){
    if(jQuery("#iframeStyle") != null && getUrlVars()["purpose"] != null && getUrlVars()["purpose"] != "")
    {
        jQuery("#iframeStyle").attr("src",jQuery("#iframeStyle").attr("src") +"?purpose="+ getUrlVars()["purpose"]);
    }
});
 


jQuery(function() {
    jQuery(".slim").expandAll({trigger: "h2.expand", ref: "div.slim", showMethod: "slideDown", hideMethod: "slideUp", speed: 400});
    jQuery("h2.expand").toggler({method: "slideFadeToggle"});    
});
  });


function submitForm(elem){
    try{
        if(elem.options[elem.selectedIndex].value){
            location.href=elem.options[elem.selectedIndex].value;
        }
    }catch(e){}
}
