//Suckerfish hover
sfHover = function() {
	var sfEls = document.getElementById("vwd-drop-down-nav").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//Make the tabs active
function setTabs() {
  $('#tabs .container').hide();
  $('#tabs div.container:first').show();
  $('#tabs ul li:first').addClass('active');
  $('#tabs ul li a').click(function(){
    $('#tabs ul li').removeClass('active');
    $(this).parent().addClass('active');
    currentTab = $(this).attr('href');
    $('#tabs .container').hide();
    $(currentTab).show();
    return false;
  });
}
function priceMatch(name, price) {
  window.open("http://www.vwdhost.com/daybeddeals/price-match.php?name="+escape(name)+"&price="+escape(price), "", "top=20,left=20,height=700,width=550,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
}
//Add comment reader
jQuery.fn.comments = function( blnDeep ){
  var blnDeep = (blnDeep || false);
  var jComments = $( [] );
  this.each(function( intI, objNode ) {
    var objChildNode = objNode.firstChild;
    var strParentID = $( this ).attr( "id" );
    while (objChildNode){
      if (objChildNode.nodeType === 8){
        jComments = jComments.add(
        "<div rel='" + strParentID + "'>" +
        objChildNode.nodeValue +
        "</div>"
        );
      } else if (blnDeep && (objChildNode.nodeType === 1)) {
        jComments = jComments.add($( objChildNode ).comments( true ));
      }
      objChildNode = objChildNode.nextSibling;
    }
  });
  return( jComments );
}
//Ready all scripts
$(document).ready(function(){
  setTabs();
});
