jQuery.noConflict();


  
(function($) {
$(document).ready(function() {
  
  var days = 1;
  
  function showComment(){
     var text = jQuery("#tx_comments_pi1_content").val();
     var empty = !( ( typeof(text) != "undefined" ) && ( text.length > 2 ) );
     empty ? jQuery(".showlater").hide() : jQuery(".showlater").show(500);
  }
  
  jQuery("#tx_comments_pi1_content").keyup( function(){
     var text = jQuery("#tx_comments_pi1_content").val();
     var empty = !( ( typeof(text) != "undefined" ) && ( text.length > 2 ) );
     empty ? jQuery(".showlater").hide() : jQuery(".showlater").show(500);
  } );
  
  showComment();
  


  jQuery(".draggable").each( function( index ){
    jQuery(this).css( "left", $.cookie( "im_" + this.id + "_left") );
    jQuery(this).css( "top", $.cookie( "im_" + this.id + "_top") );
  });

  $(".draggable").draggable({cursor: "move"});
  $('.draggable').show(); 
  $('.draggable').bind('dragstop', savePos);
  
  function savePos( event, ui ){
    $.cookie("im_" + this.id + "_left", $(this).css("left"), { path: '/', expires: days });
    $.cookie("im_" + this.id + "_top", $(this).css("top"), { path: '/', expires: days });
  }
  
$("#copySource a").click(function(){ 
  
  var i = 0;
  var sourceCode = "";
  
  // parse website and save sourcecode in "sourceCode"
  $(".tx-semasourcecode-pi1").each(function(){

    sourceCode += "\n/*\nSECTION " + ++i + " (" + 
      $(this).find("pre:first").attr("class") + 
      ")\n=======================\n*/\n\n"; 
      
    $(this).find("li").each(function(){
      sourceCode += $(this).text() + "\n";
    });
    
  });
  
  // fade out the link and fade in the textarea 
  $(this).fadeOut(500, function(){
    $("#copySource").append( 
      "<textarea cols='60' rows='20'>" + 
      sourceCode + "</textarea>").hide().fadeIn(500);
  });
  
  return( false );
});



});
})(jQuery)
