﻿$(function() {
    $("a#top_scroll").click(function() {
        var anc = $(this).attr("href").substring(1);
        //$("html:not(:animated)"+( ! $.browser.opera ? ",body:not(:animated)" : "")).animate({scrollTop: $("a[name="+anc+"]").position().top});
        $("html:not(:animated) ,body:not(:animated)").animate({scrollTop: $("a[name="+anc+"]").position().top});
        return false;
    });
});


	function nc_change_img(nc_parent_link, small_img, large_img, img_width, img_height){
	var nc_product_img = document.getElementById('nc_product_img');
	var nc_link = nc_product_img.getElementsByTagName('A')[0];
	var nc_img = nc_product_img.getElementsByTagName('IMG')[0];	
	nc_link_node = nc_parent_link.parentNode.getElementsByTagName('A');
	for(var i=0; i<nc_link_node.length; i++) if(nc_link_node[i].className == 'nc_current') nc_link_node[i].className = '';
	nc_parent_link.className = 'nc_current';
	
	nc_img.src = small_img;	
	if(large_img){
		nc_link.href = large_img;
		nc_link.style.cursor = 'pointer';
		Shadowbox.clearCache();
		Shadowbox.setup();
	}else{
		nc_link.removeAttribute('HREF');
		nc_link.style.cursor = 'context-menu';

	}
		
	return false;
}

var time='';
$(function(){
	$('#bottom_menu li:first').addClass('one');
	$('#top_menu ul li.lvl1:last').addClass('last');
	$('#bred li:last').addClass('last');
});

$(function(){
	$('input[title!=""]').hint();
});

 
$(document).ready(function(){
	$("a.good").click(function () { 
	elementClick = $(this).attr("href");
      var destination = $('#Top').offset().top;
      return false;
	 });
	 
	 $("a.ex2trigger ").click(function () { 
	elementClick = $(this).attr("href");
      var destination = $('#Top').offset().top;
      $("html").animate({ scrollTop: destination-382}, 1100 );
      return false;
	 });
	theRotator();
	if($("#point li").click()){
		$("#point li").click(function() {
			var id=$(this).attr('class');
			if($(this).hasClass('show')){
			}
			else{
				clearInterval(time);
				$('#point ul li').removeClass('show');
				$('#photo .show').removeClass('show');
				$('#photo li').css('opacity','0');
				$('#photo #'+id).css('opacity','1.0');
				$('#photo #'+id).addClass('show');
				$('#TextSlide .show').removeClass('show');
				$('#point ul li').removeClass('show');
				$('#TextSlide .'+id).addClass('show');
				$('#point ul li.'+id).addClass('show');;
				time=setInterval('rotate()',5000);
			}
		});
	}

	$('#top_menu ul li.lvl1').mouseover(function(){
		var ee=$(this).children('ul');
		$(this).addClass('active');
		$(ee).css("display","block");
	});
	
	$('#top_menu ul li').mouseout(function(){
		ee=$(this).children('ul');
		$(this).removeClass('active');
		$(ee).css("display","none");
	});
	
	$('#text .brend_list .item').mouseover(function(){
		$(this).css('background','#f3f3f3');
	});
	
	$('#text .brend_list .item').mouseout(function(){
		$(this).css('background','none');
	});
	
	$('#left_menu li').mouseover(function(){
		$(this).addClass('active');
	});
	
	$('#left_menu li').mouseout(function(){
		if ($(this).hasClass('yes')){
		}
		else{
		$(this).removeClass('active');
		}
	});
	
	
$('#brend ul li:first').addClass('show');
	var s=0;
	$("#bottom_btn a").click(function() {
	if($('#brend ul li:last').hasClass('show')){
		$('#bottom_btn').css('display','none');
	}
	else{
		height=$('#brend ul li.show').height();
		height=height+12;
		s=s+height;
		$('#brend ul').animate({
		top: '-'+s
		});
	$('#brend ul li.show').next().addClass('show');
	$('#brend ul li.show').prev().removeClass('show');
	if($('#brend ul li:last').hasClass('show')){
		$('#bottom_btn a').css('display','none');
	}
	if($('#brend ul li:first').hasClass('show')){
		$('#top_btn a').css('display','none');
	}
	if($('#brend ul li').eq(1).hasClass('show')){
		$('#top_btn a').css('display','block');
		$('#top_btn').css('display','block');
	}
	}
	});
	$("#top_btn a").click(function() {
		height=$('#brend ul li.show').prev().height();
		height=height+12;
		s=s-height;
		$('#brend ul').animate({
		top: '-'+s
		});
	if($('#brend ul li:last').hasClass('show')){
		$('#bottom_btn a').css('display','block');
	}
		$('#brend ul li.show').prev().addClass('show');
		$('#brend ul li.show:last').removeClass('show');
	if($('#brend ul li:first').hasClass('show')){
		$('#top_btn').css('display','none');
	}

	});
});


function rotate() {
		var current = ($('div#slideshow ul#photo li.show')?  $('div#slideshow ul#photo li.show') : $('div#slideshow ul#photo li:first'));
		var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#slideshow ul#photo li:first') :current.next()) : $('div#slideshow ul#photo li:first'));	
		next.css({opacity: 0.0})
		.addClass('show')
		.animate({opacity: 1.0}, 1000);
		current.animate({opacity: 0.0}, 1000)
		.removeClass('show');
		var id=$('div#slideshow ul#photo li.show').attr('id');
		$('#TextSlide .show').removeClass('show');
		$('#point ul li').removeClass('show');
		$('#TextSlide .'+id).addClass('show');
		$('#point ul li.'+id).addClass('show');
	};

function theRotator() {
		$('div#slideshow ul#photo li').css({opacity: 0.0});
		$('div#slideshow ul#photo li:first').css({opacity: 1.0});
		time=setInterval('rotate()',5000);

	}




