var simpleTreeCollection;

$(document).ready(function() {

	simpleTreeCollection = $('#LeftColumn ul').simpleTree({
		autoclose: true,
		afterClick:function(node){			
			if ( (node.is('.doc')) || (node.is('.doc-last'))   ){
				location.href = $('a',node).attr("href");
			}
		},
		afterDblClick:function(node){
			//alert("text-"+$('span:first',node).text());
		},
		afterMove:function(destination, source, pos){
			//alert("destination-"+destination.attr('id')+" source-"+source.attr('id')+" pos-"+pos);
		},
		afterAjax:function()
		{
			//alert('Loaded');
		},
		animate:true
		//,docToFolderConvert:true
     });


	$("#Logo").pngFix();
	$("#Phone").pngFix();
	$("#BottomIcons").pngFix();

    //Correct TopMenu						   
	var tempTitle = $("#TopMenu li.active a").text();
	$("#TopMenu li.active").html('<span>'+tempTitle+'</span>');

	$("div.icon1").click(function(event){
		$("#dataIcq").modal();
	});
	$("div.icon2").click(function(event){
		$("#dataPhone").modal();
	});
	$("div.icon3").click(function(event){
		$("#dataAsk").modal(
{
  overlayCss: {
    backgroundColor: '#000',
    cursor: 'wait'
  },
  containerCss: {
    height: 500,
    width: 320,
    background: 'transparent url(/images/bg2.png) no-repeat'
  }
}
		);
	});


	$("#question").click(function(event){
		$("#dataQuestion").modal(
{
  overlayCss: {
    backgroundColor: '#000',
    cursor: 'wait'
  },
  containerCss: {
    height: 500,
    width: 320,
    background: 'transparent url(/images/bg2.png) no-repeat'
  }
}
		);
	});


	$("#testimonial").click(function(event){
		$("#dataTestimonial").modal(
{
  overlayCss: {
    backgroundColor: '#000',
    cursor: 'wait'
  },
  containerCss: {
    height: 500,
    width: 320,
    background: 'transparent url(/images/bg2.png) no-repeat'
  }
}
		);
	});

	
	//Forum
	$(".forumItem").each(function(){
		var answer = $(".answer", this);
		$(".title", this).click(function(){
			answer.slideToggle("slow");
		});
	});
	
	//Gallery
	$("a.group").fancybox({ 'zoomSpeedIn': 300, 'zoomSpeedOut': 300, 'overlayShow': false });



	var blogmenu = $("div.blogMenu");
	var headoffset = blogmenu.offset();
	//alert( headoffset.top );
	$(window).scroll(function() {
	    if($(window).scrollTop() < headoffset.top) {
	        $('div.blogMenu').css({ position: 'static'}); 
	    } else {
	        $('div.blogMenu').css({ position: 'fixed', top: '0px' }); 
	    }   
	}); 



});
