jQuery(document).ready(function(){
    prettyPhoto.init();
    
    // removes all empty ul tags... specifically for the left side nav.
    jQuery("ul").each(function() {
        var elem = jQuery(this);
        if (elem.children().length == 0) {
            elem.remove();
        }
    });
 
    jQuery('ul.sf-menu').superfish({ 
        delay:       800,                            // one second delay on mouseout 
        animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
        speed:       'fast',                          // faster animation speed 
        autoArrows:  false,                           // disable generation of arrow mark-up 
        dropShadows: false                            // disable drop shadows 
    });
 
  // redeem code on checkout
    jQuery('input[name=gv_redeem_code]').focus(function(){
        if(jQuery(this).val() == 'redeem code'){
            jQuery(this).attr("value", "");
        }
    });
    jQuery('input[name=gv_redeem_code]').blur(function(){
        if(jQuery(this).val() == ''){
            jQuery(this).attr("value", "redeem code");
        }
    });
    
 // keyword search in header
    jQuery('#keywords').focus(function(){
        if(jQuery(this).val() == 'Enter Keyword'){
            jQuery(this).attr("value", "");
        }
    });
    jQuery('#keywords').blur(function(){
        if(jQuery(this).val() == ''){
            jQuery(this).attr("value", "Enter Keyword");
        }
    });
// email login in header
    jQuery('#email_address').focus(function(){
        if(jQuery(this).val() == 'Email Address'){
            jQuery(this).attr("value", "");
        }
    });
    jQuery('#email_address').blur(function(){
        if(jQuery(this).val() == ''){
            jQuery(this).attr("value", "Email Address");
        }
    });
// password login in header
    jQuery('#login_pass_value').focus(function(){
        if(jQuery(this).val() == 'Password'){
            //jQuery(this).attr("value", "");
            jQuery(this).hide();
            jQuery('#password').show();
            jQuery('#password').focus();            
        }
    });
    jQuery('#password').blur(function(){
        if(jQuery(this).val() == ''){
             jQuery(this).hide();
            jQuery('#login_pass_value').show();
        }
    });
    jQuery('#login_pass_value').blur(function(){
        if(jQuery(this).val() == ''){
            jQuery(this).attr("value", "Password");
        }
    });
});




// LEGACY CODE

function verify(form)
{
   var passed = false;
   var blnRetval, intAtSign, intDot, intComma, intSpace, intLastDot, intDomain, intStrLen;
   if (form.Email){
               intAtSign=form.Email.value.indexOf("@");
                intDot=form.Email.value.indexOf(".",intAtSign);
                intComma=form.Email.value.indexOf(",");
                intSpace=form.Email.value.indexOf(" ");
                intLastDot=form.Email.value.lastIndexOf(".");
                intDomain=intDot-intAtSign;
                intStrLen=form.Email.value.length;
        // *** CHECK FOR BLANK EMAIL VALUE
           if (form.Email.value == "" )
           {
        alert("You have not entered an email address.");
        form.Email.focus();
        passed = false;
        }
        // **** CHECK FOR THE  @ SIGN?
        else if (intAtSign == -1)
        {

        alert("Your email address is missing the \"@\".");
                form.Email.focus();
        passed = false;

        }
        // **** Check for commas ****

        else if (intComma != -1)
        {
        alert("Email address cannot contain a comma.");
        form.Email.focus();
        passed = false;
        }

        // **** Check for a space ****

        else if (intSpace != -1)
        {
        alert("Email address cannot contain spaces.");
        form.Email.focus();
        passed = false;
        }

        // **** Check for char between the @ and dot, chars between dots, and at least 1 char after the last dot ****

        else if ((intDot <= 2) || (intDomain <= 1)  || (intStrLen-(intLastDot+1) < 2))
        {
        alert("Please enter a valid Email address.\n" + form.Email.value + " is invalid.");
        form.Email.focus();
        passed = false;
        }
        else {
                passed = true;
        }
}
else    {
        passed = true;
}
return passed;
}


function empty1()
{
    document.getElementById('Email').value="";
}

