$(document).ready(function(){
var tabContainers = $('div.tabcontenwrap > div.tabcontent');
if(document.getElementById("customheight"))
{
    custom_height = parseFloat(document.getElementById("customheight").innerHTML);
}
else
{
    custom_height = 970;
}

$('div.product_wrap ul.ptabs a').click(function () {
//alert(custom_height);
	tabContainers.hide().filter(this.hash).show();
	divs = document.getElementById("tabcontainer").getElementsByTagName("div");
	if(this.hash == "#whatsnew"||this.hash == "#comparison")
	{
		document.getElementById("tabcontainer").style.height = custom_height + 230 + "px";
		divs[0].style.height = custom_height + 230 + "px";
	}
	else
	{
		if(document.getElementById("tabcontainer").style.height != "")
		{
		document.getElementById("tabcontainer").style.height = custom_height + "px";
		divs[0].style.height = custom_height + "px";
		}
	}
	$('div.product_wrap ul.ptabs a').removeClass('selected');
	$(this).addClass('selected');

	return false;
}).filter(':first').click();


if ( $('a#linkt').length != 0 ) {

	$('a#linkt').click(function () {
		tabContainers.hide().filter('#technology').show();
		$('div.product_wrap ul.ptabs a').removeClass('selected');
		$('a[hash=#technology]').addClass('selected');
		return false;
	});

}


var settings2 = {tl: { radius: 10 },tr: { radius: 10 },bl: { radius: 10 },br: { radius: 10 }};
//$('.tabcontenwrap').hide();
obj2curve = document.getElementById('tabcontainer');
curvyCorners(settings2, obj2curve);  

//obj3curve = document.getElementById('smallbox');
//curvyCorners(settings2, obj3curve);  

//obj4curve = document.getElementById('smallbox').getElementsByTagName("h3");
//curvyCorners(settings2, obj4curve[0]);

$('.smallbox').each(
	function(e, elem) {
		curvyCorners(settings2, elem); 
	}
);

$('.smallbox h3').each(
	function(e, elem) {
		curvyCorners(settings2, elem); 
	}
);


/* change product options (years, users) tracker */
    initial_users = $('#users').val();
    initial_years = $('#years').val();
    
    
    if (initial_users && initial_years)
    {
	
	pName = $('#overview h1:first').html();
	if (pName)
	{
		pName_check = pName.match(/^bitdefender/i);
		if (pName_check==null)
		{
			pName = $('#overview h1:first').html();
			f = pName.charAt(0).toUpperCase();
			pName = 'BitDefender ' + f + pName.substr(1);
		}
	}
	
	but = document.getElementById('buyOnline1');
	if (but)
	{
	    on_click = but.onclick;	
	    but.onclick = function() {
		if (typeof(on_click) != 'undefined')
		    on_click();
		
		final_users = $('#users').val();
		final_years = $('#years').val();
	    
		if ((initial_users!=final_users) || (initial_years!=final_years))
		{
		    oBuyProductChanges(pName,initial_users,initial_years,final_users,final_years);
		}
	    }
	} 
    }
/* end tracking */
});
