﻿function overview_tool() {
    $("#product_content_area h4.component_style,#product_content_area.component_style h4").corners("transparent");
    /*round class*/
    $(".round").corners("5px");
    $(".roundbg").corners("transparent");
    $(".roundmore").corners("10px");

    /*for rightimage*/
    $(".rightimage").each(function() {
        var columnWidth = $(this).parents(".column:first").width();
        var rightImgWidth = $(this).width();
        var rightPadding = columnWidth - rightImgWidth + 38;
        $(this).css({ "padding-left": rightPadding, "padding-right": 0 });
    });
}

function product_info() {
    var fabPaddingTop = 500 - $('#model_fab').height();

    if (fabPaddingTop > 0) {

        $('#model_fab').css({ 'padding-top': fabPaddingTop * 0.3 + 'px' });

    }
}

/*for tooltip*/

function showtips(id,keyword,tipcontent) {
    $('body').append("<div id='" + id + "' style='display:none;'>" + tipcontent + "</div>");

    var whichtd = $("#specifications td:contains(" + keyword + ")");
    if (whichtd.html() != null) {
        whichtd.each(function(e) {
            var whichtd_text = $(this).html().toString();
            var newtext = whichtd_text.replace(new RegExp(keyword, "gi"), "<a class='showtooltip' href='#' onclick='return false;'>" + keyword + "</a>");
            $(this).html(newtext);
        });
   	}

	var whichfab = $("#model_intro:contains(" + keyword + "):first");
	if(whichfab.html()!=null){
	    whichfab.html(whichfab.html().toString().replace(new RegExp(keyword, "gi"), "<a class='showtooltip' href='#' onclick='return false;'>" + keyword + "</a>"));
	}
	
    whichall = whichtd.add(whichfab);
    $('a.showtooltip', whichall).bt({
        padding: 20,
        width: 300,
        contentSelector: "$('div#" + id + "').html()",
        spikeLength: 10,
        spikeGirth: 10,
        positions: ['bottom', 'left'],
        centerPointX: 0.1,
        hoverIntentOpts: { timeout: 1500 },
        fill: 'rgba(255, 255, 255, 1)',
        strokeWidth: 0,
        cssStyles: { color: '#6B6B6B', background: '#fff', border: '1px solid #CCC' }
    });
	  
}

function showtipsSpec(id, keyword, tipcontent) {
    if($("#TT" + id).text()==""){
        $('body').append("<div id='TT" + id + "' style='display:none;'>" + tipcontent + "</div>");
    }

    var whichtd = $("#specifications td:contains(" + keyword + ")");
    if (whichtd.html() != null) {
        whichtd.each(function(e) {
            var whichtd_text = $(this).html().toString();
            var newtext = whichtd_text.replace(new RegExp(keyword, "gi"), "<a class='showtooltip' href='#' onclick='return false;'>" + keyword + "</a>");
            $(this).html(newtext);
        });
    }

    $('a.showtooltip', whichtd).bt({
        padding: 20,
        width: 300,
        contentSelector: "$('div#TT" + id + "').html()",
        spikeLength: 10,
        spikeGirth: 10,
        positions: ['bottom', 'left'],
        centerPointX: 0.1,
        hoverIntentOpts: { timeout: 1500 },
        fill: 'rgba(255, 255, 255, 1)',
        strokeWidth: 0,
        cssStyles: { color: '#6B6B6B', background: '#fff', border: '1px solid #CCC' }
    });

}

function showtipsInfo(id, keyword, tipcontent) {
    if($("#TT" + id).text()==""){
        $('body').append("<div id='TT" + id + "' style='display:none;'>" + tipcontent + "</div>");
    }

    var whichfab = $("#model_intro:contains(" + keyword + "):first");
    if (whichfab.html() != null) {
        whichfab.html(whichfab.html().toString().replace(new RegExp(keyword, "gi"), "<a class='showtooltip' href='#' onclick='return false;'>" + keyword + "</a>"));
    }

    $('a.showtooltip', whichfab).bt({
        padding: 20,
        width: 300,
        contentSelector: "$('div#TT" + id + "').html()",
        spikeLength: 10,
        spikeGirth: 10,
        positions: ['bottom', 'left'],
        centerPointX: 0.1,
        hoverIntentOpts: { timeout: 1500 },
        fill: 'rgba(255, 255, 255, 1)',
        strokeWidth: 0,
        cssStyles: { color: '#6B6B6B', background: '#fff', border: '1px solid #CCC' }
    });

}