function fill1()
{
    if(document.getElementById('Email').value=="")
        document.getElementById('Email').value="Enter Email Address";
}
function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=150')
}
/* used on account login */
function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}
function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
/**
* Copyright 2010 by GlamThumbs Team.
*
* This is an example to demostrate the BookmarkApp.js by GlamThumbs Team.
* Reference: http://glamthumbs.com/BookmarkApp.js
* Reference: http://stackoverflow.com/questions/992844/add-to-browser-favorites-bookmarks-from-javascript-but-for-all-browsers-mine-doe
*
*/
BookmarkApp = function () {
var isIEmac = false; /*@cc_on @if(@_jscript&&!(@_win32||@_win16)&&(@_jscript_version<5.5)) isIEmac=true; @end @*/
var isMSIE = (-[1,]) ? false : true;
var cjTitle = document.title; // Bookmark title
var cjHref = location.href;   // Bookmark url

function hotKeys() {
  var ua = navigator.userAgent.toLowerCase();
  var str = '';
  var isWebkit = (ua.indexOf('webkit') != - 1);
  var isMac = (ua.indexOf('mac') != - 1);

  if (ua.indexOf('konqueror') != - 1) {
    str = 'CTRL + B'; // Konqueror
  } else if (window.home || isWebkit || isIEmac || isMac) {
    str = (isMac ? 'Command/Cmd' : 'CTRL') + ' + D'; // Netscape, Safari, iCab, IE5/Mac
  }
  return ((str) ? 'Press ' + str + ' to bookmark this page.' : str);
}

function isIE8() {
  var rv = -1;
  if (navigator.appName == 'Microsoft Internet Explorer') {
    var ua = navigator.userAgent;
    var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null) {
      rv = parseFloat(RegExp.$1);
    }
  }
  if (rv > - 1) {
    if (rv >= 8.0) {
      return true;
    }
  }
  return false;
}

function addBookmark(a) {
  try {
    if (typeof a == "object" && a.tagName.toLowerCase() == "a") {
      a.style.cursor = 'pointer';
      if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) {
        window.sidebar.addPanel(cjTitle, cjHref, ""); // Gecko
        return false;
      } else if (isMSIE && typeof window.external == "object") {
        if (isIE8()) {
          window.external.AddToFavoritesBar(cjHref, cjTitle); // IE 8
        } else {
          window.external.AddFavorite(cjHref, cjTitle); // IE <=7
        }
        return false;
      } else if (window.opera) {
        a.href = cjHref;
        a.title = cjTitle;
        a.rel = 'sidebar'; // Opera 7+
        return true;
      } else {
        alert(hotKeys());
      }
    } else {
      throw "Error occured.\r\nNote, only A tagname is allowed!";
    }
  } catch (err) {
    alert(err);
  }
}

return {
  addBookmark : addBookmark
}
}();




