/**
 * @author Administrator
 */
jQuery(document).ready(function($){

	var randomImages = ['node-background1','node-background2','node-background3'];
  	var rndNum = Math.ceil(Math.random() * randomImages.length);
        var res = 0;
          if (screen.width <= 1024) {
              res  = "1024"
          }
          else if ((screen.width > 1024) && (screen.width <= 1600))
          {
                res  = "1600"
                //$('#back').css("background-image", "url(../images/coffeenerd/1024.jpg)");
          }
          else if ((screen.width > 1600) && (screen.width <= 1920)) {
                
                res  = "1920"
                //$('#back').css("background-image", "url(../images/coffeenerd/1280.jpg)");
          }


	$("html").css('background','#000 url(http://thenode.biologists.com/wp-content/themes/starkers/style/images/backgrounds/node-background' + rndNum + '_' + res + '.jpg) no-repeat');
        var searchBox = $('#s');
        var searchBoxDefault = "Search term...";
        var topPostId = $('.post:first-child').attr('id');


//		alert('ell' + topPostId);

        $('.box_text').jScrollPane();
        $('.box_text').jScrollPane({showArrows:true});


         searchBox.focus(function(){
             if($(this).attr("value") == searchBoxDefault) $(this).attr("value", "");
         });
          searchBox.blur(function(){
             if($(this).attr("value") == "") $(this).attr("value", searchBoxDefault);
         });

	   $(".post:first-child .post_hide").click(function () {
  	  $(this).parent().next().fadeOut();
  	  $('#' + topPostId).addClass('on');

    });

	$(".post .post_hide").click(function () {
        $(this).parent().next().fadeOut();
    });

     $(".post_show").click(function () {
      $(this).parent().next().fadeIn();

    });


    $("#dev_widgets .post_hide").click(function () {
	  $(this).parent().parent().next().fadeOut();
    });

    $("#dev_widgets .post_show").click(function () {
	  $(this).parent().parent().next().fadeIn();
    });

    $(".close").click(function () {
	  $(this).parent().parent().parent().parent().parent().parent().hide();
    });
     //$(".post").hide();

     $("#page > #main_back").css({"opacity":0.4,"background-color":"white","color":"white"});


	if ($('#main_content').height() >  $('#wp_sidebar').height()) {
		$('#wp_sidebar').height($('#main_content').height());
	} else {
		$('#page > #main_back').height($('#wp_sidebar').height());
	}

	//$('#page > #main_back').height($('#wp_sidebar').height());
     //set the starting bigestHeight variable
	//var biggestHeight = 0;
	//check each of them
	//$('.equal_height').each(function(){
		//if the height of the current element is
		//bigger then the current biggestHeight value
//	if($(this).height() > biggestHeight){
			//update the biggestHeight with the
			//height of the current elements
//			biggestHeight = $(this).height();
//		}
//	});

	//when checking for biggestHeight is done set that
	//height to all the elements



  });
