jQuery.noConflict();

(function($) { 
  $(function() {
    // more code using $ as alias to jQuery
    
    $(document).ready
    (
    	function()
    	{ 
    	    
    	    $('#boxBottom .toolTipMap').height(39);
    	    
    	    
            $('#boxBottom .toolTipMap h2').click(
                function () {
                    var currHeight = $(this).parent().height();
                    $('#boxBottom .active').animate({ 
                            height: "39px"
                    }, 800 ).removeClass('active');
                    if(currHeight==39) {
                        $(this).parent().animate({ 
                                height: "183px"
                        }, 800 ).addClass('active');
                    }
                }
            ).each( function (i) {
    	    	var currDescId = $(this).next().find(".csc-textpic-caption").html();
    	    	var currDescHtml = '<div class="toolTipDescription">'+$('#'+currDescId+'txt').html()+'</div>';
    	    	//console.log(currDescId);
    	    	$(this).append(currDescHtml);
			});
            
            $(".toolTipMap map area").each( function (i) {
				var currTooltip = $(this).attr("alt");
				//console.log(currTooltip);
				$(this).tooltip({
	                delay: 0,
	                track: true,
	                extraClass: 'toolTipBox',
	                bodyHandler: function() { 
	                    return '<div id="box_'+currTooltip+'" class="toolTipBoxHome">'+$('#'+currTooltip).html()+'</div>';
	                },
	                fixPNG: true, 
	                top: 166, 
	                left: -85,
	                showURL: false 
	            });    
			});
			
			
			$(".imgGalleryBox").scrollable({         
                size: 1,         
                items: 'ul',  
                clickable: false,         
                hoverClass: 'hover',
                keyboard: false
            });
            
            //$('#boxBottom .projectItem .csc-textpic').hide();
            $('#boxBottom .projectItem .csc-textpic:first').show().parent().addClass('proj_active');
            $('#boxBottom .projectItem h2').click(
                function () {
                	var currBox = $(this).parent();
                    if(currBox.hasClass('proj_active')) {
                    	$(this).next().slideToggle('normal', function () {
							currBox.removeClass('proj_active');
						}); 
                    } else {
						$('#boxBottom .proj_active .csc-textpic').slideUp('normal');
						$('#boxBottom .proj_active').removeClass('proj_active');
						$(this).next().slideDown('normal', function () {
						$(this).parent().addClass('proj_active');
						}); 
					}
                }
            );
            
            
            
            
    	    /*
    	   $('#boxProjects').cycle({ 
                fx:    'fade', 
                speed:  500 ,
                pause:  20 
            });
            
            $('#boxProjects').cycle({ 
                fx:     'turnRight', 
                speed:  300, 
                timeout: 10000
            });
                
            
            if($("#scrollBox .csc-frame-invisible").size()>1)     
            {
                // initialize scrollable
               
            }
            else
            {
                $("#main_middle .prev").addClass('hide');
                $("#main_middle .next").addClass('hide');
            }
            
            
            */
            

            
    	}
    );
    
  });
})(jQuery);


function initToolBox( elTool , elWidth  )
{
    
    var textVal = jQuery(elTool+' span').text();
    jQuery(elTool).qtip(
    {
       content: textVal,
       style: { 
          width: elWidth,
          padding: 3,
          background: '#000000',
          color: '#ffffff',
          textAlign: 'center',
          border: {
             width: 2,
             radius: 3,
             color: '#000000'
          },
          tip: 'leftMiddle',
          name: 'dark' // Inherit the rest of the attributes from the preset dark style
       },
       position: { 
           corner: { 
              target: 'rightMiddle', 
              tooltip: 'leftMiddle' 
           }
       }
    }); 
}


