// AAK JS CODE 


// Main Header 

	$(document).ready(function(){
	
		//Onload Functionality
		$slides_length = $(".bmnew-main-slides li").size();
		//$(".bmnew-main-slides li:last").hide();
		
		//slider Effects
		$slides_ul_width = $slides_length *  853;
		$slides_ul_width = $slides_ul_width + 'px' 
		
		$(".bmnew-main-slides").css({
			width : $slides_ul_width
			
			})
		
		// Functions For the Slider OPened
		$slidernum = $(".slidernum").html();
		
		//alert($slidernum);
			if ($(".slidernum").html() != "")
			{
				
				//$(".bmnew-main-slides li > div > div").hide();
					if($slidernum == 1)
					{
						func_bm_blogger();
						
					}
					
					if($slidernum == 2)
					{
						
					
						func_bm_login();
					}
					
					if($slidernum == 3)
					{
						func_forgot_pass()
						
					}
					//$(".bmnew-main-slides li div").child().show();
			
			}
		//functions *********************************************
		//functions *********************************************
		function func_bm_login(){
			
			//alert("Hurray Its Working");
					//Sliding
					$this = $(".header-tab a.bm_login");
					$(".bmnew-main-slides li").animate({
						left : -853+'px'
					})
					$($this).html("Blogger");
					$($this).addClass("bm-blogger").removeClass("bm_login");
			}
			
			
			function func_bm_blogger() {
				
				
				
				//alert("Hurray Its Wossrking");
					//Sliding
					$this = (".header-tab a.bm-blogger");
					$(".bmnew-main-slides li").animate({
						left : 0+'px'
					})
					$($this).html("Login");
					$($this).addClass("bm_login").removeClass("bm-blogger");
			
				}
								
		 function func_forgot_pass(){
			 
			 //alert("Hurray Its Wossrking");
					//Sliding
					$(".bmnew-main-slides li").animate({
						left : "-"+1706+'px'
					})
					$(".header-tab a.bm-blogger").html("Login");
					$(".header-tab a.bm-blogger").addClass("bm_login").removeClass("bm-blogger");
			 
			 }

		//functions Ends*********************************************
		//functions Ends*********************************************

		$(".header-tab a.bm_login").live( 'click' ,function() {
	
			// Run the Appropiatre function
			func_bm_login();	
		})
			
		
		
		$(".header-tab a.bm-blogger").live( 'click' ,function() {
			
			// Run the Appropiatre function
			func_bm_blogger();
		})
			
		
				
			
				$(".forgot_pass").live('click', function() {
			
		
			func_forgot_pass();
					
			
			})
	
	
	
	// ****************************************************************
	// Form Mouse Hover Clear Text Effect Start From Here
	
	$(".username_box").focus( function() {
		$username_value = $(this).val();
			if($username_value == "Username")
			{
				$(this).val("");
			}
	})
		
		
	$(".username_box").focusout( function() {
		$username_value = $(this).val();
			if($username_value == "")
			{
				$(this).val("Username");
			}
	})
	
	
	$(".password_box").focus( function() {
		$username_value = $(this).val();
			if($username_value == "Password")
			{
				$(this).val("");
			}
	})
		
		
	$(".password_box").focusout( function() {
		$username_value = $(this).val();
			if($username_value == "")
			{
				$(this).val("Password");
			}
	})
	
	
	$(".blogname_box").focus( function() {
		$username_value = $(this).val();
			if($username_value == "Blog Name")
			{
				$(this).val("");
			}
	})
		
		
	$(".blogname_box").focusout( function() {
		$username_value = $(this).val();
			if($username_value == "")
			{
				$(this).val("Blog Name");
			}
	})
	
	$(".emailaddress_box").focus( function() {
		$username_value = $(this).val();
			if($username_value == "Email Address")
			{
				$(this).val("");
			}
	})
		
		
	$(".emailaddress_box").focusout( function() {
		$username_value = $(this).val();
			if($username_value == "")
			{
				$(this).val("Email Address");
			}
	})
	
		$(".captcha_box").focus( function() {
		$username_value = $(this).val();
			if($username_value == "<-- Type Captcha text here")
			{
				$(this).val("");
			}
	})
		
		
	$(".captcha_box").focusout( function() {
		$username_value = $(this).val();
			if($username_value == "")
			{
				$(this).val("<-- Type Captcha text here");
			}
	})
	
	
	// ****************************************************************
	// Form Mouse Hover Clear Text Effect Ends Here
	
	
	
	
	
	
	
// **************************************************************
// **************************************************************
// **************************************************************
// **************************************************************
//  Inner Page Jquery starts from here
	
	
	// Close Functionlity
	//***********************
	

	
		// Hide the modal dialog when someone clicks outside of it.
		$(".bmi-more-options-details3").bind( "clickoutside", function(event){
		 // $(this).hide();
		 // alert("works");
			$(this).hide();
			$(this).next(".bmi-arrowleft").hide();
		});


		$(".bmi-suggest-widget-details").bind( "clickoutside", function(event){
		
				$(this).hide();
		
		});


		$(".bmi-exclusive-box").bind( "clickoutside", function(event){
		
				$(this).hide();
		
		});

		$(".bmi-more-options-details").bind( "clickoutside", function(event){
				$(this).hide();
				$(this).parent(".bmi-more-options").removeClass("bmi-more-close");
				
		});
		
		



	
	
	
	

			
	//***********************
	// Eof Close Functionlity
	
	$(".bmi-more-options").click( function(){
		
		//to close All same Divs
		$current = $(this).next(".bmi-more-options-details");
		$(".bmi-more-options-details").not($current).hide();
		$(".bmi-more-options").not(this).removeClass("bmi-more-close");
		
		// To Close Other Popups
				
				$(".bmi-more-options2").removeClass("bmi-more-close");
				$(".bmi-fav-widget-inner").hide();
				$(".bmi-suggest-widget-details").hide();
				$(".bmi-exclusive-box").hide();
				$(".bmi-more-options-details3").hide();
				$(".bmi-more-options3").removeClass("bmi-more-close");
				$(".bmi-arrowleft").hide();
		
		
		
		// functions starts
		$(this).next(".bmi-more-options-details").toggle();
		$(this).toggleClass("bmi-more-close");
		return false;
		})
		
		$(".bmi-more-options2").click( function(){
		
		//to close All same Divs
		$current = $(this).next(".bmi-more-options-details");
		$(".bmi-more-options-details").not($current).hide();
		$(".bmi-more-options2").not(this).removeClass("bmi-more-close");
		
		// To close All Others DIVs
				$(".bmi-more-options-details").hide();
				$(".bmi-more-options").removeClass("bmi-more-close");
				$(".bmi-fav-widget-inner").hide();
				$(".bmi-suggest-widget-details").hide();
				$(".bmi-exclusive-box").hide();
				$(".bmi-more-options-details3").hide();
				$(".bmi-more-options3").removeClass("bmi-more-close");
				$(".bmi-arrowleft").hide();
		
		
		// functions starts
		//$(this).prev(".bmi-setting-arrow").toggle();
		$(this).next(".bmi-more-options-details").toggle();
		//$(this).toggleClass("bmi-more-close");
		return false;
		})
		
		
		$(".bmi-option3span").click( function(){
		
		//to close All same Divs
		$current = $(this).parent(".bmi-more-options3").find(".bmi-more-options-details3");
		$current2 = $(this).parent(".bmi-more-options3").find(".bmi-arrowleft");
		$(".bmi-more-options-details3").not($current).hide();
		$(".bmi-more-options3").not(this).removeClass("bmi-more-close");
		$(".bmi-arrowleft").not($current2).hide();
		
		//To Clase Other Popups
			$(".bmi-more-options-details").hide();
				$(".bmi-more-options").removeClass("bmi-more-close");
				$(".bmi-more-options2").removeClass("bmi-more-close");
				$(".bmi-fav-widget-inner").hide();
				$(".bmi-suggest-widget-details").hide();
				$(".bmi-exclusive-box").hide();
				
		
		
		// functions starts
		$(this).parent(".bmi-more-options3").find(".bmi-more-options-details3").toggle();
		//$(this).append("<div  class='bmi-arrowleft'><img src='images/bm-new-inner/icon/arrow-left.png' alt='' /></div>")
		$(this).parent(".bmi-more-options3").find(".bmi-arrowleft").toggle();
		//$(this).toggleClass("bmi-more-close");
		return false;
		})
		
	
	$(".bmi-suggest-widget a").click( function(){
		
		//to close All same Divs
		$current = $(this).find(".bmi-suggest-widget-details");
		$(".bmi-suggest-widget-details").not($current).hide();
		
		// to Close All Other Divs
				$(".bmi-more-options-details").hide();
				$(".bmi-more-options").removeClass("bmi-more-close");
				$(".bmi-more-options2").removeClass("bmi-more-close");
				$(".bmi-fav-widget-inner").hide();
				$(".bmi-exclusive-box").hide();
				$(".bmi-more-options-details3").hide();
				$(".bmi-more-options3").removeClass("bmi-more-close");
				$(".bmi-arrowleft").hide();
		
		
		// functions starts
		$(this).parent(".bmi-suggest-widget").find(".bmi-suggest-widget-details").toggle();
		$(".bmi-fav-widget-inner").hide();
		return false;
		
		})
		
		$(".bmi-close-bttn").click( function(){
		
		$(this).parent(".bmi-suggest-widget-details").toggle();
		
		
		})
	
	
	//Exclusive Page
	$(".bmi-exclusive-arrow").click( function(){
		
		//to close All same Divs
		$current = $(this).next("div.bmi-exclusive-box");
		$(".bmi-exclusive-box").not($current).hide();
		
		//to Clase all others Div
				$(".bmi-more-options-details").hide();
				$(".bmi-more-options").removeClass("bmi-more-close");
				$(".bmi-more-options2").removeClass("bmi-more-close");
				$(".bmi-fav-widget-inner").hide();
				$(".bmi-suggest-widget-details").hide();
				
				$(".bmi-more-options-details3").hide();
				$(".bmi-more-options3").removeClass("bmi-more-close");
				$(".bmi-arrowleft").hide();
		
		// functions starts
		$(this).next("div.bmi-exclusive-box").toggle();
		return false;
		
		})
		
		// BAdge hover Effect
		
		$(".bmi-badge").hover( function() {
			
			$(this).find(".big-badge").toggle();
			
			
			})
			
			
	//Fav Button Click
	$(".bmi-fav-widget").click( function(){
		
		//to close All same Divs
		$current = $(this).find("div.bmi-fav-widget-inner");
		$(".bmi-fav-widget-inner").not($current).hide();
		
		//to Hide All other div
				$(".bmi-more-options-details").hide();
				$(".bmi-more-options").removeClass("bmi-more-close");
				$(".bmi-more-options2").removeClass("bmi-more-close");
				$(".bmi-suggest-widget-details").hide();
				$(".bmi-exclusive-box").hide();
				$(".bmi-more-options-details3").hide();
				$(".bmi-more-options3").removeClass("bmi-more-close");
				$(".bmi-arrowleft").hide();
		
		
		// functions starts
		$(this).find("div.bmi-fav-widget-inner").toggle();
		$(".bmi-suggest-widget-details").hide();
		return false;
		
		})
	
	// Top bar Functioality Start here
		var $Browser_width = $(document).width();
		var $window_width = $(window).width();
		var $Browser_height = $(document).height();
		var $window_height = $(window).height();
		var $totalheight = 100;
		// Mouse position
		var $position = $("body").position();
		
		
$(document).scroll(function () { 
     
	 $scrolltop = $(document).scrollTop();
	 
	 if($scrolltop < $totalheight )
				{
					
					//alert("small height");
				$(".bm-new-topbar").css({
					'position' : 'relative',
					'top' : '0',
					'z-index': '9999',
					'width': '898px'
					})
					
					
					$(".bmi-sm-bg").css({
					'position' : 'absolute',
					'top' : '0',
					'z-index': '9999',
					'width': '70px',
					'left' : '-72px'
					})
					
					
					}
				
			
			if($scrolltop > $totalheight )
			{
				//alert("Works");
				//alert("Big height");
				$(".bm-new-topbar").css({
					'position' : 'fixed',
					'top' : '0',
					'z-index': '9999',
					'width': '898px'
					})
					
					$(".bmi-sm-bg").css({
					'position' : 'absolute',
					'top' : $scrolltop,
					'z-index': '9999',
					'width': '70px',
					'left' : '-72px',
					
					})
				
				}
	 
    });

		
		//alert("Browser_width: "+$Browser_width+"window_width: "+$window_width+"Browser_height: "+$Browser_height+"window_height: "+$window_height+"Position: "+$position.top)


	
	
	// Eof top bar Functionality
	
	
	
	
	
	
	
	
	
	// Profile Complete Functionality
	$per_complete = $(".bmi-rating-percentage").html();
	//alert($per_complete)
	$(".bmi-profile-complete-bar > div").width($per_complete);
	
	
	
	

		//show loading bar
		
		
		function showLoading(){
			loading
				.css({visibility:"visible"})
				.css({opacity:"1"})
				.css({display:"block"})
			;
		}
		//hide loading bar
		function hideLoading(){
			loading.fadeTo(1000, 0);
		};
		//PopUp grey strip goes here
		
		
		
		
	
		
		
		
		
		
		
	
		//show loading bar
		
		
		function showLoading(){
			loading2
				.css({visibility:"visible"})
				.css({opacity:"1"})
				.css({display:"block"})
			;
		}
		//hide loading bar
		function hideLoading(){
			loading2.fadeTo(1000, 0);
		};
		//PopUp grey strip goes here
		
	
	
	
	
	// Call the data from another page
	// PopUp Data Fetch From another page
	
		var sections = $(".bmi-exclusive-arrow");
		var loading = $("<div class='loading'>Loading</div>");
		var content = $("exclusivebox1");
		var contentwrap = $(".bmi-exclusive-box");		
		//Manage click events
		sections.click(function(){
		//	$(".more-features .join").remove();
			//show the loading bar
			//showLoading();			
			//Remove Active Class
				
			switch(this.id){
				case "ex1":
			//alert("test");
					var links = $(this).attr("title");
					//alert(links);
					contentwrap.load( links , hideLoading);
					content.fadeIn("fast");
					$(this).addClass("active");
					break;
		
				default:
					//hide loading bar if there is no selected section
					hideLoading();
					break;
			}
		
		});
		
		
		// for User Picture
		var sections2 = $(".bmi-option3span");
		var loading2 = $("<div class='loading'>Loading</div>");
		var content2 = $(".ex2");
		var contentwrap2 = $(".bmi-more-options-details3");	
		
		//Manage click events
		sections2.click(function(){
			
		//	$(".more-features .join").remove();
			//show the loading bar
			showLoading();			
			//Remove Active Class
				
			switch(this.id){
				case "ex2":
			//alert("test");
					var links = $(this).attr("title");
					//alert("test2");	
					contentwrap2.load( links , hideLoading);
					content2.fadeIn("fast");
					$(this).addClass("active");
					break;
		
				default:
					//hide loading bar if there is no selected section
					hideLoading();
					break;
			}
		
		});	
		
		
		
		// for Suggest button
		var sections3 = $(".bmi-suggest-widget > a");
		var loading3 = $("<div class='loading'>Loading</div>");
		var content3 = $(".ex3");
		var contentwrap3 = $(".bmi_suggestlistings");	
		
		//Manage click events
		sections3.click(function(){
		//	$(".more-features .join").remove();
			//show the loading bar
			//alert("works");
			showLoading();			
			//Remove Active Class
				
			switch(this.id){
				case "ex3":
			//alert("test");
					var links = $(this).attr("title");
					//alert("test2");	
					contentwrap3.load( links , hideLoading);
					content3.fadeIn("fast");
					$(this).addClass("active");
					break;
		
				default:
					//hide loading bar if there is no selected section
					hideLoading();
					break;
			}
		
		});	
		
		
			// for Suggest button
		var sections4 = $(".bmi-fav-widget > a");
		var loading4 = $("<div class='loading'>Loading</div>");
		var content4 = $(".ex4");
		var contentwrap4 = $(".dynamic-content");	
		
		//Manage click events
		sections4.click(function(){
		//	$(".more-features .join").remove();
			//show the loading bar
			//alert("works");
			//$(this).parent(".bmi-fav-widget").find(".bmi-fav-widget-inner").show();
			showLoading();			
			//Remove Active Class
				
			switch(this.id){
				case "ex4":
			//alert("test");
					var links = $(this).attr("title");
					//alert("test2");	
					contentwrap4.load( links , hideLoading);
					content4.fadeIn("fast");
					$(this).addClass("active");
					break;
		
				default:
					//hide loading bar if there is no selected section
					hideLoading();
					break;
			}
		
		});	
		
		
		
		
//bmi_profile_update accordion

$profile_count = $(".profilebox_count").html();
//alert($profile_count);

$(".bmi_profile_update h2").next("div").hide();	
$(".bmi_profile_update h2").eq($profile_count).addClass("uncomplete").next("div").show();	




$(".bmi_profile_update h2").click( function(){
	
		$(this).toggleClass("open").next("div").slideToggle("fast");
	//$(this).hasClass("uncomplete").removeClass("uncomplete");	
	
	})
		
		
//  Eof Inner Page Jquery
// **************************************************************
// **************************************************************
// **************************************************************
// **************************************************************

	
	
	
	
	
	
	
	})













// Eof Main header 