/* PRETTY PHOTOS */
    prettyPhoto = {
        options : {
            'animationSpeed' : 'fast', /* fast/normal/slow */
            'padding' : 40 /* padding for each side of the picture */
        },
        init : function(){
            // Find all the images to overlay
            prettyPhoto.imagesArray = [];
            jQuery("a[rel^='prettyOverlay']").each(function(){
                prettyPhoto.imagesArray[prettyPhoto.imagesArray.length] = this;
                jQuery(this).bind('click',function(){
                    prettyPhoto.open(this); return false;
                });
            });
        },
        open : function(caller) {
            prettyPhoto.caller = caller;
            
            // Find out if the picture is part of a set
            theRel = jQuery(caller).attr('rel');
            galleryRegExp = /\[(?:.*)\]/;
            theGallery = galleryRegExp.exec(theRel);
            
            // Calculate the number of items in the set, and the position of the clicked picture.
            prettyPhoto.setCount = 0; /* Total images in the set */
            prettyPhoto.setPosition = 0; /* Position in the set */
            prettyPhoto.arrayPosition = 0; /* Total position in the array */
            prettyPhoto.isSet = false;
            for (i = 0; i < prettyPhoto.imagesArray.length; i++){
                if(jQuery(prettyPhoto.imagesArray[i]).attr('rel').indexOf(theGallery) != -1){
                    prettyPhoto.setCount++;
                    if(prettyPhoto.setCount > 1) prettyPhoto.isSet = true;

                    if(jQuery(prettyPhoto.imagesArray[i]).attr('href') == jQuery(caller).attr('href')){
                        prettyPhoto.setPosition = prettyPhoto.setCount;
                        prettyPhoto.arrayPosition = i;
                    };
                };
            };
            
            prettyPhoto.buildOverlay(prettyPhoto.isSet);

            // Display the current position
            jQuery('div.pictureHolder span.currentText').html('<span>' + prettyPhoto.setPosition + '</span>' + '/' + prettyPhoto.setCount);

            // Position the picture in the center of the viewing area
            prettyPhoto.centerPicture();
            
            // Fade out the current picture
            jQuery('div.pictureHolder #fullResImage').fadeTo(prettyPhoto.options['animationSpeed'],0,function(){
                jQuery('.loaderIcon').show();

                // Preload the neighbour images
                prettyPhoto.preload();
            });
        },
        next : function(){
            // Change the current position
            prettyPhoto.arrayPosition++;
            prettyPhoto.setPosition++;

            // Fade out the current picture
            jQuery('div.pictureHolder #fullResImage').fadeTo(prettyPhoto.options['animationSpeed'],0,function(){
                jQuery('.loaderIcon').show();
                
                // Preload the neighbour images
                prettyPhoto.preload();
            });
            
            jQuery('div.pictureHolder .hoverContainer').fadeOut(prettyPhoto.options['animationSpeed']);
            jQuery('div.pictureHolder .details').fadeOut(prettyPhoto.options['animationSpeed'],function(){
                prettyPhoto.checkPosition();
            });
        },
        previous: function(){
            // Change the current position
            prettyPhoto.arrayPosition--;
            prettyPhoto.setPosition--;

            // Fade out the current picture
            jQuery('div.pictureHolder #fullResImage').fadeTo(prettyPhoto.options['animationSpeed'],0,function(){
                jQuery('.loaderIcon').show();
                
                // Preload the image
                prettyPhoto.preload();
            });

            jQuery('div.pictureHolder .hoverContainer').fadeOut(prettyPhoto.options['animationSpeed']);
            jQuery('div.pictureHolder .details').fadeOut(prettyPhoto.options['animationSpeed'],function(){
                prettyPhoto.checkPosition();
            });
        },
        checkPosition : function(){
            // If at the end, hide the next link
            (prettyPhoto.setPosition == prettyPhoto.setCount) ? jQuery('div.pictureHolder a.next').hide() : jQuery('div.pictureHolder a.next').show();
            
            // If at the beginning, hide the previous link
            (prettyPhoto.setPosition == 1) ? jQuery('div.pictureHolder a.previous').hide() : jQuery('div.pictureHolder a.previous').show();
            
            // Change the current picture text
            jQuery('div.pictureHolder span.currentText span').text(prettyPhoto.setPosition);
            
            if(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('title')){
                jQuery('div.pictureHolder .description').text(jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('title'));
            }else{
                jQuery('div.pictureHolder .description').text('');
            }
        },
        centerPicture : function(){
            var offset = jQuery('div.pictureHolder').offset();

            jQuery('div.pictureHolder').css({
                'top': offset.top + prettyPhoto.getScroll() - jQuery('div.pictureHolder').height()/2,
                'left': offset.left - jQuery('div.pictureHolder').width()/2
            });
        },
        preload : function(){
            // Set the new image
            imgPreloader = new Image();

            jQuery('div.pictureHolder .content').css('overflow','hidden');
            jQuery('div.pictureHolder #fullResImage').attr('src',jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('href'));

            imgPreloader.onload = function(){
                // Need that small delay for the anim to be nice
                setTimeout('prettyPhoto.showimage(imgPreloader.width,imgPreloader.height)',750);
            };
            
            imgPreloader.src = jQuery(prettyPhoto.imagesArray[prettyPhoto.arrayPosition]).attr('href');
        },
        showimage : function(width,height){
            // Hide the next/previous links if on first or last images.
            prettyPhoto.checkPosition();
            
            jQuery('div.pictureHolder .details').width(width); /* To have the correct height */
            jQuery('div.pictureHolder .details p.description').width(width - parseFloat(jQuery('div.pictureHolder a.close').css('width'))); /* So it doesn't overlap the button */
            
            // Get the container size, to resize the holder to the right dimensions
            containerHeight = height + parseFloat(jQuery('div.pictureHolder .details').height()) + parseFloat(jQuery('div.pictureHolder .top').height()) + parseFloat(jQuery('div.pictureHolder .bottom').height());
            contentHeight = height + parseFloat(jQuery('div.pictureHolder .details').height()) + parseFloat(jQuery('div.pictureHolder .details').css('margin-top')) + parseFloat(jQuery('div.pictureHolder .details').css('margin-bottom'));
            containerWidth = width + parseFloat(jQuery('div.pictureHolder .content').css("padding-left")) + parseFloat(jQuery('div.pictureHolder .content').css("padding-right")) + prettyPhoto.options['padding'];
            
            jQuery('div.pictureHolder .content').animate({'height':contentHeight},prettyPhoto.options['animationSpeed']);

            // Resize the holder
            jQuery('div.pictureHolder').animate({
                'top': prettyPhoto.getScroll() + ((jQuery(window).height()/2) - (containerHeight/2)),
                'left': ((jQuery(window).width()/2) - (containerWidth/2)),
                'width':containerWidth,
                'height':containerHeight
            },prettyPhoto.options['animationSpeed'],function(){
                // Show the nav elements
                prettyPhoto.shownav();

                jQuery('#fullResImage').show();

                // Fade the new image
                jQuery('div.pictureHolder #fullResImage').fadeTo(prettyPhoto.options['animationSpeed'],1,function(){
                    jQuery('div.pictureHolder .hoverContainer').height(height);
                });
            });    
        },
        shownav : function(){
            if(prettyPhoto.isSet) jQuery('div.pictureHolder .hoverContainer').fadeIn();
            jQuery('div.pictureHolder .details').fadeIn();
            jQuery('.loaderIcon').hide();
        },
        buildOverlay : function(){
            
            // Build the background overlay div
            backgroundDiv = "<div class='prettyPhotoOverlay'></div>";
             jQuery('body').append(backgroundDiv);
            jQuery('div.prettyPhotoOverlay').css('height',jQuery(document).height());
            jQuery('.prettyPhotoOverlay').bind('click',function(){
                prettyPhoto.close();
            });
            
            // Basic HTML for the picture holder
            pictureHolder = '<div class="pictureHolder"><div class="top"><div class="left"></div><div class="middle"></div><div class="right"></div></div><div class="content"><div class="loaderIcon"></div><div class="hoverContainer"><a class="next" href="#">next</a><a class="previous" href="#">previous</a></div><img id="fullResImage" src="" style="display:none;" /><div class="details clearfix"><a class="close" href="#">Close</a><p class="description"></p><p class="currentTextHolder"><span class="currentText"><span>0</span>/<span class="total">0</span></span></p></div></div><div class="bottom"><div class="left"></div><div class="middle"></div><div class="right"></div></div></div>';
            jQuery('body').append(pictureHolder);

            jQuery('.pictureHolder').css({'opacity': 0});
            jQuery('a.close').bind('click',function(){ prettyPhoto.close(); return false; });
            
            jQuery('.pictureHolder .previous').bind('click',function(){
                prettyPhoto.previous();
                return false;
            });
            
            jQuery('.pictureHolder .next').bind('click',function(){
                prettyPhoto.next();
                return false;
            });
            
            // If it's not a set, hide the links
            if(!prettyPhoto.isSet) {
                jQuery('.hoverContainer').hide();
                jQuery('.currentTextHolder').hide();
            };

            // Then fade it in
            jQuery('div.prettyPhotoOverlay').css('opacity',0);
            // jQuery('div.prettyPhotoOverlay').hide();
            jQuery('div.prettyPhotoOverlay').fadeTo(prettyPhoto.options['animationSpeed'],0.35, function(){
                jQuery('div.pictureHolder').fadeTo(prettyPhoto.options['animationSpeed'],1,function(){
                    // To fix an IE bug
                    jQuery('div.pictureHolder').attr('style','left:'+jQuery('div.pictureHolder').css('left')+';top:'+jQuery('div.pictureHolder').css('top')+';');
                });
            });
        },
        getScroll : function(){
            scrollTop = window.pageYOffset || document.documentElement.scrollTop || 0;
            return scrollTop;
        },
        close : function(){
            jQuery('div.pictureHolder').fadeTo(prettyPhoto.options['animationSpeed'],0, function(){
                jQuery('div.prettyPhotoOverlay').fadeTo(prettyPhoto.options['animationSpeed'],0, function(){
                    jQuery('div.prettyPhotoOverlay').remove();
                    jQuery('div.pictureHolder').remove();
                });
            });
        }
    }
