function pop_window(url, w, h) {
	myfocus = window.open(url, 'mywindow', 'menubar=no,scrollbars=yes,width='+w+',height='+(h+30)); 
	setTimeout('myfocus.focus()',500);
}

function sign_in_out() {
	if (!($.browser.msie && $.browser.version < 7)) { // all but IE6
		$('#myAsurency a').click(function (e) {
			e.preventDefault();
			$('#signin').slideToggle();
		});
	}
}

function round_borders() {
	$('.roundWhiteBorder').each(function (i) {
		$(this).html('<div class="tl"><div class="tr"></div></div><div class="c">' + $(this).html() + '</div><div class="bl"><div class="br"></div></div>');
	});
	//$('.box').wrapInner('<div class="wrapper"></div>');
}

function modify_product_table() {
	$('.productTable th, .productTable td').wrapInner('<span></span>');
	$('.productTable .active').each(function () {
		$(this).prev().find('span').css('border-right', '0');
		$(this).next().find('span').css('border-left', '0');
	});
	$('.productTable tr').each(function () {
		$(this).find(':first').addClass('first');
	});
	$('.productTable .active').removeClass('active').addClass('jsActive');
	$('.productTable tr').each(function () {
		var tr = $(this);
		var h = 0;
		$(tr).find('span').each(function () {
			if ( $(this).height() > h) h = $(this).height();
		});
		$(tr).find('span').each(function () {
			$(this).height(h);
		});
	});
}

function handle_product_feature_hints() {
	$('#main').append('<div class="productComparisonHint"><span></span></div>');
	$('.productComparison .label').mouseover(function (e) {
		$('.productComparisonHint').show();
		$('.productComparisonHint span').html($(this).html());
		var x = e.pageX; // - mainOffset.left;
		var y = e.pageY; // - mainOffset.top;
		$('.productComparisonHint').css({'top' : y + 3, 'left' : x + 3});
	});
	$('.productComparison .label').mouseout(function () {
		$('.productComparisonHint').hide();
	});
}

function handle_comparison_chart() {
	$('.productComparison th a').each(function () {
		var box = $(this).parent().parent().parent().parent().parent().find('.features');
		if (!$(this).hasClass('open')) {
			$(box).hide();
			$(this).text('Open');
		} else {
			$(this).text('Close');
		}
	});;
	$('.productComparison th a').click(function (e) {
		e.preventDefault();
		var link = $(this);
		var box = $(this).parent().parent().parent().parent().parent().find('.features');
		$(box).slideToggle(function () {
			if ($(this).css('display') == 'none') {
				$(link).removeClass('open');
				$(link).text('Open');
			} else {
				$(link).addClass('open');
				$(link).text('Close');
			}
		});

	});
}

function disable_main_nav_links() {
	$('#navigation li a').each(function () {
		if ($(this).attr('href') == '') {
			$(this).click(function (e) {
				e.preventDefault();
			});
		}
	});
}

function handle_faq() {
	$('.faq .title a').click(function (e) {
		e.preventDefault();
		var container = $(this).parent().parent().parent();
		$('.faq').each(function () {
			if ($(this).html() != $(container).html()) {
				$(this).removeClass('active');
			}
		});
		if ($(container).hasClass('active')) {
			$(container).removeClass('active');
		} else {
			$(container).addClass('active');
		}
	});
}