
///Slider
jQuery(document).ready(function() {
    jQuery('#mycarousel').jcarousel({
        speed: 1
    });
	
});

///Slider end



///Select box///
$(document).ready(function() {
	$('#CAT_Custom_73085').selectbox();
});


jQuery.fn.extend({
	selectbox: function(options) {
		return this.each(function() {
			new jQuery.SelectBox(this, options);
		});
	}
});



jQuery.SelectBox = function(selectobj, options) {
	
	var opt = options || {};
	opt.inputClass = opt.inputClass || "selectbox";
	opt.containerClass = opt.containerClass || "selectbox-wrapper";
	opt.hoverClass = opt.hoverClass || "selected";
	opt.debug = opt.debug || false;
	
	var elm_id = selectobj.id;
	var active = -1;
	var inFocus = false;
	var hasfocus = 0;
	var $select = $(selectobj);
	var $container = setupContainer(opt);
	var $input = setupInput(opt);
	$select.hide().before($input).before($container);
	
	init();
	
	$input
	.click(function(){
        if (!inFocus) {
		  $container.toggle();
		}
	})
	.focus(function(){
	   if ($container.not(':visible')) {
	       inFocus = true;
	       $container.show();
	   }
	})
	.keydown(function(event) {	   
		switch(event.keyCode) {
			case 38: // up
				event.preventDefault();
				moveSelect(-1);
				break;
			case 40: // down
				event.preventDefault();
				moveSelect(1);
				break;
			//case 9:  // tab 
			case 13: // return
				event.preventDefault(); 
				setCurrent();
				hideMe();
				break;
		}
	})
	.blur(function() {
		if ($container.is(':visible') && hasfocus > 0 ) {
			if(opt.debug) console.log('container visible and has focus')
		} else {
			hideMe();	
		}
	});


	function hideMe() { 
		hasfocus = 0;
		$container.hide(); 
	}
	
	function init() {
		$container.append(getSelectOptions()).hide();
		var width = $input.width()
		$container.width(width);
    }
	
	function setupContainer(options) {
		var container = document.createElement("div");
		$container = $(container);
		$container.attr('id', elm_id+'_container');
		$container.addClass(options.containerClass);
		
		return $container;
	}
	
	function setupInput(options) {
		var input = document.createElement("input");
		var $input = $(input);
		$input.attr("id", elm_id+"_input");
		$input.attr("type", "text");
		$input.addClass(options.inputClass);
		$input.attr("autocomplete", "off");
		$input.attr("readonly", "readonly");
		$input.attr("tabIndex", $select.attr("tabindex")); 
		
		return $input;	
	}
	
	function moveSelect(step) {
		var lis = $("li", $container);
		if (!lis) return;

		active += step;

		if (active < 0) {
			active = 0;
		} else if (active >= lis.size()) {
			active = lis.size() - 1;
		}

		lis.removeClass(opt.hoverClass);

		$(lis[active]).addClass(opt.hoverClass);
	}
	
	function setCurrent() {	
		var li = $("li."+opt.hoverClass, $container).get(0);
		var el = li.id
		$select.val(el);
		$input.val($(li).html());
		return true;
	}
	
	// select value
	function getCurrentSelected() {
		return $select.val();
	}
	
	// input value
	function getCurrentValue() {
		return $input.val();
	}
	
	function getSelectOptions() {
		var select_options = new Array();
		var ul = document.createElement('ul');
		$select.children('option').each(function() {
			var li = document.createElement('li');
			li.setAttribute('id', $(this).val());
			li.innerHTML = $(this).html();
			if ($(this).is(':selected')) {
				$input.val($(this).html());
				$(li).addClass(opt.hoverClass);
			}
			ul.appendChild(li);
			$(li)
			.mouseover(function(event) {
				hasfocus = 1;
				if (opt.debug) console.log('out on : '+this.id);
				jQuery(event.target, $container).addClass(opt.hoverClass);
			})
			.mouseout(function(event) {
				hasfocus = -1;
				if (opt.debug) console.log('out on : '+this.id);
				jQuery(event.target, $container).removeClass(opt.hoverClass);
			})
			.click(function(event) {
				if (opt.debug) console.log('click on :'+this.id);
				$(this).addClass(opt.hoverClass);
				setCurrent();
				hideMe();
			});
		});
		return ul;
	}
	
};
///Select box end here///




