function docwidth(){
$r = document.documentElement.clientWidth;
return $r;}

$(document).ready(function(){

 $(".mute").click(function(event){
   event.preventDefault();
 });

var elements = {};

$.fn.makeAbsolute = function(rebase) {
    return this.each(function() {
        var el = $(this);
        var pos = el.position();
        el.css({ position: "fixed",
            top: pos.top, left: pos.left });
        if (rebase)
            el.remove().appendTo("body");
    });
}

if(navigator.userAgent.match(/iPhone/i)){

}else{
/*$("#sidebar").makeAbsolute();
window.onresize = doResize;

function doResize(){
	$("#sidebar").css({position:'relative',top:'auto',left:'auto'}).makeAbsolute();
}*/

}




//strippx

//	var sidebarX = sidebarjq.[0].offsetLeft.replace('px','') - window.scrollLeft;
//	var sidebarY = sidebarjq.[0].offsetTop.replace('px','') - window.scrollTop ;
	
//	alert(sidebarX + ' ' + sidebarY)
	
//	sidebarjq.css({left:( sidebarX + 'px' ),top:( sidebarY + 'px' ),position:'fixed'});
 

    $(".themenucontainer:not(.isopen)").bind("mouseenter", function(e){
        openmenu();
    });
    
    $("div:not(.isopen) .menutrigger").bind("click", function(e){
        openmenu();
    });
    
    $("div.isopen .menutrigger,.j_closenav").bind("click", function(e){
        closemenu();
    });

var sitetitle_fx = $(".sitetitle_fx");

$(".sitetitle_c").hover(function(){
 sitetitle_fx.animate({opacity: '.9'},{queue:false, duration:400});
},function(){
 sitetitle_fx.animate({opacity: '.3'},{queue:false, duration:400});
});


function openmenu(){
   var howfar = $(".navmain").css('width');
   howfar = parseFloat(howfar.substring(0,howfar.indexOf('px')))
   howfar += 100;
//   alert(howfar);
   $(".themenucontainer").animate({width: (howfar)},{queue:false, duration:400 }).removeClass('.isactive');
}

function closemenu(){
 $(".themenucontainer").animate({width: "100px"},400,function(){$(".themenucontainer").addClass('isactive');});
}
 
$(".j_closenav").click(function(){

 });

// .animate(){font-size:100%},{queue:true, duration:40 })
	
	
$('.nosign_c,.menutrigger').hover(function(){$(this).addClass('hover')
},function(){$(this).removeClass('hover')})


$('.themenucontainer:not(.isactive) .feedicon')
	.css( {backgroundPosition: "0 0"} )
	.mouseover(function(){
		$(this).stop().animate(
			{backgroundPosition:"32px 0"}, 
			{duration:250})
		})
	.mouseout(function(){
		$(this).stop().animate(
			{backgroundPosition:"64px 0"},250,function(){$(this).css( {backgroundPosition: "0 0"} )})
		})
		
$('*[rel~="external"]').attr('target','_blank');

});