/* CALCULATOR */
function ffgc()
{

    var fw = document.getElementById('fw').value;
    var bw = document.getElementById('bw').value;
    var gh = document.getElementById('gh').value;
    var fd = document.getElementById('fd').value;
    
    if(fw=='' || bw=='' || gh=='' || fd=='')
        {
            alert("Please fill out all of the parameters!");
            if(fw=='')         { setfocus('fw'); }
            else if(bw=='') { setfocus('bw'); }
            else if(gh=='') { setfocus('gh'); }
            else if(fd=='') { setfocus('fd'); }
        }
    else
        {
        
            fw = parseFloat(document.getElementById('fw').value);
            bw = parseFloat(document.getElementById('bw').value);
            gh = parseFloat(document.getElementById('gh').value);
            fd = parseFloat(document.getElementById('fd').value);
            
            if(isNaN(fw) || isNaN(bw) || isNaN(gh) || isNaN(fd))
            {
                alert("Enter Only Numeric values.");
                
                if(isNaN(fw))        { setfocus('fw'); }
                else if(isNaN(bw)) { setfocus('bw'); }
                else if(isNaN(gh)) { setfocus('gh'); }
                else if(isNaN(fd)) { setfocus('fd'); }
            }
            else
            {
            var sum = eval(fw+bw)/2;
            var ans= Math.round(sum*(gh*fd)/(231)*12,2);
            //var ans= (fw+bw/2*gh*fd/231*12);
            document.getElementById('ffgcans').innerHTML = ans;
            }
        }
}

