function rz2()
{
	$(".menu_middle").css('z-index','0');

}

$(document).ready(function(){

    deeplink();

//        top:('640' - jarakH) +'px', left:('300'  - jarakW) +'px'
        

	/*Cufon.replace('.blue_gothic , .btn_up, .btn_down, .btn_close, .white_gothic, .grey_gothic, .blue_gothic_2',  {
		fontFamily: "TradeGothic LT CondEighteen",
		hover : true
	});*/


//-------------------------------------------------- KLO SUDAH ADA BACKLINK, TOLONG DI EDIT --------------------------------------------------//

//var jarakW = ($(window).width() - 960)/2;
//var jarakH = ($(window).height() - 600)/2;
//
//$.scrollTo({top:('700' - jarakH) +'px', left:('300' - jarakW) +'px'}, 0);

//-------------- AMPE SINI EDIT NYA --------------//



$(window).resize (function() {
	slide($oldPos);
});

//-------------------------------------------------- MENU --------------------------------------------------//

	$(".buttonArea").mouseover( function () {
		$(".menu_nav").fadeIn(0);
		$(".menu_top").fadeOut(500);
		$(".menu_nav").animate({top:0}, 500);
		$(".description").css( {'backgroundImage' : 'url()' });
		$(".menu_middle").css('position','absolute');
		$(".menu_middle").css('z-index','99999');
	});
	
	$(".menu_middle").mouseleave( function () {
		$(".menu_nav").animate({top:165}, 500);
		$(".menu_top").fadeIn(500);
		$(".menu_nav").fadeOut(0);
				
		setTimeout("rz2()",100);
	});
	
	
	
	$(".icon_home").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:-110});
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_home.jpg)' });
	})
	$(".icon_product").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:-68});
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_products.jpg)' });
	})
	$(".icon_news").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:-37}); 
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_news.jpg)' });
	})
	$(".icon_articles").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:0}); 
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_articles.jpg)' });
	})
	$(".icon_video").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:37});
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_video.jpg)' }); 
	})
	$(".icon_consultation").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:68}); 
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_consultation.jpg)' });
	})
	$(".icon_contact").mouseover( function() {
		$('.icon_go_ion').rotate({animateTo:110});
		$('.description').css( {'backgroundImage' : 'url(0_images/menu_desc_contact.jpg)' });
	})

$('.input, .textarea').defaultValue();

//$("#core").scale(0.8);

//-------------------------------------------------- INDEX PAGE SUB HOVER --------------------------------------------------//

	$('.index_sub_list_img_hov').animate({opacity : 0}, { duration: 0, queue: false });
	
	$('li.index_sub_hov').hover(
			function() {
				$(this).children('.index_sub_list_img_hov').animate({opacity : 1}, { duration: 500, queue: false });
		},
		function() {
			$(this).children('.index_sub_list_img_hov').animate({opacity : 0}, { duration: 500, queue: false });
		}
	)
	
//--------------------------------------------------
	
	var rz = 0;
	$('#index_btn_up').click(function() {
		if(rz == 0) // kondisi nutup
		{
			$('#index_close, .btn_close').fadeIn('slow');
			
			rz=1;
			
			$('#index_back').animate({
				top: '+120'
			  }, 500, "easeInQuint", function() {
				  //cb  
					$('#muter').animate({rotate: '+=180deg'}, 500);
			  });
	
		}
		else
		{
			$('#index_close, .btn_close').fadeOut('slow');
			rz = 0;
			
			$('#muter').animate({rotate: '-=360deg'});
			
			  $('#index_back').animate({
				top: '270'
			  }, 500, "easeOutQuint", function() {
				  
					//$('#muter').animate({rotate: '-=360deg'}, 500);
	
			  });
	  
		}
	});
	
		$('.btn_close').click(function() {
			
			$('#index_close, .btn_close').fadeOut('slow');
			
			rz=0;
			
			$('#index_back').animate({
				top: '+270'
			  }, 500, "easeInQuint", function() {
				  
					$('#muter').animate({rotate: '-=360deg'}, 500);
		  });
	
	});

