jQuery.fn.extend
({
    removeCss: function(cssName) {
        return this.each(function() {
            var curDom = $(this);
            jQuery.grep(cssName.split(","),
                    function(cssToBeRemoved) {
                        curDom.css(cssToBeRemoved, '');
                    });
            return curDom;
        });
    }
});

function equalHeight(group) {
	var tallest = 0;
	group.each(function() {
		var thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
}

function getOriginalHeightOfImg(img_element) {
    var t = new Image();
    t.src = (img_element.getAttribute ? img_element.getAttribute("src") : false) || img_element.src;
    return t.height;
}


function equalHeightByImg(group) {
	var tallest = 0;
	group.each(function() {
                var thisHeight = getOriginalHeightOfImg($(this).children()[0]);
                if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	if (tallest>0) group.height(tallest);
}


$(document).ready(
function(){
	$('#carousel_content').cycle({
      fx:     'fade',
      speed:   900,
      timeout: 10000,
      next:   '#carousel_content',
      pause:   1,
      pagerEvent: 'mouseover',
      pager:      '#carousel_navigator',
      activePagerClass: 'active_slide',
      pagerAnchorBuilder: function(idx, slide) {
                    return '#carousel_navigator .carousel_navs:eq(' + (idx) + ')';
                }
    });
    $('#seachfield').click(
      function () {
          $(this).val('');
      }
    );
    $(".product").click(function(event){
        window.location = $(this).find('a').attr('href');
    });
    $(".producttop").click(function(event){
        window.location = $(this).find('a').attr('href');
    });
    $(".productrow").click(function(event){
        window.location = $(this).find('a').attr('href');
    });
    $("#contactbox").after($("#basket"));

    if (jQuery.browser.safari && document.readyState != "complete") {

            $("img").one("load", function(){
                var img = this;
                setTimeout(function(){
                    equalHeightByImg($(".toppic"));
                }, 0);
            });
    } else {
      equalHeightByImg($(".toppic"));
    }
    $('.cnews').click(function(event){
        window.location = $(this).find('a').attr('href');
    }).css({cursor:"pointer"});

    $('#shop-zoom').CloudZoom();

	/*
    $("#tip").css({height:($("#tip").height()+10)+"px"});
    //Pro detail
    $(".product").click(function(event){
        window.location = $(this).find('a').attr('href');
    });
    $(".producttop").click(function(event){
        window.location = $(this).find('a').attr('href');
    });



    $(".productrow").css({cursor:"pointer"});


    $(".productrow").click(function(event){
        window.location = $(this).find('a:first').attr('href');
    });

    $("#headerrightblank").append($("#basket"));

    if($("#navbarr").height() > $("#content").height()) {

        $("#content").height($("#navbarr").height())

    }*/


});

