if(IBD == undefined){
	var IBD = {};
}
IBD.Comment = {};
IBD.Comment.anim = Array();
IBD.Comment.countCheck = function(obj){
	var total = 0;
	var chks = document.getElementsByTagName('input');
	for (var i=0;i<chks.length;i++){
		if(chks.item(i).checked && chks.item(i).type == 'checkbox') total++;
	}
	if (total == 5){
		alert('You can only compare up to 4 offers at a time !');
		obj.checked = false;
		return false;
	}
	return true;
}
IBD.Comment.show = function(comm_id){
	var current_height = document.getElementById('comm_'+comm_id).style.height;
	var is_close = (current_height == '' || current_height == '0px')? true : false;
	if (is_close){
		var box_height = document.getElementById('cmt_'+comm_id).clientHeight;
		IBD.Comment.anim[comm_id].attributes.height = { to: (box_height + 65)};
		IBD.Comment.anim[comm_id].duration = 0.5;
		IBD.Comment.anim[comm_id].animate();
	}else{
		IBD.Comment.hide(comm_id);
	}
};
IBD.Comment.hide = function(comm_id){
	IBD.Comment.anim[comm_id].attributes.height = { to: 0};
	IBD.Comment.anim[comm_id].duration = 0.5;
	IBD.Comment.anim[comm_id].animate();
};
IBD.Popup = {panel:null}
IBD.Popup.show = function(url, w, h, modal){
	var frame_width = w - 10;
	var frame_height = h - 10;
	if(IBD.Popup.panel != null){
		IBD.Popup.panel.destroy();
	}
	IBD.Popup.panel = new YAHOO.widget.Panel("ibd_popup", 
		{
		width: w + 'px',
		height: h + 'px',
		fixedcenter: true, 
		constraintoviewport: true, 
		underlay: 'shadow',
		shadow: true,
		close: false, 
		visible: true,
		modal: modal,
		effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.75}
		} 
	);
	IBD.Popup.panel.setBody('<iframe src="' + url + '" width="' + frame_width + '" height="' + frame_height + '" frameborder="0" />');
	IBD.Popup.panel.cfg.setProperty('underlay','matte');
	IBD.Popup.panel.render(document.body);
	YAHOO.util.Dom.setStyle(YAHOO.util.Dom.getElementsByClassName('hd', IBD.Popup.panel.element), 'display', 'none');
	YAHOO.util.Dom.setStyle('ibd_popup', 'border', 'none');
};
IBD.Popup.hide = function(){
	IBD.Popup.panel.hide();
}