$(document).ready(function() {

		/*** Begin of input fields buttons ***/
		
		$.extend($.expr[':'], {
		    	focus: function(element) { 
		        return element == document.activeElement; 
	    	}
		});	
		
		
			if($('#email').val()!='')
				$('#emailLabel').css('visibility','hidden');

				if($('#password').val()!='')
					$('#passwordLabel').css('visibility','hidden');
			
			$('#password').blur(
			function(){
					if($(this).val()=='')
						$('#passwordLabel').css('visibility','visible');
			}
			);

			$('#password').blur(
			function(){
					if($(this).val()=='' && !$(this).is(":focus"))
						$('#passwordLabel').css('visibility','visible');
			}
			);
			
		
			$('#email').blur(
			function(){
					if($(this).val()=='' && !$(this).is(":focus"))
						$('#emailLabel').css('visibility','visible');
			}
			);
			


			$('#password').focus(function(){
				if($(this).val()=='')
				{ 
					$('#passwordLabel').css('visibility','hidden');
				}
			}
			);
			
			$('#email').focus(function(){
				if($(this).val()=='')
				{ 
					$('#emailLabel').css('visibility','hidden');
				}
			}
			);
									
			$('#password').hover(
			function(){
				if($(this).val()=='')
				{ 
					$('#passwordLabel').css('visibility','hidden');
				}
				}, 
			function(){
				if($(this).val()=='' && !$(this).is(":focus")) {
					$('#passwordLabel').css('visibility','visible');


				}
				});
			
			$('#email').hover(
			function(){
				if($(this).val()=='')
				{ 
					$('#emailLabel').css('visibility','hidden');
				}
				}, 
			function(){
				if($(this).val()=='' && !$(this).is(":focus")) {
					$('#emailLabel').css('visibility','visible');


				}
				});
				
			/*** End of input fields buttons ***/
			
			
			/*** Begin of tabs ***/
			$('#tabContact.inactive').mouseover(
			function() {
				$('#tabBgrContact').animate({'margin-left': '0px'},200);
			}
			);
			
			$('#tabContact.inactive').mouseout(
			function() {
				$('#tabBgrContact.inactive').animate({'margin-left': '7px'},200);
				
			}
			);
			
			$('#tabContact.inactive').click(
				function() {
				var curActive = $('#tabBgrs .active');
				curActive.animate({'margin-left': '7px'},200);				
				curActive.removeClass('active');
				curActive.addClass('inactive');
				var curTab = $('#tabBgrContact');
				curTab.removeClass('inactive');
				curTab.addClass('active');
				var curActiveLink = $('#tabLinks .active');
				curActiveLink.removeClass('active');
				curActiveLink.addClass('inactive');				
				$('#tabContact').addClass('active');
				if(isFirstVisit) {
					$('#tipTabContent').removeClass('tipTabContentAbout');
				}				
				
			}
			);
			
			
			$('#tabAbout.inactive').mouseover(
			function() {
				$('#tabBgrAbout').animate({'margin-left': '0px'},200);
			}
			);
			
			$('#tabAbout.inactive').mouseout(
			function() {
				$('#tabBgrAbout.inactive').animate({'margin-left': '7px'},200);
				
			}
			);
			
			$('#tabAbout.inactive').click(
				function() {
				var curActive = $('#tabBgrs .active');
				curActive.animate({'margin-left': '7px'},200);				
				curActive.removeClass('active');
				curActive.addClass('inactive');
				var curTab = $('#tabBgrAbout');
				curTab.removeClass('inactive');
				curTab.addClass('active');
				var curActiveLink = $('#tabLinks .active');
				curActiveLink.removeClass('active');
				curActiveLink.addClass('inactive');				
				$('#tabAbout').addClass('active');
				if(isFirstVisit) {
					$('#tipTabContent').addClass('tipTabContentAbout');
				}
				
			}
			);		

			$('#tabVcard').mouseover(
			function() {
				$('#tabBgrVcard').animate({'margin-left': '0px'},200);
			}
			);
			
			$('#tabVcard').mouseout(
			function() {
				$('#tabBgrVcard.inactive').animate({'margin-left': '7px'},200);
				
			}
			);
			
			$('#tabVcard.inactive').click(
				function() {
				var curActive = $('#tabBgrs .active');
				curActive.animate({'margin-left': '7px'},200);
				curActive.removeClass('active');
				curActive.addClass('inactive');
				var curTab = $('#tabBgrVcard');
				curTab.removeClass('inactive');
				curTab.addClass('active');
				var curActiveLink = $('#tabLinks .active');
				curActiveLink.removeClass('active');
				curActiveLink.addClass('inactive');				
				$('#tabVcard').addClass('active');
				
				
				
			}
			);						
	
			/*** End of tabs ***/
			
			var localScroll = $('#navigation').localScroll({
			   target:'#card_content',
			   hash: false
			});


			$activeTab = $("a#tabContact");
			$activeTab.trigger("click");
			
			/*** Dock ***/
			

			startDockMenu();

			//Bubble popup
					//create a bubble popup for each DOM element with class attribute as "text", "button" or "link" and LI, P, IMG elements.
					$('.bubble').CreateBubblePopup({
												position : 'top',
												align	 : 'center',

												innerHtmlStyle: {
																	color:'#FFFFFF', 
																	'text-align':'center'
																},
												themeName: 	'all-black',
												themePath: 	'http://beename.com/images/jquerybubblepopup-theme'
											});

					$('.bubbleShare').CreateBubblePopup({
												divStyle: {'margin-left':'-10px'},
												position : 'left',
												align	 : 'middle',

												innerHtmlStyle: {
																	color:'#FFFFFF', 
																	'text-align':'center'
																},
												themeName: 	'all-black',
												themePath: 	'http://beename.com/images/jquerybubblepopup-theme'
											});				
			//End of bubble popup
			
			//checkbox
			editCB = $('#editMode').iphoneStyle();
			
			//growl
			$('#growl').growlAlert({ 
								autoShow: false
			});

			//scrollbar
			addressContentScroll = $('#addressContent').tinyscrollbar();
			aboutContentScroll = $('#aboutContent').tinyscrollbar();
			
			centerCard();
			
			//webcam
			//$('#webcamParent').
			
			//$('#scrollBar1').tinyscrollbar();
			
			$('a').click(
				function(e) {
					if($(this).attr('href') == '#')
						e.preventDefault();
				
			}
			);
			
			$(function() {
					progressBar = $( "#progressbar" ).progressbar({
						value: 0
					});
				});
			
				
			$('.shareIcon').hover(function() {
				$(this).animate({'right' : '13'}, 200);
			}, function(){
				$(this).animate({'right' : '0'}, 200);
			});
			
			positionSuspended();

}); //End of document.ready


function positionSuspended() {
	var windowHeight = $(window).height();
	newTop = ((windowHeight - 230)/2)-160;
	if(newTop<30)
		newTop = 30;	
	$('#accountSuspended').css({'top': newTop});

}

function ie7fix() {
	$('.viewport').css({'float':'left'});
	alert('test');
}

var resizeTimer = null;
$(window).resize(function    () {
if (resizeTimer) clearTimeout(resizeTimer);
resizeTimer = setTimeout(centerCard, 300);
positionSuspended();
});




