$(function(){ 
$('body').hide();
$("body").fadeIn(1000);
$("#page").css('height', $(window).height()); 
$(".contentin").css('height', $(window).height() - 40); 
$(".page2").css('height', $(window).height() - 43); 

$(window).bind('resize', function(){
$("#page").css('height', $(window).height()); 
$(".contentin").css('height', $(window).height() - 40); 
$(".page2").css('height', $(window).height() - 43); 
});

tooltip();

$("#top .slideall").click(function(){
$(".content").animate({width: "0px"},300);
$(".header").css("background-position", "2px 50px");
$("body").css('width', $(window).width()); 
});

haccordions();
$(".contentin").jScrollPane({showArrows:true, wheelSpeed:100, scrollbarWidth:3});
//$(".page2").jScrollPane({showArrows:true, wheelSpeed:100, scrollbarWidth:3});
 
$(".btn-slide").click(function(){
		$("#panel").slideToggle("fast");
		$("#panel ul").slideToggle("fast");
		$(this).toggleClass("active"); 
		return false;
});

$("#wrapper").mouseover(function(){
		$("#panel").slideUp("fast");
		$("#panel ul").slideUp("fast");
		});
		
$('.linetop').each(function(){
$(this).css('height', $(this).text()*5+'px'); 
}); 

$('a.linetop, #menu2 ul li a').click(function(){
var rel = $(this).attr('rel');
var p = $("div#"+rel);
var position = p.position();
$('body').scrollTo( {top:'0px',left:position.left-300}, 800);
$(".content").animate({width: "0px"},300);
$(p).animate({width: "300px"},300);
$(".header").css("background-position", "2px 50px");
$("body").css('width', $(window).width()); 
$("#panel").slideUp("fast");
$("#panel ul").slideUp("fast");
return false;
});


$('.linetop').mouseenter(function(){
    var thisid = $(this).attr('id').split('-');
    $('#menu-'+thisid[1]).parent().animate({backgroundColor: '#FF6A00'}, 'fast');
    $('#menu-'+thisid[1]).animate({color: '#FFFFFF'}, 'fast');
		}).mouseleave(function(){
    var thisid = $(this).attr('id').split('-');
    $('#menu-'+thisid[1]).parent().animate({backgroundColor: '#DFDFDF'}, 'fast');
    $('#menu-'+thisid[1]).animate({color: '#FF6A00'}, 'fast');
		});


$("#menu2 ul li").mouseenter(function(){
    var thisid = $(this).children().attr('id').split('-');
    $('#line-'+thisid[1]).animate({backgroundColor: '#FF6A00'}, 'fast');
		$(this).animate({backgroundColor: '#FF6A00'}, 'fast');
		$(this).children('a').animate({color: '#FFFFFF'}, 'fast');
		}).mouseleave(function(){
    var thisid = $(this).children().attr('id').split('-');
    $('#line-'+thisid[1]).animate({backgroundColor: '#FFFFFF'}, 'fast');
		$(this).animate({backgroundColor: '#DFDFDF'}, 'fast');
		$(this).children('a').animate({color: '#FF6A00'}, 'fast');
		});


$("input[type='checkbox']").click(function(){
var v = $("input[name='label']").getValue();
$("#cat").val(v+",||");
}); 



$("#labels div").hide();




$("#TvTagCloud").tagoSphere(settings);
$("#TvTagCloudStaticColco ul").tagcloud({type:"sphere",sizemin:8,sizemax:28,power:0});
$("#TvTagCloudStaticBuket ul").tagcloud({type:"sphere",sizemin:8,sizemax:28,power:1.3});
$("#TvTagCloudStaticList ul").tagcloud({type:"list",sizemin:8,sizemax:28});
$("#TvTagCloudStaticCloud ul").tagcloud();

$("#TvTagCloudStaticColco, #TvTagCloudStaticBuket, #TvTagCloudStaticList, #TvTagCloudStaticCloud").hide();

$("#Colco").click(function(){
$("#TvTagCloudStaticColco").show();
$("#TvTagCloud, #TvTagCloudStaticBuket, #TvTagCloudStaticList, #TvTagCloudStaticCloud").hide();
return false;
}); 

$("#Buket").click(function(){
$("#TvTagCloudStaticBuket").show();
$("#TvTagCloud, #TvTagCloudStaticColco, #TvTagCloudStaticList, #TvTagCloudStaticCloud").hide();
return false;
}); 

$("#List").click(function(){
$("#TvTagCloudStaticList").show();
$("#TvTagCloud, #TvTagCloudStaticColco, #TvTagCloudStaticBuket, #TvTagCloudStaticCloud").hide();
return false;
}); 

$("#Cloud").click(function(){
$("#TvTagCloudStaticCloud").show();
$("#TvTagCloud, #TvTagCloudStaticColco, #TvTagCloudStaticBuket, #TvTagCloudStaticList").hide();
return false;
}); 

$("#Sphere").click(function(){
$("#TvTagCloud").show();
$("#TvTagCloudStaticColco, #TvTagCloudStaticBuket, #TvTagCloudStaticList, #TvTagCloudStaticCloud").hide();
return false;
}); 



/*********************/
}); 
	var settings = {
                //height of sphere container
                height: 600,
                //width of sphere container
                width: 700,
                //radius of sphere
                radius: 250,
                //rotation speed
                speed: 1,
                //sphere rotations slower
                slower: 0.97,
                //delay between update position
                timer: 10,
                //dependence of a font size on axis Z
                fontMultiplier: 15,
                //tag css stylies on mouse over
                hoverStyle: {
                    border: '0',
                    color: '#0b2e6f'
                },
                //tag css stylies on mouse out
                mouseOutStyle: {
                    border: '',
                    color: ''
                }
            };
			

function getLabels(elem){
   $("#labels div").hide();
$(".ref_select option:selected").each(function(){
   
    var value = $(this).val();
   $("#check_"+value).show();
  });
};


function haccordions() {
	$('.header').click(function() {
			var checkElement = $(this).next();
			//var parent = $(this).parent().attr('id');
			if(checkElement.width() == 300) {
				$(this).next(".content").animate({width: "0px"},200);
				$(this).css("background-position", "2px 50px");
				$("body").css('width', $("body").width() - 300); 
				return false;
			}
			if(checkElement.width() == 0)  {
       $(this).next(".content").animate({width: "300px"}, 200);
       $(this).css("background-position", "12px 50px");
       $("body").css('width', $("body").width() + 300); 
				return false;
			}
		});
}


function imgren(){
var i = $('#fup').val();
$('#tvimages').val('/assets/images/'+i);
}


    
