jQuery(document).ready(function($) {
	$("#slider").easySlider({auto: true, continuous: true, numeric: true, speed: 300, pause: 7000});
		 $('#style-log').jcarousel();
		 $('#style-log li').each(function(){
			$('a',this).each(function(i){
				$(this).addClass('link-'+i);
			});
		 });
		//  $('#style-log li a').css({opacity: 0});
		//  $('#style-log li a').hover(
       //   function(){$(this).animate({opacity: 1},{duration:300, queue:false});},
       //   function(){$(this).animate({opacity: 0},{duration:300, queue:false});
    // });
	 
	$('#products li').hover(function(){
			$('.link',this).show();
		},
         function(){$('.link',this).hide();
    });
	$('.latest li').hover(
          function(){$('span',this).fadeIn('slow');
		  $(this).css({opacity: 0.6});},
          function(){$('span',this).fadeOut('slow');
		  $(this).css({opacity: 1});
     });
	 $('#design-gallery li img').hover(
          function(){
			this.src = this.src.replace("-bw.jpg",".jpg");
		},
         function(){
			this.src = this.src.replace(".jpg","-bw.jpg");
     });
	 $('.tbl-data tr:even').addClass('even');
	defaulttextFunction();
	$('.nav-left li.level0').each(function(){
		var viewAll = $('> a',this).attr('href');
		$('ul.level0',this).append('<li><a href="'+viewAll+'">View All</a></li>');
	});
	$('.nav-left ul').dcAccordion({eventType: 'click', autoClose: true, saveState: false, disableLink: true, speed: 'slow', showCount: false, classExpand	 : 'active',autoExpand: true});
	$('.nav-left li.level0:not(.active)').hide();
	var maxValue = undefined;
	 $('.tab').each(function(){
		var val = parseInt($(this).height());
		if (maxValue === undefined || maxValue < val){
			maxValue = val;
		}
	 });
	 $('.tab').hide();
	 $('.tab').css('height',maxValue+'px');
	 $('.tab').eq(0).show();
	 $('.nav-tabs a').click(function(e){
		$('.nav-tabs li').removeClass('active');
		var getIndex = $(this).index('.nav-tabs a');
		$('.tab').hide();
		$('.tab').eq(getIndex).fadeIn();
		$(this).parent().addClass('active');
		e.preventDefault();
	 });
	 $('.attribute-list li span').each(function(){
		var getText = $(this).text();
		if(getText = 'Designer:'){
	//		$(this).hide();
		}
	//	if(getText = 'Material:'){
	//		var getMat = $(this).text();
	//		$(this).remove();
	//		$('.tab:first').append('<ul class="attribute-list"><li>'+getMat+'</li></ul>');
	//	}
	 });
	 $('.link-size').colorbox();
	 $('#form-contact ol li.button-row').append('<button id="btn-form-contact" type="button" title="Submit" class="button"><span>Submit</span></button>');
	 $('#btn-form-contact').live('click',function(e){
		$('#form-contact fieldset').fadeOut();
		$('#form-contact').append('<div class="loading">Loading ...</div>').fadeIn();
			$.post("/mail.php", $("#form-contact").serialize(),function(data){
				$('.loading').remove();
				$('#form-contact').html(data).fadeIn();
			});
		e.preventDefault();
	 });
	 // Declare the array variable
   // var imgSwap = [];
    // Select all images used in the image swap function - in our case class "img-swap"
   // $("#design-gallery img").each(function(){
        // Loop through all images which are used in our image swap function
        // Get the file name of the active images to be loaded by replacing _off with _on
   //     imgUrl = this.src.replace("-bw.jpg",".jpg");
        // Store the file name in our array
   //     imgSwap.push(imgUrl);
   // });
    // Pass the array to our preload function
   // $(imgSwap).preload();
	
function defaulttextFunction(){
	var $defaultText = $(".defaultText");
	$defaultText.focus(function(srcc) {
		if ($(this).val() == $(this)[0].title) {
			$(this).removeClass("defaultTextActive");
			$(this).val("");
		}
	});
	$defaultText.blur(function() {
		if ($(this).val() == "") {
			$(this).addClass("defaultTextActive");
			$(this).val($(this)[0].title);
		}
	});
	$defaultText.addClass("defaultTextActive").blur();
}
function defaulttextRemove(){
	$('.defaultText').each(function(){
		var checkVal = $(this).attr('title');
		if ($(this).val() == checkVal){
			$(this).val('');
		}
	  });
}
});
$.fn.preload = function() {
    this.each(function(){
        $('<img/>')[0].src = this;
    });
}


