/*-------- IMPORT FROM ( Name [ vip3/event.js ], Type [ WebComponetFile  ] ) --------*/
// written by Dean Edwards, 2005
// with input from Tino Zijdel, Matthias Miller, Diego Perini
// http://dean.edwards.name/weblog/2005/10/add-event/

function addEvent(element, type, handler) {
	if (element.addEventListener) {
		element.addEventListener(type, handler, false);
	} else {
		// assign each event handler a unique ID
		if (!handler.$$guid) handler.$$guid = addEvent.guid++;
		// create a hash table of event types for the element
		if (!element.events) element.events = {};
		// create a hash table of event handlers for each element/event pair
		var handlers = element.events[type];
		if (!handlers) {
			handlers = element.events[type] = {};
			// store the existing event handler (if there is one)
			if (element["on" + type]) {
				handlers[0] = element["on" + type];
			}
		}
		// store the event handler in the hash table
		handlers[handler.$$guid] = handler;
		// assign a global event handler to do all the work
		element["on" + type] = handleEvent;
	}
};
// a counter used to create unique IDs
addEvent.guid = 1;

function removeEvent(element, type, handler) {
	if (element.removeEventListener) {
		element.removeEventListener(type, handler, false);
	} else {
		// delete the event handler from the hash table
		if (element.events && element.events[type]) {
			delete element.events[type][handler.$$guid];
		}
	}
};

function handleEvent(event) {
	var returnValue = true;
	// grab the event object (IE uses a global event object)
	event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
	// get a reference to the hash table of event handlers
	var handlers = this.events[event.type];
	// execute each event handler
	for (var i in handlers) {
		this.$$handleEvent = handlers[i];
		if (this.$$handleEvent(event) === false) {
			returnValue = false;
		}
	}
	return returnValue;
};

function fixEvent(event) {
	// add W3C standard event methods
	event.preventDefault = fixEvent.preventDefault;
	event.stopPropagation = fixEvent.stopPropagation;
	return event;
};
fixEvent.preventDefault = function() {
	this.returnValue = false;
};
fixEvent.stopPropagation = function() {
	this.cancelBubble = true;
};

/*-------- IMPORT FROM ( Name [ apiEvents.js ], Type [ WebComponetFile  ] ) --------*/
var tasksClick = new Array();
function addClickListener(task){
	if (task!=null)
		tasksClick[tasksClick.length]=task;	
	return;
}
document.onclick = clickFired;
function clickFired(E){
	for(var i =0 ; i <tasksClick.length; i++){
		tasksClick[i](E);
	}
	return;
}
var tasksKey=new Array();
function addKeyListener(task){
	if (task!=null)
		tasksKey[tasksKey.length]=task;	
	return;
}
document.onkeypress = keypressFired;
function keypressFired(E){
	for(var i =0 ; i <tasksKey.length; i++){
		tasksKey[i](E);
	}
	return;
}
		

/*-------- IMPORT FROM ( Name [ VIP3_LIST_URL_VAR ], Type [ P ], Class [ WebComponetVo ] ) --------*/
var listUrl = "http://listado.mercadolibre.com.mx/";
/*-------- IMPORT FROM ( Name [ RP2_URL_SITE ], Type [ P ], Class [ WebComponetVo ] ) --------*/
var urlBaseSiteRP2 = "http://www.mercadolibre.com.mx";
/*-------- IMPORT FROM ( Name [ RP2_JOKER_JS ], Type [ H ], Class [ WebComponetVo ] ) --------*/
function getCurrentUrlBase(){
return "http://"+window.location.host;
}
var urlBase = "http://"+window.location.host;
var contentIsEnabled	= true;
var autocenterIsEnabled	= true;
var loadingIsEnabled	= true;

var cnt_width  = '790px';
var img_src    = '/org-img/vip3/layer/loading230x180.gif';

var loading_width  = '230px';
var loading_height = '180px';

var image = new Image();
image.src = '/org-img/vip3/layer/loading230x180.gif';

	function getCookieValue(name) {

		var start=document.cookie.indexOf(name+"=");

		var len=start+name.length+1;

		if (start == -1) 

			return null;

		var end=document.cookie.indexOf(";",len);

		if (end==-1) 

			end=document.cookie.length;

		return unescape(document.cookie.substring(len,end));

	}

