/**
 * Funciones de pop
 */

function installListeners(){
	document.onclick= clickEvent;
	document.onkeypress= keyPressEvent;
}

function keyPressEvent(E){
	performPopPms();
}

function clickEvent(E){
	performPopPms();
}

function performPopPms(){
	var t_orgpms= getCookieValue("t_orgpms");
	if(t_orgpms){
		var t_cust_id = getCookieValue("t_cust_id");
		var t_pmsword= getCookieValue("t_pmsword");
		var key= "PMS"+t_cust_id;
		//Persistir cookies de PMS
		setCookie("orgpms", t_orgpms, 30);
		setCookie(key, key, 1);
		setCookie("pmsword", t_pmsword, 30);
		// Eliminar cookies temporales
		setCookie("t_orgpms", t_orgpms, -10);
		setCookie("t_pmsword", t_pmsword, -10);
		setCookie("t_cust_id", t_cust_id, -10);
	}
}

function deleteCookie(name)
{
	setCookie(szName,tmp,(new Date(1)));
}