var display_state = "player";

function toggle_display() {
	$j.each(["player","seo_body","seo_meta","links"], function(i,display_str) {

		var div_selector = "#"+display_str+"_code";
		if(display_str == display_state) {
			$j(div_selector).show();
		}
		else {
			$j(div_selector).hide();
		}
	});
}

$j(document).ready(function(){
	
	toggle_display();
	
	$j('.ldt_json_link').click(function(e) {
    	e.preventDefault();
 		link = $j(e.target);
 		$j("#res_link_{{player_id}}").load(link.attr("href"));
 		$j("#res_link_{{player_id}}").show();
 		return false;
    });

    $j('#player_button').click(function(e) {
    	display_state = "player";
    	toggle_display();
    });
    $j('#seo_body_button').click(function(e) {
    	display_state = "seo_body";
    	toggle_display();
    });
    $j('#seo_meta_button').click(function(e) {
    	display_state = "seo_meta";
    	toggle_display();
    });
    $j('#links_button').click(function(e) {
    	display_state = "links";
    	toggle_display();
    });

   $j("#copy_button").click(function(e) {
 	   alert($j("#"+display_state+"_code").html());
   });	 	    
    
});