/*-------- IMPORT FROM ( Name [ JS_FILE_CORE_YUI ], Type [ H ], Class [ WebComponetVo ] ) --------*/
if(typeof YAHOO=="undefined"||!YAHOO){var YAHOO={};}YAHOO.namespace=function(){var A=arguments,E=null,C,B,D;for(C=0;C<A.length;C=C+1){D=A[C].split(".");E=YAHOO;for(B=(D[0]=="YAHOO")?1:0;B<D.length;B=B+1){E[D[B]]=E[D[B]]||{};E=E[D[B]];}}return E;};YAHOO.log=function(D,A,C){var B=YAHOO.widget.Logger;if(B&&B.log){return B.log(D,A,C);}else{return false;}};YAHOO.register=function(A,E,D){var I=YAHOO.env.modules;if(!I[A]){I[A]={versions:[],builds:[]};}var B=I[A],H=D.version,G=D.build,F=YAHOO.env.listeners;B.name=A;B.version=H;B.build=G;B.versions.push(H);B.builds.push(G);B.mainClass=E;for(var C=0;C<F.length;C=C+1){F[C](B);}if(E){E.VERSION=H;E.BUILD=G;}else{YAHOO.log("mainClass is undefined for module "+A,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(A){return YAHOO.env.modules[A]||null;};YAHOO.env.ua=function(){var C={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0};var B=navigator.userAgent,A;if((/KHTML/).test(B)){C.webkit=1;}A=B.match(/AppleWebKit\/([^\s]*)/);if(A&&A[1]){C.webkit=parseFloat(A[1]);if(/ Mobile\//.test(B)){C.mobile="Apple";}else{A=B.match(/NokiaN[^\/]*/);if(A){C.mobile=A[0];}}A=B.match(/AdobeAIR\/([^\s]*)/);if(A){C.air=A[0];}}if(!C.webkit){A=B.match(/Opera[\s\/]([^\s]*)/);if(A&&A[1]){C.opera=parseFloat(A[1]);A=B.match(/Opera Mini[^;]*/);if(A){C.mobile=A[0];}}else{A=B.match(/MSIE\s([^;]*)/);if(A&&A[1]){C.ie=parseFloat(A[1]);}else{A=B.match(/Gecko\/([^\s]*)/);if(A){C.gecko=1;A=B.match(/rv:([^\s\)]*)/);if(A&&A[1]){C.gecko=parseFloat(A[1]);}}}}}return C;}();(function(){YAHOO.namespace("util","widget","example");if("undefined"!==typeof YAHOO_config){var B=YAHOO_config.listener,A=YAHOO.env.listeners,D=true,C;if(B){for(C=0;C<A.length;C=C+1){if(A[C]==B){D=false;break;}}if(D){A.push(B);}}}})();YAHOO.lang=YAHOO.lang||{};(function(){var A=YAHOO.lang,C=["toString","valueOf"],B={isArray:function(D){if(D){return A.isNumber(D.length)&&A.isFunction(D.splice);}return false;},isBoolean:function(D){return typeof D==="boolean";},isFunction:function(D){return typeof D==="function";},isNull:function(D){return D===null;},isNumber:function(D){return typeof D==="number"&&isFinite(D);},isObject:function(D){return(D&&(typeof D==="object"||A.isFunction(D)))||false;},isString:function(D){return typeof D==="string";},isUndefined:function(D){return typeof D==="undefined";},_IEEnumFix:(YAHOO.env.ua.ie)?function(F,E){for(var D=0;D<C.length;D=D+1){var H=C[D],G=E[H];if(A.isFunction(G)&&G!=Object.prototype[H]){F[H]=G;}}}:function(){},extend:function(H,I,G){if(!I||!H){throw new Error("extend failed, please check that "+"all dependencies are included.");}var E=function(){};E.prototype=I.prototype;H.prototype=new E();H.prototype.constructor=H;H.superclass=I.prototype;if(I.prototype.constructor==Object.prototype.constructor){I.prototype.constructor=I;}if(G){for(var D in G){if(A.hasOwnProperty(G,D)){H.prototype[D]=G[D];}}A._IEEnumFix(H.prototype,G);}},augmentObject:function(H,G){if(!G||!H){throw new Error("Absorb failed, verify dependencies.");}var D=arguments,F,I,E=D[2];if(E&&E!==true){for(F=2;F<D.length;F=F+1){H[D[F]]=G[D[F]];}}else{for(I in G){if(E||!(I in H)){H[I]=G[I];}}A._IEEnumFix(H,G);}},augmentProto:function(G,F){if(!F||!G){throw new Error("Augment failed, verify dependencies.");}var D=[G.prototype,F.prototype];for(var E=2;E<arguments.length;E=E+1){D.push(arguments[E]);}A.augmentObject.apply(this,D);},dump:function(D,I){var F,H,K=[],L="{...}",E="f(){...}",J=", ",G=" => ";if(!A.isObject(D)){return D+"";}else{if(D instanceof Date||("nodeType" in D&&"tagName" in D)){return D;}else{if(A.isFunction(D)){return E;}}}I=(A.isNumber(I))?I:3;if(A.isArray(D)){K.push("[");for(F=0,H=D.length;F<H;F=F+1){if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}if(K.length>1){K.pop();}K.push("]");}else{K.push("{");for(F in D){if(A.hasOwnProperty(D,F)){K.push(F+G);if(A.isObject(D[F])){K.push((I>0)?A.dump(D[F],I-1):L);}else{K.push(D[F]);}K.push(J);}}if(K.length>1){K.pop();}K.push("}");}return K.join("");},substitute:function(S,E,L){var I,H,G,O,P,R,N=[],F,J="dump",M=" ",D="{",Q="}";for(;;){I=S.lastIndexOf(D);if(I<0){break;}H=S.indexOf(Q,I);if(I+1>=H){break;}F=S.substring(I+1,H);O=F;R=null;G=O.indexOf(M);if(G>-1){R=O.substring(G+1);O=O.substring(0,G);}P=E[O];if(L){P=L(O,P,R);}if(A.isObject(P)){if(A.isArray(P)){P=A.dump(P,parseInt(R,10));}else{R=R||"";var K=R.indexOf(J);if(K>-1){R=R.substring(4);}if(P.toString===Object.prototype.toString||K>-1){P=A.dump(P,parseInt(R,10));}else{P=P.toString();}}}else{if(!A.isString(P)&&!A.isNumber(P)){P="~-"+N.length+"-~";N[N.length]=F;}}S=S.substring(0,I)+P+S.substring(H+1);}for(I=N.length-1;I>=0;I=I-1){S=S.replace(new RegExp("~-"+I+"-~"),"{"+N[I]+"}","g");}return S;},trim:function(D){try{return D.replace(/^\s+|\s+$/g,"");}catch(E){return D;}},merge:function(){var G={},E=arguments;for(var F=0,D=E.length;F<D;F=F+1){A.augmentObject(G,E[F],true);}return G;},later:function(K,E,L,G,H){K=K||0;E=E||{};var F=L,J=G,I,D;if(A.isString(L)){F=E[L];}if(!F){throw new TypeError("method undefined");}if(!A.isArray(J)){J=[G];}I=function(){F.apply(E,J);};D=(H)?setInterval(I,K):setTimeout(I,K);return{interval:H,cancel:function(){if(this.interval){clearInterval(D);}else{clearTimeout(D);}}};},isValue:function(D){return(A.isObject(D)||A.isString(D)||A.isNumber(D)||A.isBoolean(D));}};A.hasOwnProperty=(Object.prototype.hasOwnProperty)?function(D,E){return D&&D.hasOwnProperty(E);}:function(D,E){return !A.isUndefined(D[E])&&D.constructor.prototype[E]!==D[E];};B.augmentObject(A,B,true);YAHOO.util.Lang=A;A.augment=A.augmentProto;YAHOO.augment=A.augmentProto;YAHOO.extend=A.extend;})();YAHOO.register("yahoo",YAHOO,{version:"2.6.0",build:"1321"});
/*-------- IMPORT FROM ( Name [ JS_FILE_EVENT_YUI ], Type [ H ], Class [ WebComponetVo ] ) --------*/
YAHOO.util.CustomEvent=function(D,B,C,A){this.type=D;this.scope=B||window;this.silent=C;this.signature=A||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){}var E="_YUICEOnSubscribe";if(D!==E){this.subscribeEvent=new YAHOO.util.CustomEvent(E,this,true);}this.lastError=null;};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(B,C,A){if(!B){throw new Error("Invalid callback for subscriber to '"+this.type+"'");}if(this.subscribeEvent){this.subscribeEvent.fire(B,C,A);}this.subscribers.push(new YAHOO.util.Subscriber(B,C,A));},unsubscribe:function(D,F){if(!D){return this.unsubscribeAll();}var E=false;for(var B=0,A=this.subscribers.length;B<A;++B){var C=this.subscribers[B];if(C&&C.contains(D,F)){this._delete(B);E=true;}}return E;},fire:function(){this.lastError=null;var K=[],E=this.subscribers.length;if(!E&&this.silent){return true;}var I=[].slice.call(arguments,0),G=true,D,J=false;if(!this.silent){}var C=this.subscribers.slice(),A=YAHOO.util.Event.throwErrors;for(D=0;D<E;++D){var M=C[D];if(!M){J=true;}else{if(!this.silent){}var L=M.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var B=null;if(I.length>0){B=I[0];}try{G=M.fn.call(L,B,M.obj);}catch(F){this.lastError=F;if(A){throw F;}}}else{try{G=M.fn.call(L,this.type,I,M.obj);}catch(H){this.lastError=H;if(A){throw H;}}}if(false===G){if(!this.silent){}break;}}}return(G!==false);},unsubscribeAll:function(){for(var A=this.subscribers.length-1;A>-1;A--){this._delete(A);}this.subscribers=[];return A;},_delete:function(A){var B=this.subscribers[A];if(B){delete B.fn;delete B.obj;}this.subscribers.splice(A,1);},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(B,C,A){this.fn=B;this.obj=YAHOO.lang.isUndefined(C)?null:C;this.override=A;};YAHOO.util.Subscriber.prototype.getScope=function(A){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}}return A;};YAHOO.util.Subscriber.prototype.contains=function(A,B){if(B){return(this.fn==A&&this.obj==B);}else{return(this.fn==A);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var H=false;var I=[];var J=[];var G=[];var E=[];var C=0;var F=[];var B=[];var A=0;var D={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9};var K=YAHOO.env.ua.ie?"focusin":"focus";var L=YAHOO.env.ua.ie?"focusout":"blur";return{POLL_RETRYS:2000,POLL_INTERVAL:20,EL:0,TYPE:1,FN:2,WFN:3,UNLOAD_OBJ:3,ADJ_SCOPE:4,OBJ:5,OVERRIDE:6,CAPTURE:7,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,_dri:null,DOMReady:false,throwErrors:false,startInterval:function(){if(!this._interval){var M=this;var N=function(){M._tryPreloadAttach();};this._interval=setInterval(N,this.POLL_INTERVAL);}},onAvailable:function(R,O,S,Q,P){var M=(YAHOO.lang.isString(R))?[R]:R;for(var N=0;N<M.length;N=N+1){F.push({id:M[N],fn:O,obj:S,override:Q,checkReady:P});}C=this.POLL_RETRYS;this.startInterval();},onContentReady:function(O,M,P,N){this.onAvailable(O,M,P,N,true);},onDOMReady:function(M,O,N){if(this.DOMReady){setTimeout(function(){var P=window;if(N){if(N===true){P=O;}else{P=N;}}M.call(P,"DOMReady",[],O);},0);}else{this.DOMReadyEvent.subscribe(M,O,N);}},_addListener:function(O,M,X,S,N,a){if(!X||!X.call){return false;}if(this._isValidCollection(O)){var Y=true;for(var T=0,V=O.length;T<V;++T){Y=this._addListener(O[T],M,X,S,N,a)&&Y;}return Y;}else{if(YAHOO.lang.isString(O)){var R=this.getEl(O);if(R){O=R;}else{this.onAvailable(O,function(){YAHOO.util.Event._addListener(O,M,X,S,N,a);});return true;}}}if(!O){return false;}if("unload"==M&&S!==this){J[J.length]=[O,M,X,S,N,a];return true;}var b=O;if(N){if(N===true){b=S;}else{b=N;}}var P=function(c){return X.call(b,YAHOO.util.Event.getEvent(c,O),S);};var Z=[O,M,X,P,b,S,N,a];var U=I.length;I[U]=Z;if(this.useLegacyEvent(O,M)){var Q=this.getLegacyIndex(O,M);if(Q==-1||O!=G[Q][0]){Q=G.length;B[O.id+M]=Q;G[Q]=[O,M,O["on"+M]];E[Q]=[];O["on"+M]=function(c){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(c),Q);};}E[Q].push(Z);}else{try{this._simpleAdd(O,M,P,a);}catch(W){this.lastError=W;this._removeListener(O,M,X,a);return false;}}return true;},addListener:function(O,Q,N,P,M){return this._addListener(O,Q,N,P,M,false);},addFocusListener:function(O,N,P,M){return this._addListener(O,K,N,P,M,true);},removeFocusListener:function(N,M){return this._removeListener(N,K,M,true);},addBlurListener:function(O,N,P,M){return this._addListener(O,L,N,P,M,true);},removeBlurListener:function(N,M){return this._removeListener(N,L,M,true);},fireLegacyEvent:function(Q,O){var S=true,M,U,T,V,R;U=E[O].slice();for(var N=0,P=U.length;N<P;++N){T=U[N];if(T&&T[this.WFN]){V=T[this.ADJ_SCOPE];R=T[this.WFN].call(V,Q);S=(S&&R);}}M=G[O];if(M&&M[2]){M[2](Q);}return S;},getLegacyIndex:function(N,O){var M=this.generateId(N)+O;if(typeof B[M]=="undefined"){return -1;}else{return B[M];}},useLegacyEvent:function(M,N){return(this.webkit&&this.webkit<419&&("click"==N||"dblclick"==N));},_removeListener:function(N,M,V,Y){var Q,T,X;if(typeof N=="string"){N=this.getEl(N);}else{if(this._isValidCollection(N)){var W=true;for(Q=N.length-1;Q>-1;Q--){W=(this._removeListener(N[Q],M,V,Y)&&W);}return W;}}if(!V||!V.call){return this.purgeElement(N,false,M);}if("unload"==M){for(Q=J.length-1;Q>-1;Q--){X=J[Q];if(X&&X[0]==N&&X[1]==M&&X[2]==V){J.splice(Q,1);return true;}}return false;}var R=null;var S=arguments[4];if("undefined"===typeof S){S=this._getCacheIndex(N,M,V);}if(S>=0){R=I[S];}if(!N||!R){return false;}if(this.useLegacyEvent(N,M)){var P=this.getLegacyIndex(N,M);var O=E[P];if(O){for(Q=0,T=O.length;Q<T;++Q){X=O[Q];if(X&&X[this.EL]==N&&X[this.TYPE]==M&&X[this.FN]==V){O.splice(Q,1);break;}}}}else{try{this._simpleRemove(N,M,R[this.WFN],Y);}catch(U){this.lastError=U;return false;}}delete I[S][this.WFN];delete I[S][this.FN];
I.splice(S,1);return true;},removeListener:function(N,O,M){return this._removeListener(N,O,M,false);},getTarget:function(O,N){var M=O.target||O.srcElement;return this.resolveTextNode(M);},resolveTextNode:function(N){try{if(N&&3==N.nodeType){return N.parentNode;}}catch(M){}return N;},getPageX:function(N){var M=N.pageX;if(!M&&0!==M){M=N.clientX||0;if(this.isIE){M+=this._getScrollLeft();}}return M;},getPageY:function(M){var N=M.pageY;if(!N&&0!==N){N=M.clientY||0;if(this.isIE){N+=this._getScrollTop();}}return N;},getXY:function(M){return[this.getPageX(M),this.getPageY(M)];},getRelatedTarget:function(N){var M=N.relatedTarget;if(!M){if(N.type=="mouseout"){M=N.toElement;}else{if(N.type=="mouseover"){M=N.fromElement;}}}return this.resolveTextNode(M);},getTime:function(O){if(!O.time){var N=new Date().getTime();try{O.time=N;}catch(M){this.lastError=M;return N;}}return O.time;},stopEvent:function(M){this.stopPropagation(M);this.preventDefault(M);},stopPropagation:function(M){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}},preventDefault:function(M){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}},getEvent:function(O,M){var N=O||window.event;if(!N){var P=this.getEvent.caller;while(P){N=P.arguments[0];if(N&&Event==N.constructor){break;}P=P.caller;}}return N;},getCharCode:function(N){var M=N.keyCode||N.charCode||0;if(YAHOO.env.ua.webkit&&(M in D)){M=D[M];}return M;},_getCacheIndex:function(Q,R,P){for(var O=0,N=I.length;O<N;O=O+1){var M=I[O];if(M&&M[this.FN]==P&&M[this.EL]==Q&&M[this.TYPE]==R){return O;}}return -1;},generateId:function(M){var N=M.id;if(!N){N="yuievtautoid-"+A;++A;M.id=N;}return N;},_isValidCollection:function(N){try{return(N&&typeof N!=="string"&&N.length&&!N.tagName&&!N.alert&&typeof N[0]!=="undefined");}catch(M){return false;}},elCache:{},getEl:function(M){return(typeof M==="string")?document.getElementById(M):M;},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(N){if(!H){H=true;var M=YAHOO.util.Event;M._ready();M._tryPreloadAttach();}},_ready:function(N){var M=YAHOO.util.Event;if(!M.DOMReady){M.DOMReady=true;M.DOMReadyEvent.fire();M._simpleRemove(document,"DOMContentLoaded",M._ready);}},_tryPreloadAttach:function(){if(F.length===0){C=0;clearInterval(this._interval);this._interval=null;return ;}if(this.locked){return ;}if(this.isIE){if(!this.DOMReady){this.startInterval();return ;}}this.locked=true;var S=!H;if(!S){S=(C>0&&F.length>0);}var R=[];var T=function(V,W){var U=V;if(W.override){if(W.override===true){U=W.obj;}else{U=W.override;}}W.fn.call(U,W.obj);};var N,M,Q,P,O=[];for(N=0,M=F.length;N<M;N=N+1){Q=F[N];if(Q){P=this.getEl(Q.id);if(P){if(Q.checkReady){if(H||P.nextSibling||!S){O.push(Q);F[N]=null;}}else{T(P,Q);F[N]=null;}}else{R.push(Q);}}}for(N=0,M=O.length;N<M;N=N+1){Q=O[N];T(this.getEl(Q.id),Q);}C--;if(S){for(N=F.length-1;N>-1;N--){Q=F[N];if(!Q||!Q.id){F.splice(N,1);}}this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;},purgeElement:function(Q,R,T){var O=(YAHOO.lang.isString(Q))?this.getEl(Q):Q;var S=this.getListeners(O,T),P,M;if(S){for(P=S.length-1;P>-1;P--){var N=S[P];this._removeListener(O,N.type,N.fn,N.capture);}}if(R&&O&&O.childNodes){for(P=0,M=O.childNodes.length;P<M;++P){this.purgeElement(O.childNodes[P],R,T);}}},getListeners:function(O,M){var R=[],N;if(!M){N=[I,J];}else{if(M==="unload"){N=[J];}else{N=[I];}}var T=(YAHOO.lang.isString(O))?this.getEl(O):O;for(var Q=0;Q<N.length;Q=Q+1){var V=N[Q];if(V){for(var S=0,U=V.length;S<U;++S){var P=V[S];if(P&&P[this.EL]===T&&(!M||M===P[this.TYPE])){R.push({type:P[this.TYPE],fn:P[this.FN],obj:P[this.OBJ],adjust:P[this.OVERRIDE],scope:P[this.ADJ_SCOPE],capture:P[this.CAPTURE],index:S});}}}}return(R.length)?R:null;},_unload:function(S){var M=YAHOO.util.Event,P,O,N,R,Q,T=J.slice();for(P=0,R=J.length;P<R;++P){N=T[P];if(N){var U=window;if(N[M.ADJ_SCOPE]){if(N[M.ADJ_SCOPE]===true){U=N[M.UNLOAD_OBJ];}else{U=N[M.ADJ_SCOPE];}}N[M.FN].call(U,M.getEvent(S,N[M.EL]),N[M.UNLOAD_OBJ]);T[P]=null;N=null;U=null;}}J=null;if(I){for(O=I.length-1;O>-1;O--){N=I[O];if(N){M._removeListener(N[M.EL],N[M.TYPE],N[M.FN],N[M.CAPTURE],O);}}N=null;}G=null;M._simpleRemove(window,"unload",M._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var M=document.documentElement,N=document.body;if(M&&(M.scrollTop||M.scrollLeft)){return[M.scrollTop,M.scrollLeft];}else{if(N){return[N.scrollTop,N.scrollLeft];}else{return[0,0];}}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(O,P,N,M){O.addEventListener(P,N,(M));};}else{if(window.attachEvent){return function(O,P,N,M){O.attachEvent("on"+P,N);};}else{return function(){};}}}(),_simpleRemove:function(){if(window.removeEventListener){return function(O,P,N,M){O.removeEventListener(P,N,(M));};}else{if(window.detachEvent){return function(N,O,M){N.detachEvent("on"+O,M);};}else{return function(){};}}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;EU.onFocus=EU.addFocusListener;EU.onBlur=EU.addBlurListener;
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller */
if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var n=document.createElement("p");EU._dri=setInterval(function(){try{n.doScroll("left");clearInterval(EU._dri);EU._dri=null;EU._ready();n=null;}catch(ex){}},EU.POLL_INTERVAL);}else{if(EU.webkit&&EU.webkit<525){EU._dri=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._dri);EU._dri=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);}}EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();}YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(A,C,F,E){this.__yui_events=this.__yui_events||{};
var D=this.__yui_events[A];if(D){D.subscribe(C,F,E);}else{this.__yui_subscribers=this.__yui_subscribers||{};var B=this.__yui_subscribers;if(!B[A]){B[A]=[];}B[A].push({fn:C,obj:F,override:E});}},unsubscribe:function(C,E,G){this.__yui_events=this.__yui_events||{};var A=this.__yui_events;if(C){var F=A[C];if(F){return F.unsubscribe(E,G);}}else{var B=true;for(var D in A){if(YAHOO.lang.hasOwnProperty(A,D)){B=B&&A[D].unsubscribe(E,G);}}return B;}return false;},unsubscribeAll:function(A){return this.unsubscribe(A);},createEvent:function(G,D){this.__yui_events=this.__yui_events||{};var A=D||{};var I=this.__yui_events;if(I[G]){}else{var H=A.scope||this;var E=(A.silent);var B=new YAHOO.util.CustomEvent(G,H,E,YAHOO.util.CustomEvent.FLAT);I[G]=B;if(A.onSubscribeCallback){B.subscribeEvent.subscribe(A.onSubscribeCallback);}this.__yui_subscribers=this.__yui_subscribers||{};var F=this.__yui_subscribers[G];if(F){for(var C=0;C<F.length;++C){B.subscribe(F[C].fn,F[C].obj,F[C].override);}}}return I[G];},fireEvent:function(E,D,A,C){this.__yui_events=this.__yui_events||{};var G=this.__yui_events[E];if(!G){return null;}var B=[];for(var F=1;F<arguments.length;++F){B.push(arguments[F]);}return G.fire.apply(G,B);},hasEvent:function(A){if(this.__yui_events){if(this.__yui_events[A]){return true;}}return false;}};YAHOO.util.KeyListener=function(A,F,B,C){if(!A){}else{if(!F){}else{if(!B){}}}if(!C){C=YAHOO.util.KeyListener.KEYDOWN;}var D=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof A=="string"){A=document.getElementById(A);}if(typeof B=="function"){D.subscribe(B);}else{D.subscribe(B.fn,B.scope,B.correctScope);}function E(J,I){if(!F.shift){F.shift=false;}if(!F.alt){F.alt=false;}if(!F.ctrl){F.ctrl=false;}if(J.shiftKey==F.shift&&J.altKey==F.alt&&J.ctrlKey==F.ctrl){var G;if(F.keys instanceof Array){for(var H=0;H<F.keys.length;H++){G=F.keys[H];if(G==J.charCode){D.fire(J.charCode,J);break;}else{if(G==J.keyCode){D.fire(J.keyCode,J);break;}}}}else{G=F.keys;if(G==J.charCode){D.fire(J.charCode,J);}else{if(G==J.keyCode){D.fire(J.keyCode,J);}}}}}this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(A,C,E);this.enabledEvent.fire(F);}this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(A,C,E);this.disabledEvent.fire(F);}this.enabled=false;};this.toString=function(){return"KeyListener ["+F.keys+"] "+A.tagName+(A.id?"["+A.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.util.KeyListener.KEY={ALT:18,BACK_SPACE:8,CAPS_LOCK:20,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,META:224,NUM_LOCK:144,PAGE_DOWN:34,PAGE_UP:33,PAUSE:19,PRINTSCREEN:44,RIGHT:39,SCROLL_LOCK:145,SHIFT:16,SPACE:32,TAB:9,UP:38};YAHOO.register("event",YAHOO.util.Event,{version:"2.6.0",build:"1321"});
/*-------- IMPORT FROM ( Name [ JS_FILE_LAYER ], Type [ H ], Class [ WebComponetVo ] ) --------*/
function processEnterKey(e){
		
		keycode = e.keyCode;
		
		if(keycode == 13)
			document.getElementById('userPassForm').submit();
	}

netscape = "";

ver = navigator.appVersion; 
len = ver.length;

for(iln = 0; iln < len; iln++) {
	if (ver.charAt(iln) == "(") break;
}

netscape = (ver.charAt(iln+1).toUpperCase() != "C");

if (netscape) document.captureEvents(Event.KEYDOWN|Event.KEYUP);


var divWidth   = 0;
var divHeight  = 0;
var html       = "";
var windowHeight = 0;
var windowWidth = 0;
var totalWidth = 0;
var contentTop = 0;
var scrOfY = 0;
var first = true;
var postProcess;
var postClosing;
var reques = null;
var cancelLoading = 0;

var ERROR_MESSAGE = "error"; 
var WARNING_MESSAGE = "warning";
var VALIDATED_MESSAGE = "validated";
/* FAD - Inicio - NAP VIP3 Captcha*/
var REDIR_LOGIN_TYPE = "redir_login";
/* FAD - Fin - NAP VIP3 Captcha */

/* ----------------- Funciones ----------------- */

function showLayer(urlAction)
{
	/* ------- Comportamiento de la ventana -------- */

	addEvent(window, 'resize', readjustContent);
	addEvent(window, 'scroll', readjustContent);
	
	var nickName = getcookie('orgnickp');

	if (isNickNameNoEncoder(nickName)){
		
		var myDomain = (window.location.host + "");
		var myDomainCookie = myDomain.substring(myDomain.indexOf('.'));
		deleteCookie('orghash', '/', myDomainCookie);
		deleteCookie('orgnickp', '/', myDomainCookie);
	}
	
	//Creamos el DIMMER
	createDimmerDiv();
	 
	var layerURL = cnt_src+'&random='+Math.random();

        //la variable destQuest la obtengo del VOB VIP_LAYER_JS
        if (typeof(destQuest) != "undefined"
 && (urlAction == destQuest || urlAction == (destQuest + "&step=ask"))) {

            layerURL = urlAction+'&random='+Math.random();

        } 

        if (typeof(atlasPoolSufix) != "undefined"){
		layerURL += "&"+ atlasPoolSufix; 	
	}
	
	//Creamos el contenido dinamico
	createDynamicContent(img_src, loading_width, loading_height, layerURL , cnt_width);
	
	//Inicializo variables de cuotas
	myMethod="";
	myQuotas="";

}

/*Funciones para desloguear al usuario que tenga caracteres raros en el nickname: 
--> Siempre se le pide que ingrese user y pass */

function isNickNameNoEncoder(nickName){
	
	if (nickName == null)
	return false;
	
	for (i=0;i<nickName.length;i++){
		char = nickName.substring(i,i + 1);
		if (encodeURIComponent(char) != char)
				return true;
	}
	return false;
}


function getcookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ';', len );
if ( end == -1 ) end = document.cookie.length;
return document.cookie.substring( len, end );
}

