YAHOO.namespace("sun.site");
YAHOO.sun.site.active_tip = 'none';
YAHOO.sun.site.active_div = 'none'

function doPop(e) {

	var x_adjust = -109;
	var y_adjust = -1;
	var split_class_array = this.id.split("__");
	var prod_id_raw = split_class_array[0];
	var ptype_id = split_class_array[1];
	prod_id = 'panel_' + prod_id_raw;
	var x = YAHOO.util.Event.getPageX(e);
	x = x + x_adjust;
	//var y = YAHOO.util.Event.getPageY(e);	
	//y = y + y_adjust;
	// so the panel will always appear at the same height relative to the row 
	var y = YAHOO.util.Dom.getY(this) + 23;

	if (YAHOO.sun.site.active_tip == 'none') {
		YAHOO.sun.site.active_tip = prod_id;
		YAHOO.sun.site.active_div = this;
		


		YAHOO.sun.site[prod_id].cfg.setProperty("xy", [x, y]);

		YAHOO.sun.site[prod_id].show();
	} else {
	
		// if they are reactivating the currently active tip, skip the hide processing
		if (YAHOO.sun.site.active_tip != prod_id)
		{
			YAHOO.sun.site[YAHOO.sun.site.active_tip].hide();
		}
;
		
		YAHOO.sun.site.active_div = this;	
		YAHOO.sun.site.active_tip = prod_id;
		

		YAHOO.sun.site[prod_id].cfg.setProperty("xy", [x, y]);

		YAHOO.sun.site[prod_id].show();
	}
	 
}

function doPart(e) {

	var x_adjust = -120;
	//var y_adjust = YAHOO.util.Dom.get('puwin_'+prod_id_raw).offsetHeight * -1;
	var split_class_array = this.id.split("__");
	var prod_id_raw = split_class_array[0];
	prod_id = 'panel_' + prod_id_raw;
	var x = YAHOO.util.Event.getPageX(e);
	x = x + x_adjust;
	
	var y = YAHOO.util.Event.getPageY(e);	
	var y_adjust = YAHOO.util.Dom.get('puwin_'+prod_id_raw).offsetHeight * -1 + 10;
	y = y + y_adjust;

	// this sets y based on the row position, 
	// so the panel will always appear at the same height relative to the row 
	//var y = YAHOO.util.Dom.getY(this) + 20;

	if (YAHOO.sun.site.active_tip == 'none') {
		YAHOO.sun.site.active_tip = prod_id;
		YAHOO.sun.site.active_div = this;
		
		YAHOO.sun.site[prod_id].cfg.setProperty("xy", [x, y]);

		YAHOO.sun.site[prod_id].show();
	} else {
		//alert(this);
		// if they are reactivating the currently active tip, skip the hide processing
		if (YAHOO.sun.site.active_tip != prod_id)
		{
			YAHOO.sun.site[YAHOO.sun.site.active_tip].hide();
		}
		YAHOO.sun.site.active_tip = prod_id;
		YAHOO.sun.site.active_div = this;

		YAHOO.sun.site[prod_id].cfg.setProperty("xy", [x, y]);

		YAHOO.sun.site[prod_id].show();
	}

}

function closeActive(e)
{
	if (YAHOO.sun.site.active_tip == 'none') {
	} else {
		
		var active_split_class_array = YAHOO.sun.site.active_div.id.split("__");
		var active_prod_id_raw = active_split_class_array[0];
		var active_ptype_id = active_split_class_array[1];

		YAHOO.util.Dom.replaceClass(YAHOO.sun.site.active_div, 'ptype_'+active_ptype_id+'_hightlight', 'ptype_'+active_ptype_id );
		

	}
}


function setupPanel(productId) {
	YAHOO.sun.site['panel_' + productId] = new YAHOO.widget.Panel("puwin_"+productId,  {
		width:"233px", 
		fixedcenter: false, 
		constraintoviewport: false, 
		underlay: "none", 
		close: true, 
		visible: false, 
		draggable: false,
		effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: .15}
	}
	);

//		effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: .3}

	YAHOO.sun.site['panel_' + productId].render();
}

function setupPartnerPanel(productId) {
	YAHOO.sun.site['panel_' + productId] = new YAHOO.widget.Panel("puwin_"+productId,  {
		width:"233px", 
		fixedcenter: false, 
		constraintoviewport: false, 
		underlay: "none", 
		close: true, 
		visible: false, 
		draggable: false,
		effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: .15},
		context: [productId + "__part", "tl", "br" ]
	}
	);

//		effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: .3}

	YAHOO.sun.site['panel_' + productId].render();
}