//--------------------------------------------------

	$('#login_zone').animate({top : "-120"}, { duration: 0, queue: false });
	
	$('#login_button').click(function() {
		$('#login_zone').animate({top: "0"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});
		
	$('#login_close').click(function() {
		$('#login_zone').animate({top: "-120"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});

//--------------------------------------------------

	$('#password_zone').animate({top : "-120"}, { duration: 0, queue: false });
	
	$('#forgot_password').click(function() {
		$('#login_zone').animate({top: "-120"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		$('#password_zone').animate({top: "0"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});
		
	$('#password_close').click(function() {
		$('#password_zone').animate({top: "-120"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});

//--------------------------------------------------	
		
		
	$('#register_zone_top').animate({top : "-361"}, { duration: 0, queue: false });
	
	$('#register_button').click(function() {
		$('#register_zone_top').animate({top: "0"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});
		
	$('#register_close').click(function() {
		$('#register_zone_top').animate({top: "-361"}, { duration: 500, queue: false, "easing": "easeOutCirc" });
		});	

//-------------------------------------------------- PRODUCT PAGE --------------------------------------------------//
	
	$('#product_detail').hide();
	$('.dock-container ul li a img').click(function() {
		$('#product_detail').fadeIn(500);
	});
	$('#product_detail_back').click(function() {
		$('#product_detail').fadeOut(500);
	});

//-------------------------------------------------- PRODUCT PAGE SCALE --------------------------------------------------//
	
//$("#product_1").hover(function () {
      //$("#product_1").animate({scale: '1%'}, 20);
	  //stop();
//});	

//-------------------------------------------------- NEWS PAGE --------------------------------------------------//
	
	//$('#news_list').hide();
	$('#news_detail').hide();
	$('#news_archives').hide();
	
	$('.news_list_title, .news_list_image, .news_list_more').click(function() {
		$('#news_list').fadeOut(500, function() {
      		 $('#news_detail').fadeIn(500);
			 mCustomScrollbars();
     	});
	});
			$('#news_detail_back').click(function() {
				$('#news_detail').fadeOut(500, function() {
					$('#news_list').fadeIn(500);
					$('.dragger_container').fadeIn(500);
					mCustomScrollbars2();
				});
			});
	
	//$('#news_archives').show();
	
			
	$('#news_detail_archives').click(function() {
		$('#news_detail').fadeOut(500, function() {
			$('#news_archives').fadeIn(500);
		});
	});
	
	$('.news_archives_list_text').click(function() {
		$('#news_archives').fadeOut(500, function() {
			$('#news_detail').fadeIn(500);
		});
	});
	
	
	$('#news_list_archives').click(function() {
		$('#news_list').fadeOut(500, function() {
			$('#news_archives').fadeIn(500);
		});
	});
	
	$('#news_archives_back').click(function() {
		$('#news_archives').fadeOut(500, function() {
			$('#news_list').fadeIn(500);
		});
	});

//--------------------------------------------------
	
$(window).load(function() {
	mCustomScrollbars();
});

function mCustomScrollbars(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#news_detail_scroll").mCustomScrollbar("vertical",300,"easeOutCirc",1.05,"auto","yes","yes",20); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#news_detail_scroll .customScrollBox .content").load(file,function(){
		mCustomScrollbars();
	});
};

//--------------------------------------------------

$(window).load(function() {
	mCustomScrollbars2();
});

function mCustomScrollbars2(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#news_list_scroll").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#news_list_scroll .customScrollBox .content").load(file,function(){
		mCustomScrollbars2();
		
	});
		
};	
	
	
//-------------------------------------------------- ARTICLES PAGE --------------------------------------------------//
	

	//$('#articles_list').hide();
	$('#articles_detail').hide();
	
	$('.articles_list_title, .articles_list_image, .articles_list_more').click(function() {
		$('#articles_list').fadeOut(500, function() {
      		 $('#articles_detail').fadeIn(500);
			 mCustomScrollbars3();
     	});
	});
			$('#articles_detail_back').click(function() {
				$('#articles_detail').fadeOut(500, function() {
					$('#articles_list').fadeIn(500);
					mCustomScrollbars4();
				});
			});
			
	
	$('#article_open_1').hide();
	$('#article_open_2').hide();
	
	
//--------------------------------------------------
	
	//$('#articles_archives').show();
	$('#articles_archives').hide();
			
	$('#articles_detail_archives').click(function() {
		$('#articles_detail').fadeOut(500, function() {
			$('#articles_archives').fadeIn(500);
		});
	});
	
	$('.articles_archives_list_text').click(function() {
		$('#articles_archives').fadeOut(500, function() {
			$('#articles_detail').fadeIn(500);
		});
	});

//--------------------------------------------------	
	
	$('#articles_list_archives').click(function() {
		$('#articles_list').fadeOut(500, function() {
			$('#articles_archives').fadeIn(500);
		});
	});
	
	$('#articles_archives_back').click(function() {
		$('#articles_archives').fadeOut(500, function() {
			$('#articles_list').fadeIn(500);
		});
	});

//--------------------------------------------------
	
	$('#articles_archives_category_list').hide();
	
	$('#articles_archives_category').click(function() {
		$('#articles_archives_category_list').fadeIn(500);
		});
	
	$('#articles_archives_category_list').mouseleave(function() {
		$('#articles_archives_category_list').fadeOut(500);
		});
	
	$('#articles_archives_category_list ul li h5').click(function() {
		$('#articles_archives_category_list').fadeOut(500);
		});
		
		



//--------------------------------------------------

$(window).load(function() {
	mCustomScrollbars3();
});

function mCustomScrollbars3(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#articles_detail_scroll").mCustomScrollbar("vertical",300,"easeOutCirc",1.05,"auto","yes","yes",20); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#articles_detail_scroll .customScrollBox .content").load(file,function(){
		mCustomScrollbars3();
	});
};

//--------------------------------------------------

$(window).load(function() {
	mCustomScrollbars4();
});

function mCustomScrollbars4(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#articles_list_scroll").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#articles_list_scroll .customScrollBox .content").load(file,function(){
		mCustomScrollbars4();
		
		});	
	};

//-------------------------------------------------- CONSULTANT PAGE --------------------------------------------------//

$('#consultant_form').hide();
			
	$('#consultant_question_button').click(function() {
		$('#consultant_form').fadeIn(500);
		$(' [placeholder] ').defaultValue();
	});
	
	$('#consultant_close').click(function() {
		$('#consultant_form').fadeOut(500);
	});
	
//-------------------------------------------------- CONTACT PAGE --------------------------------------------------//

$('#contact_form').hide();
			
	$('#contact_email').click(function() {
		$('#contact_form').fadeIn(500);
		$(' [placeholder] ').defaultValue();
	});
	
	
	$('#contact_close').click(function() {
		$('#contact_form').fadeOut(500);
	});
		

//-------------------------------------------------- PRIVACY PAGE --------------------------------------------------//

$('#privacy_area').hide();
			
	$('#privacy_btn').click(function() {
		$('#privacy_area').fadeIn(500, function() {
			$('#terms_area').fadeOut(500);
		});
	});
	
	$('#privacy_close').click(function() {
		$('#privacy_area').fadeOut(500);
	});	

//-------------------------------------------------- TERMS PAGE --------------------------------------------------//

$('#terms_area').hide();
			
	$('#terms_btn').click(function() {
		$('#terms_area').fadeIn(500, function() {
			$('#privacy_area').fadeOut(500);
		});;
	});
	
	$('#terms_close').click(function() {
		$('#terms_area').fadeOut(500);
	});	

//-------------------------------------------------- VIDEO PAGE --------------------------------------------------//

$(window).load(function() {
	mCustomScrollbars5();
});

function mCustomScrollbars5(){
	/* 
	malihu custom scrollbar function parameters: 
	1) scroll type (values: "vertical" or "horizontal")
	2) scroll easing amount (0 for no easing) 
	3) scroll easing type 
	4) extra bottom scrolling space for vertical scroll type only (minimum value: 1)
	5) scrollbar height/width adjustment (values: "auto" or "fixed")
	6) mouse-wheel support (values: "yes" or "no")
	7) scrolling via buttons support (values: "yes" or "no")
	8) buttons scrolling speed (values: 1-20, 1 being the slowest)
	*/
	$("#video_list_scroll").mCustomScrollbar("horizontal",500,"easeOutCirc",1,"fixed","yes","yes",20); 
}

/* function to fix the -10000 pixel limit of jquery.animate */
$.fx.prototype.cur = function(){
    if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
      return this.elem[ this.prop ];
    }
    var r = parseFloat( jQuery.css( this.elem, this.prop ) );
    return typeof r == 'undefined' ? 0 : r;
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#video_list_scroll .customScrollBox .content").load(file,function(){
		mCustomScrollbars5();
		
		});	
	};

});