function rfgc()
{

    var dm = document.getElementById('dm').value;
    var gd = document.getElementById('gd').value;
    
    
    if(dm=='' || gd=='')
        {
            alert("Please fill out all of the parameters!");
            if(dm=='')         { setfocus('dm'); }
            else if(gd=='') { setfocus('gd'); }
        }
    else
        {
            dm = parseFloat(document.getElementById('dm').value);
            gd = parseFloat(document.getElementById('gd').value);
            
            if(isNaN(dm) || isNaN(gd))
            {
                alert("Enter Only Numeric values.");
                if(isNaN(dm))        { setfocus('dm'); }
                else if(isNaN(gd)) { setfocus('gd'); }
            }
            else
            {
            var ans=Math.round(eval(dm*dm*gd/231*12*0.8),2);
            document.getElementById('rfgcans').innerHTML = ans;
            }
        }    
    
}

function sfgc()
{
    var pl  = document.getElementById('pl').value;
    var pw  = document.getElementById('pw').value;
    var gdi = document.getElementById('gdi').value;
    
    if(pl=='' || pw=='' || gdi=='')
        {
            alert("Please fill out all of the parameters!");
            if(pl=='')         { setfocus('pl'); }
            else if(gd=='') { setfocus('gd'); }
            else if(gdi=='') { setfocus('gdi'); }
        }
    else
        {
            pl  = parseFloat(document.getElementById('pl').value);
            pw  = parseFloat(document.getElementById('pw').value);
            gdi = parseFloat(document.getElementById('gdi').value);
            if(isNaN(pl) || isNaN(pw) || isNaN(gdi))
            {
                alert("Enter Only Numeric values.");
                if(isNaN(pl))         { setfocus('pl'); }
                else if(isNaN(gd)) { setfocus('gd'); }
                else if(isNaN(gdi)) { setfocus('gdi'); }
            }
            else
            {
            var ans= Math.round(pl*pw*gdi/231*12,2);
            document.getElementById('sfgcans').innerHTML = ans;
            }
        }        

}

function setfocus(ele)
{
    var val = document.getElementById(ele).value;
    document.getElementById(ele).focus();
}

