$(document).ready(function () {
	/* the timer starts for initial product list on page load */
	$(".menuDiv").mouseover(function(){
			var rel = $(this).find('li').first().attr('rel');
			$("#categoryParent_"+rel).addClass("selected");
		}).mouseout(function(){
			var rel = $(this).find('li').first().attr('rel');
			$("#categoryParent_"+rel).removeClass("selected");
			var selectedCategoryKey = $('#selectedCategory').val();
			var selectedCategoryParentId = $('.'+selectedCategoryKey).attr('rel');
			$("#categoryParent_"+selectedCategoryParentId).addClass("active");
		});
	$('.menuDiv').each(function(index) {
		var ID = $(this).attr('id');
		$("#"+ID+" ul").each(function() {
			var elem = $(this);
			if (elem.children().length == 0) {
				elem.remove();
			}
		});
		$("#"+ID).css('width', $("#"+ID+" .megamenu-grouping").length*200);
	});
	var selectedCategoryKey = $('#selectedCategory').val();
	var selectedCategoryParentId = $('.'+selectedCategoryKey).attr('rel');
	$("#categoryParent_"+selectedCategoryParentId).addClass("active");     
});
	
	
/* timer.plugin.js */
(function(n){n.fn.countDown=function(e){config={};n.extend(config,e);diffSecs=this.setCountDown(config);if(config.onComplete){n.data(n(this)[0],"callback",config.onComplete)}if(config.omitWeeks){n.data(n(this)[0],"omitWeeks",config.omitWeeks)}n(this).doCountDown(n(this).attr("id"),diffSecs,500);return this};n.fn.stopCountDown=function(){clearTimeout(n.data(this[0],"timer"))};n.fn.startCountDown=function(){this.doCountDown(n(this).attr("id"),n.data(this[0],"diffSecs"),500)};n.fn.setCountDown=function(e){var t=new Date;if(e.targetDate){t=new Date(e.targetDate.month+"/"+e.targetDate.day+"/"+e.targetDate.year+" "+e.targetDate.hour+":"+e.targetDate.min+":"+e.targetDate.sec+(e.targetDate.utc?" UTC":""))}else if(e.targetOffset){t.setFullYear(e.targetOffset.year+t.getFullYear());t.setMonth(e.targetOffset.month+t.getMonth());t.setDate(e.targetOffset.day+t.getDate());t.setHours(e.targetOffset.hour+t.getHours());t.setMinutes(e.targetOffset.min+t.getMinutes());t.setSeconds(e.targetOffset.sec+t.getSeconds())}var r=new Date;if(e.fromDate){r=new Date(e.fromDate.month+"/"+e.fromDate.day+"/"+e.fromDate.year+" "+e.fromDate.hour+":"+e.fromDate.min+":"+e.fromDate.sec+(e.fromDate.utc?" UTC":""))}diffSecs=Math.floor((t.valueOf()-r.valueOf())/1e3);n.data(this[0],"diffSecs",diffSecs);return diffSecs};n.fn.doCountDown=function(r,i,s){$this=n("#"+r);if(i<=0){i=0;if(n.data($this[0],"timer")){clearTimeout(n.data($this[0],"timer"))}}secs=i%60;mins=Math.floor(i/60)%60;hours=Math.floor(i/60/60)%24;if(n.data($this[0],"omitWeeks")==true){days=Math.floor(i/60/60/24);weeks=Math.floor(i/60/60/24/7)}else{days=Math.floor(i/60/60/24);weeks=Math.floor(i/60/60/24/7)}hours=days*24+hours+weeks*7*24;hours1=hours%24;if(weeks==0&&days==0&&hours==0&&mins==0&&secs==0){}if(days>0){if(days!=0){$this.dashChangeTo(r,"days_dash",days,s?s:1200)}else{n("#dayschange").hide();n("#"+r+" .days_dash").hide()}n("#"+r+" .hours_dash").hide();n("#"+r+" .minutes_dash").hide();n("#"+r+" .seconds_dash").hide()}else if(hours1>0){$this.dashChangeTo(r,"hours_dash",hours1,s?s:1200);n("#"+r+" .days_dash").hide();n("#"+r+" .minutes_dash").hide();n("#"+r+" .seconds_dash").hide()}else if(mins>0){$this.dashChangeTo(r,"minutes_dash",mins,s?s:1200);n("#"+r+" .days_dash").hide();n("#"+r+" .hours_dash").hide();n("#"+r+" .seconds_dash").hide()}else if(secs>0){$this.dashChangeTo(r,"seconds_dash",secs,s?s:800);n("#"+r+" .days_dash").hide();n("#"+r+" .hours_dash").hide();n("#"+r+" .minutes_dash").hide()}else{n("#dayschange").hide();n("#"+r+" .days_dash").hide();n("#"+r+" .hours_dash").hide();n("#"+r+" .minutes_dash").hide();n("#"+r+" .seconds_dash").hide()}$this.dashChangeTo(r,"weeks_dash",weeks,s?s:1200);n.data($this[0],"diffSecs",i);if(i>0){e=$this;t=setTimeout(function(){e.doCountDown(r,i-1)},1e3);n.data(e[0],"timer",t)}else if(cb=n.data($this[0],"callback")){n.data($this[0],"callback")()}};n.fn.dashChangeTo=function(e,t,r,i){$this=n("#"+e);if(r<10){r="0"+r}n("#"+e+" ."+t+" .digit:eq(0)").html(r)};n.fn.digitChangeTo=function(e,t,r){if(!r){r=800}if(n(e+" div.top").html()!=t+""){n(e+" div.top").css({display:"none"});n(e+" div.top").html(t?t:"0").slideDown(r);n(e+" div.bottom").animate({height:""},r,function(){n(e+" div.bottom").html(n(e+" div.top").html());n(e+" div.bottom").css({display:"block",height:""});n(e+" div.top").hide().slideUp(10)})}}})(jQuery)