// JavaScript Document
function fireSearch(event, target) {
        if (event.keyCode == 13) {
            $('#' + target).trigger('click');
			StopEvent(event);
        }
        return true;

    }
function showHideFeedback(id)
{
	//Setup initial form values
	$('#spnFeedbackSubmit').hide();
	$('#btnFeedbackCancel').show();
    $('#btnFeedbackSubmit').show();
	$('#btnFeedbackClose').hide();
	
	//Get variables for positioning the form
	var pos = $('#feedback').position();
	var width = $('#feedback').width();	
	var height = $('#feedback').outerHeight();
	var mWidth = $('#feedback').parent().offset();
	$('#' + id).css({ "left": (pos.left + width) + "px", "top": (pos.top) + "px" });		
	$('#' + id).toggle('slide', {direction: 'left'}, 500);
	
}
    function FeedBackSubmit() 
{
	$('#spnFeedbackSubmit').show();		
	$.ajax({ url: '/feedbacksubmit/default.aspx',
		type: 'POST',
		data: { name: $('#txtFeedbackName').val(), email: $('#txtFeedbackEmail').val(), feedbacktext: $('#FeedbackText').val() },
		dataType: 'html',
		success: FeedBackSuccess,
		error: FeedBackFailure
	});                                
}
function FeedBackSuccess() 
{
	var pos = $('#btnFeedbackCancel').position();
	
	$('#spnFeedbackSubmit').html('Your feedback has been sent!');
	$('#btnFeedbackCancel').hide('slide', { direction: 'down' }, 500, function() {$('#btnFeedbackClose').show().css("margin-left", pos.left + "px");});
	$('#btnFeedbackSubmit').hide('slide', { direction: 'down' }, 500);
	
	
	setTimeout("$('#spnFeedbackSubmit').hide('slow')", 5000);
	
}
function FeedBackFailure(xhr, e) {
	alert('error trying to send');
	alert(xhr.responseText);
	$('#btnFeedbackCancel').show();
	$('#btnFeedbackSubmit').show();                                
	$('#spnFeedbackSubmit').html('unexpected error trying to send');
	setTimeout("$('#spnFeedbackSubmit').hide('slow')", 5000);
}
                            
                        
function getElementsByClass(searchClass,node,tag) {
	var classElements = new Array();
	if ( node == null )
			node = document;
	if ( tag == null )
			tag = '*';
	var els = node.getElementsByTagName(tag);
	var elsLen = els.length;
	var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	for (i = 0, j = 0; i < elsLen; i++) {
			if ( pattern.test(els[i].className) ) {
					classElements[j] = els[i];
					j++;
			}
	}
	return classElements;
}
function openDropTree(objEL, action) {
    dropTree = objEL.parentNode.getElementsByTagName('DIV')
    //get child ul element
    //alert($(objEL).children().children().html());
    $(objEL).children().children().css("display", action);

    //	for(i=0; i< dropTree.length ; i++)
    //	{	    
    //		if(dropTree[i].className == 'drop_tree')
    //		{
    //			if(action == 'block')
    //			{
    //			    dropTree[i].style.display = 'block';
    //				objEL.className += ' current';
    //			}
    //			else
    //			{
    //				dropTree[i].style.display = 'none';
    //				objEL.className = objEL.className.replace(new RegExp("(\s)?current\\b"), "");
    //			}
    //			
    //			dropTree[i].onmouseover = function () { this.style.display = 'block'; objEL.className += ' current';}
    //		
    //			dropTree[i].onmouseout = function () { this.style.display = 'none'; objEL.className = objEL.className.replace(new RegExp("(\s)?current\\b"), "");}
    //		}
    //	}
    //	dropTree = objEL.parentNode.getElementsByTagName('UL')

    //	for (i = 0; i < dropTree.length; i++) {
    //	    if (dropTree[i].className == 'drop_tree') {
    //	        if (action == 'block') {
    //	            dropTree[i].style.display = 'block';
    //	            objEL.className += ' current';
    //	        }
    //	        else {
    //	            dropTree[i].style.display = 'none';
    //	            objEL.className = objEL.className.replace(new RegExp("(\s)?current\\b"), "");
    //	        }

    //	        dropTree[i].onmouseover = function() { this.style.display = 'block'; objEL.className += ' current'; }

    //	        dropTree[i].onmouseout = function() { this.style.display = 'none'; objEL.className = objEL.className.replace(new RegExp("(\s)?current\\b"), ""); }
    //	    }
    //	}
    //alert($('*.current1').parent().parent().parent().parent().parent().html());
    //$('*.current1').parent().parent().css('display', 'block');
    //$('*.current1').parent().parent().removeClass('current');
}

function closeDropTree(objEL, action) {

    //alert('hi');
    //$($(objEL).children().children().get(1)).find('.current1').css('display', action);
    $($(objEL).children().children().get(1)).css('display', action);
}

    


function showImage() 
{
//    $('.drop_tree').bind('mouseover', function(event) { openDropTree(this, 'block'); });
//    $('.drop_tree').bind('mouseout', function(event) { closeDropTree(this, 'none'); });
//    $('.tree_img').bind('mouseover', function(event) { openDropTree(this, 'block'); });
//    $('.tree_img').bind('mouseout', function(event) { openDropTree(this, 'none'); });
//    alert($('.drop_tree:has(a.current)').html());
//	dropDownImages = getElementsByClass('tree_img');
//	for(i=0;i<(dropDownImages.length);i++)
//	{
//		dropDownImages[i].onmouseover = function () { openDropTree(this, 'block');}
//		
//		dropDownImages[i].onmouseout = function () { openDropTree(this, 'none');}
//	}

}

 function checkSearch()
  {    
    obj = document.getElementById('Search');
    if(obj.value == 'Keyword Search')
    {
      return false;
    }
    else
    {
      return true;
    }
  }
  function SiteSearch()
  {	
	if(checkSearch() == true)
    { 
		
		window.location = ('http://www.housewares.org/SiteSearch?query=' + $('#Search').val()); 
	}
	return true;
  }
  function StopEvent(pE)
{
   if (!pE)
     if (window.event)
       pE = window.event;
     else
       return;
  if (pE.cancelBubble != null)
     pE.cancelBubble = true;
  if (pE.stopPropagation)
     pE.stopPropagation();
  if (pE.preventDefault)
     pE.preventDefault();
  if (window.event)
     pE.returnValue = false;
  if (pE.cancel != null)
     pE.cancel = true;
}  

<!-- Hide script from older browsers

	function jumpPage(newLoc) {
		newPage = newLoc.options[newLoc.selectedIndex].value

		if(newPage != "") {
			window.location.href = newPage
			}
		}

//-->
