// JavaScript Document

$(function() {
	var helpnav = 	'<ul id="help-nav-list">';
	helpnav +=			'<li id="about"><a href="/about_us">About Us</a></li>';
	helpnav +=			'<li id="comp"><a href="/help/composition_fit">Composition and Fit</a></li>';
	helpnav +=			'<li id="shipping"><a href="/help/shipping_information">Shipping Information</a></li>';
	helpnav +=			'<li id="returns"><a href="/help/returns_exchanges">Returns and Exchanges</a></li>';
	helpnav +=			'<li id="privacy"><a href="/help/privacy">Privacy</a></li>';
	helpnav += 			'<li id="testimonials"><a href="/help/customer_testimonials">Testimonials</a></li>';
	helpnav +=			'<li id="faq"><a href="/help/faq">FAQ</a></li>';
	helpnav +=			'<li id="giftfaq"><a href="/help/gift_certificate_faq">Gift Certificate FAQ</a></li>';
helpnav +=			'<li id="notifications"><a href="/help/notifications_faq">Notifications FAQ</a></li>';
        helpnav +=			'<li id="btb"><a href="/help/what-is-be-the-buyer">What is Be the Buyer?</a></li>';
	helpnav +=			'<li id="affiliate"><a href="/help/affiliate">Affiliate Sign Up</a></li>';
	helpnav +=			'<li id="feedback"><a href="/help/feedback">Site Feedback</a></li>';
	helpnav +=		'</ul>';
	
	$('div#help-nav').html(helpnav);
	
	if(helppage) { 
	
		var helppagecontent = $('li[id=' + helppage + '] a').html();
		$('li[id=' + helppage + '] a').css('font-weight', 'bold');
		
		$('h1#help-title').html("<a href='/help'>Help</a> <span>&gt;</span> " + helppagecontent); 
	
	} else { 
	
		$('h1#help-title').html("Help"); 
	
	}
});

function scrollTo(where, speed) {
	if($.browser.opera){
		$('html').animate({scrollTop: $('#'+where).offset().top}, speed);
	} else {
		$('html,body').animate({scrollTop: $('#'+where).offset().top}, speed);
	}
}

function checkFeedback()
{
var re = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test($("#email").val());
if($('#email').val()!='')
{
 if(re!=true)
 {
    $.jGrowl("Please enter a valid email address", { life: 7000, theme: 'error_growl', header: 'Feedback Error' });
    $('#email').css('border-color', 'red')
    return false;
 }
 else
    $('#email').css('border-color', '#4D4D4D')
}
else
{
    $.jGrowl("Please enter an email address", { life: 7000, theme: 'error_growl', header: 'Feedback Error' });
    $('#email').css('border-color', 'red')
    return false;
}

if($('#message').val()=='')
{
    $.jGrowl("Please enter some feedback", { life: 7000, theme: 'error_growl', header: 'Feedback Error' });
    $('#message').css('border-color', 'red')
    return false;
}
else
    $('#message').css('border-color', '#4D4D4D')
return true;
}
	