$(document).ready(function(){

    colWidth();
    
    $opened=false;
	$arrowOpen="images/contact_arrow_open.png";
	$arrowClose="images/contact_arrow_close.png";
    $("div#contact-btn").live('click', function(e){
        if(e.type=='click' && $opened){ //close panel
            $opened=false;
            $("#contact-btn span img").attr("src", $arrowOpen);
            $("div#contact-js").animate({right:"-355px"}, "fast").animate({right:"-345px"}, "fast");
            $(this).removeClass("opened").addClass("closed");
        }else if(e.type=='click' && !$opened){ //open panel
            $opened=true;
            $("#contact-btn span img").attr("src", $arrowClose);
            $("div#contact-js").animate({right:"0px"}, "fast").animate({right:"-10px"}, "fast");
            $(this).removeClass("closed").addClass("opened");
        }
    });

    $(window).resize(function() {
        colWidth();
    });

});

function colWidth(){
    var pWidth = $("div#yui-main div.yui-b div.yui-gc").width();
    var contentWidth = $(".yui-gc div.first, .yui-gd .yui-u");
    if (pWidth>1275){
        $(contentWidth).css({"width" : "72%"});
    }else if(pWidth<=1274 && pWidth>1100){
        $(contentWidth).css({"width" : "66%"});
    }else if(pWidth<=1099 && pWidth>880){
        $(contentWidth).css({"width" : "60%"});
    }else{
        $(contentWidth).css({"width" : "55%"});
    }
}
