function padlength(what){ var output=(what.toString().length==1)? "0"+what : what; return output; } function displaytime(){ serverdate.setMinutes(serverdate.getMinutes()+1); // var datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear(); var timestring = padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes()); $("#time span").text(timestring); $("#time-para span").text(timestring); } jQuery.fn.clearonfocus = function() { jQuery(this) .bind('focus', function() { // Set the default value if it isn't set if ( !this.defaultValue ) this.defaultValue = this.value; // Check to see if the value is different if ( this.defaultValue && this.defaultValue != this.value ) return; // It isn't, so remove the text from the input this.value = ''; }) .bind('blur', function() { // If the value is blank, return it to the defaultValue if ( this.value.match(/^\s*$/) ) this.value = this.defaultValue; }); }; $(function() { if($('li.submit-reset input[type=reset]').length) { $('li.submit-reset input[type=reset]').each(function() { $('').insertBefore(this); }); } if($('a.delete_row').length) { $('a.delete_row').click( function() { var $row = $(this).parent().parent('tr'); changeNextRow($row); return false; } ); } function changeNextRow($row) { $row.find('input[type=text]').each(function(index,element) { $(this).val($row.next('tr').find('>:eq('+index+') input[type=text]').val()); }); if($row.next('tr').length) { $row = $row.next('tr'); changeNextRow($row); } else { $row.find('input[type=text]').val(' '); return $row; } } // currency switcher $('.currency-switcher a').currencySwitcher(); /* jQuery("div.svw").prepend("loading..."); */ if($('dl.hooks')[0]!=undefined) { jQuery('dl.hooks').accordion({ header: "dt.send-to-friend", alwaysOpen: false, active:false, selectedClass: 'active', autoHeight: false }); } if($('.currency-switcher')[0]!=undefined) { jQuery('.currency-switcher').accordion({ header: "dt", alwaysOpen: false, active:false, selectedClass: 'active', autoHeight:false }); } jQuery('#primary-navigation').accordion({ active: false, header: 'dt.opener', event: 'click', alwaysOpen: false, autoHeight:false, clearStyle:true, collapsible:true }); $('#primary-navigation dt.opener+dd').append('Close button'); $('#primary-navigation dd img.close-button').click(function() { $('#primary-navigation').accordion( "activate", -1); }); $('hr').replaceWith('

'); $('form:not(#entryform) input[type=text]').clearonfocus(); $("dt:last-child").addClass('last'); $("#super-navigation li:last-child").addClass('last'); $("dl.product-attributes dd:last-child").addClass('last'); $("dd:last-child").addClass('last'); $("li:last-child").addClass('last'); $("td:last-child").addClass('last'); $("tr:last-child").addClass('last'); $("th:last-child").addClass('last'); $("#secondary>div:first-child").addClass('top'); function zoom_dimensions(el,nodeType,parameter) { if(parameter == 'height') { return $(el).find(nodeType).height(); } else { return $(el).find(nodeType).width(); } } $('a.zoom').each(function() { var href = $(this).attr('href'); if(href!=undefined&&href!=null) { var elWidth = zoom_dimensions(href,'img','width'); var elHeight = zoom_dimensions(href,'img','height'); if(elWidth!=undefined&&elWidth>0) { $(this).fancyZoom({width:elWidth, height:elHeight,closeOnClick:true}); } else { $(this).fancyZoom({width:580, closeOnClick:true}); } } }); $('a.standard-zoom').each(function() { var href = $(this).attr('href'); if(href!=undefined&&href!=null) { $(this).fancyZoom({width:580, closeOnClick:true}); } }); $('a.map-zoom').each(function() { var href = $(this).attr('href'); if(href!=undefined&&href!=null) { var elWidth = zoom_dimensions(href,'div.scarf','width'); var elHeight = zoom_dimensions(href,'div.scarf','height'); if(elWidth!=undefined&&elWidth>0) { $(this).fancyZoom({width:elWidth, height:120}); } else { $(this).fancyZoom({width:530, height:120}); } } }); $('ul.items a').fancyZoom({width:580,height:387,closeOnClick:true}); $('a.principle-image').fancyZoom({width:580,height:387,closeOnClick:true}); $('a.rates').each(function() { var href = $(this).attr('href'); if(href!=undefined&&href!=null) { var elWidth = zoom_dimensions(href,'table','width'); var elHeight = zoom_dimensions(href,'table','height') + 62 /* adding some height to accommodate h2 above table */; if(elWidth!=undefined&&elWidth>0) { $(this).fancyZoom({width:elWidth, height:elHeight,closeOnClick:false}); } else { $(this).fancyZoom({width:530, height:180,closeOnClick:false}); } } }); $('ul.items a').fancyZoom({width:530, height:387,closeOnClick:true}); $('#mailinglist-link').fancyZoom({width:270, height:150}); // Navigation animation /* var name = "#primary-navigation"; var fullWidthBase = "#breadcrumb-wrap"; var menuYloc = null; menuYloc = -183; breadcrumbYloc = -11; $(window).scroll(function () { if($(document).scrollTop() > -menuYloc) { offset = menuYloc+$(document).scrollTop()+"px"; // alert(offset); fullwidthOffset = breadcrumbYloc+$(document).scrollTop()+"px"; $(name).animate({top:offset},{duration:500,queue:false}); $(fullWidthBase).animate({top:fullwidthOffset},{duration:500,queue:false}); } else { $(name).animate({top:"0px"},{duration:500,queue:false}); $(fullWidthBase).animate({top:219+"px"},{duration:500,queue:false}); } }); // end Navigation animation */ $("div.strip-viewer").scrollable({ items:'ul', size:4, vertical:true, prev:'div.up', next:'div.down', activeClass:'active', loop: true }); $("#scrollable").scrollable({items:'.items',horizontal:true}); $('#super-navigation').after('

The time in South Africa is now

'); displaytime(); setInterval("displaytime()", 60000); if ($("#form-enquire-now")[0] != undefined) { $("#form-enquire-now").validate({ rules: { first_name: "required", email: "required", confirm_email: "required", first_name: { required: true, minlength: 2 }, email: { required: true, minlength: 5, email: true }, confirm_email: { required: true, equalTo: "#email" }, phone_number: { minlength: 8 } }, messages: { first_name: { required: "Please tell us your name", minlength: "Your name must be longer than that" }, email: { required: "Please tell us your email address", minlength: "Whoops, that is not a valid email address" }, confirm_email: { required: "Please confirm your email address", equalTo: "Please enter the same email address" }, email: "Whoops, that is not a valid email address", phone_number: { minlength: "Your phone number is a bit too short" } } }); } }); // Display Server Time var currenttime = 'September 05, 2010 13:34:09' //PHP method of getting server date var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December"); var serverdate=new Date(currenttime);