function deleteCookie( name, path, domain ) {
if ( getcookie( name ) ) document.cookie = name + '=' +
( ( path ) ? ';path=' + path : '') +
( ( domain ) ? ';domain=' + domain : '' ) +
';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}


//FIN de funciones de logueo de usuario con caracteres raros.


function createDynamicContent(loadImg_url, loadImg_width, loadImg_height, content_url, content_width)
{
	//Si el LOADING esta habilitado lo mostramos
		if(loadingIsEnabled) createLoadingDiv(loadImg_url, loadImg_width, loadImg_height);
	
	//Si el CONTENT esta habilitado lo mostramos
 	if(contentIsEnabled) createContent(content_url, content_width);
}

function createDimmerDiv()
{
	 //Verifico si el browser es IE6 q contiene un bug con los selects, q no respetan los 
	 //z-index y se ven por encima del del gray layout box, por lo tanto un "arreglo" es 
	 //mostrarlos y ocultarlos al hacer desaparecer o aparecer al gray layout box
	 showOrHideAllDropDowns("hidden");	 	
	
// document.onkeydown = processKey;
	
 first=true;

 //Buscamos en el documento el elemento DIMMER
 divDimmer = document.getElementById('dimmer');
			
 //Si el DIMMER no existe lo creamos dinamicamente
 if(divDimmer == null){
   divDimmer = document.createElement("div");
   divDimmer.id = "dimmer";
   divDimmer.className = "dimmer";
   document.getElementsByTagName('body')[0].appendChild(divDimmer);}	

 getTotalWindowWidth();

 //Cubrimos toda la pantalla con el dimmer
 divDimmer.style.width = totalWidth + "px"; 
 divDimmer.style.height = document.body.scrollHeight + 10 + "px";
 
 //Hacemos visible el dimmer en pantalla
 divDimmer.style.display = 'block';
}

function processKey(DnEvents)
{ 
	keyPressed = (netscape) ? DnEvents.which : window.event.keyCode;
    
    if (keyPressed == 27) 
    { 
        //Ejecutar el submit o la llamada a la función que corresponda
	      abortProcess()
    }
}

function processEnter(DnEvents)
{ 
	keyPressed = (netscape) ? DnEvents.which : window.event.keyCode;
    
    if (keyPressed == 13) 
    { 
        //Ejecutar el submit o la llamada a la función que corresponda
	      doSubmitForm();
    }
}

function createLoadingDiv(loadImg_url, loadImg_width, loadImg_height)
{		
		loadingImg = document.getElementById('loadingImg');
		
		if(loadingImg != null)
			document.getElementsByTagName('body')[0].removeChild(loadingImg);
		
		setWindowSize();
		getScrollY();
		
		loadingImg 		  = document.createElement("img");
		loadingImg.id 		  = "loadingImg";
		loadingImg.src 		  = loadImg_url;
		loadingImg.style.width 	  = loadImg_width;
		loadingImg.style.height   = loadImg_height;
		loadingImg.style.top 	  =  scrOfY + (windowHeight / 2) - (loadingImg.height / 2) + "px";
		loadingImg.style.left 	  = (windowWidth / 2) - (loadingImg.width / 2) + "px"; 
		loadingImg.style.position = "absolute";
		loadingImg.style.zIndex 	  = 100000;
		
		loadingImg.onclick = abortProcess;
		
		document.getElementsByTagName('body')[0].appendChild(loadingImg);
		document.onkeydown = processKey;
}

function abortProcess()
{
 document.onkeydown = function(){};
 if(reques)
 {
 	reques.onreadystatechange = function () {};
 	reques.abort();
 }

 hideFloatingLayer();
 cancelLoading = 1;

}


function hideFloatingLayer()
{				
	 if(loadingIsEnabled) {
	  //Buscamos el elemento LOADING
	  loadingImg = document.getElementById('loadingImg');
	 
	  //Si existe lo escondemos
	  if(loadingImg!=null)
	   loadingImg.style.display = 'none';
	 }
					
	 if(contentIsEnabled) {
	  //Buscamos el elemento CONTENT
	  contentIframe = document.getElementById('content');	
					
	  //Si existe lo escondemos
	  if(contentIframe!=null)
	   contentIframe.style.display = 'none';
	 }
	
	 //Buscamos el elemento DIMMER
	 divDimmer = document.getElementById('dimmer');
					
	 //Si existe lo escondemos
	 if(divDimmer!=null)
	   document.getElementsByTagName('body')[0].removeChild(divDimmer);
					
	 //Devolvemos el control al script de visor
	 removeEvent(window, 'resize', readjustContent);

passInput = document.getElementById('as_pass');
	
if(passInput !=null)
{
 removeEvent(passInput , 'keydown', processEnter);
 removeEvent(passInput , 'keydown', enableConfirm);
}

  //removeEvent(window, 'keydown', processKey);	 

  document.onkeydown=keyDown;
	 	 
	 //Verifico si el browser es IE6 q contiene un bug con los selects, q no respetan los 
	 //z-index y se ven por encima del del gray layout box, por lo tanto un "arreglo" es 
	 //mostrarlos y ocultarlos al hacer desaparecer o aparecer al gray layout box
	 showOrHideAllDropDowns("visible");	 	
	 	 
	 //Se quita la funcion asociada a postProcess de manera que si se invoca otro layer no se vuelva a llamar
	 if(postProcess != undefined){ postProcess = undefined;}
	 
	 //Si esta definida una funcion de postClosing la ejecutamos 
	 //IMPORTANTE: (La funcion de postClosing tiene la responsabilidad de desasignar el evento!!!)
	 if(postClosing != undefined){	postClosing();}
}

function createContent(content_url, content_width)
{
	//Buscamos los elementos
	content = document.getElementById('content');
	
	script  = document.getElementById('script');
	
	style   = document.getElementById('style');
	
	if(content!=null){
	
		content.parentNode.removeChild(content);
	
	}
		
	if(script!=null) {
	
	script.parentNode.removeChild(script);
	
	}
		
	if(style!=null){
	
	style.parentNode.removeChild(style);
	
	}
	
	
	content 		= document.createElement("div");
	content.id 		= "content";
	content.className 	= "content";
	content.style.position 	= "absolute";
	content.style.width 	= content_width;
	content.style.margin  = "0px";
  content.style.left    = "0px";
	
	document.getElementsByTagName('body')[0].appendChild(content);
	
	getContent(content_url); 
	
	content.style.display = "block";
}

function readjustContent(){
	
	//Buscamos el elemento CONTENT
	content = document.getElementById('content');
	
	setWindowSize();
	
	if(content!=null) {
		divWidth  = content.offsetWidth;
		divHeight = content.offsetHeight;
		
		getScrollY();
		
		if((((scrOfY + (windowHeight - divHeight ) / 2) + content.offsetHeight)<document.body.scrollHeight))
		{		
			
			if(autocenterIsEnabled) {
				
				if((divHeight < windowHeight)||first==true)
				{
						if(first==true)
							first = false;
						if(divHeight > windowHeight)
							content.style.top = scrOfY + "px";
						else
						content.style.top  = (scrOfY + (windowHeight - divHeight ) / 2) + "px";
				}
				
				if(divWidth > windowWidth)
						content.style.left = "0px";
				else
						content.style.left = ((windowWidth - divWidth) / 2 ) + "px";
				
			}else {
				content.style.top  = scrOfY + "px";
				content.style.left = '0px';
			}
		}
	}
}

function enableClosing()
{
 //Buscamos en el documento el elemento DIMMER
 divDimmer = document.getElementById('dimmer');
 divDimmer.onclick = hideFloatingLayer;
}

function getContent(urlContent){
	url 	= urlContent;
	reques 	= GetXmlHttpRequest(processContentChange);
	
	reques.open("GET", url, true);
	reques.send(null);
}

function processContentChange() {
  if (reques.readyState == 4) {
    if (reques.status == 200) {
    	responseXML = reques.responseXML;
      processContent();
    
    } else {
       // TODO: Loguear y redirigir a vista de error!
    }
  }
}

function processContent() {
  
	if(loadingIsEnabled) {
		loadingImg = document.getElementById('loadingImg');
		loadingImg.style.display="none";
	} 
	
	var xml = responseXML;
	content = document.getElementById('content'); 
	content.innerHTML = xml.getElementsByTagName("content")[0].childNodes[0].nodeValue;
	
	// Agregamos los Scripts
	if(xml.getElementsByTagName("script").length > 0)	{
		var script = document.createElement('script');
		script.id = "script";
		script.text = xml.getElementsByTagName("script")[0].childNodes[0].nodeValue;

   document.getElementsByTagName('body')[0].appendChild(script);		
	}
	
	// Agregamos los Styles
	/*if(xml.getElementsByTagName("style").length > 0)	{


		// FOR IE
		if(document.styleSheets[0].cssText){
			
			document.styleSheets[0].cssText += xml.getElementsByTagName("style")[0].childNodes[0].nodeValue;
		
		} else{
			
			var styles = document.createElement('style');
			styles.setAttribute('type', 'text/css');
			styles.setAttribute('id','style');
	
			var newStyle = document.createTextNode(xml.getElementsByTagName("style")[0].childNodes[0].nodeValue);  	
	    
			styles.appendChild(newStyle);
		    
			var headRef = document.getElementsByTagName('head')[0];
	    
	    headRef.appendChild(styles); 
  	}		

	}*/
		
	content.style.display = "block";
	readjustContent();
	content.style.position="absolute";
	
	enableClosing();


        if(document.getElementById('as_pass')!=null)
{
 //addEvent(document.getElementById('as_pass'), 'keydown', processEnter);
 addEvent(document.getElementById('as_pass'), 'keydown', enableConfirm);
}
       
	if(postProcess != undefined){	postProcess();}
}

function getScrollY() {
	functionSelector('scrOfY = window.pageYOffset',
  								 'scrOfY = document.documentElement.scrollTop',
  								 'scrOfY = document.body.scrollTop');
}

function setWindowSize() 
{
	functionSelector('windowHeight = window.innerHeight;windowWidth  = window.innerWidth',
  								 'windowHeight = document.documentElement.clientHeight;windowWidth = document.documentElement.clientWidth',
  								 'windowHeight = document.body.clientHeight;windowWidth = document.body.clientWidth');
}

function getTotalWindowWidth() 
{
  functionSelector(' totalWidth  = screen.width - getHScrollBarWidth()', 
  								 'totalWidth  = screen.width - 21',
  								 'totalWidth  = screen.width - 21');
}

function getHScrollBarWidth()
{
	var div = document.createElement("div");
	var innerDiv = document.createElement("div");
	
	div.style.width="50px";
	div.style.height="50px";
	div.style.overflow="hidden";
	div.style.position="absolute";
	div.style.top="-200px";
	div.style.left="0px";
	
	innerDiv.style.height="100px"; 
	
	div.appendChild(innerDiv);
	document.getElementsByTagName('body')[0].appendChild(div);
	
	var w1 = innerDiv.clientWidth;
	
	div.style.overflow="scroll";
	
	var w2 = innerDiv.clientWidth;
	
	document.getElementsByTagName('body')[0].removeChild(div);	
	
	return (w1 - w2);
}

/* Ejemplo: --> functionSelector('alert("NonIE")','alert("IE6")', 'alert("IE4")'); */

function functionSelector(f_if_NonIE, f_if_IE6, f_if_IE4)
{
  if( typeof( window.innerWidth ) == 'number' ) {
    //Execute if Non-IE (Netscape Compliant)
    return(eval(f_if_NonIE));
    
  } else if( document.documentElement && document.documentElement.clientWidth) {
    //Execute if IE 6+ in 'standards compliant mode'
    return(eval(f_if_IE6));
    
  } else if( document.body && document.body.clientWidth) {
    //Execute if IE 4 compatible (DOM Compliant)
    return(eval(f_if_IE4));
  }
}


function logout()
{
	reques 	= GetXmlHttpRequest(logoutChange);
	
	ofertarUrl 	= getCurrentUrlBase() + '/jm/ConfirmBid?axn=logout&random='+Math.random();
	
	reques.open("GET", ofertarUrl, true);
	
	reques.send(null);
}

function logoutChange() {
  if (reques.readyState == 4) {
    if (reques.status == 200) {
		hideFloatingLayer();
		if (myQuotas=="" || myMethod==""){
			showLayer();
		}else{
			confirmBidWithQuotas();
		}
    } else {
       // TODO: Loguear y redirigir a vista de error!
    }
  }
}



function showOrHideAllDropDowns(newState) {
   var isIE6 = ((navigator.appName == "Internet Explorer") || (navigator.appVersion.indexOf("MSIE") !=-1))	 
							 && (parseInt(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE") + 5)) == 6) // test for IE6
	 
	 if (isIE6) {	 	
	    var elements = document.documentElement.getElementsByTagName('select');
	
	    for (var i=0; i<elements.length; i++) {
	       elements[i].style.visibility = newState;
	    }
   }
}

function refreshQuestOnQuest() {
   var html = document.location.href +'&goToQuestOn=Y';
   document.location.href = html;    
}
/*-------- IMPORT FROM ( Name [ RP2_PROFILE_LAYER ], Type [ H ], Class [ WebComponetVo ] ) --------*/
// Flag para el uso de buttonLayer
var buttonStart = false;

/*
* Habilita la ejecución del layer de las otorgadas.
*/
function initProfile(){
buttonStart = true;
}

YAHOO.util.Event.onDOMReady(initProfile);

/**
 * Muestra el layer con la información de la calificación otorgada.
 */

function showGivenLayer(custTo,custFrom,siteID,itemID)

{
	if(!buttonStart)
		return ;

	var given_src = getCurrentUrlBase() +  '/jm/profile?act=getSendLayer&itemID='+itemID+'&custTo='+custTo+'&custFrom='+custFrom+'&siteID='+siteID ;

  
	addEvent(window, 'resize', readjustContent);
	addEvent(window, 'scroll', readjustContent);

	//Creamos el DIMMER
	createDimmerDiv();

	//Creamos el contenido
	//si quieren modificar el ancho del form modificar esto cnt_width
	createDynamicContent(img_src, loading_width, loading_height, given_src, 400+ 'px');


	return ;

}

/* XML Http Request */



function GetXmlHttpRequest (handler, isDebugEnabled) 

{

	var req=false;

	

	//para MZ

	if(window.XMLHttpRequest)	{

		try {

			req = new XMLHttpRequest();

		}catch(e){

			req = false;

			if (debugEnabled)

				debug(e);

		}

	} 

	

	// para IE

	else if(window.ActiveXObject) {

		try {

			req = new ActiveXObject("Msxml2.XMLHTTP");

		}catch(e) {

			try{

				req = new ActiveXObject("Microsoft.XMLHTTP");

			}catch(e) {

				req = false;

				if (debugEnabled)

					debug(e);

			}

		}

	}

	

	if(req) {

		req.onreadystatechange = handler;

	}



	return req;

}
/*-------- IMPORT FROM ( Name [ RP2_PROFILE_JS ], Type [ H ], Class [ WebComponetVo ] ) --------*/
function searchByNick(){
SetScrollPosition();
document.filtros.submit();
}

function setTipo(tipoCalif){

document.filtros.tipo.value = tipoCalif;
searchByNick();
}
document.onclick = hideHelp;
		
		var helpPop;
		var baseT;
		var baseL;
		var popY;
		var popX;
		var hideFlag = false;
		
		function asd(){
		                alert(helpPop.style.getAttribute('top'));
		                alert(helpPop.style.getAttribute('left'));
		}
		
		function showHelp(pop_id,clickevent) {
		
			hideHelp();
		
			if (document.all) { // MSIE
				var iebody=(document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body;
				popX = clickevent.clientX;
				popY = clickevent.clientY;
				baseT = iebody.scrollTop;
				baseL = iebody.scrollLeft;
                                popX += baseL;
                                popY +=baseT;
			} else { // Netscape, etc.
				popX = clickevent.clientX;
				popY = clickevent.clientY;
				baseT = window.pageYOffset
				baseL = window.pageXOffset
                                popX += baseL;
                                popY +=baseT;
			}
		
			popY -= -26;
			popX -= 140;
		 
			helpPop = document.getElementById(pop_id);
		
		
			if( helpPop.style.setAttribute ){ //IE
				helpPop.style.setAttribute('display', 'block');
				helpPop.style.setAttribute('visibility','visible');
				helpPop.style.setAttribute('top',parseInt(popY)+'px');
			helpPop.style.setAttribute('left',parseInt(popX)+'px');
		        helpPop.style.setAttribute('z-index','3');
			}else{
				helpPop.setAttribute('style',"display:block;visibility:visible;top:"+parseInt(popY)+"px;left:"+parseInt(popX)+"px;position:absolute");

			}
			hideFlag=false;
		}
		
		var intervalID;
		function delayHide( millis ){
			if (millis == null) millis = 1000;
			deleteDelayHide();
			intervalID = setInterval('hideHelp();', millis);
		}
		
		function deleteDelayHide(){
			window.clearInterval( intervalID );
		}
		
		function hideHelp(){
			if(hideFlag){
				if(helpPop!=null){
					if( helpPop.style.setAttribute ){ //IE
						helpPop.style.setAttribute('display', 'none');
						helpPop.style.setAttribute('visibility','hidden');
					}else{
						helpPop.setAttribute('style',"display:none;visibility:hidden;");
					}
					helpPop = null;
				}
			}else{
				hideFlag=true;
			}
		}
		
		function realignOpenGlobito(){
			if(helpPop!=null){
				var offsetT;
				var offsetL;
				if (document.all) { // MSIE
					offsetT = document.body.scrollTop;
					offsetL = document.body.scrollLeft;
				} else { // Netscape, etc.
					offsetT = window.pageYOffset
					offsetL = window.pageXOffset
				}
				var diffT = baseT-offsetT;
				var diffL = baseL-offsetL;
				
				if( helpPop.style.setAttribute ){ //IE
					helpPop.style.setAttribute('top',parseInt(diffT+popY));
					helpPop.style.setAttribute('left',parseInt(diffL+popX));
				}else{
					helpPop.setAttribute('style',"top:"+parseInt(diffT+popY)+"px;left:"+parseInt(diffL+popX)+"px;position:fixed");
				}
			}
		}
	
/*-------- IMPORT FROM ( Name [ RP2_SEARCH_JS ], Type [ H ], Class [ WebComponetVo ] ) --------*/
function setCookie(cookieName,cookieValue,nDays) {

	setCookie(cookieName,cookieValue,nDays, null);

}

function setCookie(cookieName,cookieValue,nDays,path) {

	var subdomain = getSubdomain();

	if (path == null)

		path ="/";

	if(nDays!=null){

		today  = new Date();

		expire = new Date();

		if (nDays==null || nDays==0) 

			nDays=1;

		expire.setTime(today.getTime() + 3600000*24*nDays);								

		document.cookie = cookieName+"="+cookieValue+";path="+path + ";domain=."+ subdomain +  ";expires="+expire.toGMTString();

	}

	else

		document.cookie = cookieName+"="+cookieValue+";path="+path+";domain=."+ subdomain;		

}
function getSubdomain(){		

	var dom = ""+window.location.host;

	var pos = dom.indexOf("mercadoli");

	if(pos == -1)

		pos = dom.indexOf("deremate");

	if(pos == -1)

		pos = dom.indexOf("arremate");

	if (pos != -1)	

		dom = dom.substring(pos);		

	return dom;

}
function getChr(value) {

	var vHexCode = "0123456789ABCDEF"

	var hex = "" + vHexCode.charAt((value - (value % 16))/16) + vHexCode.charAt(value % 16)

	return unescape("%"+hex)

}
function encodeNatural(toEncode) {
	toEncode= toEncode.replace(/\+/g, getChr(254));
	toEncode= toEncode.replace(/-/g, getChr(216));
	toEncode= toEncode.replace(/\s/g, '-');
	toEncode= toEncode.replace(/\t/g, '-');
	toEncode= toEncode.replace(/_/g, '*');
	return encodeURIComponent(toEncode);
}
function innerSearch(){

 var urlToRedirect;

	var word = document.getElementById("as_inner_word").value;

 setCookie("ml_list","searching");
   
	setCookie('LAST_SEARCH', word, null);

 urlToRedirect = listUrl + "/" + encodeNatural(word);

	if(getCookieValue('pr_categ') == 'AD') {

		urlToRedirect = urlToRedirect+ "_PrCategId_AD";

	}

 document.location.href = urlToRedirect;

}

function setFocus(){
	wordFocus = true;
}

function setBlur(){
	wordFocus = false;
}

var wordFocus = false;

document.onkeydown = keyDown;

function keyDown(DnEvents) {

    k = (netscape) ? DnEvents.which : window.event.keyCode;

    if (k == 13 && wordFocus==true) {

	 innerSearch();

	return false;

     }else{

	return true;

    }

}

function logoutTargetUrl() {
 window.location=urlBaseSiteRP2+'/jm/logout';
}

                               
function setLog(){

   ck = getCookieValue("orguserid"); 

      if (ck!=null && ck.length >= 4 ) {       
          document.write("<div class=\"lnk_menu_der\"><a target=\"_top\" href=\"javascript:logoutTargetUrl();\" class=\"hpcateg\" id=\"MENU:SALIR\">Salir</a></div>");

      }  
}
/*-------- IMPORT FROM ( Name [ RP2_BACK_TO_VIP_JS ], Type [ H ], Class [ WebComponetVo ] ) --------*/
var subdomains=new Array("articulo","produto")

 

// Devuelve false y envia al browser al back si hay history

 

function vipBack(e) {

            //tengo historial

            if(history.length > 1){

                        //detengo el browser

                        if (document.all != undefined){

                                   document.execCommand('Stop');

                        }

                        else{

                                   window.stop();

                        }

 

                        // envio al back

                        history.back();

                        return false;

                        }

            else{

                        return true;

            }

}

 

// Inicializa el boton de volver al lisado

 

function initVIPButton() {

 

            // Remuevo el http://

            var myReferrer = document.referrer;

            var oListButton = document.getElementById("vipButton");

 

            if(isVip(myReferrer)){

                                   var a = document.createElement('a');

                                   a.appendChild(document.createTextNode('Volver a la publicación'));

                                   a.onclick = vipBack;

 

                                   if(!(document.referrer == "")){

                                                           a.href = document.referrer;

 

                                   }

         oListButton.appendChild(a);

            }

 

}

 

 

// valida si el referar es de VIP

 

function isVip(myReferrer) {

 

            if(myReferrer.indexOf("http://") == 0 ){

 

                        // Remuevo el http://

                        var myReferrerTemp = myReferrer.substring(7);

                        for (i=0;i<subdomains.length;i++){

                                   if (myReferrerTemp.indexOf(subdomains[i]) == 0 )

                                                           return true;

                        }

            }

            return false;

}
/*-------- IMPORT FROM ( Name [ RP2_SMART_NAV_JS ], Type [ H ], Class [ WebComponetVo ] ) --------*/
window.onload = function()
    {
        var strCook = document.cookie; 
        if(strCook.indexOf("!~~")!=-1)
        { 
            var intS = strCook.indexOf("!~~"); 
            var intE = strCook.indexOf("~~!"); 
            var strPos = strCook.substring(intS+3,intE); 
            
			//seteo la posición que estaba antes de recargar la página.
			document.body.scrollTop = strPos; 
			
			//hago expirar la cookie.
			today  = new Date();
			expire = new Date();
			expire.setTime(today.getTime() + 3600000*24*(-10));
			document.cookie = "yPos=!~~0~~!;expires="+expire.toGMTString(); 
        } 
    }
    // Guarda en una cookie el valor del desplazamiento en Y antes de recargar. 

    function SetScrollPosition()
    { 
        var intY = document.body.scrollTop; 
        document.cookie = "yPos=!~~" + intY + "~~!"; 
    }
/* --------- Gen:8 --------- */