/* advacned search */
function check_form() {
  var error_message = "<?php echo JS_ERROR; ?>";
  var error_found = false;
  var error_field;
  var keywords = document.advanced_search.keywords.value;
  var dfrom = document.advanced_search.dfrom.value;
  var dto = document.advanced_search.dto.value;
  var pfrom = document.advanced_search.pfrom.value;
  var pto = document.advanced_search.pto.value;
  var pfrom_float;
  var pto_float;

  if ( ((keywords == '') || (keywords.length < 1)) && ((dfrom == '') || (dfrom == '<?php echo DOB_FORMAT_STRING; ?>') || (dfrom.length < 1)) && ((dto == '') || (dto == '<?php echo DOB_FORMAT_STRING; ?>') || (dto.length < 1)) && ((pfrom == '') || (pfrom.length < 1)) && ((pto == '') || (pto.length < 1)) ) {
    error_message = error_message + "* <?php echo ERROR_AT_LEAST_ONE_INPUT; ?>\n";
    error_field = document.advanced_search.keywords;
    error_found = true;
  }

  if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>')) {
    if (!IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) {
      error_message = error_message + "* <?php echo ERROR_INVALID_FROM_DATE; ?>\n";
      error_field = document.advanced_search.dfrom;
      error_found = true;
    }
  }

  if ((dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>')) {
    if (!IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>')) {
      error_message = error_message + "* <?php echo ERROR_INVALID_TO_DATE; ?>\n";
      error_field = document.advanced_search.dto;
      error_found = true;
    }
  }

  if ((dfrom.length > 0) && (dfrom != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dfrom, '<?php echo DOB_FORMAT_STRING; ?>')) && (dto.length > 0) && (dto != '<?php echo DOB_FORMAT_STRING; ?>') && (IsValidDate(dto, '<?php echo DOB_FORMAT_STRING; ?>'))) {
    if (!CheckDateRange(document.advanced_search.dfrom, document.advanced_search.dto)) {
      error_message = error_message + "* <?php echo ERROR_TO_DATE_LESS_THAN_FROM_DATE; ?>\n";
      error_field = document.advanced_search.dto;
      error_found = true;
    }
  }

  if (pfrom.length > 0) {
    pfrom_float = parseFloat(pfrom);
    if (isNaN(pfrom_float)) {
      error_message = error_message + "* <?php echo ERROR_PRICE_FROM_MUST_BE_NUM; ?>\n";
      error_field = document.advanced_search.pfrom;
      error_found = true;
    }
  } else {
    pfrom_float = 0;
  }

  if (pto.length > 0) {
    pto_float = parseFloat(pto);
    if (isNaN(pto_float)) {
      error_message = error_message + "* <?php echo ERROR_PRICE_TO_MUST_BE_NUM; ?>\n";
      error_field = document.advanced_search.pto;
      error_found = true;
    }
  } else {
    pto_float = 0;
  }

  if ( (pfrom.length > 0) && (pto.length > 0) ) {
    if ( (!isNaN(pfrom_float)) && (!isNaN(pto_float)) && (pto_float < pfrom_float) ) {
      error_message = error_message + "* <?php echo ERROR_PRICE_TO_LESS_THAN_PRICE_FROM; ?>\n";
      error_field = document.advanced_search.pto;
      error_found = true;
    }
  }

  if (error_found == true) {
    alert(error_message);
    error_field.focus();
    return false;
  } else {
    RemoveFormatString(document.advanced_search.dfrom, "<?php echo DOB_FORMAT_STRING; ?>");
    RemoveFormatString(document.advanced_search.dto, "<?php echo DOB_FORMAT_STRING; ?>");
    return true;
  }
}


// checout stuff
var selected;
function selectRowEffect(object, buttonSelect) {
  if (!selected) {
    if (document.getElementById) {
      selected = document.getElementById('defaultSelected');
    } else {
      selected = document.all['defaultSelected'];
    }
  }

  if (selected) selected.className = 'moduleRow';
  object.className = 'moduleRowSelected';
  selected = object;

// one button is not an array
  if (document.checkout_address.shipping[0]) {
    document.checkout_address.shipping[buttonSelect].checked=true;
  } else {
    document.checkout_address.shipping.checked=true;
  }
}

function rowOverEffect(object) {
  if (object.className == 'moduleRow') object.className = 'moduleRowOver';
}

function rowOutEffect(object) {
  if (object.className == 'moduleRowOver') object.className = 'moduleRow';
}
