$(document).ready(function () {
	var a, b, c;
	a = 0;
	function getNavSize() {
		$('#nav-main li').each(function () { a += $(this).width(); });
	}
	getNavSize(a);
	b = $('#nav-main a').size();
	c = 960 - a;
	c = Math.floor(c / b / 2);
	$('#nav-main li a').css({
		'padding-left': (c),
		'padding-right': (c)
	});
	a = 5;
	getNavSize(a);
	$('#nav-main > ul').css({
		width: (a),
		visibility: 'visible'
	});
});
$(document).ready(function () {
	var a = $('#footer a').size();
	$('#footer li').each(function () { a += $(this).width(); });
	$('#footer > ul').css({
		width: (a)
	});
});
$(document).ready(function () {
	var url = window.location.pathname,
        urlRegExp = new RegExp(url.replace(/\/$/, '') + "$"); // create regexp to match current url pathname and remove trailing slash if present as it could collide with the link in navigation in case trailing slash wasn't present there
        // now grab every link from the navigation
	$('a').each(function () {
		// and test its normalized href against the url pathname regexp
		if (urlRegExp.test(this.href.replace(/\/$/, ''))) {
			$(this).addClass('current');
		}
	});
});
$(document).ready(function ($) {
	$('a.print').click(function () {
		var coupon, html;
		coupon = window.open('', 'Coupons', 'width=350,height=350');
		html = '<html><head><title>Print Coupons</title><style type="text/css">#mycoupons { padding: 25px; border: 4px dashed black; font-family: Arial; font-size: 24px; text-align: center; background: url(../images/coupon-bg.png) 0 0 repeat-x #e4e4e4;}a.print{display: none;}.title{font-weight: bold;}.price{font-weight: bold;font-size:30px;}.detail{font-size: 18px;}.fineprint{margin-top: 15px;}.fineprint, .exp{font-size: 12px;}.exp{font-style:italic;padding: 15px 0;}</style></head><body onload="window.print()"><div id="mycoupons" style="">' + $('<div />').append($(this).closest('.coupon').clone()).html() + '<?= $store_title_ext ?></div></body></html>';
		coupon.document.open();
		coupon.document.write(html);
		coupon.document.close();
		return false;
	});
});
$(document).ready(function () {
	$("#contact-form").validate();
	$("#scheduleServiceForm").validate({
		rules: {
			'requested_time': {
				required: true,
				minlength: 1
			},
			'service_type[]': {
				required: true,
				minlength: 1
			}
		}
	});
});
