jQuery(window).load(function() {
	jQuery('#loading-image').hide();
});
 $(function() {
				//all the menu items
				var $items 		= $('#cc_menu .cc_item');
				//number of menu items
				var cnt_items	= $items.length;
				//if menu is expanded then folded is true
				var folded		= false;
				//timeout to trigger the mouseenter event on the menu items
				var menu_time;
				/**
				bind the mouseenter, mouseleave to each item:
				- shows / hides image and submenu
				bind the click event to the list elements (submenu):
				- hides all items except the clicked one, 
				and shows the content for that item
				*/
				$items.unbind('mouseenter')
					  .bind('mouseenter',m_enter)
				      .unbind('mouseleave')
					  .bind('mouseleave',m_leave)
					  .find('div')
					  .bind('click',function(){
					var $li_e = $(this);
						  //if the menu is already folded,
						  //just replace the content
					if(folded){
						hideContent();
						showContent($li_e.attr('class'));
					}	
					      else //fold and show the content
						fold($li_e);
				});
				
				/**
				mouseenter function for the items
				the timeout is used to prevent this event 
				to trigger if the user moves the mouse with 
				a considerable speed through the menu items
				*/
							
				$('.enter').bind('click', function(){
					$('.pane').animate({'top':'-1500px'},3000);}); 
	
				$('.reg').bind('click', function(){
					$('.cc_back').trigger('click')	
					$('.cc_back').animate({'right':'0px'},400, function(){$('.cc_back_page').animate({'right':'-189'},400);}); 
					$('.reg_content').animate({'right':'222px'},400)});
				$('.in_news').bind('click', function(){
					$('.cc_back').trigger('click')	
					$('.cc_back').animate({'right':'0px'},400, function(){$('.cc_back_page').animate({'right':'-189'},400);}); 
					$('.in_news_content').animate({'right':'222px'},400)});

				
				$('.contact').bind('click', function(){
					$('.cc_back').trigger('click')	
					$('.cc_back').animate({'right':'0px'},400, function(){$('.cc_back_page').animate({'right':'-189'},400);}); 
					$('.contact_content').animate({'right':'222px'},400)});
					
				$('.about_ges').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.about_ges_content').animate({'right':'222px'},400)});
				
				$('.about_e-cell').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.about_e-cell_content').animate({'right':'222px'},400)});
				
				$('.about_iit').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.about_iit_content').animate({'right':'222px'},400)});
				
				$('.about_infob').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.about_infob_content').animate({'right':'222px'},400)});
						
				$('.empresario_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.empresario_o_content').animate({'right':'222px'},400)
						$('.empresario_r_content').animate({'right':'-980px'},400)
						$('.empresario_f_content').animate({'right':'-980px'},400)});
				$('.empresario_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.empresario_o_content').animate({'right':'-980px'},400)
						$('.empresario_r_content').animate({'right':'222px'},400)
						$('.empresario_f_content').animate({'right':'-980px'},400)});
				$('.empresario_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.empresario_o_content').animate({'right':'-980px'},400)
						$('.empresario_r_content').animate({'right':'-980px'},400)
						$('.empresario_f_content').animate({'right':'222px'},400)});
				
				$('.envision_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.envision_o_content').animate({'right':'222px'},400)
						$('.envision_r_content').animate({'right':'-980px'},400)
						$('.envision_f_content').animate({'right':'-980px'},400)
						});
					
				$('.envision_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.envision_o_content').animate({'right':'-980px'},400)
						$('.envision_r_content').animate({'right':'222px'},400)
						$('.envision_f_content').animate({'right':'-980px'},400)
						});
						
				$('.envision_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.envision_o_content').animate({'right':'-980px'},400)
						$('.envision_r_content').animate({'right':'-980px'},400)
						$('.envision_f_content').animate({'right':'222px'},400)
						});
											
				$('.concipio_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.concipio_o_content').animate({'right':'222px'},400)
						$('.concipio_r_content').animate({'right':'-980px'},400)
						$('.concipio_f_content').animate({'right':'-980px'},400)
						});
				$('.concipio_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.concipio_o_content').animate({'right':'-980px'},400)
						$('.concipio_r_content').animate({'right':'222px'},400)
						$('.concipio_f_content').animate({'right':'-980px'},400)
						});
				$('.concipio_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.concipio_o_content').animate({'right':'-980px'},400)
						$('.concipio_r_content').animate({'right':'-980px'},400)
						$('.concipio_f_content').animate({'right':'222px'},400)
						});						

				/*$('.workshops').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.workshops_content').animate({'right':'222px'},400)
						});*/
						
				$('.guest_lectures').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.guest_lectures_content').animate({'right':'222px'},400)
						});
						
				$('.panel_discussions').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.panel_discussions_content').animate({'right':'222px'},400)
						});
						
				$('.startup-camp').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.startup-camp_content').animate({'right':'222px'},400)
						$('.startup-part_content').animate({'right':'-980px'},400)
						});
				$('.startup-part').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.startup-part_content').animate({'right':'222px'},400)
						$('.startup-camp_content').animate({'right':'-980px'},400)
						
						});
								
				$('.gec').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.gec_content').animate({'right':'222px'},400)
						});
								
				$('.connect_dots').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.connect_dots_content').animate({'right':'222px'},400)
						});
				
				$('.biz_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.biz_o_content').animate({'right':'222px'},400)
						$('.biz_r_content').animate({'right':'-980px'},400)
						$('.biz_f_content').animate({'right':'-980px'},400)
						});
				$('.biz_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.biz_o_content').animate({'right':'-980px'},400)
						$('.biz_r_content').animate({'right':'222px'},400)
						$('.biz_f_content').animate({'right':'-980px'},400)
						});
				$('.biz_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.biz_o_content').animate({'right':'-980px'},400)
						$('.biz_r_content').animate({'right':'-980px'},400)
						$('.biz_f_content').animate({'right':'222px'},400)
						});

				$('.incio_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.incio_o_content').animate({'right':'222px'},400)
						$('.incio_r_content').animate({'right':'-980px'},400)
						$('.incio_f_content').animate({'right':'-980px'},400)
						});
				$('.incio_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.incio_o_content').animate({'right':'-980px'},400)
						$('.incio_r_content').animate({'right':'222px'},400)
						$('.incio_f_content').animate({'right':'-980px'},400)
						});
				$('.incio_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.incio_o_content').animate({'right':'-980px'},400)
						$('.incio_r_content').animate({'right':'-980px'},400)
						$('.incio_f_content').animate({'right':'222px'},400)
						});					
				
				$('.emonopoly_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.emonopoly_o_content').animate({'right':'222px'},400)
						$('.emonopoly_r_content').animate({'right':'-980px'},400)
						$('.emonopoly_f_content').animate({'right':'-980px'},400)
						});
				$('.emonopoly_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.emonopoly_o_content').animate({'right':'-980px'},400)
						$('.emonopoly_r_content').animate({'right':'222px'},400)
						$('.emonopoly_f_content').animate({'right':'-980px'},400)
						});
				$('.emonopoly_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.emonopoly_o_content').animate({'right':'-980px'},400)
						$('.emonopoly_r_content').animate({'right':'-980px'},400)
						$('.emonopoly_f_content').animate({'right':'222px'},400)
						});				
				$('.tagemall_o').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.tagemall_o_content').animate({'right':'222px'},400)
						$('.tagemall_r_content').animate({'right':'-980px'},400)
						$('.tagemall_f_content').animate({'right':'-980px'},400)
						});
				$('.tagemall_r').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.tagemall_o_content').animate({'right':'-980px'},400)
						$('.tagemall_r_content').animate({'right':'222px'},400)
						$('.tagemall_f_content').animate({'right':'-980px'},400)
						});
				$('.tagemall_f').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.tagemall_o_content').animate({'right':'-980px'},400)
						$('.tagemall_r_content').animate({'right':'-980px'},400)
						$('.tagemall_f_content').animate({'right':'222px'},400)
						});				

						
				
				$('.workshops').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.workshops_content').animate({'right':'222px'},400)
						
						$('.work_anjan_content').animate({'right':'-980px'},400)
						$('.work_sam_content').animate({'right':'-980px'},400)
						$('.work_auto_content').animate({'right':'-980px'},400)
						});
				$('.work_auto').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.work_auto_content').animate({'right':'222px'},400)
						$('.workshops_content').animate({'right':'-980px'},400)
						});
				$('.work_sam').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.work_sam_content').animate({'right':'222px'},400)
						$('.workshops_content').animate({'right':'-980px'},400)
						});
				$('.work_anjan').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						
						$('.work_anjan_content').animate({'right':'222px'},400)
						$('.workshops_content').animate({'right':'-980px'},400)
						
						});
				
				$('.elevator_pitch').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.elevator_pitch_content').animate({'right':'222px'},400)
						});
		
				
				$('.innovation_exhibition').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.innovation_exhibition_content').animate({'right':'222px'},400)
						});
				
				$('.sponsors').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.sponsors_content').animate({'right':'221px'},400)
						});
				$('.media').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.media_content').animate({'right':'221px'},400)
						});
				$('.venture').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.venture_content').animate({'right':'222px'},400)
						});
				$('.mentors').bind('click', function(){
						$('.cc_back').animate({'right':'0'},400, 
						function(){$('.cc_back_page').animate({'right':'129px'},400);}); 
						$('.mentors_content').animate({'right':'221px'},400)
						});						
						
				$('.cc_back_page').bind('click', function(){
						$('.sponsors_content').animate({'right':'-980px'},400)
						$('.media_content').animate({'right':'-980px'},400)
						$('.venture_content').animate({'right':'-980px'},400)
						$('.mentors_content').animate({'right':'-980px'},400)
						
						$('.work_anjan_content').animate({'right':'-980px'},400)
						$('.work_sam_content').animate({'right':'-980px'},400)
						$('.work_auto_content').animate({'right':'-980px'},400)
						
						
						$('.workshops_content').animate({'right':'-980px'},400)
						$('.elevator_pitch_content').animate({'right':'-980px'},400)
						$('.guest_lectures_content').animate({'right':'-980px'},400)
						$('.panel_discussions_content').animate({'right':'-980px'},400)
						$('.startup-part_content').animate({'right':'-980px'},400)
						$('.startup-camp_content').animate({'right':'-980px'},400)
						
						$('.gec_content').animate({'right':'-980px'},400)
						$('.connect_dots_content').animate({'right':'-980px'},400)
						$('.innovation_exhibition_content').animate({'right':'-980px'},400)
						
						$('.biz_f_content').animate({'right':'-980px'},400)
						$('.biz_r_content').animate({'right':'-980px'},400)
						$('.biz_o_content').animate({'right':'-980px'},400)
						
						$('.incio_f_content').animate({'right':'-980px'},400)
						$('.incio_r_content').animate({'right':'-980px'},400)
						$('.incio_o_content').animate({'right':'-980px'},400)
						
						$('.emonopoly_f_content').animate({'right':'-980px'},400)
						$('.emonopoly_r_content').animate({'right':'-980px'},400)
						$('.emonopoly_o_content').animate({'right':'-980px'},400)
						
						
						$('.tagemall_f_content').animate({'right':'-980px'},400)
						$('.tagemall_r_content').animate({'right':'-980px'},400)
						$('.tagemall_o_content').animate({'right':'-980px'},400)
						
						$('.concipio_f_content').animate({'right':'-980px'},400)
						$('.concipio_r_content').animate({'right':'-980px'},400)
						$('.concipio_o_content').animate({'right':'-980px'},400)
						$('.envision_f_content').animate({'right':'-980px'},400)
						$('.envision_r_content').animate({'right':'-980px'},400)
						$('.envision_o_content').animate({'right':'-980px'},400)
						$('.empresario_f_content').animate({'right':'-980px'},400)
						$('.empresario_r_content').animate({'right':'-980px'},400)
						$('.empresario_o_content').animate({'right':'-980px'},400)
						$('.about_infob_content').animate({'right':'-980px'},400)
						$('.about_iit_content').animate({'right':'-980px'},400)
						$('.about_e-cell_content').animate({'right':'-980px'},400)
						$('.about_ges_content').animate({'right':'-980px'},400)
						$('.contact_content').animate({'right':'-1001px'},400)
						$('.reg_content').animate({'right':'-1001px'},400)
						$('.in_news_content').animate({'right':'-1001px'},400)
						$('.cc_back_page').animate({'right':'-189'},400);
				});
			

				function m_enter(){
					var $this 	= $(this);
					clearTimeout(menu_time);
					menu_time 	= setTimeout(function(){
					//img
					$this.find('img').stop().animate({'top':'0px'},400);
					//cc_submenu ul
					$this.find('.cc_submenu').stop().animate({'height':'156px'},400);
					},0);
					$this.find('.cc_title').fadeOut();
				}
				
				//mouseleave function for the items
				function m_leave(){
					var $this = $(this);
					clearTimeout(menu_time);
					//img
					$this.find('img').stop().animate({'top':'-600px'},400);
					//cc_submenu ul
					$this.find('.cc_submenu').stop().animate({'height':'0px'},400);
					$this.find('.cc_title').fadeIn();
				}
				
				//back to menu button - unfolds the menu
				$('#cc_back').bind('click',unfold);
				
				/**
				hides all the menu items except the clicked one
				after that, the content is shown
				*/
				function fold($li_e){
					
					var $item		= $li_e.closest('.cc_item');
					
					var d = 129;
					var step = 0;
					$items.unbind('mouseenter mouseleave');
					$items.not($item).each(function(){
						var $item = $(this);
						$item.stop().animate({
							'marginLeft':'-196px'
						},d += 200,function(){
							++step;
							if(step == cnt_items-1){
								folded = true;
								showContent($li_e.attr('class'));
							}	
						});
					});
				}
				
				/**
				shows all the menu items 
				also hides any item's image / submenu 
				that might be displayed
				*/
				function unfold(){
					$('#cont_privacy').animate({'right':'-980px'},400)
					$('.cc_back_page').trigger('click')
					$('.cc_back').animate({'right':'-189px'},400)
					$('#cc_content').stop().animate({'left':'-700px'},600,function(){
						var d = 109;
						var step = 0;
					$items.each(function(){
							var $item = $(this);
							$('.cc_title').fadeIn();
							$item.find('img')
								 .stop()
								 .animate({'top':'-600px'},200)
								 .andSelf()
								 .find('.cc_submenu')
								 .stop()
								 .animate({'height':'0px'},200);
								 
							$item.stop().animate({
							'marginLeft':'0px'
							},d += 200,function(){
								++step;
								
								if(step == cnt_items-1){
									folded = false;
									$items.unbind('mouseenter')
										  .bind('mouseenter',m_enter)
										  .unbind('mouseleave')
										  .bind('mouseleave',m_leave);
									
									hideContent();
									
								} 
							});
							
						});
					});
					
				}				
				//function to show the content
				function showContent(idx){
					$('#cc_content').stop().animate({'left':'196px'},200,function(){
						$(this).find('.'+idx).fadeIn();
					});
					
					$('.cc_back').animate({'right':'0px'},400)
				}
				
				//function to hide the content
				function hideContent(){
					 $('#cc_content').find('section').hide();
					 				
				}
            });		
