/****************************************************************************************** * Default Text Toggle ******************************************************************************************/ function ClearText(Elem,DefaultText) { if(Elem) { if(typeof(Elem.value) != 'undefined') { if (Elem.value == DefaultText) { Elem.value = ''; } } else if(typeof(Elem.innerHTML) != 'undefined') { if (Elem.value == DefaultText) { Elem.innerHTML = ''; } } } } function DefaultText(Elem,DefaultText) { if(Elem) { if(typeof(Elem.value) != 'undefined') { if (Elem.value == '') { Elem.value = DefaultText; } } else if(typeof(Elem.innerHTML) != 'undefined') { if (Elem.innerHTML == '') { Elem.innerHTML = DefaultText; } } } } /****************************************************************************************** * Calendar Icon Switcher ******************************************************************************************/ if(document.getElementById('CalendarDate')) { var today=new Date(); var thisDay=today.getDate(); var offsetHorizontal=(thisDay*40)-40; var offsetVertical= '0'; var offset='-'+offsetHorizontal+'px '+offsetVertical+'px'; $('#SON .CalendarIcon').css('background-position',offset); } /****************************************************************************************** * Home Page - Main Slideshow ******************************************************************************************/ if(document.getElementById('MainSlideshow')) { $(function() { $('#MainSlideshow').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, pager: '#SlideShowNav', //timeout: 0, False turns Auto Scrolling off pagerAnchorBuilder: function(idx, slide) { // return sel string for existing anchor return '#SlideShowNav li:eq(' + (idx) + ') a'; } }); }); } /****************************************************************************************** * Home Page - Blog Slideshow ******************************************************************************************/ if(document.getElementById('BlogSlideshow')) { $(function() { $('#BlogSlideshow').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, pager: '#BlogSlideShowNav', startingSlide: 0, pauseOnPagerHover: true, timeout: 0, pagerAnchorBuilder: function(idx, slide) { // return sel string for existing anchor return '#BlogSlideShowNav li:eq(' + (idx) + ') a'; } }); }); } /****************************************************************************************** * Slider - Recent How Tos - Default ******************************************************************************************/ if(document.getElementById('HowToSlider')) { $(function() { $('.HowToSlides').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, prev: '.SliderPrevious', next: '.SliderNext', timeout: 0 //False turns Auto Scrolling off }); }); } /****************************************************************************************** * Slider - Recent - How Tos - Category Based ******************************************************************************************/ if(document.getElementById('HowToSliderhowtos')) { $(function() { $('.HowToSlideshowtos').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, prev: '.SliderPrevioushowtos', next: '.SliderNexthowtos', timeout: 0 //False turns Auto Scrolling off }); }); } if(document.getElementById('HowToSliderwhatwereloving')) { $(function() { $('.HowToSlideswhatwereloving').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, prev: '.SliderPreviouswhatwereloving', next: '.SliderNextwhatwereloving', timeout: 0 //False turns Auto Scrolling off }); }); } /****************************************************************************************** * Slider - How to Slider - Full Page ******************************************************************************************/ if(document.getElementById('SliderSlider')) { $(function() { $('#SliderSlider').cycle({ fx: 'fade', speed: 2000, speedIn: 500, speedOut: 500, prev: '#SliderSliderPrev', next: '#SliderSliderNext', //timeout: 0, Remove comment to turn Auto Scrolling off pager: '#SliderSliderNav', pagerAnchorBuilder: function(idx, slide) { return '
  • '+(idx+1)+'
  • '; } }); }); } /****************************************************************************************** * Article Rating ******************************************************************************************/ function HighlightStars( StarElement, Score ) { var MaxStars = 5; var Container = StarElement.parentNode; var Stars = Container.getElementsByTagName('a'); for( var StarIndex = 0; StarIndex < MaxStars; StarIndex++ ) { Stars[StarIndex].className = 'Star' + ( StarIndex+1 <= Score ? 'On' : 'Off' ); } } // Submit Rating Form if(document.getElementById('RatingForm')) { $("#RatingForm a").click(function() { $('#RatingScore').val($(this).attr('rel')); $("#RatingForm").submit(); return false; }); } /****************************************************************************************** * Self Checkup Latest ******************************************************************************************/ if(document.getElementById('SelfCheckupLatest')) { $('.SelfCheckupOptionText').hover(function() { $(this).css('color', '#4D8A2B'); }, function() { $(this).css('color', '#444444'); }); $('#SelfCheckupLatest input').change(function() { $('#SON #SelfCheckupForm').submit(); }); } /****************************************************************************************** * Poll Latest ******************************************************************************************/ if(document.getElementById('PollLatest')) { $('.PollOptionText').hover(function() { $(this).css('color', '#4D8A2B'); }, function() { $(this).css('color', '#444444'); }); $('#PollLatest input').change(function() { $('#SON #PollForm').submit(); }); } /****************************************************************************************** * Poll AJAX - i.e. Self Submitting ******************************************************************************************/ if(document.getElementById('PollDynamics')) { var OptionClick = function(Event) { // IE requires some help checking the selection before submit var TargetTag = Event.target.tagName.toLowerCase(); if( TargetTag == 'input' ) { $(this).checked = true; } else if( TargetTag == 'label' ) { document.getElementById(Event.target.htmlFor).checked = true; } $("#PollDynamics").fadeOut(500, function () { UpdatePoll($('#TrackingURL').val()) }); return false; } $("#SON #PollForm label, #SON #PollForm input").click(OptionClick); } function UpdatePoll(trackingURL) { $("#PollDynamics").load( 'http://www.completelyyou.com/includes/poll.php', $("#PollForm").serializeArray(), function () { DisplayPollResults(trackingURL) } ); } function DisplayPollResults(trackingURL) { $("#PollDynamics").fadeIn(500); $("#PollResults").load( 'http://www.completelyyou.com/' + trackingURL, '' ); } function GetNextPoll(newURL) { $("#PollDynamics").fadeOut(500, RefreshPollContent(newURL)); } function RefreshPollContent(newURL) { $.ajax({ url:newURL, dataType:'html', timeout:5000, success:function (html) { $("#SON #PollDynamics").html(html); $("#SON #PollDynamics").fadeIn(500); $("#SON #PollForm").bind("submit", function() { $("#SON #PollDynamics").fadeOut(500,UpdatePoll($('#SON #SBPoll #TrackingURL').val())); return false; } ); $("#SON #PollForm label, #SON #PollForm input").bind("click", OptionClick); } }); }