$(document).ready(function() {
	if (hideWrapper != 1)
	{
		if (vPageName == "Business-Customer" || vPageName == "Business-Features-ZoneService")
			fSetContentScroll();
	   
		if (self != parent) {
			var contentHeight = $('div.customer-box')[0].offsetHeight;
			parent.fixPlayerHeight(contentHeight);
		}
		if (isFriendly && browser == "msie" && parseInt($.browser.version) < 7)
			fFixCustomersLogo();
		customer_loadComparison(vHeadingCode);
	}
});

function fSetContentScroll() {
    
    var content = $('div.customer-content');
    var sideMenu = $('div.customer-side-menu');

    if (content[0].scrollHeight > content[0].offsetHeight) {
        //$('div.headings').css("position", "normal");
        //content.css("width", "350px");
         $('#customerPanel').jScrollPane({ showArrows: true });
        

    }
    else {
       
        var dcardTable = $('div.customer-content table.infoTbl');
        $('div.customer-content table.infoTbl td:last').css("height", 310 - dcardTable.height() + "px");
       // dcardTable.css("height", "255px");
    }
    
}


function fFixCustomersLogo() {

    var logos = $(".customer-logo img");
    if (logos.length == 1 && $(".customer-logo").css("height") == "115px")
        return;

    function fixSize()
    {
        var maxLogoHeight = 88.0;
        var maxLogoWidth = 176.0;
        var h = this.height / maxLogoHeight;
        var w = this.width / maxLogoWidth;
        if (h > 1 || w > 1) {
            if (h > w)
                $(this).attr({ height: this.height / h, width: this.width / h });
            else
                $(this).attr({ height: this.height / w, width: this.width / w });
        }

    }
    logos.each(function(index) {
        if (!this.complete)
         $(this).bind("load", fixSize);
        else
         fixSize.call(this);
    });
}
 
function customer_comparison_click(custId,custName,pHeadingCode)
{
	parent.comparison_click(custId,custName,pHeadingCode);
	
		if($("A[name=iconComparison_"+custId+"]").attr("class")=="comparison" && parent.$(".comparison_business .business").length<3)
			$("A[name=iconComparison_"+custId+"]").removeClass("comparison").addClass("comparison_sel");
		else
			$("A[name=iconComparison_"+custId+"]").removeClass("comparison_sel").addClass("comparison");
	
	
}
function customer_loadComparison(heading_code)
{
	var comparisonCookie=eval(getCookie("cookie-js-comparison_"+heading_code))==undefined?new Array():eval(getCookie("cookie-js-comparison_"+heading_code));
	if(comparisonCookie.length>0)
	{
		 $.each(comparisonCookie,function(i,item){
			$("A[name=iconComparison_"+item.cust_id+"]").addClass("comparison_sel");
		 });
	
	}
	else
		pageLoad = 1;
}
