$(function() {         
         
    // initialize scrollables  
	if($("div.scrollable").length>0)
	    $("div.scrollable").scrollable({size:6}).mousewheel();   


    $("div.scrollableComments").scrollable({ 
        vertical:true, 
        size: 5,
		prev: '.up',
		next: '.down'
    }).mousewheel();   


	$("#bioMenuChatNow").mousedown(function() {
		$(this).attr('src', '/home/templates/images/bioMenuChatNowOn.jpg');
	}).mouseup(function() {
		$(this).attr('src', '/home/templates/images/bioMenuChatNow.jpg');
	});

	$("#bioMenuMakeAppointment").mousedown(function() {
		$(this).attr('src', '/home/templates/images/bioMenuMakeAppointmentOn.jpg');
	}).mouseup(function() {
		$(this).attr('src', '/home/templates/images/bioMenuMakeAppointment.jpg');
	});
	
	
	$('#appointment_add').click(function() {
		if($(this).attr('href').search(/small=1/)!=-1)
			appointmentAdd(this, $(this).attr('href'), 'small');
		else	appointmentAdd(this, $(this).attr('href'), 'large');
		return false;
	});

	if(isonline)	$('div.bioAboutMeBox').css('background-image', 'url(/home/templates/images/bioAboutMeBoxOnAir.jpg)');
	else	$('div.bioAboutMeBox').css('background-image', 'url(/home/templates/images/bioAboutMeBoxOffAir.jpg)');

	
	/*
	$('a[rel=gallery]').lightBox({fixedNavigation:true
								 , imageBtnClose:'/home/templates/images/galleryClose.png'
								 , imageLoading:'/home/templates/images/galleryLoading.gif'});
		*/

	
	if($('a[rel=gallery]').length>0) {
	
	$('a[rel=gallery]').phototacious({
					hideControlsFadeOut: 800,
					hideControlsFadeIn: 200,
					hideControlsElements: ['close', 'forwardStep', 'forwardEnd', 'backward', 'forward', 'slideShow', 'saveAs', 'displayStatus', 'backwardStep', 'backwardEnd'],					
					htmlSlideShowStart: '<img src="/home/templates/buttons/photoaciousStartSlideShow.png" class="phototacious" alt="" border="0">',
					htmlSlideShowStop: '<img src="/home/templates/buttons/photoaciousStopSlideShow.png" class="phototacious" alt="" border="0">',
					htmlSaveAs: '<img src="/home/templates/buttons/photoaciousSaveAs.png" class="phototacious" alt="" border="0">',
					saveAsUrl: '/home/downloadFile.php?file=',
					htmlClose: '<img src="/home/templates/buttons/photoaciousClose.png" class="phototacious" alt="" border="0">',
					htmlBackward: '<img src="/home/templates/buttons/photoaciousPrev.png" class="phototacious" alt="" border="0">',
					htmlForward: '<img src="/home/templates/buttons/photoaciousNext.png" class="phototacious" alt="" border="0">',
					htmlBackwardEnd: '<img src="/home/templates/buttons/photoaciousPrevEnd.png" class="phototacious" alt="" border="0">',
					htmlForwardEnd: '<img src="/home/templates/buttons/photoaciousNextEnd.png" class="phototacious" alt="" border="0">',
					slideshowTimeout: 6000,
					photoFadeIn: 800,
					photoFadeOut: 800,
					loadingImage: '/home/templates/images/loadingAnimation.gif',
					minPhotoWidth: 350,
					minPhotoHeight: 250,
					photoCenter: true,
					messageMargin: 20,
					photoDisplayMarginLeft: 20,
					photoDisplayMarginRight: 20,
					photoDisplayMarginTop: 20,
					photoDisplayMarginBottom: 20,
					callBackSlideShow: phototaciousSwapImages,
					callBackInit: phototaciousSwapImages,
					getDimensionsUrl:'/home/getDimensions.php',
					messageCSS: { 
						top:  '4px', 
					    cursor: 'default',
						border: '2px solid #b2b2b2',
					    backgroundColor: '#000'
					},
					photoCSS: {}});

	}


	//Preloading the phototacious images
	if($('#preLoader').length==0)		$('body').append('<div id="preLoader"></div>');
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousStopSlideShow_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousStopSlideShow_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousStartSlideShow_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousStartSlideShow_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousSaveAs_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousSaveAs_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousClose_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousClose_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");	
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousPrev_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousPrev_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousNext_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousNext_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousPrevEnd_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousPrevEnd_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousNextEnd_on.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");	
	$('#preLoader').append('<img src="/home/templates/buttons/photoaciousNextEnd_over.png" class="displayNone" alt="" border="0" width="0" height="0">'+"\n");	

}); 
