$(document).ready(function(){
	
	
	$('.roundedcorner').corner();

	
 
 	$(".sidebarbutton").click(function(){
      
                //hide the sidebar
    			if( parseInt($(".sidebar").css("width"))>8)
                {
                    $(".sidebar").css("overflow","auto");
            		$(".sidebar").animate({
                     	 width: "85px"
                    }, 750 );
      
                    setTimeout("$('.sidebar').animate({width: '8px',marginLeft: '76px'}, 500 );",300);
      
                  	setTimeout("$('.field').animate({marginLeft: '10px'}, 500 );",1500);
      
                    $(".sidebarbutton").css("backgroundImage","url(images/sidebarshowover.png)");
      	
                }
                else  //show the sidebar
                {
                    $(".sidebar").css("overflow","hidden");
                    $('.sidebar').animate({width: '85px',marginLeft: '0px'}, 1000 );
      	
                  	setTimeout("$('.field').animate({marginLeft: '100px'}, 500 );",500);
				
                	setTimeout("$('.sidebar').animate({width: '170px'}, 750 );",1000);
      
                    $(".sidebarbutton").css("backgroundImage","url(images/sidebarhide.png)");
                }
      
    });


    
    
    $(".sidebarbutton").mouseout(function(){
    	//sidebar not hidden
			if(parseInt($(".sidebar").css("width"))>8)
    	{
    		$(".sidebarbutton").css("backgroundImage","url(images/sidebarhide.png)");    	
    	}
    	else //sidebar hidden
    	{
    		$(".sidebarbutton").css("backgroundImage","url(images/sidebarshow.png)");    	
    	} 
  	});


  	
  	
  	$(".sidebarbutton").mouseover(function(){
    	//sidebar not hidden
			if(parseInt($(".sidebar").css("width"))>8)
    	{
    		$(".sidebarbutton").css("backgroundImage","url(images/sidebarhideover.png)");    	
    	}
    	else //sidebar hidden
    	{
    		$(".sidebarbutton").css("backgroundImage","url(images/sidebarshowover.png)");    	
    	}
 
 
  	});
  	
  	
  	
  	
  	$(".toplinks").mouseover(function(){
  		$(this).animate({opacity: "0.5"}, 600 );
  	});
  	
  	$(".toplinks").mouseout(function(){
  		$(this).animate({opacity: "1.0"}, 1800 );
  	});
  	
  	$(".sidebarlinks").mouseover(function(){
  		$(this).animate({opacity: "0.3"}, 600 );
  		$(this).parent().css({"backgroundImage":"url(images/tinylogo.png)","background-repeat":"no-repeat","background-position":"right"});
       
  	});
  	
  	$(".sidebarlinks").mouseout(function(){
  		$(this).animate({opacity: "1.0"}, 1800 );
  		$(this).parent().css({"backgroundImage":"url()"});
       
  	});


    	$(".sidebarsublink").mouseover(function(){
  		$(this).animate({opacity: "0.3"}, 600 );
  		$(this).parent().css({"backgroundImage":"url(images/tinytinylogo.png)","background-repeat":"no-repeat","background-position":"bottom right"});

  	});

  	$(".sidebarsublink").mouseout(function(){
  		$(this).animate({opacity: "1.0"}, 1800 );
  		$(this).parent().css({"backgroundImage":"url()"});

  	});

		
		$("#tools").mouseover(function(){
  		$(this).css({opacity: "1.0"});
  	});
  	
  	$("#tools").mouseout(function(){
  		$(this).css({opacity: "0.2"});
  	});
  	
  	$("#tools").css("opacity","0.2");
		
		
	//	$(".wrapper").show(1500);
			
		  	

    $(".enlargeimage").click(function(){
        var tempSrc = $(this).attr("src");
        if(tempSrc.match("_big.jpg")==null){ $(this).attr("src",tempSrc.split(".")[0]+"_big.jpg"); }
            var w = Math.round((parseInt($(this).css("width")))+80);
            var h = Math.round((parseInt($(this).css("height")))+80);
            
            $(this).animate({"width":w+"px","height":h+"px"},500);
       // }
    });


/*
    $(".programmetable td").mouseover(function(){
       $(this).animate({"opacity":"0.7"},800);
    });

    $(".programmetable td").mouseout(function(){
       $(this).animate({"opacity":"1.0"},800);
    });
*/


//preload images
    $(".preloader").css("backgroundImage","url(images/submitpaperOver.jpg)");
    $(".preloader").css("backgroundImage","url(images/submitpaperOver.jpg)");
    $(".preloader").css("backgroundImage","url(images/tinylogo.png)");
    $(".preloader").css("backgroundImage","url(images/tinytinylogo.png)");




});  //function ready


    
    function sidebarToggle(sublinksid){
        $(".sidebarsublinks").each(function(){

        if($(this).attr("id") != sublinksid) $(this).slideUp(200);
        
        });



        $("#"+sublinksid).slideToggle(200,function(){var h = document.getElementById("sidebarid").offsetHeight; $(".sidebarbottom").css("top",h+"px"); });
    }

    


    var timerID;
	function startIncreaseFontSize()
	{
		timerID = setInterval("increaseFontSize()",10);
	}

	function stopIncreaseFontSize()
	{
		clearInterval(timerID);
	}

	function increaseFontSize()
	{
		var size = parseInt($(".field").css("fontSize"));
		$(".field").css({fontSize:(size+1)+"px"});

	}

    
	function startDecreaseFontSize()
	{
		timerID = setInterval("decreaseFontSize()",10);
	}
	
	function stopDecreaseFontSize()
	{
		clearInterval(timerID);
	}
	
	function decreaseFontSize()
	{
		var size = parseInt($(".field").css("fontSize"));
		$(".field").css({fontSize:(size-1)+"px"});
	}


    function startZoomInTable()
	{
		timerID = setInterval("zoomInTable()",10);
	}


    function stopZoomInTable()
	{
		clearInterval(timerID);
	}


    function zoomInTable()
    {
       var size = parseInt($(".programmetable td").css("fontSize"));
       $(".programmetable td").css({fontSize:(size+1)+"px"});
       size = parseInt($(".programmetable th").css("fontSize"));
       $(".programmetable th").css({fontSize:(size+1)+"px"});
    }



    function startZoomOutTable()
	{
		timerID = setInterval("zoomOutTable()",10);
	}


    function stopZoomOutTable()
	{
		clearInterval(timerID);
	}


    function zoomOutTable()
    {
       var size = parseInt($(".programmetable td").css("fontSize"));
       $(".programmetable td").css({fontSize:(size-1)+"px"});
       size = parseInt($(".programmetable th").css("fontSize"));
       $(".programmetable th").css({fontSize:(size-1)+"px"});
    }