//-------------------------------------------------- PRODUCTS --------------------------------------------------//




//-------------------------------------------------- WINDOW ON LOAD --------------------------------------------------//


$(window).load(function(){
	
isLoaded = true;
        
$(".menu_nav").animate({top:165}, 1000, function(){
	
		$("#loading").fadeOut(500);
		//$("#canvas").css("display","block");  
		  $('.hide').animate({
			opacity: 1
		  }, 1000, "linear", function() {
			  
			  
			//var jarakW = ($(window).width() - 960)/2;
			//var jarakH = ($(window).height() - 600)/2;
			//$.scrollTo({top:('640' - jarakH) +'px', left:('300' - jarakW) +'px'}, 0);

            $(".menu_nav").fadeOut(0);
			
		  });
		
	});
	
	
	$(function(){ 
	$('#dock').Fisheye(
		{
			maxWidth: 50,
			items: 'a',
			itemsText: 'span',
			container: '.dock-container',
			itemWidth: 120,
			proximity: 100,
			alignment : 'left',
			valign: 'bottom',
			halign : 'center'
		});
	});	
	
	
	/*Cufon.replace('.blue_gothic , .btn_up, .btn_down, .btn_close, .white_gothic, .grey_gothic, .blue_gothic_2',  {
		fontFamily: "TradeGothic LT CondEighteen",
		hover : true
	});*/
	
});