///Accordion///

var ddaccordion={
	
	contentclassname:{},

	expandone:function(headerclass, selected){
		this.toggleone(headerclass, selected, "expand")
	},

	collapseone:function(headerclass, selected){
		this.toggleone(headerclass, selected, "collapse")
	},

	expandall:function(headerclass){ 
		var $=jQuery
		var $headers=$('.'+headerclass)
		$('.'+this.contentclassname[headerclass]+':hidden').each(function(){
			$headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")
		})
	},

	collapseall:function(headerclass){ 
		var $=jQuery
		var $headers=$('.'+headerclass)
		$('.'+this.contentclassname[headerclass]+':visible').each(function(){
			$headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")
		})
	},

	toggleone:function(headerclass, selected, optstate){
		var $=jQuery
		var $targetHeader=$('.'+headerclass).eq(selected)
		var $subcontent=$('.'+this.contentclassname[headerclass]).eq(selected)
		if (typeof optstate=="undefined" || optstate=="expand" && $subcontent.is(":hidden") || optstate=="collapse" && $subcontent.is(":visible"))
			$targetHeader.trigger("evt_accordion")
	},

	expandit:function($targetHeader, $targetContent, config, useractivated){
		$targetContent.slideDown(config.animatespeed, function(){config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), useractivated)})
		this.transformHeader($targetHeader, config, "expand")
	},

	collapseit:function($targetHeader, $targetContent, config, isuseractivated){
		$targetContent.slideUp(config.animatespeed, function(){config.onopenclose($targetHeader.get(0), parseInt($targetHeader.attr('headerindex')), $targetContent.css('display'), isuseractivated)})
		this.transformHeader($targetHeader, config, "collapse")
	},

	transformHeader:function($targetHeader, config, state){
		$targetHeader.addClass((state=="expand")? config.cssclass.expand : config.cssclass.collapse) 
		.removeClass((state=="expand")? config.cssclass.collapse : config.cssclass.expand)
		if (config.htmlsetting.location=='src'){ 
			$targetHeader=($targetHeader.is("img"))? $targetHeader : $targetHeader.find('img').eq(0) 
			$targetHeader.attr('src', (state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse) 
		}
		else if (config.htmlsetting.location=="prefix")
			$targetHeader.find('.accordprefix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse)
		else if (config.htmlsetting.location=="suffix")
			$targetHeader.find('.accordsuffix').html((state=="expand")? config.htmlsetting.expand : config.htmlsetting.collapse)
	},

	urlparamselect:function(headerclass){
		var result=window.location.search.match(new RegExp(headerclass+"=((\\d+)(,(\\d+))*)", "i"))
		if (result!=null)
			result=RegExp.$1.split(',')
		return result 
	},

	getCookie:function(Name){ 
		var re=new RegExp(Name+"=[^;]+", "i") 
		if (document.cookie.match(re)) 
			return document.cookie.match(re)[0].split("=")[1]
		return null
	},

	setCookie:function(name, value){
		document.cookie = name + "=" + value + "; path=/"
	},

	init:function(config){
	document.write('<style type="text/css">\n')
	document.write('.'+config.contentclass+'{display: none}\n') //
	document.write('<\/style>')
	jQuery(document).ready(function($){
		ddaccordion.urlparamselect(config.headerclass)
		var persistedheaders=ddaccordion.getCookie(config.headerclass)
		ddaccordion.contentclassname[config.headerclass]=config.contentclass //
		config.cssclass={collapse: config.toggleclass[0], expand: config.toggleclass[1]} //
		config.revealtype=/^(click)|(mouseover)$/i.test(config.revealtype)? config.revealtype.replace(/mouseover/i, "mouseenter") : "click"
		config.htmlsetting={location: config.togglehtml[0], collapse: config.togglehtml[1], expand: config.togglehtml[2]} //
		config.oninit=(typeof config.oninit=="undefined")? function(){} : config.oninit //
		config.onopenclose=(typeof config.onopenclose=="undefined")? function(){} : config.onopenclose //
		var lastexpanded={} //
		var expandedindices=ddaccordion.urlparamselect(config.headerclass) || ((config.persiststate && persistedheaders!=null)? persistedheaders : config.defaultexpanded)
		if (typeof expandedindices=='string') //
			expandedindices=expandedindices.replace(/c/ig, '').split(',') //
		var $subcontents=$('.'+config["contentclass"])
		if (expandedindices.length==1 && expandedindices[0]=="-1") //
			expandedindices=[]
		if (config["collapseprev"] && expandedindices.length>1) //
			expandedindices=[expandedindices.pop()] //
		if (config["onemustopen"] && expandedindices.length==0) //
			expandedindices=[0]
		$('.'+config["headerclass"]).each(function(index){ //
			if (/(prefix)|(suffix)/i.test(config.htmlsetting.location) && $(this).html()!=""){ //
				$('<span class="accordprefix"></span>').prependTo(this)
				$('<span class="accordsuffix"></span>').appendTo(this)
			}
			$(this).attr('headerindex', index+'h') //
			$subcontents.eq(index).attr('contentindex', index+'c') //
			var $subcontent=$subcontents.eq(index)
			var needle=(typeof expandedindices[0]=="number")? index : index+'' //
			if (jQuery.inArray(needle, expandedindices)!=-1){ //
				if (config.animatedefault==false)
					$subcontent.show()
				ddaccordion.expandit($(this), $subcontent, config, false) //
				lastexpanded={$header:$(this), $content:$subcontent}
			}  //end check
			else{
				$subcontent.hide()
				config.onopenclose($(this).get(0), parseInt($(this).attr('headerindex')), $subcontent.css('display'), false) //
				ddaccordion.transformHeader($(this), config, "collapse")
			}
		})
		$('.'+config["headerclass"]).bind("evt_accordion", function(){ //
				var $subcontent=$subcontents.eq(parseInt($(this).attr('headerindex'))) //
				if ($subcontent.css('display')=="none"){
					ddaccordion.expandit($(this), $subcontent, config, true) //
					if (config["collapseprev"] && lastexpanded.$header && $(this).get(0)!=lastexpanded.$header.get(0)){ //
						ddaccordion.collapseit(lastexpanded.$header, lastexpanded.$content, config, true) //
					}
					lastexpanded={$header:$(this), $content:$subcontent}
				}
				else{
					ddaccordion.collapseit($(this), $subcontent, config, true) //
				}
 		})
		$('.'+config["headerclass"]).bind(config.revealtype, function(){
			if (config.revealtype=="mouseenter"){
				ddaccordion.expandone(config["headerclass"], parseInt($(this).attr("headerindex")))
			}
			else{
				$(this).trigger("evt_accordion")
				return false //cancel default click behavior
			}
		})
		config.oninit($('.'+config["headerclass"]).get(), expandedindices)
		$(window).bind('unload', function(){ //
			$('.'+config["headerclass"]).unbind()
			var expandedindices=[]
			$('.'+config["contentclass"]+":visible").each(function(index){ //
				expandedindices.push($(this).attr('contentindex'))
			})
			if (config.persiststate==true){ //persist state?
				expandedindices=(expandedindices.length==0)? '-1c' : expandedindices //
				ddaccordion.setCookie(config.headerclass, expandedindices)
			}
		})
	})
	}
}

///Accordion End here///






///product Slider///
var theInt = null;
		var $crosslink, $navthumb;
		var curclicked = 0;
		
		theInterval = function(cur){
			clearInterval(theInt);
			
			if( typeof cur != 'undefined' )
				curclicked = cur;
			
			$crosslink.removeClass("active-thumb");
			$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
			
			theInt = setInterval(function(){
				$crosslink.removeClass("active-thumb");
				$navthumb.eq(curclicked).parent().addClass("active-thumb");
				$(".stripNav ul li a").eq(curclicked).trigger('click');
				curclicked++;
				if( 5 == curclicked )
					curclicked = 0;
				
			}, 5000);
		};
		
		$(function(){
			
			$("#scroll_main").codaSlider();
			
			$navthumb = $(".nav-thumb");
			$crosslink = $(".cross-link");
			
			$navthumb
			.click(function() {
				var $this = $(this);
				theInterval($this.parent().attr('href').slice(1) - 1);
				return false;
			});
			
			theInterval();
		});

///product Slider End here///



///product Slider Hover///
$(document).ready(function(){
	
	$(".featured_product").live("mouseover", function(){
	$(".featured_product").removeClass('featured_product_mh');
	$(this).addClass('featured_product_mh');
	});
	
	$(".featured_product").live("mouseout", function(){
	$(".featured_product").removeClass('featured_product_mh');
	$(this).removeClass('featured_product_mh');
	});
	
	
	$(".featured_product_top").live("mouseover", function(){
	$(".featured_product_top").removeClass('featured_product_top_mh');
	$(this).addClass('featured_product_top_mh');
	});
	
	$(".featured_product_top").live("mouseout", function(){
	$(".featured_product").removeClass('featured_product_top_mh');
	$(this).removeClass('featured_product_top_mh');
	});
	
	$(".featured_product_bottom").live("mouseover", function(){
	$(".featured_product_bottom").removeClass('featured_product_bottom_mh');
	$(this).addClass('featured_product_bottom_mh');
	});
	
	$(".featured_product_bottom").live("mouseout", function(){
	$(".featured_product_bottom").removeClass('featured_product_bottom_mh');
	$(this).removeClass('featured_product_bottom_mh');
	});

  });
///product Slider Hover End here///





///Tab Gallery///

$(document).ready(function(){
	
	$(".gallery_tab li").live("click", function(){
	$(".gallery_tab li").removeClass('tab_active');
	$(this).addClass('tab_active');
	});
	
	$("#GallTabClick1").click(function(){
		$("#GallTab1").fadeIn("slow");		
		$("#GallTab2").hide("fast");
		$("#GallTab3").hide("fast");
	});
	
	$("#GallTabClick2").click(function(){
		$("#GallTab2").fadeIn("slow");	
		$("#GallTab1").hide("fast");
		$("#GallTab3").hide("fast");
	});
	
	$("#GallTabClick3").click(function(){
		$("#GallTab3").fadeIn("slow");	
		$("#GallTab1").hide("fast");
		$("#GallTab2").hide("fast");
	});
	


///Tab Gallery End here///







///Gallery ///
	$(".gallery_main img").addClass("img_big");
	
    $(".gall_thumb a").hover(function(){
			alert("test");
			var imgHref = $(this).attr('rev');  
			var imgHref2 = $(this).attr('rel'); 
			$(".gallery_main").stop();
			
		$(".gallery_main").stop().fadeTo(300, 0, function() { 
		
    		$('.img_big').attr('src',imgHref); 
    		$('.very_big').attr('src',imgHref2);
		}).fadeTo("fast", 1);  
	},function(){   
	});
	
	
	$("#Enlarge").click(function(){
		$(".modal_wrapper").css("opacity", .80);
		$(".modal_wrapper").fadeIn("slow");
		$(".modal_image_wrapper").fadeIn("slow");	
	});
	
	$("#ModalClose").click(function(){
		$(".modal_wrapper").fadeOut("slow");
		$(".modal_image_wrapper").fadeOut("fast");	
	});
	
///Gallery End here ///
	
	
	
	
	
///Tool Tip///	
	
	$(".Small").mouseover(function(){
		  $(".Toll_1").fadeIn(100).animate({ 
			left: "82px"
		  }, 200 );
			
    });
	
	$(".Small").mouseout(function(){
		  $(".Toll_1").animate({ 
			left: "60px"
		  }, 100 ).fadeOut(100);
			
    });
	
	$(".Medium").mouseover(function(){
		  $(".Toll_2").fadeIn(100).animate({ 
			left: "82px"
		  }, 200 );
			
    });
	
	$(".Medium").mouseout(function(){
		  $(".Toll_2").animate({ 
			left: "60px"
		  }, 100 ).fadeOut(100);
			
    });
	
	$(".Large").mouseover(function(){
		  $(".Toll_3").fadeIn(100).animate({ 
			left: "82px"
		  }, 200 );
			
    });
	
	$(".Large").mouseout(function(){
		  $(".Toll_3").animate({ 
			left: "60px"
		  }, 100 ).fadeOut(100);
			
    });





///Gallery End here ///



	$("#Contact_us_modal").css('display','block');
	$('.Contactpopup').click(function () 
	{
		$("#Contact_us_modal").css('visibility','visible');
		$("#modal_overlay").css("opacity", .75);
		$("#modal_overlay").fadeIn("slow");
		$("#Contact_us_modal").fadeIn("slow");
		
	});
	
	$('.CloseModal').click(function () 
	{
		$("#modal_overlay").fadeOut("slow");
		$("#Contact_us_modal").fadeOut("fast");
	});
	
	
	
	
	
});






	
jQuery.fn.LiveCheckboxes = function(settings) {
	settings = jQuery.extend({
				checkboxWidth: 17,
				checkboxHeight: 17,
				className : 'prettyCheckbox',
				display: 'list'
			}, settings);

	$(this).each(function(){
		// Find the label
		$label = $('label[for="'+$(this).attr('id')+'"]');

		// Add the checkbox holder to the label
		$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");

		// If the checkbox is checked, display it as checked
		if($(this).is(':checked')) { $label.addClass('checked'); };

		// Assign the class on the label
		$label.addClass(settings.className).addClass($(this).attr('type')).addClass(settings.display);

		// Assign the dimensions to the checkbox display
		$label.find('span.holderWrap').width(settings.checkboxWidth).height(settings.checkboxHeight);
		$label.find('span.holder').width(settings.checkboxWidth);

		// Hide the checkbox
		$(this).addClass('hiddenCheckbox');

		// Associate the click event
		$label.bind('click',function(){
			$('input#' + $(this).attr('for')).triggerHandler('click');
			
			if($('input#' + $(this).attr('for')).is(':checkbox')){
				$(this).toggleClass('checked');
				$('input#' + $(this).attr('for')).checked = true;
				
				$(this).find('span.holder').css('top',0);
			}else{
				$toCheck = $('input#' + $(this).attr('for'));

				// Uncheck all radio
				/*$('input[name="'+$toCheck.attr('name')+'"]').each(function(){
					$('label[for="' + $(this).attr('id')+'"]').removeClass('checked');	
				});*/

				$(this).addClass('checked');
				$toCheck.checked = true;
			};
		});
		
		$('input#' + $label.attr('for')).bind('keypress',function(e){
			if(e.keyCode == 32){
				if($.browser.msie){
					$('label[for="'+$(this).attr('id')+'"]').toggleClass("checked");
				}else{
					$(this).trigger('click');
				}
				return false;
			};
		});
	});
};

checkAllLiveCheckboxes = function(caller, container){
	if($(caller).is(':checked')){
		// Find the label corresponding to each checkbox and click it
		$(container).find('input[type=checkbox]:not(:checked)').each(function(){
			$('label[for="'+$(this).attr('id')+'"]').trigger('click');
			if($.browser.msie){
				$(this).attr('checked','checked');
			}else{
				$(this).trigger('click');
			};
		});
	}else{
		$(container).find('input[type=checkbox]:checked').each(function(){
			$('label[for="'+$(this).attr('id')+'"]').trigger('click');
			if($.browser.msie){
				$(this).attr('checked','');
			}else{
				$(this).trigger('click');
			};
		});
	};
};

	
	
	
	
	

