﻿/* from: http://myradio.batanga.com/include/MyRadio.js 20/11/2009 07:40:08 p.m. */
// JScript File

function setLinkCookie(linkID) 
{
  if (getCookie("auxiliary")==null || getCookie("auxiliary")=="") 
  {
    document.cookie = "auxiliary=" + escape(linkID) + ";path=/;domain=batanga.com";
  }
  
  return true;
 }
 
function resetLinkCookie() 
{
   document.cookie = "auxiliary=;path=/;domain=batanga.com;expires=Thu, 01-Jan-1970 00:00:01 GMT";
   return true;
 }
  
function addFavorites() {
	var title = "Batanga: Videos y Radio";
	var url = "http://www.batanga.com";  
	if (window.sidebar) { // Mozilla Firefox Bookmark		
		window.sidebar.addPanel(title, url,"");	
	} else if( window.external ) { // IE Favorite		
		window.external.AddFavorite( url, title); 
	}	else if(window.opera && window.print) { // Opera Hotlist		
		return true; 
	} 
}

function OpenMyRadioURL(URL)
{
 window.open(URL,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');        
}

function OpenMyRadio(PlaylistID)
{
    OpenMyRadioURL('./Player/player.aspx?PlaylistID='+PlaylistID);
}


function ShowDetailError(spanID)
{

    var spanTag  = document.getElementById(spanID);

    if(spanTag.style.display == "")
        spanTag.style.display = "none";
    else
        spanTag.style.display = "";
}


function OpenPlaylistBrowser(PlaylistID)
{    
	window.open('http://music.batanga.com/' +  languageId +  '/MyRadio/PlaylistEditor/GeneratePlayList.asp?PlaylistID='+PlaylistID,'BrowserMain','width=1000,height=700');
}
function OpenHelp()
{   
	window.open('http://myradio.batanga.com/Help.html');
}


function AskBeforeDelete(PlaylistID)
{
    if (confirm('Are you sure you want to delete this radio station?'))
    {        
        document.getElementById("ctl00_theContent_delete1").value = PlaylistID;
        return true;         
       
    } 
    else 
    {    
        document.getElementById("ctl00_theContent_delete1").value =  -1;
        return false; 	        
	}
}

/*function setCookieD(cookieName,cookieValue,nDays,Domain) 
{
    var today = new Date();
    var expire = new Date();
    if (nDays == null || nDays == 0) 
        nDays=1;
        
    expire.setTime(today.getTime() + 3600000*24*nDays);
    var theCookie = cookieName + "=" + escape(cookieValue) + ";expires=" + expire.toGMTString() + ";path=/;domain=" + Domain + ";";
    document.cookie = theCookie;
    //window.alert('setting cookie:\n' + theCookie);
}
*/
/*
function changeLanguage(newLanguage)
{   
	if (newLanguage =="EN" || newLanguage == "en" )
		myLanguage = "EN";
	else // default is Español
		myLanguage = "ES";
			
	setCookieD("idioma",myLanguage,10,"batanga.com");
	document.location.reload();
    //document.location.href = document.location.href;
}
*/

function logoutClubSubscriber()
{
    setCookieD("LoggedInClub","0",-1,"batanga.com");
    document.location.reload();
    //document.location.href = document.location.href;
}

// Returns a cookie value, given the name of the cookie:
function getCookie(Name) 
{
    var search = Name + "=" ;
	document.cookie.setDomain="batanga.com"
	//HttpCookie languageCookie = HttpContext.Current.Request.Cookies[Name];
	if (document.cookie.length > 0) 
	{ // if there are any cookies
		offset = document.cookie.indexOf(search)
		if (offset != -1 && offset != null) { // if cookie exists
			offset += search.length;
			// set index of beginning of value
			end = document.cookie.indexOf(";", offset);
			// set index of end of cookie value
			if (end == -1)
				end = document.cookie.length;
			return unescape(document.cookie.substring(offset, end));
		}
		
	}
	else
	{
		return null;
	}
}


//read idioma cookie to set language
var languageId =getCookie("idioma");
var idioma;
if (languageId !=null) {
    if (languageId.toUpperCase()=="EN") {
         languageId="en";
         idioma="EN";
    }  else {
        languageId="sp";
        idioma="ES";
    } 
} else {
    idioma="ES";
    languageId="sp";
} 
/* from: http://www.batanga.com/scripts/jquery/jquery.min.js 20/11/2009 07:40:08 p.m. */
/*
 * jQuery JavaScript Library v1.3
 * http://jquery.com/
 *
 * Copyright (c) 2009 John Resig
 * Dual licensed under the MIT and GPL licenses.
 * http://docs.jquery.com/License
 *
 * Date: 2009-01-13 12:50:31 -0500 (Tue, 13 Jan 2009)
 * Revision: 6104
 */
(function(){var l=this,g,x=l.jQuery,o=l.$,n=l.jQuery=l.$=function(D,E){return new n.fn.init(D,E)},C=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,f=/^.[^:#\[\.,]*$/;n.fn=n.prototype={init:function(D,G){D=D||document;if(D.nodeType){this[0]=D;this.length=1;this.context=D;return this}if(typeof D==="string"){var F=C.exec(D);if(F&&(F[1]||!G)){if(F[1]){D=n.clean([F[1]],G)}else{var H=document.getElementById(F[3]);if(H){if(H.id!=F[3]){return n().find(D)}var E=n(H);E.context=document;E.selector=D;return E}D=[]}}else{return n(G).find(D)}}else{if(n.isFunction(D)){return n(document).ready(D)}}if(D.selector&&D.context){this.selector=D.selector;this.context=D.context}return this.setArray(n.makeArray(D))},selector:"",jquery:"1.3",size:function(){return this.length},get:function(D){return D===g?n.makeArray(this):this[D]},pushStack:function(E,G,D){var F=n(E);F.prevObject=this;F.context=this.context;if(G==="find"){F.selector=this.selector+(this.selector?" ":"")+D}else{if(G){F.selector=this.selector+"."+G+"("+D+")"}}return F},setArray:function(D){this.length=0;Array.prototype.push.apply(this,D);return this},each:function(E,D){return n.each(this,E,D)},index:function(D){return n.inArray(D&&D.jquery?D[0]:D,this)},attr:function(E,G,F){var D=E;if(typeof E==="string"){if(G===g){return this[0]&&n[F||"attr"](this[0],E)}else{D={};D[E]=G}}return this.each(function(H){for(E in D){n.attr(F?this.style:this,E,n.prop(this,D[E],F,H,E))}})},css:function(D,E){if((D=="width"||D=="height")&&parseFloat(E)<0){E=g}return this.attr(D,E,"curCSS")},text:function(E){if(typeof E!=="object"&&E!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(E))}var D="";n.each(E||this,function(){n.each(this.childNodes,function(){if(this.nodeType!=8){D+=this.nodeType!=1?this.nodeValue:n.fn.text([this])}})});return D},wrapAll:function(D){if(this[0]){var E=n(D,this[0].ownerDocument).clone();if(this[0].parentNode){E.insertBefore(this[0])}E.map(function(){var F=this;while(F.firstChild){F=F.firstChild}return F}).append(this)}return this},wrapInner:function(D){return this.each(function(){n(this).contents().wrapAll(D)})},wrap:function(D){return this.each(function(){n(this).wrapAll(D)})},append:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.appendChild(D)}})},prepend:function(){return this.domManip(arguments,true,function(D){if(this.nodeType==1){this.insertBefore(D,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this)})},after:function(){return this.domManip(arguments,false,function(D){this.parentNode.insertBefore(D,this.nextSibling)})},end:function(){return this.prevObject||n([])},push:[].push,find:function(D){if(this.length===1&&!/,/.test(D)){var F=this.pushStack([],"find",D);F.length=0;n.find(D,this[0],F);return F}else{var E=n.map(this,function(G){return n.find(D,G)});return this.pushStack(/[^+>] [^+>]/.test(D)?n.unique(E):E,"find",D)}},clone:function(E){var D=this.map(function(){if(!n.support.noCloneEvent&&!n.isXMLDoc(this)){var H=this.cloneNode(true),G=document.createElement("div");G.appendChild(H);return n.clean([G.innerHTML])[0]}else{return this.cloneNode(true)}});var F=D.find("*").andSelf().each(function(){if(this[h]!==g){this[h]=null}});if(E===true){this.find("*").andSelf().each(function(H){if(this.nodeType==3){return}var G=n.data(this,"events");for(var J in G){for(var I in G[J]){n.event.add(F[H],J,G[J][I],G[J][I].data)}}})}return D},filter:function(D){return this.pushStack(n.isFunction(D)&&n.grep(this,function(F,E){return D.call(F,E)})||n.multiFilter(D,n.grep(this,function(E){return E.nodeType===1})),"filter",D)},closest:function(D){var E=n.expr.match.POS.test(D)?n(D):null;return this.map(function(){var F=this;while(F&&F.ownerDocument){if(E?E.index(F)>-1:n(F).is(D)){return F}F=F.parentNode}})},not:function(D){if(typeof D==="string"){if(f.test(D)){return this.pushStack(n.multiFilter(D,this,true),"not",D)}else{D=n.multiFilter(D,this)}}var E=D.length&&D[D.length-1]!==g&&!D.nodeType;return this.filter(function(){return E?n.inArray(this,D)<0:this!=D})},add:function(D){return this.pushStack(n.unique(n.merge(this.get(),typeof D==="string"?n(D):n.makeArray(D))))},is:function(D){return !!D&&n.multiFilter(D,this).length>0},hasClass:function(D){return !!D&&this.is("."+D)},val:function(J){if(J===g){var D=this[0];if(D){if(n.nodeName(D,"option")){return(D.attributes.value||{}).specified?D.value:D.text}if(n.nodeName(D,"select")){var H=D.selectedIndex,K=[],L=D.options,G=D.type=="select-one";if(H<0){return null}for(var E=G?H:0,I=G?H+1:L.length;E<I;E++){var F=L[E];if(F.selected){J=n(F).val();if(G){return J}K.push(J)}}return K}return(D.value||"").replace(/\r/g,"")}return g}if(typeof J==="number"){J+=""}return this.each(function(){if(this.nodeType!=1){return}if(n.isArray(J)&&/radio|checkbox/.test(this.type)){this.checked=(n.inArray(this.value,J)>=0||n.inArray(this.name,J)>=0)}else{if(n.nodeName(this,"select")){var M=n.makeArray(J);n("option",this).each(function(){this.selected=(n.inArray(this.value,M)>=0||n.inArray(this.text,M)>=0)});if(!M.length){this.selectedIndex=-1}}else{this.value=J}}})},html:function(D){return D===g?(this[0]?this[0].innerHTML:null):this.empty().append(D)},replaceWith:function(D){return this.after(D).remove()},eq:function(D){return this.slice(D,+D+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(D){return this.pushStack(n.map(this,function(F,E){return D.call(F,E,F)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(J,M,L){if(this[0]){var I=(this[0].ownerDocument||this[0]).createDocumentFragment(),F=n.clean(J,(this[0].ownerDocument||this[0]),I),H=I.firstChild,D=this.length>1?I.cloneNode(true):I;if(H){for(var G=0,E=this.length;G<E;G++){L.call(K(this[G],H),G>0?D.cloneNode(true):I)}}if(F){n.each(F,y)}}return this;function K(N,O){return M&&n.nodeName(N,"table")&&n.nodeName(O,"tr")?(N.getElementsByTagName("tbody")[0]||N.appendChild(N.ownerDocument.createElement("tbody"))):N}}};n.fn.init.prototype=n.fn;function y(D,E){if(E.src){n.ajax({url:E.src,async:false,dataType:"script"})}else{n.globalEval(E.text||E.textContent||E.innerHTML||"")}if(E.parentNode){E.parentNode.removeChild(E)}}function e(){return +new Date}n.extend=n.fn.extend=function(){var I=arguments[0]||{},G=1,H=arguments.length,D=false,F;if(typeof I==="boolean"){D=I;I=arguments[1]||{};G=2}if(typeof I!=="object"&&!n.isFunction(I)){I={}}if(H==G){I=this;--G}for(;G<H;G++){if((F=arguments[G])!=null){for(var E in F){var J=I[E],K=F[E];if(I===K){continue}if(D&&K&&typeof K==="object"&&!K.nodeType){I[E]=n.extend(D,J||(K.length!=null?[]:{}),K)}else{if(K!==g){I[E]=K}}}}}return I};var b=/z-?index|font-?weight|opacity|zoom|line-?height/i,p=document.defaultView||{},r=Object.prototype.toString;n.extend({noConflict:function(D){l.$=o;if(D){l.jQuery=x}return n},isFunction:function(D){return r.call(D)==="[object Function]"},isArray:function(D){return r.call(D)==="[object Array]"},isXMLDoc:function(D){return D.documentElement&&!D.body||D.tagName&&D.ownerDocument&&!D.ownerDocument.body},globalEval:function(F){F=n.trim(F);if(F){var E=document.getElementsByTagName("head")[0]||document.documentElement,D=document.createElement("script");D.type="text/javascript";if(n.support.scriptEval){D.appendChild(document.createTextNode(F))}else{D.text=F}E.insertBefore(D,E.firstChild);E.removeChild(D)}},nodeName:function(E,D){return E.nodeName&&E.nodeName.toUpperCase()==D.toUpperCase()},each:function(F,J,E){var D,G=0,H=F.length;if(E){if(H===g){for(D in F){if(J.apply(F[D],E)===false){break}}}else{for(;G<H;){if(J.apply(F[G++],E)===false){break}}}}else{if(H===g){for(D in F){if(J.call(F[D],D,F[D])===false){break}}}else{for(var I=F[0];G<H&&J.call(I,G,I)!==false;I=F[++G]){}}}return F},prop:function(G,H,F,E,D){if(n.isFunction(H)){H=H.call(G,E)}return typeof H==="number"&&F=="curCSS"&&!b.test(D)?H+"px":H},className:{add:function(D,E){n.each((E||"").split(/\s+/),function(F,G){if(D.nodeType==1&&!n.className.has(D.className,G)){D.className+=(D.className?" ":"")+G}})},remove:function(D,E){if(D.nodeType==1){D.className=E!==g?n.grep(D.className.split(/\s+/),function(F){return !n.className.has(E,F)}).join(" "):""}},has:function(E,D){return n.inArray(D,(E.className||E).toString().split(/\s+/))>-1}},swap:function(G,F,H){var D={};for(var E in F){D[E]=G.style[E];G.style[E]=F[E]}H.call(G);for(var E in F){G.style[E]=D[E]}},css:function(F,D,H){if(D=="width"||D=="height"){var J,E={position:"absolute",visibility:"hidden",display:"block"},I=D=="width"?["Left","Right"]:["Top","Bottom"];function G(){J=D=="width"?F.offsetWidth:F.offsetHeight;var L=0,K=0;n.each(I,function(){L+=parseFloat(n.curCSS(F,"padding"+this,true))||0;K+=parseFloat(n.curCSS(F,"border"+this+"Width",true))||0});J-=Math.round(L+K)}if(n(F).is(":visible")){G()}else{n.swap(F,E,G)}return Math.max(0,J)}return n.curCSS(F,D,H)},curCSS:function(H,E,F){var K,D=H.style;if(E=="opacity"&&!n.support.opacity){K=n.attr(D,"opacity");return K==""?"1":K}if(E.match(/float/i)){E=v}if(!F&&D&&D[E]){K=D[E]}else{if(p.getComputedStyle){if(E.match(/float/i)){E="float"}E=E.replace(/([A-Z])/g,"-$1").toLowerCase();var L=p.getComputedStyle(H,null);if(L){K=L.getPropertyValue(E)}if(E=="opacity"&&K==""){K="1"}}else{if(H.currentStyle){var I=E.replace(/\-(\w)/g,function(M,N){return N.toUpperCase()});K=H.currentStyle[E]||H.currentStyle[I];if(!/^\d+(px)?$/i.test(K)&&/^\d/.test(K)){var G=D.left,J=H.runtimeStyle.left;H.runtimeStyle.left=H.currentStyle.left;D.left=K||0;K=D.pixelLeft+"px";D.left=G;H.runtimeStyle.left=J}}}}return K},clean:function(E,J,H){J=J||document;if(typeof J.createElement==="undefined"){J=J.ownerDocument||J[0]&&J[0].ownerDocument||document}if(!H&&E.length===1&&typeof E[0]==="string"){var G=/^<(\w+)\s*\/?>$/.exec(E[0]);if(G){return[J.createElement(G[1])]}}var F=[],D=[],K=J.createElement("div");n.each(E,function(O,Q){if(typeof Q==="number"){Q+=""}if(!Q){return}if(typeof Q==="string"){Q=Q.replace(/(<(\w+)[^>]*?)\/>/g,function(S,T,R){return R.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?S:T+"></"+R+">"});var N=n.trim(Q).toLowerCase();var P=!N.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!N.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||N.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!N.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!N.indexOf("<td")||!N.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!N.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!n.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];K.innerHTML=P[1]+Q+P[2];while(P[0]--){K=K.lastChild}if(!n.support.tbody){var M=!N.indexOf("<table")&&N.indexOf("<tbody")<0?K.firstChild&&K.firstChild.childNodes:P[1]=="<table>"&&N.indexOf("<tbody")<0?K.childNodes:[];for(var L=M.length-1;L>=0;--L){if(n.nodeName(M[L],"tbody")&&!M[L].childNodes.length){M[L].parentNode.removeChild(M[L])}}}if(!n.support.leadingWhitespace&&/^\s/.test(Q)){K.insertBefore(J.createTextNode(Q.match(/^\s*/)[0]),K.firstChild)}Q=n.makeArray(K.childNodes)}if(Q.nodeType){F.push(Q)}else{F=n.merge(F,Q)}});if(H){for(var I=0;F[I];I++){if(n.nodeName(F[I],"script")&&(!F[I].type||F[I].type.toLowerCase()==="text/javascript")){D.push(F[I].parentNode?F[I].parentNode.removeChild(F[I]):F[I])}else{if(F[I].nodeType===1){F.splice.apply(F,[I+1,0].concat(n.makeArray(F[I].getElementsByTagName("script"))))}H.appendChild(F[I])}}return D}return F},attr:function(I,F,J){if(!I||I.nodeType==3||I.nodeType==8){return g}var G=!n.isXMLDoc(I),K=J!==g;F=G&&n.props[F]||F;if(I.tagName){var E=/href|src|style/.test(F);if(F=="selected"&&I.parentNode){I.parentNode.selectedIndex}if(F in I&&G&&!E){if(K){if(F=="type"&&n.nodeName(I,"input")&&I.parentNode){throw"type property can't be changed"}I[F]=J}if(n.nodeName(I,"form")&&I.getAttributeNode(F)){return I.getAttributeNode(F).nodeValue}if(F=="tabIndex"){var H=I.getAttributeNode("tabIndex");return H&&H.specified?H.value:I.nodeName.match(/^(a|area|button|input|object|select|textarea)$/i)?0:g}return I[F]}if(!n.support.style&&G&&F=="style"){return n.attr(I.style,"cssText",J)}if(K){I.setAttribute(F,""+J)}var D=!n.support.hrefNormalized&&G&&E?I.getAttribute(F,2):I.getAttribute(F);return D===null?g:D}if(!n.support.opacity&&F=="opacity"){if(K){I.zoom=1;I.filter=(I.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(J)+""=="NaN"?"":"alpha(opacity="+J*100+")")}return I.filter&&I.filter.indexOf("opacity=")>=0?(parseFloat(I.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}F=F.replace(/-([a-z])/ig,function(L,M){return M.toUpperCase()});if(K){I[F]=J}return I[F]},trim:function(D){return(D||"").replace(/^\s+|\s+$/g,"")},makeArray:function(F){var D=[];if(F!=null){var E=F.length;if(E==null||typeof F==="string"||n.isFunction(F)||F.setInterval){D[0]=F}else{while(E){D[--E]=F[E]}}}return D},inArray:function(F,G){for(var D=0,E=G.length;D<E;D++){if(G[D]===F){return D}}return -1},merge:function(G,D){var E=0,F,H=G.length;if(!n.support.getAll){while((F=D[E++])!=null){if(F.nodeType!=8){G[H++]=F}}}else{while((F=D[E++])!=null){G[H++]=F}}return G},unique:function(J){var E=[],D={};try{for(var F=0,G=J.length;F<G;F++){var I=n.data(J[F]);if(!D[I]){D[I]=true;E.push(J[F])}}}catch(H){E=J}return E},grep:function(E,I,D){var F=[];for(var G=0,H=E.length;G<H;G++){if(!D!=!I(E[G],G)){F.push(E[G])}}return F},map:function(D,I){var E=[];for(var F=0,G=D.length;F<G;F++){var H=I(D[F],F);if(H!=null){E[E.length]=H}}return E.concat.apply([],E)}});var B=navigator.userAgent.toLowerCase();n.browser={version:(B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(B),opera:/opera/.test(B),msie:/msie/.test(B)&&!/opera/.test(B),mozilla:/mozilla/.test(B)&&!/(compatible|webkit)/.test(B)};n.each({parent:function(D){return D.parentNode},parents:function(D){return n.dir(D,"parentNode")},next:function(D){return n.nth(D,2,"nextSibling")},prev:function(D){return n.nth(D,2,"previousSibling")},nextAll:function(D){return n.dir(D,"nextSibling")},prevAll:function(D){return n.dir(D,"previousSibling")},siblings:function(D){return n.sibling(D.parentNode.firstChild,D)},children:function(D){return n.sibling(D.firstChild)},contents:function(D){return n.nodeName(D,"iframe")?D.contentDocument||D.contentWindow.document:n.makeArray(D.childNodes)}},function(D,E){n.fn[D]=function(F){var G=n.map(this,E);if(F&&typeof F=="string"){G=n.multiFilter(F,G)}return this.pushStack(n.unique(G),D,F)}});n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(D,E){n.fn[D]=function(){var F=arguments;return this.each(function(){for(var G=0,H=F.length;G<H;G++){n(F[G])[E](this)}})}});n.each({removeAttr:function(D){n.attr(this,D,"");if(this.nodeType==1){this.removeAttribute(D)}},addClass:function(D){n.className.add(this,D)},removeClass:function(D){n.className.remove(this,D)},toggleClass:function(E,D){if(typeof D!=="boolean"){D=!n.className.has(this,E)}n.className[D?"add":"remove"](this,E)},remove:function(D){if(!D||n.filter(D,[this]).length){n("*",this).add([this]).each(function(){n.event.remove(this);n.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){n(">*",this).remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(D,E){n.fn[D]=function(){return this.each(E,arguments)}});function j(D,E){return D[0]&&parseInt(n.curCSS(D[0],E,true),10)||0}var h="jQuery"+e(),u=0,z={};n.extend({cache:{},data:function(E,D,F){E=E==l?z:E;var G=E[h];if(!G){G=E[h]=++u}if(D&&!n.cache[G]){n.cache[G]={}}if(F!==g){n.cache[G][D]=F}return D?n.cache[G][D]:G},removeData:function(E,D){E=E==l?z:E;var G=E[h];if(D){if(n.cache[G]){delete n.cache[G][D];D="";for(D in n.cache[G]){break}if(!D){n.removeData(E)}}}else{try{delete E[h]}catch(F){if(E.removeAttribute){E.removeAttribute(h)}}delete n.cache[G]}},queue:function(E,D,G){if(E){D=(D||"fx")+"queue";var F=n.data(E,D);if(!F||n.isArray(G)){F=n.data(E,D,n.makeArray(G))}else{if(G){F.push(G)}}}return F},dequeue:function(G,F){var D=n.queue(G,F),E=D.shift();if(!F||F==="fx"){E=D[0]}if(E!==g){E.call(G)}}});n.fn.extend({data:function(D,F){var G=D.split(".");G[1]=G[1]?"."+G[1]:"";if(F===g){var E=this.triggerHandler("getData"+G[1]+"!",[G[0]]);if(E===g&&this.length){E=n.data(this[0],D)}return E===g&&G[1]?this.data(G[0]):E}else{return this.trigger("setData"+G[1]+"!",[G[0],F]).each(function(){n.data(this,D,F)})}},removeData:function(D){return this.each(function(){n.removeData(this,D)})},queue:function(D,E){if(typeof D!=="string"){E=D;D="fx"}if(E===g){return n.queue(this[0],D)}return this.each(function(){var F=n.queue(this,D,E);if(D=="fx"&&F.length==1){F[0].call(this)}})},dequeue:function(D){return this.each(function(){n.dequeue(this,D)})}});
/*
 * Sizzle CSS Selector Engine - v0.9.1
 *  Copyright 2009, The Dojo Foundation
 *  Released under the MIT, BSD, and GPL Licenses.
 *  More information: http://sizzlejs.com/
 */
(function(){var N=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|[^[\]]+)+\]|\\.|[^ >+~,(\[]+)+|[>+~])(\s*,\s*)?/g,I=0,F=Object.prototype.toString;var E=function(ae,S,aa,V){aa=aa||[];S=S||document;if(S.nodeType!==1&&S.nodeType!==9){return[]}if(!ae||typeof ae!=="string"){return aa}var ab=[],ac,Y,ah,ag,Z,R,Q=true;N.lastIndex=0;while((ac=N.exec(ae))!==null){ab.push(ac[1]);if(ac[2]){R=RegExp.rightContext;break}}if(ab.length>1&&G.match.POS.exec(ae)){if(ab.length===2&&G.relative[ab[0]]){var U="",X;while((X=G.match.POS.exec(ae))){U+=X[0];ae=ae.replace(G.match.POS,"")}Y=E.filter(U,E(/\s$/.test(ae)?ae+"*":ae,S))}else{Y=G.relative[ab[0]]?[S]:E(ab.shift(),S);while(ab.length){var P=[];ae=ab.shift();if(G.relative[ae]){ae+=ab.shift()}for(var af=0,ad=Y.length;af<ad;af++){E(ae,Y[af],P)}Y=P}}}else{var ai=V?{expr:ab.pop(),set:D(V)}:E.find(ab.pop(),ab.length===1&&S.parentNode?S.parentNode:S);Y=E.filter(ai.expr,ai.set);if(ab.length>0){ah=D(Y)}else{Q=false}while(ab.length){var T=ab.pop(),W=T;if(!G.relative[T]){T=""}else{W=ab.pop()}if(W==null){W=S}G.relative[T](ah,W,M(S))}}if(!ah){ah=Y}if(!ah){throw"Syntax error, unrecognized expression: "+(T||ae)}if(F.call(ah)==="[object Array]"){if(!Q){aa.push.apply(aa,ah)}else{if(S.nodeType===1){for(var af=0;ah[af]!=null;af++){if(ah[af]&&(ah[af]===true||ah[af].nodeType===1&&H(S,ah[af]))){aa.push(Y[af])}}}else{for(var af=0;ah[af]!=null;af++){if(ah[af]&&ah[af].nodeType===1){aa.push(Y[af])}}}}}else{D(ah,aa)}if(R){E(R,S,aa,V)}return aa};E.matches=function(P,Q){return E(P,null,null,Q)};E.find=function(V,S){var W,Q;if(!V){return[]}for(var R=0,P=G.order.length;R<P;R++){var T=G.order[R],Q;if((Q=G.match[T].exec(V))){var U=RegExp.leftContext;if(U.substr(U.length-1)!=="\\"){Q[1]=(Q[1]||"").replace(/\\/g,"");W=G.find[T](Q,S);if(W!=null){V=V.replace(G.match[T],"");break}}}}if(!W){W=S.getElementsByTagName("*")}return{set:W,expr:V}};E.filter=function(S,ac,ad,T){var Q=S,Y=[],ah=ac,V,ab;while(S&&ac.length){for(var U in G.filter){if((V=G.match[U].exec(S))!=null){var Z=G.filter[U],R=null,X=0,aa,ag;ab=false;if(ah==Y){Y=[]}if(G.preFilter[U]){V=G.preFilter[U](V,ah,ad,Y,T);if(!V){ab=aa=true}else{if(V===true){continue}else{if(V[0]===true){R=[];var W=null,af;for(var ae=0;(af=ah[ae])!==g;ae++){if(af&&W!==af){R.push(af);W=af}}}}}}if(V){for(var ae=0;(ag=ah[ae])!==g;ae++){if(ag){if(R&&ag!=R[X]){X++}aa=Z(ag,V,X,R);var P=T^!!aa;if(ad&&aa!=null){if(P){ab=true}else{ah[ae]=false}}else{if(P){Y.push(ag);ab=true}}}}}if(aa!==g){if(!ad){ah=Y}S=S.replace(G.match[U],"");if(!ab){return[]}break}}}S=S.replace(/\s*,\s*/,"");if(S==Q){if(ab==null){throw"Syntax error, unrecognized expression: "+S}else{break}}Q=S}return ah};var G=E.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(P){return P.getAttribute("href")}},relative:{"+":function(T,Q){for(var R=0,P=T.length;R<P;R++){var S=T[R];if(S){var U=S.previousSibling;while(U&&U.nodeType!==1){U=U.previousSibling}T[R]=typeof Q==="string"?U||false:U===Q}}if(typeof Q==="string"){E.filter(Q,T,true)}},">":function(U,Q,V){if(typeof Q==="string"&&!/\W/.test(Q)){Q=V?Q:Q.toUpperCase();for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){var S=T.parentNode;U[R]=S.nodeName===Q?S:false}}}else{for(var R=0,P=U.length;R<P;R++){var T=U[R];if(T){U[R]=typeof Q==="string"?T.parentNode:T.parentNode===Q}}if(typeof Q==="string"){E.filter(Q,U,true)}}},"":function(S,Q,U){var R="done"+(I++),P=O;if(!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("parentNode",Q,R,S,T,U)},"~":function(S,Q,U){var R="done"+(I++),P=O;if(typeof Q==="string"&&!Q.match(/\W/)){var T=Q=U?Q:Q.toUpperCase();P=L}P("previousSibling",Q,R,S,T,U)}},find:{ID:function(Q,R){if(R.getElementById){var P=R.getElementById(Q[1]);return P?[P]:[]}},NAME:function(P,Q){return Q.getElementsByName?Q.getElementsByName(P[1]):null},TAG:function(P,Q){return Q.getElementsByTagName(P[1])}},preFilter:{CLASS:function(S,Q,R,P,U){S=" "+S[1].replace(/\\/g,"")+" ";for(var T=0;Q[T];T++){if(U^(" "+Q[T].className+" ").indexOf(S)>=0){if(!R){P.push(Q[T])}}else{if(R){Q[T]=false}}}return false},ID:function(P){return P[1].replace(/\\/g,"")},TAG:function(Q,P){for(var R=0;!P[R];R++){}return M(P[R])?Q[1]:Q[1].toUpperCase()},CHILD:function(P){if(P[1]=="nth"){var Q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(P[2]=="even"&&"2n"||P[2]=="odd"&&"2n+1"||!/\D/.test(P[2])&&"0n+"+P[2]||P[2]);P[2]=(Q[1]+(Q[2]||1))-0;P[3]=Q[3]-0}P[0]="done"+(I++);return P},ATTR:function(Q){var P=Q[1];if(G.attrMap[P]){Q[1]=G.attrMap[P]}if(Q[2]==="~="){Q[4]=" "+Q[4]+" "}return Q},PSEUDO:function(T,Q,R,P,U){if(T[1]==="not"){if(T[3].match(N).length>1){T[3]=E(T[3],null,null,Q)}else{var S=E.filter(T[3],Q,R,true^U);if(!R){P.push.apply(P,S)}return false}}else{if(G.match.POS.test(T[0])){return true}}return T},POS:function(P){P.unshift(true);return P}},filters:{enabled:function(P){return P.disabled===false&&P.type!=="hidden"},disabled:function(P){return P.disabled===true},checked:function(P){return P.checked===true},selected:function(P){P.parentNode.selectedIndex;return P.selected===true},parent:function(P){return !!P.firstChild},empty:function(P){return !P.firstChild},has:function(R,Q,P){return !!E(P[3],R).length},header:function(P){return/h\d/i.test(P.nodeName)},text:function(P){return"text"===P.type},radio:function(P){return"radio"===P.type},checkbox:function(P){return"checkbox"===P.type},file:function(P){return"file"===P.type},password:function(P){return"password"===P.type},submit:function(P){return"submit"===P.type},image:function(P){return"image"===P.type},reset:function(P){return"reset"===P.type},button:function(P){return"button"===P.type||P.nodeName.toUpperCase()==="BUTTON"},input:function(P){return/input|select|textarea|button/i.test(P.nodeName)}},setFilters:{first:function(Q,P){return P===0},last:function(R,Q,P,S){return Q===S.length-1},even:function(Q,P){return P%2===0},odd:function(Q,P){return P%2===1},lt:function(R,Q,P){return Q<P[3]-0},gt:function(R,Q,P){return Q>P[3]-0},nth:function(R,Q,P){return P[3]-0==Q},eq:function(R,Q,P){return P[3]-0==Q}},filter:{CHILD:function(P,S){var V=S[1],W=P.parentNode;var U="child"+W.childNodes.length;if(W&&(!W[U]||!P.nodeIndex)){var T=1;for(var Q=W.firstChild;Q;Q=Q.nextSibling){if(Q.nodeType==1){Q.nodeIndex=T++}}W[U]=T-1}if(V=="first"){return P.nodeIndex==1}else{if(V=="last"){return P.nodeIndex==W[U]}else{if(V=="only"){return W[U]==1}else{if(V=="nth"){var Y=false,R=S[2],X=S[3];if(R==1&&X==0){return true}if(R==0){if(P.nodeIndex==X){Y=true}}else{if((P.nodeIndex-X)%R==0&&(P.nodeIndex-X)/R>=0){Y=true}}return Y}}}}},PSEUDO:function(V,R,S,W){var Q=R[1],T=G.filters[Q];if(T){return T(V,S,R,W)}else{if(Q==="contains"){return(V.textContent||V.innerText||"").indexOf(R[3])>=0}else{if(Q==="not"){var U=R[3];for(var S=0,P=U.length;S<P;S++){if(U[S]===V){return false}}return true}}}},ID:function(Q,P){return Q.nodeType===1&&Q.getAttribute("id")===P},TAG:function(Q,P){return(P==="*"&&Q.nodeType===1)||Q.nodeName===P},CLASS:function(Q,P){return P.test(Q.className)},ATTR:function(T,R){var P=G.attrHandle[R[1]]?G.attrHandle[R[1]](T):T[R[1]]||T.getAttribute(R[1]),U=P+"",S=R[2],Q=R[4];return P==null?false:S==="="?U===Q:S==="*="?U.indexOf(Q)>=0:S==="~="?(" "+U+" ").indexOf(Q)>=0:!R[4]?P:S==="!="?U!=Q:S==="^="?U.indexOf(Q)===0:S==="$="?U.substr(U.length-Q.length)===Q:S==="|="?U===Q||U.substr(0,Q.length+1)===Q+"-":false},POS:function(T,Q,R,U){var P=Q[2],S=G.setFilters[P];if(S){return S(T,R,Q,U)}}}};for(var K in G.match){G.match[K]=RegExp(G.match[K].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var D=function(Q,P){Q=Array.prototype.slice.call(Q);if(P){P.push.apply(P,Q);return P}return Q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(J){D=function(T,S){var Q=S||[];if(F.call(T)==="[object Array]"){Array.prototype.push.apply(Q,T)}else{if(typeof T.length==="number"){for(var R=0,P=T.length;R<P;R++){Q.push(T[R])}}else{for(var R=0;T[R];R++){Q.push(T[R])}}}return Q}}(function(){var Q=document.createElement("form"),R="script"+(new Date).getTime();Q.innerHTML="<input name='"+R+"'/>";var P=document.documentElement;P.insertBefore(Q,P.firstChild);if(!!document.getElementById(R)){G.find.ID=function(T,U){if(U.getElementById){var S=U.getElementById(T[1]);return S?S.id===T[1]||S.getAttributeNode&&S.getAttributeNode("id").nodeValue===T[1]?[S]:g:[]}};G.filter.ID=function(U,S){var T=U.getAttributeNode&&U.getAttributeNode("id");return U.nodeType===1&&T&&T.nodeValue===S}}P.removeChild(Q)})();(function(){var P=document.createElement("div");P.appendChild(document.createComment(""));if(P.getElementsByTagName("*").length>0){G.find.TAG=function(Q,U){var T=U.getElementsByTagName(Q[1]);if(Q[1]==="*"){var S=[];for(var R=0;T[R];R++){if(T[R].nodeType===1){S.push(T[R])}}T=S}return T}}P.innerHTML="<a href='#'></a>";if(P.firstChild.getAttribute("href")!=="#"){G.attrHandle.href=function(Q){return Q.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var P=E;E=function(T,S,Q,R){S=S||document;if(!R&&S.nodeType===9){try{return D(S.querySelectorAll(T),Q)}catch(U){}}return P(T,S,Q,R)};E.find=P.find;E.filter=P.filter;E.selectors=P.selectors;E.matches=P.matches})()}if(document.documentElement.getElementsByClassName){G.order.splice(1,0,"CLASS");G.find.CLASS=function(P,Q){return Q.getElementsByClassName(P[1])}}function L(Q,W,V,Z,X,Y){for(var T=0,R=Z.length;T<R;T++){var P=Z[T];if(P){P=P[Q];var U=false;while(P&&P.nodeType){var S=P[V];if(S){U=Z[S];break}if(P.nodeType===1&&!Y){P[V]=T}if(P.nodeName===W){U=P;break}P=P[Q]}Z[T]=U}}}function O(Q,V,U,Y,W,X){for(var S=0,R=Y.length;S<R;S++){var P=Y[S];if(P){P=P[Q];var T=false;while(P&&P.nodeType){if(P[U]){T=Y[P[U]];break}if(P.nodeType===1){if(!X){P[U]=S}if(typeof V!=="string"){if(P===V){T=true;break}}else{if(E.filter(V,[P]).length>0){T=P;break}}}P=P[Q]}Y[S]=T}}}var H=document.compareDocumentPosition?function(Q,P){return Q.compareDocumentPosition(P)&16}:function(Q,P){return Q!==P&&(Q.contains?Q.contains(P):true)};var M=function(P){return P.documentElement&&!P.body||P.tagName&&P.ownerDocument&&!P.ownerDocument.body};n.find=E;n.filter=E.filter;n.expr=E.selectors;n.expr[":"]=n.expr.filters;E.selectors.filters.hidden=function(P){return"hidden"===P.type||n.css(P,"display")==="none"||n.css(P,"visibility")==="hidden"};E.selectors.filters.visible=function(P){return"hidden"!==P.type&&n.css(P,"display")!=="none"&&n.css(P,"visibility")!=="hidden"};E.selectors.filters.animated=function(P){return n.grep(n.timers,function(Q){return P===Q.elem}).length};n.multiFilter=function(R,P,Q){if(Q){R=":not("+R+")"}return E.matches(R,P)};n.dir=function(R,Q){var P=[],S=R[Q];while(S&&S!=document){if(S.nodeType==1){P.push(S)}S=S[Q]}return P};n.nth=function(T,P,R,S){P=P||1;var Q=0;for(;T;T=T[R]){if(T.nodeType==1&&++Q==P){break}}return T};n.sibling=function(R,Q){var P=[];for(;R;R=R.nextSibling){if(R.nodeType==1&&R!=Q){P.push(R)}}return P};return;l.Sizzle=E})();n.event={add:function(H,E,G,J){if(H.nodeType==3||H.nodeType==8){return}if(H.setInterval&&H!=l){H=l}if(!G.guid){G.guid=this.guid++}if(J!==g){var F=G;G=this.proxy(F);G.data=J}var D=n.data(H,"events")||n.data(H,"events",{}),I=n.data(H,"handle")||n.data(H,"handle",function(){return typeof n!=="undefined"&&!n.event.triggered?n.event.handle.apply(arguments.callee.elem,arguments):g});I.elem=H;n.each(E.split(/\s+/),function(L,M){var N=M.split(".");M=N.shift();G.type=N.slice().sort().join(".");var K=D[M];if(n.event.specialAll[M]){n.event.specialAll[M].setup.call(H,J,N)}if(!K){K=D[M]={};if(!n.event.special[M]||n.event.special[M].setup.call(H,J,N)===false){if(H.addEventListener){H.addEventListener(M,I,false)}else{if(H.attachEvent){H.attachEvent("on"+M,I)}}}}K[G.guid]=G;n.event.global[M]=true});H=null},guid:1,global:{},remove:function(J,G,I){if(J.nodeType==3||J.nodeType==8){return}var F=n.data(J,"events"),E,D;if(F){if(G===g||(typeof G==="string"&&G.charAt(0)==".")){for(var H in F){this.remove(J,H+(G||""))}}else{if(G.type){I=G.handler;G=G.type}n.each(G.split(/\s+/),function(L,N){var P=N.split(".");N=P.shift();var M=RegExp("(^|\\.)"+P.slice().sort().join(".*\\.")+"(\\.|$)");if(F[N]){if(I){delete F[N][I.guid]}else{for(var O in F[N]){if(M.test(F[N][O].type)){delete F[N][O]}}}if(n.event.specialAll[N]){n.event.specialAll[N].teardown.call(J,P)}for(E in F[N]){break}if(!E){if(!n.event.special[N]||n.event.special[N].teardown.call(J,P)===false){if(J.removeEventListener){J.removeEventListener(N,n.data(J,"handle"),false)}else{if(J.detachEvent){J.detachEvent("on"+N,n.data(J,"handle"))}}}E=null;delete F[N]}}})}for(E in F){break}if(!E){var K=n.data(J,"handle");if(K){K.elem=null}n.removeData(J,"events");n.removeData(J,"handle")}}},trigger:function(H,J,G,D){var F=H.type||H;if(!D){H=typeof H==="object"?H[h]?H:n.extend(n.Event(F),H):n.Event(F);if(F.indexOf("!")>=0){H.type=F=F.slice(0,-1);H.exclusive=true}if(!G){H.stopPropagation();if(this.global[F]){n.each(n.cache,function(){if(this.events&&this.events[F]){n.event.trigger(H,J,this.handle.elem)}})}}if(!G||G.nodeType==3||G.nodeType==8){return g}H.result=g;H.target=G;J=n.makeArray(J);J.unshift(H)}H.currentTarget=G;var I=n.data(G,"handle");if(I){I.apply(G,J)}if((!G[F]||(n.nodeName(G,"a")&&F=="click"))&&G["on"+F]&&G["on"+F].apply(G,J)===false){H.result=false}if(!D&&G[F]&&!H.isDefaultPrevented()&&!(n.nodeName(G,"a")&&F=="click")){this.triggered=true;try{G[F]()}catch(K){}}this.triggered=false;if(!H.isPropagationStopped()){var E=G.parentNode||G.ownerDocument;if(E){n.event.trigger(H,J,E,true)}}},handle:function(J){var I,D;J=arguments[0]=n.event.fix(J||l.event);var K=J.type.split(".");J.type=K.shift();I=!K.length&&!J.exclusive;var H=RegExp("(^|\\.)"+K.slice().sort().join(".*\\.")+"(\\.|$)");D=(n.data(this,"events")||{})[J.type];for(var F in D){var G=D[F];if(I||H.test(G.type)){J.handler=G;J.data=G.data;var E=G.apply(this,arguments);if(E!==g){J.result=E;if(E===false){J.preventDefault();J.stopPropagation()}}if(J.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(G){if(G[h]){return G}var E=G;G=n.Event(E);for(var F=this.props.length,I;F;){I=this.props[--F];G[I]=E[I]}if(!G.target){G.target=G.srcElement||document}if(G.target.nodeType==3){G.target=G.target.parentNode}if(!G.relatedTarget&&G.fromElement){G.relatedTarget=G.fromElement==G.target?G.toElement:G.fromElement}if(G.pageX==null&&G.clientX!=null){var H=document.documentElement,D=document.body;G.pageX=G.clientX+(H&&H.scrollLeft||D&&D.scrollLeft||0)-(H.clientLeft||0);G.pageY=G.clientY+(H&&H.scrollTop||D&&D.scrollTop||0)-(H.clientTop||0)}if(!G.which&&((G.charCode||G.charCode===0)?G.charCode:G.keyCode)){G.which=G.charCode||G.keyCode}if(!G.metaKey&&G.ctrlKey){G.metaKey=G.ctrlKey}if(!G.which&&G.button){G.which=(G.button&1?1:(G.button&2?3:(G.button&4?2:0)))}return G},proxy:function(E,D){D=D||function(){return E.apply(this,arguments)};D.guid=E.guid=E.guid||D.guid||this.guid++;return D},special:{ready:{setup:A,teardown:function(){}}},specialAll:{live:{setup:function(D,E){n.event.add(this,E[0],c)},teardown:function(F){if(F.length){var D=0,E=RegExp("(^|\\.)"+F[0]+"(\\.|$)");n.each((n.data(this,"events").live||{}),function(){if(E.test(this.type)){D++}});if(D<1){n.event.remove(this,F[0],c)}}}}}};n.Event=function(D){if(!this.preventDefault){return new n.Event(D)}if(D&&D.type){this.originalEvent=D;this.type=D.type;this.timeStamp=D.timeStamp}else{this.type=D}if(!this.timeStamp){this.timeStamp=e()}this[h]=true};function k(){return false}function t(){return true}n.Event.prototype={preventDefault:function(){this.isDefaultPrevented=t;var D=this.originalEvent;if(!D){return}if(D.preventDefault){D.preventDefault()}D.returnValue=false},stopPropagation:function(){this.isPropagationStopped=t;var D=this.originalEvent;if(!D){return}if(D.stopPropagation){D.stopPropagation()}D.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=t;this.stopPropagation()},isDefaultPrevented:k,isPropagationStopped:k,isImmediatePropagationStopped:k};var a=function(E){var D=E.relatedTarget;while(D&&D!=this){try{D=D.parentNode}catch(F){D=this}}if(D!=this){E.type=E.data;n.event.handle.apply(this,arguments)}};n.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(E,D){n.event.special[D]={setup:function(){n.event.add(this,E,a,D)},teardown:function(){n.event.remove(this,E,a)}}});n.fn.extend({bind:function(E,F,D){return E=="unload"?this.one(E,F,D):this.each(function(){n.event.add(this,E,D||F,D&&F)})},one:function(F,G,E){var D=n.event.proxy(E||G,function(H){n(this).unbind(H,D);return(E||G).apply(this,arguments)});return this.each(function(){n.event.add(this,F,D,E&&G)})},unbind:function(E,D){return this.each(function(){n.event.remove(this,E,D)})},trigger:function(D,E){return this.each(function(){n.event.trigger(D,E,this)})},triggerHandler:function(D,F){if(this[0]){var E=n.Event(D);E.preventDefault();E.stopPropagation();n.event.trigger(E,F,this[0]);return E.result}},toggle:function(F){var D=arguments,E=1;while(E<D.length){n.event.proxy(F,D[E++])}return this.click(n.event.proxy(F,function(G){this.lastToggle=(this.lastToggle||0)%E;G.preventDefault();return D[this.lastToggle++].apply(this,arguments)||false}))},hover:function(D,E){return this.mouseenter(D).mouseleave(E)},ready:function(D){A();if(n.isReady){D.call(document,n)}else{n.readyList.push(D)}return this},live:function(F,E){var D=n.event.proxy(E);D.guid+=this.selector+F;n(document).bind(i(F,this.selector),this.selector,D);return this},die:function(E,D){n(document).unbind(i(E,this.selector),D?{guid:D.guid+this.selector+E}:null);return this}});function c(G){var D=RegExp("(^|\\.)"+G.type+"(\\.|$)"),F=true,E=[];n.each(n.data(this,"events").live||[],function(H,I){if(D.test(I.type)){var J=n(G.target).closest(I.data)[0];if(J){E.push({elem:J,fn:I})}}});n.each(E,function(){if(!G.isImmediatePropagationStopped()&&this.fn.call(this.elem,G,this.fn.data)===false){F=false}});return F}function i(E,D){return["live",E,D.replace(/\./g,"`").replace(/ /g,"|")].join(".")}n.extend({isReady:false,readyList:[],ready:function(){if(!n.isReady){n.isReady=true;if(n.readyList){n.each(n.readyList,function(){this.call(document,n)});n.readyList=null}n(document).triggerHandler("ready")}}});var w=false;function A(){if(w){return}w=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);n.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);n.ready()}});if(document.documentElement.doScroll&&!l.frameElement){(function(){if(n.isReady){return}try{document.documentElement.doScroll("left")}catch(D){setTimeout(arguments.callee,0);return}n.ready()})()}}}n.event.add(l,"load",n.ready)}n.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(E,D){n.fn[D]=function(F){return F?this.bind(D,F):this.trigger(D)}});n(l).bind("unload",function(){for(var D in n.cache){if(D!=1&&n.cache[D].handle){n.event.remove(n.cache[D].handle.elem)}}});(function(){n.support={};var E=document.documentElement,F=document.createElement("script"),J=document.createElement("div"),I="script"+(new Date).getTime();J.style.display="none";J.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var G=J.getElementsByTagName("*"),D=J.getElementsByTagName("a")[0];if(!G||!G.length||!D){return}n.support={leadingWhitespace:J.firstChild.nodeType==3,tbody:!J.getElementsByTagName("tbody").length,objectAll:!!J.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!J.getElementsByTagName("link").length,style:/red/.test(D.getAttribute("style")),hrefNormalized:D.getAttribute("href")==="/a",opacity:D.style.opacity==="0.5",cssFloat:!!D.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};F.type="text/javascript";try{F.appendChild(document.createTextNode("window."+I+"=1;"))}catch(H){}E.insertBefore(F,E.firstChild);if(l[I]){n.support.scriptEval=true;delete l[I]}E.removeChild(F);if(J.attachEvent&&J.fireEvent){J.attachEvent("onclick",function(){n.support.noCloneEvent=false;J.detachEvent("onclick",arguments.callee)});J.cloneNode(true).fireEvent("onclick")}n(function(){var K=document.createElement("div");K.style.width="1px";K.style.paddingLeft="1px";document.body.appendChild(K);n.boxModel=n.support.boxModel=K.offsetWidth===2;document.body.removeChild(K)})})();var v=n.support.cssFloat?"cssFloat":"styleFloat";n.props={"for":"htmlFor","class":"className","float":v,cssFloat:v,styleFloat:v,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};n.fn.extend({_load:n.fn.load,load:function(F,I,J){if(typeof F!=="string"){return this._load(F)}var H=F.indexOf(" ");if(H>=0){var D=F.slice(H,F.length);F=F.slice(0,H)}var G="GET";if(I){if(n.isFunction(I)){J=I;I=null}else{if(typeof I==="object"){I=n.param(I);G="POST"}}}var E=this;n.ajax({url:F,type:G,dataType:"html",data:I,complete:function(L,K){if(K=="success"||K=="notmodified"){E.html(D?n("<div/>").append(L.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(D):L.responseText)}if(J){E.each(J,[L.responseText,K,L])}}});return this},serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?n.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password/i.test(this.type))}).map(function(D,E){var F=n(this).val();return F==null?null:n.isArray(F)?n.map(F,function(H,G){return{name:E.name,value:H}}):{name:E.name,value:F}}).get()}});n.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(D,E){n.fn[E]=function(F){return this.bind(E,F)}});var q=e();n.extend({get:function(D,F,G,E){if(n.isFunction(F)){G=F;F=null}return n.ajax({type:"GET",url:D,data:F,success:G,dataType:E})},getScript:function(D,E){return n.get(D,null,E,"script")},getJSON:function(D,E,F){return n.get(D,E,F,"json")},post:function(D,F,G,E){if(n.isFunction(F)){G=F;F={}}return n.ajax({type:"POST",url:D,data:F,success:G,dataType:E})},ajaxSetup:function(D){n.extend(n.ajaxSettings,D)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return l.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(L){L=n.extend(true,L,n.extend(true,{},n.ajaxSettings,L));var V,E=/=\?(&|$)/g,Q,U,F=L.type.toUpperCase();if(L.data&&L.processData&&typeof L.data!=="string"){L.data=n.param(L.data)}if(L.dataType=="jsonp"){if(F=="GET"){if(!L.url.match(E)){L.url+=(L.url.match(/\?/)?"&":"?")+(L.jsonp||"callback")+"=?"}}else{if(!L.data||!L.data.match(E)){L.data=(L.data?L.data+"&":"")+(L.jsonp||"callback")+"=?"}}L.dataType="json"}if(L.dataType=="json"&&(L.data&&L.data.match(E)||L.url.match(E))){V="jsonp"+q++;if(L.data){L.data=(L.data+"").replace(E,"="+V+"$1")}L.url=L.url.replace(E,"="+V+"$1");L.dataType="script";l[V]=function(W){U=W;H();K();l[V]=g;try{delete l[V]}catch(X){}if(G){G.removeChild(S)}}}if(L.dataType=="script"&&L.cache==null){L.cache=false}if(L.cache===false&&F=="GET"){var D=e();var T=L.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+D+"$2");L.url=T+((T==L.url)?(L.url.match(/\?/)?"&":"?")+"_="+D:"")}if(L.data&&F=="GET"){L.url+=(L.url.match(/\?/)?"&":"?")+L.data;L.data=null}if(L.global&&!n.active++){n.event.trigger("ajaxStart")}var P=/^(\w+:)?\/\/([^\/?#]+)/.exec(L.url);if(L.dataType=="script"&&F=="GET"&&P&&(P[1]&&P[1]!=location.protocol||P[2]!=location.host)){var G=document.getElementsByTagName("head")[0];var S=document.createElement("script");S.src=L.url;if(L.scriptCharset){S.charset=L.scriptCharset}if(!V){var N=false;S.onload=S.onreadystatechange=function(){if(!N&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){N=true;H();K();G.removeChild(S)}}}G.appendChild(S);return g}var J=false;var I=L.xhr();if(L.username){I.open(F,L.url,L.async,L.username,L.password)}else{I.open(F,L.url,L.async)}try{if(L.data){I.setRequestHeader("Content-Type",L.contentType)}if(L.ifModified){I.setRequestHeader("If-Modified-Since",n.lastModified[L.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}I.setRequestHeader("X-Requested-With","XMLHttpRequest");I.setRequestHeader("Accept",L.dataType&&L.accepts[L.dataType]?L.accepts[L.dataType]+", */*":L.accepts._default)}catch(R){}if(L.beforeSend&&L.beforeSend(I,L)===false){if(L.global&&!--n.active){n.event.trigger("ajaxStop")}I.abort();return false}if(L.global){n.event.trigger("ajaxSend",[I,L])}var M=function(W){if(I.readyState==0){if(O){clearInterval(O);O=null;if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}}else{if(!J&&I&&(I.readyState==4||W=="timeout")){J=true;if(O){clearInterval(O);O=null}Q=W=="timeout"?"timeout":!n.httpSuccess(I)?"error":L.ifModified&&n.httpNotModified(I,L.url)?"notmodified":"success";if(Q=="success"){try{U=n.httpData(I,L.dataType,L)}catch(Y){Q="parsererror"}}if(Q=="success"){var X;try{X=I.getResponseHeader("Last-Modified")}catch(Y){}if(L.ifModified&&X){n.lastModified[L.url]=X}if(!V){H()}}else{n.handleError(L,I,Q)}K();if(L.async){I=null}}}};if(L.async){var O=setInterval(M,13);if(L.timeout>0){setTimeout(function(){if(I){if(!J){M("timeout")}if(I){I.abort()}}},L.timeout)}}try{I.send(L.data)}catch(R){n.handleError(L,I,null,R)}if(!L.async){M()}function H(){if(L.success){L.success(U,Q)}if(L.global){n.event.trigger("ajaxSuccess",[I,L])}}function K(){if(L.complete){L.complete(I,Q)}if(L.global){n.event.trigger("ajaxComplete",[I,L])}if(L.global&&!--n.active){n.event.trigger("ajaxStop")}}return I},handleError:function(E,G,D,F){if(E.error){E.error(G,D,F)}if(E.global){n.event.trigger("ajaxError",[G,E,F])}},active:0,httpSuccess:function(E){try{return !E.status&&location.protocol=="file:"||(E.status>=200&&E.status<300)||E.status==304||E.status==1223}catch(D){}return false},httpNotModified:function(F,D){try{var G=F.getResponseHeader("Last-Modified");return F.status==304||G==n.lastModified[D]}catch(E){}return false},httpData:function(I,G,F){var E=I.getResponseHeader("content-type"),D=G=="xml"||!G&&E&&E.indexOf("xml")>=0,H=D?I.responseXML:I.responseText;if(D&&H.documentElement.tagName=="parsererror"){throw"parsererror"}if(F&&F.dataFilter){H=F.dataFilter(H,G)}if(typeof H==="string"){if(G=="script"){n.globalEval(H)}if(G=="json"){H=l["eval"]("("+H+")")}}return H},param:function(D){var F=[];function G(H,I){F[F.length]=encodeURIComponent(H)+"="+encodeURIComponent(I)}if(n.isArray(D)||D.jquery){n.each(D,function(){G(this.name,this.value)})}else{for(var E in D){if(n.isArray(D[E])){n.each(D[E],function(){G(E,this)})}else{G(E,n.isFunction(D[E])?D[E]():D[E])}}}return F.join("&").replace(/%20/g,"+")}});var m={},d=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function s(E,D){var F={};n.each(d.concat.apply([],d.slice(0,D)),function(){F[this]=E});return F}n.fn.extend({show:function(I,K){if(I){return this.animate(s("show",3),I,K)}else{for(var G=0,E=this.length;G<E;G++){var D=n.data(this[G],"olddisplay");this[G].style.display=D||"";if(n.css(this[G],"display")==="none"){var F=this[G].tagName,J;if(m[F]){J=m[F]}else{var H=n("<"+F+" />").appendTo("body");J=H.css("display");if(J==="none"){J="block"}H.remove();m[F]=J}this[G].style.display=n.data(this[G],"olddisplay",J)}}return this}},hide:function(G,H){if(G){return this.animate(s("hide",3),G,H)}else{for(var F=0,E=this.length;F<E;F++){var D=n.data(this[F],"olddisplay");if(!D&&D!=="none"){n.data(this[F],"olddisplay",n.css(this[F],"display"))}this[F].style.display="none"}return this}},_toggle:n.fn.toggle,toggle:function(F,E){var D=typeof F==="boolean";return n.isFunction(F)&&n.isFunction(E)?this._toggle.apply(this,arguments):F==null||D?this.each(function(){var G=D?F:n(this).is(":hidden");n(this)[G?"show":"hide"]()}):this.animate(s("toggle",3),F,E)},fadeTo:function(D,F,E){return this.animate({opacity:F},D,E)},animate:function(H,E,G,F){var D=n.speed(E,G,F);return this[D.queue===false?"each":"queue"](function(){var J=n.extend({},D),L,K=this.nodeType==1&&n(this).is(":hidden"),I=this;for(L in H){if(H[L]=="hide"&&K||H[L]=="show"&&!K){return J.complete.call(this)}if((L=="height"||L=="width")&&this.style){J.display=n.css(this,"display");J.overflow=this.style.overflow}}if(J.overflow!=null){this.style.overflow="hidden"}J.curAnim=n.extend({},H);n.each(H,function(N,R){var Q=new n.fx(I,J,N);if(/toggle|show|hide/.test(R)){Q[R=="toggle"?K?"show":"hide":R](H)}else{var P=R.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),S=Q.cur(true)||0;if(P){var M=parseFloat(P[2]),O=P[3]||"px";if(O!="px"){I.style[N]=(M||1)+O;S=((M||1)/Q.cur(true))*S;I.style[N]=S+O}if(P[1]){M=((P[1]=="-="?-1:1)*M)+S}Q.custom(S,M,O)}else{Q.custom(S,R,"")}}});return true})},stop:function(E,D){var F=n.timers;if(E){this.queue([])}this.each(function(){for(var G=F.length-1;G>=0;G--){if(F[G].elem==this){if(D){F[G](true)}F.splice(G,1)}}});if(!D){this.dequeue()}return this}});n.each({slideDown:s("show",1),slideUp:s("hide",1),slideToggle:s("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(D,E){n.fn[D]=function(F,G){return this.animate(E,F,G)}});n.extend({speed:function(F,G,E){var D=typeof F==="object"?F:{complete:E||!E&&G||n.isFunction(F)&&F,duration:F,easing:E&&G||G&&!n.isFunction(G)&&G};D.duration=n.fx.off?0:typeof D.duration==="number"?D.duration:n.fx.speeds[D.duration]||n.fx.speeds._default;D.old=D.complete;D.complete=function(){if(D.queue!==false){n(this).dequeue()}if(n.isFunction(D.old)){D.old.call(this)}};return D},easing:{linear:function(F,G,D,E){return D+E*F},swing:function(F,G,D,E){return((-Math.cos(F*Math.PI)/2)+0.5)*E+D}},timers:[],timerId:null,fx:function(E,D,F){this.options=D;this.elem=E;this.prop=F;if(!D.orig){D.orig={}}}});n.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(n.fx.step[this.prop]||n.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(E){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var D=parseFloat(n.css(this.elem,this.prop,E));return D&&D>-10000?D:parseFloat(n.curCSS(this.elem,this.prop))||0},custom:function(H,G,F){this.startTime=e();this.start=H;this.end=G;this.unit=F||this.unit||"px";this.now=this.start;this.pos=this.state=0;var D=this;function E(I){return D.step(I)}E.elem=this.elem;n.timers.push(E);if(E()&&n.timerId==null){n.timerId=setInterval(function(){var J=n.timers;for(var I=0;I<J.length;I++){if(!J[I]()){J.splice(I--,1)}}if(!J.length){clearInterval(n.timerId);n.timerId=null}},13)}},show:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());n(this.elem).show()},hide:function(){this.options.orig[this.prop]=n.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(G){var F=e();if(G||F>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var D=true;for(var E in this.options.curAnim){if(this.options.curAnim[E]!==true){D=false}}if(D){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(n.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){n(this.elem).hide()}if(this.options.hide||this.options.show){for(var H in this.options.curAnim){n.attr(this.elem.style,H,this.options.orig[H])}}}if(D){this.options.complete.call(this.elem)}return false}else{var I=F-this.startTime;this.state=I/this.options.duration;this.pos=n.easing[this.options.easing||(n.easing.swing?"swing":"linear")](this.state,I,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};n.extend(n.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(D){n.attr(D.elem.style,"opacity",D.now)},_default:function(D){if(D.elem.style&&D.elem.style[D.prop]!=null){D.elem.style[D.prop]=D.now+D.unit}else{D.elem[D.prop]=D.now}}}});if(document.documentElement.getBoundingClientRect){n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}var F=this[0].getBoundingClientRect(),I=this[0].ownerDocument,E=I.body,D=I.documentElement,K=D.clientTop||E.clientTop||0,J=D.clientLeft||E.clientLeft||0,H=F.top+(self.pageYOffset||n.boxModel&&D.scrollTop||E.scrollTop)-K,G=F.left+(self.pageXOffset||n.boxModel&&D.scrollLeft||E.scrollLeft)-J;return{top:H,left:G}}}else{n.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return n.offset.bodyOffset(this[0])}n.offset.initialized||n.offset.initialize();var I=this[0],F=I.offsetParent,E=I,N=I.ownerDocument,L,G=N.documentElement,J=N.body,K=N.defaultView,D=K.getComputedStyle(I,null),M=I.offsetTop,H=I.offsetLeft;while((I=I.parentNode)&&I!==J&&I!==G){L=K.getComputedStyle(I,null);M-=I.scrollTop,H-=I.scrollLeft;if(I===F){M+=I.offsetTop,H+=I.offsetLeft;if(n.offset.doesNotAddBorder&&!(n.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(I.tagName))){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}E=F,F=I.offsetParent}if(n.offset.subtractsBorderForOverflowNotVisible&&L.overflow!=="visible"){M+=parseInt(L.borderTopWidth,10)||0,H+=parseInt(L.borderLeftWidth,10)||0}D=L}if(D.position==="relative"||D.position==="static"){M+=J.offsetTop,H+=J.offsetLeft}if(D.position==="fixed"){M+=Math.max(G.scrollTop,J.scrollTop),H+=Math.max(G.scrollLeft,J.scrollLeft)}return{top:M,left:H}}}n.offset={initialize:function(){if(this.initialized){return}var K=document.body,E=document.createElement("div"),G,F,M,H,L,D,I=K.style.marginTop,J='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"cellpadding="0"cellspacing="0"><tr><td></td></tr></table>';L={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(D in L){E.style[D]=L[D]}E.innerHTML=J;K.insertBefore(E,K.firstChild);G=E.firstChild,F=G.firstChild,H=G.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(F.offsetTop!==5);this.doesAddBorderForTableAndCells=(H.offsetTop===5);G.style.overflow="hidden",G.style.position="relative";this.subtractsBorderForOverflowNotVisible=(F.offsetTop===-5);K.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(K.offsetTop===0);K.style.marginTop=I;K.removeChild(E);this.initialized=true},bodyOffset:function(D){n.offset.initialized||n.offset.initialize();var F=D.offsetTop,E=D.offsetLeft;if(n.offset.doesNotIncludeMarginInBodyOffset){F+=parseInt(n.curCSS(D,"marginTop",true),10)||0,E+=parseInt(n.curCSS(D,"marginLeft",true),10)||0}return{top:F,left:E}}};n.fn.extend({position:function(){var H=0,G=0,E;if(this[0]){var F=this.offsetParent(),I=this.offset(),D=/^body|html$/i.test(F[0].tagName)?{top:0,left:0}:F.offset();I.top-=j(this,"marginTop");I.left-=j(this,"marginLeft");D.top+=j(F,"borderTopWidth");D.left+=j(F,"borderLeftWidth");E={top:I.top-D.top,left:I.left-D.left}}return E},offsetParent:function(){var D=this[0].offsetParent||document.body;while(D&&(!/^body|html$/i.test(D.tagName)&&n.css(D,"position")=="static")){D=D.offsetParent}return n(D)}});n.each(["Left","Top"],function(E,D){var F="scroll"+D;n.fn[F]=function(G){if(!this[0]){return null}return G!==g?this.each(function(){this==l||this==document?l.scrollTo(!E?G:n(l).scrollLeft(),E?G:n(l).scrollTop()):this[F]=G}):this[0]==l||this[0]==document?self[E?"pageYOffset":"pageXOffset"]||n.boxModel&&document.documentElement[F]||document.body[F]:this[0][F]}});n.each(["Height","Width"],function(G,E){var D=G?"Left":"Top",F=G?"Right":"Bottom";n.fn["inner"+E]=function(){return this[E.toLowerCase()]()+j(this,"padding"+D)+j(this,"padding"+F)};n.fn["outer"+E]=function(I){return this["inner"+E]()+j(this,"border"+D+"Width")+j(this,"border"+F+"Width")+(I?j(this,"margin"+D)+j(this,"margin"+F):0)};var H=E.toLowerCase();n.fn[H]=function(I){return this[0]==l?document.compatMode=="CSS1Compat"&&document.documentElement["client"+E]||document.body["client"+E]:this[0]==document?Math.max(document.documentElement["client"+E],document.body["scroll"+E],document.documentElement["scroll"+E],document.body["offset"+E],document.documentElement["offset"+E]):I===g?(this.length?n.css(this[0],H):null):this.css(H,typeof I==="string"?I:I+"px")}})})();

var BNetjQuery = true;/* from: http://www.batanga.com/scripts/jquery/DOMWindow/jquery.DOMWindow.js 20/11/2009 07:40:08 p.m. */
(function($){
	
	//closeDOMWindow
	$.fn.closeDOMWindow = function(settings){
		
		if(!settings){settings={};}
		
		var run = function(passingThis){
			
			if(settings.anchoredClassName){
				var $anchorClassName = $('.'+settings.anchoredClassName);
				$anchorClassName.fadeOut('fast',function(){
					if($.fn.draggable){
						$anchorClassName.draggable('destory').trigger("unload").remove();	
					}else{
						$anchorClassName.trigger("unload").remove();
					}
				});
				if(settings.functionCallOnClose){settings.functionCallAfterClose();}
			}else{
				var $DOMWindowOverlay = $('#DOMWindowOverlay');
				var $DOMWindow = $('#DOMWindow');
				$DOMWindowOverlay.fadeOut('fast',function(){
					$DOMWindowOverlay.trigger('unload').unbind().remove();																	  
				});
				$DOMWindow.fadeOut('fast',function(){
					if($.fn.draggable){
						$DOMWindow.draggable("destroy").trigger("unload").remove();
					}else{
						$DOMWindow.trigger("unload").remove();
					}
				});
			
				$(window).unbind('scroll.DOMWindow');
				$(window).unbind('resize.DOMWindow');
				
				if($.fn.openDOMWindow.isIE6){$('#DOMWindowIE6FixIframe').remove();}
				if(settings.functionCallOnClose){settings.functionCallAfterClose();}
			}	
		};
		
		if(settings.eventType){//if used with $().
			return this.each(function(index){
				$(this).bind(settings.eventType, function(){
					run(this);
					return false;
				});
			});
		}else{//else called as $.function
			run();
		}
		
	};
	
	//allow for public call, pass settings
	$.closeDOMWindow = function(s){$.fn.closeDOMWindow(s);};
	
	//openDOMWindow
	$.fn.openDOMWindow = function(instanceSettings){	
		
		var shortcut =  $.fn.openDOMWindow;
	
		//default settings combined with callerSettings////////////////////////////////////////////////////////////////////////
		
		shortcut.defaultsSettings = {
			anchoredClassName:'',
			anchoredSelector:'',
			borderColor:'#ccc',
			borderSize:'4',
			draggable:0,
			eventType:null, //click, blur, change, dblclick, error, focus, load, mousedown, mouseout, mouseup etc...
			fixedWindowY:100,
			functionCallOnOpen:null,
			functionCallOnClose:null,
			height:500,
			loader:0,
			loaderHeight:0,
			loaderImagePath:'',
			loaderWidth:0,
			modal:0,
			overlay:1,
			overlayColor:'#000',
			overlayOpacity:'85',
			positionLeft:0,
			positionTop:0,
			positionType:'centered', // centered, anchored, absolute, fixed
			width:500, 
			windowBGColor:'#fff',
			windowBGImage:null, // http path
			windowHTTPType:'get',
			windowPadding:10,
			windowSource:'inline', //inline, ajax, iframe
			windowSourceID:'',
			windowSourceURL:'',
			windowSourceAttrURL:'href'
		};
		
		var settings = $.extend({}, $.fn.openDOMWindow.defaultsSettings , instanceSettings || {});
		
		//Public functions
		
		shortcut.viewPortHeight = function(){ return self.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;};
		shortcut.viewPortWidth = function(){ return self.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;};
		shortcut.scrollOffsetHeight = function(){ return self.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;};
		shortcut.scrollOffsetWidth = function(){ return self.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;};
		shortcut.isIE6 = typeof document.body.style.maxHeight === "undefined";
		
		//Private Functions/////////////////////////////////////////////////////////////////////////////////////////////////////////
		
		var sizeOverlay = function(){
			var $DOMWindowOverlay = $('#DOMWindowOverlay');
			if(shortcut.isIE6){//if IE 6
				var overlayViewportHeight = document.documentElement.offsetHeight + document.documentElement.scrollTop - 4;
				var overlayViewportWidth = document.documentElement.offsetWidth - 21;
				$DOMWindowOverlay.css({'height':overlayViewportHeight +'px','width':overlayViewportWidth+'px'});
			}else{//else Firefox, safari, opera, IE 7+
				$DOMWindowOverlay.css({'height':'100%','width':'100%','position':'fixed'});
			}	
		};
		
		var sizeIE6Iframe = function(){
			var overlayViewportHeight = document.documentElement.offsetHeight + document.documentElement.scrollTop - 4;
			var overlayViewportWidth = document.documentElement.offsetWidth - 21;
			$('#DOMWindowIE6FixIframe').css({'height':overlayViewportHeight +'px','width':overlayViewportWidth+'px'});
		};
		
		var centerDOMWindow = function() {
			var $DOMWindow = $('#DOMWindow');
			if(settings.height + 50 > shortcut.viewPortHeight()){//added 50 to be safe
				$DOMWindow.css('left',Math.round(shortcut.viewPortWidth()/2) + shortcut.scrollOffsetWidth() - Math.round(($DOMWindow.outerWidth())/2));
			}else{
				$DOMWindow.css('left',Math.round(shortcut.viewPortWidth()/2) + shortcut.scrollOffsetWidth() - Math.round(($DOMWindow.outerWidth())/2));
				$DOMWindow.css('top',Math.round(shortcut.viewPortHeight()/2) + shortcut.scrollOffsetHeight() - Math.round(($DOMWindow.outerHeight())/2));
			}
		};
		
		var centerLoader = function() {
			var $DOMWindowLoader = $('#DOMWindowLoader');
			if(shortcut.isIE6){//if IE 6
				$DOMWindowLoader.css({'left':Math.round(shortcut.viewPortWidth()/2) + shortcut.scrollOffsetWidth() - Math.round(($DOMWindowLoader.innerWidth())/2),'position':'absolute'});
				$DOMWindowLoader.css({'top':Math.round(shortcut.viewPortHeight()/2) + shortcut.scrollOffsetHeight() - Math.round(($DOMWindowLoader.innerHeight())/2),'position':'absolute'});
			}else{
				$DOMWindowLoader.css({'left':'50%','top':'50%','position':'fixed'});
			}
			
		};
		
		var fixedDOMWindow = function(){
			var $DOMWindow = $('#DOMWindow');
			$DOMWindow.css('left', settings.positionLeft + shortcut.scrollOffsetWidth());
			$DOMWindow.css('top', + settings.positionTop + shortcut.scrollOffsetHeight());
		};
		
		var showDOMWindow = function(instance){
			if(arguments[0]){
				$('.'+instance+' #DOMWindowLoader').remove();
				$('.'+instance+' #DOMWindowContent').fadeIn('fast',function(){if(settings.functionCallOnOpen){settings.functionCallOnOpen();}});
				$('.'+instance+ '.closeDOMWindow').click(function(){
					$.closeDOMWindow();	
					return false;
				});
			}else{
				$('#DOMWindowLoader').remove();
				$('#DOMWindow').fadeIn('fast',function(){if(settings.functionCallOnOpen){settings.functionCallOnOpen();}});
				$('#DOMWindow .closeDOMWindow').click(function(){						
					$.closeDOMWindow();
					return false;
				});
			}
			
		};
		
		var urlQueryToObject = function(s){
			  var query = {};
			  s.replace(/b([^&=]*)=([^&=]*)b/g, function (m, a, d) {
				if (typeof query[a] != 'undefined') {
				  query[a] += ',' + d;
				} else {
				  query[a] = d;
				}
			  });
			  return query;
		};
			
		//Run Routine ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
		var run = function(passingThis){
			
			//get values from element clicked, or assume its passed as an option
			settings.windowSourceID = $(passingThis).attr('href') || settings.windowSourceID;
			settings.windowSourceURL = $(passingThis).attr(settings.windowSourceAttrURL) || settings.windowSourceURL;
			settings.windowBGImage = settings.windowBGImage ? 'background-image:url('+settings.windowBGImage+')' : '';
			var urlOnly, urlQueryObject;
			
			if(settings.positionType == 'anchored'){//anchored DOM window
				
				var anchoredPositions = $(settings.anchoredSelector).position();
				var anchoredPositionX = anchoredPositions.left + settings.positionLeft;
				var anchoredPositionY = anchoredPositions.top + settings.positionTop;
				
				$('body').append('<div class="'+settings.anchoredClassName+'" style="'+settings.windowBGImage+';background-repeat:no-repeat;padding:'+settings.windowPadding+'px;overflow:auto;position:absolute;top:'+anchoredPositionY+'px;left:'+anchoredPositionX+'px;height:'+settings.height+'px;width:'+settings.width+'px;background-color:'+settings.windowBGColor+';border:'+settings.borderSize+'px solid '+settings.borderColor+';z-index:10001"><div id="DOMWindowContent" style="display:none"></div></div>');		
				//loader
				if(settings.loader && settings.loaderImagePath !== ''){
					$('.'+settings.anchoredClassName).append('<div id="DOMWindowLoader" style="width:'+settings.loaderWidth+'px;height:'+settings.loaderHeight+'px;"><img src="'+settings.loaderImagePath+'" /></div>');
					
				}

				if($.fn.draggable){
					if(settings.draggable){$('.' + settings.anchoredClassName).draggable({cursor:'move'});}
				}
				
				switch(settings.windowSource){
					case 'inline'://////////////////////////////// inline //////////////////////////////////////////
						$('.' + settings.anchoredClassName+" #DOMWindowContent").append($(settings.windowSourceID).children());
						$('.' + settings.anchoredClassName).unload(function(){// move elements back when you're finished
							$('.' + settings.windowSourceID).append( $('.' + settings.anchoredClassName+" #DOMWindowContent").children());				
						});
						showDOMWindow(settings.anchoredClassName);
					break;
					case 'iframe'://////////////////////////////// iframe //////////////////////////////////////////
						$('.' + settings.anchoredClassName+" #DOMWindowContent").append('<iframe frameborder="0" hspace="0" wspace="0" src="'+settings.windowSourceURL+'" name="DOMWindowIframe'+Math.round(Math.random()*1000)+'" style="width:100%;height:100%;border:none;background-color:#fff;" class="'+settings.anchoredClassName+'Iframe" ></iframe>');
						$('.'+settings.anchoredClassName+'Iframe').load(showDOMWindow(settings.anchoredClassName));
					break;
					case 'ajax'://////////////////////////////// ajax //////////////////////////////////////////	
						if(settings.windowHTTPType == 'post'){
							
							if(settings.windowSourceURL.indexOf("?") !== -1){//has a query string
								urlOnly = settings.windowSourceURL.substr(0, settings.windowSourceURL.indexOf("?"));
								urlQueryObject = urlQueryToObject(settings.windowSourceURL);
							}else{
								urlOnly = settings.windowSourceURL;
								urlQueryObject = {};
							}
							$('.' + settings.anchoredClassName+" #DOMWindowContent").load(urlOnly,urlQueryObject,function(){
								showDOMWindow(settings.anchoredClassName);
							});
						}else{
							if(settings.windowSourceURL.indexOf("?") == -1){ //no query string, so add one
								settings.windowSourceURL += '?';
							}
							$('.' + settings.anchoredClassName+" #DOMWindowContent").load(
								settings.windowSourceURL + '&random=' + (new Date().getTime()),function(){
								showDOMWindow(settings.anchoredClassName);
							});
						}
					break;
				}
				
			}else{//centered, fixed, absolute DOM window
				
				//overlay & modal
				if(settings.overlay){
					$('body').append('<div id="DOMWindowOverlay" style="z-index:10000;display:none;position:absolute;top:0;left:0;background-color:'+settings.overlayColor+';filter:alpha(opacity='+settings.overlayOpacity+');-moz-opacity: 0.'+settings.overlayOpacity+';opacity: 0.'+settings.overlayOpacity+';"></div>');
					if(shortcut.isIE6){//if IE 6
						$('body').append('<iframe id="DOMWindowIE6FixIframe"  src="blank.html"  style="width:100%;height:100%;z-index:9999;position:absolute;top:0;left:0;filter:alpha(opacity=0);"></iframe>');
						sizeIE6Iframe();
					}
					sizeOverlay();
					var $DOMWindowOverlay = $('#DOMWindowOverlay');
					$DOMWindowOverlay.fadeIn('fast');
					if(!settings.modal){$DOMWindowOverlay.click(function(){$.closeDOMWindow();});}
				}
				
				//loader
				if(settings.loader && settings.loaderImagePath !== ''){
					$('body').append('<div id="DOMWindowLoader" style="z-index:10002;width:'+settings.loaderWidth+'px;height:'+settings.loaderHeight+'px;"><img src="'+settings.loaderImagePath+'" /></div>');
					centerLoader();
				}

				//add DOMwindow
				$('body').append('<div id="DOMWindow" style="background-repeat:no-repeat;'+settings.windowBGImage+';overflow:auto;padding:'+settings.windowPadding+'px;display:none;height:'+settings.height+'px;width:'+settings.width+'px;background-color:'+settings.windowBGColor+';border:'+settings.borderSize+'px solid '+settings.borderColor+'; position:absolute;z-index:10001"></div>');
				
				var $DOMWindow = $('#DOMWindow');
				//centered, absolute, or fixed
				switch(settings.positionType){
					case 'centered':
						centerDOMWindow();
						if(settings.height + 50 > shortcut.viewPortHeight()){//added 50 to be safe
							$DOMWindow.css('top', (settings.fixedWindowY + shortcut.scrollOffsetHeight()) + 'px');
						}
					break;
					case 'absolute':
						$DOMWindow.css({'top':(settings.positionTop+shortcut.scrollOffsetHeight())+'px','left':(settings.positionLeft+shortcut.scrollOffsetWidth())+'px'});
						if($.fn.draggable){
							if(settings.draggable){$DOMWindow.draggable({cursor:'move'});}
						}
					break;
					case 'fixed':
						fixedDOMWindow();
					break;
					case 'anchoredSingleWindow':
						var anchoredPositions = $(settings.anchoredSelector).position();
						var anchoredPositionX = anchoredPositions.left + settings.positionLeft;
						var anchoredPositionY = anchoredPositions.top + settings.positionTop;
						$DOMWindow.css({'top':anchoredPositionY + 'px','left':anchoredPositionX+'px'});
								
					break;
				}
				
				$(window).bind('scroll.DOMWindow',function(){
					if(settings.overlay){sizeOverlay();}
					if(shortcut.isIE6){sizeIE6Iframe();}
					if(settings.positionType == 'centered'){centerDOMWindow();}
					if(settings.positionType == 'fixed'){fixedDOMWindow();}
				});

				$(window).bind('resize.DOMWindow',function(){
					if(shortcut.isIE6){sizeIE6Iframe();}
					if(settings.overlay){sizeOverlay();}
					if(settings.positionType == 'centered'){centerDOMWindow();}
				});
				
				switch(settings.windowSource){
					case 'inline'://////////////////////////////// inline //////////////////////////////////////////
						$DOMWindow.append($(settings.windowSourceID).children());
						$DOMWindow.unload(function(){// move elements back when you're finished
							$(settings.windowSourceID).append($DOMWindow.children());				
						});
						showDOMWindow();
					break;
					case 'iframe'://////////////////////////////// iframe //////////////////////////////////////////
						$DOMWindow.append('<iframe frameborder="0" hspace="0" wspace="0" src="'+settings.windowSourceURL+'" name="DOMWindowIframe'+Math.round(Math.random()*1000)+'" style="width:100%;height:100%;border:none;background-color:#fff;" id="DOMWindowIframe" ></iframe>');
						$('#DOMWindowIframe').load(showDOMWindow());
					break;
					case 'ajax'://////////////////////////////// ajax //////////////////////////////////////////
						if(settings.windowHTTPType == 'post'){
							
							if(settings.windowSourceURL.indexOf("?") !== -1){//has a query string
								urlOnly = settings.windowSourceURL.substr(0, settings.windowSourceURL.indexOf("?"));
								urlQueryObject = urlQueryToObject(settings.windowSourceURL);
							}else{
								urlOnly = settings.windowSourceURL;
								urlQueryObject = {};
							}
							$DOMWindow.load(urlOnly,urlQueryObject,function(){
								showDOMWindow();
							});
						}else{
							if(settings.windowSourceURL.indexOf("?") == -1){ //no query string, so add one
								settings.windowSourceURL += '?';
							}
							$DOMWindow.load(
								settings.windowSourceURL + '&random=' + (new Date().getTime()),function(){
								showDOMWindow();
							});
						}
					break;
				}
				
			}//end if anchored, or absolute, fixed, centered
			
		};//end run()
		
		if(settings.eventType){//if used with $().
			return this.each(function(index){				  
				$(this).bind(settings.eventType,function(){
					run(this);
					return false;
				});
			});	
		}else{//else called as $.function
			run();
		}
		
	};//end function openDOMWindow
	
	//allow for public call, pass settings
	$.openDOMWindow = function(s){$.fn.openDOMWindow(s);};
	
})(jQuery);
/* from: http://www.batanga.com/login/js/mainLogin.js 20/11/2009 07:40:08 p.m. */
// var xmlObjLogin = null;
var batangaLoginDebug = 0;
var rememberMe = $("#rememberme:checked").length>0;
if (typeof wwwSiteRoot == "undefined")
    wwwSiteRoot = "http://www.batanga.com";

UrlRegistrationHelper = wwwSiteRoot  + "/login/registrationhelper.aspx";  
UrlExternalLogin = wwwSiteRoot  + "/login/externalLoginOp.aspx";  
UrlExternalRegLogout = wwwSiteRoot  + "/login/externalRegLogoutOp.aspx";  
UrlProgressImage = wwwSiteRoot + "/images/indicator.gif";

//////////////////// UI ///////////////////////////////////
function showMsg(msg){
    $(".error_msg").show();
    $(".error_msg").text(msg);
}

function clearPassword() {
    $("#password").val("");
    $("#loginpassword").val("");
    $("#password_again").val("");
}


function ShowSuccessMessage()
{
/*
    $("#reg").hide();
    parent.$("#DOMWindow").animate({
		height:190
		});    
    $("#regokbox").show();
    */
    $("#reg").hide();
    $("#regokbox").show();
    reg2log('self');
} 

////////////////////////////////////////////////////////////



/////////////// LOGIN ///////////////////////////////////////
function executeLogin(email,password) {
    if (!email)
        return;
        
    rememberMe = $("#rememberme:checked").length>0;
    parameters = "email=" + email;
    parameters = parameters + "&password=" + password;
    parameters = parameters + "&op=loginuser";
    var callingError = !areWeSameDomain();
    try {
        if (!callingError)
            $.post(UrlRegistrationHelper,parameters,function(data,textstatus) {RetrieveLoginCallBack(data,textstatus,email,password); },"xml");
    } catch (loginException) {
       callingError = true; 
    }
    if (callingError && top == self)
        dropIframeForExternalOperation(UrlExternalLogin+ "?email="+email+"&password="+password);        

}

function doLogin(idEmail, idPassword)
{
	if (idEmail == null) idEmail = "loginemail";
	if (idPassword == null) idPassword = "loginpassword";

	if ($("#"+idEmail).length == 0) idEmail = "email";
	if ($("#"+idPassword).length == 0) idPassword = "password";

	var email = $("#"+idEmail).val();
    email = $.trim(email);

    var password = $("#"+idPassword).val();    	
    var parameters;
    executeLogin(email,password);
}

function RetrieveLoginCallBack(data,textstatus,email,password) 
{
    if (textstatus == "success") {
        
        if(batangaLoginDebug == 1)
        	console.log(data);
        
        var status = $("status",data).text();//getTagValue(outputText, "status");
        
        if(status == "1")
        {
            FinalizeLogin(data);
        }
        else if (top==self) {
            showLoginDialog(email,password);
        } else {
            clearPassword();
            if (status == "-1")
            {
                //Should not happen anymore
                //ShowPendingConfirmation();
            }
            else if(status == "-2")
            {
                //Should not happen anymore
                //ShowPendingConfirmation();
            }
            else if(status == "-3")
            {
                showMsg(wrongC);
            }
            else
            {
               var message = $("errormessage",data).text();//getTagValue(outputText, "errormessage");        
                showMsg(message);                          
            }            
        }
    }
} 


function doForgotPassword(){

    var email = $("#email").val();

    parameters = "email=" + email;
    parameters = parameters + "&op=forgotpassword";

    $.post(UrlRegistrationHelper,parameters,function(data,textstatus) {ForgotPasswordCallBack(data,textstatus); },"xml");

}

function ForgotPasswordCallBack(data,textstatus){

    if (textstatus == "success") {
        
        if(batangaLoginDebug == 1)
        	console.log(data);
        
        var status = $("status",data).text();//getTagValue(outputText, "status");
        
        if(status == "1")
        {
            ShowPasswordSent();
        } else {
            if (status == "-1")
            {
                //Should not happen anymore
                //ShowPendingConfirmation();
            }
            else if(status == "-2")
            {
                showMsg(noUser);
            }
            else if(status == "-3")
            {
                showMsg(wrongC);
            }
            else
            {
               var message = $("errormessage",data).text();//getTagValue(outputText, "errormessage");        
                showMsg(message);                          
            }            
        }
    }

}

function ShowPasswordSent(){

			$("#forgot_p").hide("fast",function(){
			
				$("#sent_ok").show();
				
			});	


}

var keepWindowOpenAfterLogin = false;
function FinalizeLogin(data)
    {
        if(batangaLoginDebug == 1)
            console.log(data);
        var nDays = 0; //session
        if (rememberMe) nDays = 30;
        setCookieD("batangacom", $("email",data).text(),nDays);
        setCookieD("batangakey", $("batangakey", data).text(),nDays);
        setCookieD("mcim", $("mcim", data).text(),nDays);
        setCookieD("DJScreenName", $("displayname", data).text(),nDays);
        setCookieD("batangausername", $("username", data).text(),nDays);
        setCookieD("batangauserid", $("userid", data).text(),nDays);
        setCookieD("avatarurl", $("avatarurl", data).text(),nDays);
        
/*        setupCookie("email", "batangacom", data);
        setupCookie("batangakey", "batangakey", data);
        setupCookie("mcim", "mcim", data);
        setupCookie("displayname", "DJScreenName", data);
        setupCookie("username", "batangausername", data);
        setupCookie("userid", "batangauserid", data);
        setupCookie("avatarurl", "avatarurl", data);
  */      
        //setup the pluck hd cookie.
        userName = $("username", data).text();//getTagValue(data, "username");
        email = $("email",data).text();//getTagValue(data, "email");
        displayName = $("displayname", data).text(); //getTagValue(data, "displayname");
        //remove any <![CDATA[]]>  and just extract the data inside....
        var re = /(<!\[CDATA\[)(.+)(\]\]>)/;
        displayName = displayName.replace(re, "$2");
    
        plckHdCookie = escape(userName) + "|" + escape(displayName) + "|1|" + escape(email);
        setCookieD("hd", plckHdCookie, null,nDays);        
        
        /*if ($("#regProfileLink").length>0) {
            var cL = $("#regProfileLink")[0].href;
            cL = cL.replace(/\?userid=/,"?userid="+userName+"&");
            $("#regProfileLink")[0].href = cL;
        }*/
        
        try {
            top.updateNewMenuTopBar2008();
            
        } catch(exLCB) {}
        try {
            top.loginCallBack ();
            
        } catch(exLCB2) {}
/*        if(loginCallBack != null && (typeof loginCallBack == 'function'))
        {                
            loginCallBack();
        }                
        else*/ 
        if(batangaLoginDebug == 1)       
        {
            console.log("no login callback defined");
        }
       if (top != self && !keepWindowOpenAfterLogin)
            parent.closeLogin();
        //closeModalDialogs();
        //authenticated successfully! 
 }
    
 ////////////////////////////////////////////////////////////////
 
 
 /////////////////// SIGN UP /////////////////////////////////////////////   
 
 function doNewUserSignup(){
        //var language=getLanguage();
/*        xmlObjSignUp=CreateAJAXRequest();
        if(xmlObjSignUp==null)
        return;
*/
        var email=$("#email").val();
        var password=$("#password").val();
        var year=$("select#yearofb option:selected").val();        
        var gender=$("input:radio[name=sex]:checked").val();
          
        var newsLetterSignup="0";
             
        if ($(".newsletter").is(":checked")) newsLetterSignup="1";



        var parameters;

        parameters="email="+email;
        parameters=parameters+"&password="+password;

        parameters=parameters+"&gender="+gender;

        parameters=parameters+"&year="+year;

        parameters=parameters+"&signupReferrer="+escape(top.location.href);

        parameters=parameters+"&newslettersignup="+newsLetterSignup;
        parameters=parameters+"&op=signupuser";

        if(batangaLoginDebug==1)
        alert("UrlRegistrationHelper = "+UrlRegistrationHelper+", parameters = "+parameters);
        
        $.post(UrlRegistrationHelper,parameters,function(data,textstatus) {SignupUserCallback(data,textstatus,email,password); },"xml");
        
/*        xmlObjSignUp.open("POST",UrlRegistrationHelper,true);
        xmlObjSignUp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
        xmlObjSignUp.setRequestHeader("Content-length",parameters.length);
        xmlObjSignUp.onreadystatechange=SignupUserCallback;
        xmlObjSignUp.send(parameters);*/
} 



function SignupUserCallback(data,textstatus,email,password){
    //var outputText;
    if(batangaLoginDebug==1){
        console.log(data);
    }

    if (textstatus == "success") {
        var status= $("status",data).text();
        
       
        if(status=="1"){
            try{
            top.OmnitureSignUpStart("MyBatangaRegistrationCompleted");
            }catch(OmnE){}
            ShowSuccessMessage();
            top.loginCallBack  = function() {parent.updateNewMenuTopBar2008()};
            keepWindowOpenAfterLogin = true;
            executeLogin(email,password);
        } else {
            
            
            var reason=$("errormessage",data).text();//getTagValue(outputText,"errormessage");
            showMsg(reason);
            
            if(batangaLoginDebug==1)  alert("failed reason = "+reason);

/*            if(document.getElementById("signupEmail")!=null) {
            document.getElementById("signupEmail").focus();
            document.getElementById("signupEmail").select();
            }*/
            
            }
            //xmlObjSignUp=null;
      }
} 


		 		



// JScript File

function openBox(url,DMWboxW, DMWboxH){
	
		$.openDOMWindow({
			overlayOpacity:'65',
			borderColor:'#AEAF49',
			windowPadding:5,
			height:DMWboxH,
			width:DMWboxW,
			loaderImagePath:wwwSiteRoot+'/images/loading.gif', 
			windowSource:'iframe',
			windowSourceURL:url,
            functionCallOnOpen:function(){            
            $("#DOMWindow").css('overflow','hidden');
            $("DOMWindowIframe").css('overflow','hidden');            
            $("#DOMWindowOverlay").css('zIndex','100000000');	
            $("#DOMWindow").css('zIndex','100000001');			
            }

		}); 	

	}


function showLoginDialog(email,password) {
    var loginUrl = wwwSiteRoot+'/login/login.aspx';
    if (email)
        loginUrl += "?email="+escape(email)+"&password="+escape(password);
	openBox(loginUrl, 350, 300);

	//return false;
	
}

function showLoginDialogSmall() {
    var loginUrl = wwwSiteRoot+'/login/login.aspx?smallversion=true';
	openBox(loginUrl, 290, 240); 
	//return false;
	
}

		
function signupUser() {
    openBox(wwwSiteRoot+'/login/reg.aspx', 380, 450); 
    //return false;
}


function ShowActivatedConfirmation() {
    openBox(wwwSiteRoot+'/login/welcome.aspx?userid='+getCookie("batangausername"), 400, 200); 
    //return false;
}

function signupUserSmall() {
    openBox(wwwSiteRoot+'/login/reg.aspx?smallversion=true', 340, 400); 
    //return false;
}


function closeLogin(){		
    $.closeDOMWindow();
}

//This is used on the external page
function SubmitForLogin(evt, id)
{	
    if (evt.keyCode == 13) //enter key
    {
        if(batangaLoginDebug == 1)
            alert("SubmitForLogin:id=" + id);
            
        if(id == 1)
	        doLogin();
	    else if(id == 2)
	           doForgotPassword();
	    else if(id == 3)
	           doNewUserSignup();
	    else if(id == 4)
	           doUpdateUserProfile();
	    else if(id == 5)
	        ConfirmAccountPassword();
    }   
    else
    {
        //closeTag('Err-Message');
    }
}


/////////////////////////////////////////////////////////////////
   
///////////////////// LOG OUT //////////////////////////////////

function basicLogout()
{
    var email = getCookie("batangacom");
    setCookieD("batangakey", "", -1);
    setCookieD("mcim", "", -1);
    setCookieD("batangacom", "", -1);
    setCookieD("imageUrl", "", -1);
    
    //remove the pluck cookie as well
    setCookieD("hd", "", -1);

/*    if(isDownTimePeriod())
    {
        alert(GetDownTimeMessage());
        return;
     }
*/        
    registerLogOut(email);

/*
    xmlObjLogout = CreateAJAXRequest();
	if(xmlObjLogout == null)
	    return;		      
    
            
    
    if(batangaLoginDebug == 1)
	    alert("UrlRegistrationHelper = " + UrlRegistrationHelper + ", parameters = " + parameters);
    	    
	xmlObjLogout.open("POST", UrlRegistrationHelper, true);  						
	xmlObjLogout.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");				
	xmlObjLogout.setRequestHeader("Content-length", parameters.length);				
	xmlObjLogout.onreadystatechange = RetrieveLogout;
	xmlObjLogout.send(parameters);*/
}   
    
/*    function RetrieveLogout() {
        if ((xmlObjLogout != null) && (xmlObjLogout.readyState == 4) && (xmlObjLogout.status == 200))
        { 
        
            outputText = xmlObjLogout.responseText;  		//get the reesponse from the web service
            xmlObjLogout = null;    
            outputText = decode(outputText);
            //alert(outputText);
        }    
    }
*/  

function registerLogOut(email) {
    var parameters;
    parameters = "email=" + email;
    parameters = parameters + "&op=logoutuser";
    var callingError = !areWeSameDomain();
    try {
        if (!callingError)
            $.post(UrlRegistrationHelper,parameters,logoutCallBack);//,function(data,textstatus) {RetrieveLogout(); },"xml");
    } catch (loginException) {
       callingError = true; 
    }
    if (callingError && top == self)
            dropIframeForExternalOperation(UrlExternalRegLogout+"?email="+email); 

}  

var logoutCallBack = function() {}

function Logout()
{
    logoutCallBack = reloadThePage;
    basicLogout();
}

if (typeof localLogout == "undefined")
    localLogout = Logout;

function reloadThePage() {
    //document.location.reload();
    var currentLoc = document.location.href.split("#")[0];
    document.location.href = currentLoc;
}
    
/////////////////////////////////////////////////////////////////
///**** EXTERNAL OPS ********************//////////////////////
/////////////////////////////////////////////////////////////////

function areWeSameDomain() {
    if (UrlRegistrationHelper.indexOf("/")==0)
        return true;
    var hostName = UrlRegistrationHelper.substr(0,UrlRegistrationHelper.indexOf("/",10)); //not use initial http://...
    var currentLoc = location.href;
    return hostName.length>0 && currentLoc.indexOf(hostName) >= 0;
}

function dropIframeForExternalOperation(url) {
    var c = document.getElementById("loginExOperDiv");
    if(!c) {
        var c = document.createElement("div");
        c.id = "loginExOperDiv";
        c.style.width = "0px";
        c.style.height = "0px";
        c.style.overflow = "hidden";
        document.body.appendChild(c);
    }

    frameContainer = document.createElement("iframe");
    frameContainer.width = 1;
    frameContainer.height = 1;
    frameContainer.src = url;
    if (c)
        c.appendChild(frameContainer);
}/* from: http://myradio.batanga.com/include/xmlwriter.js 20/11/2009 07:40:08 p.m. */
function XMLWriter()
{
    this.XML=[];
    this.Nodes=[];
    this.State="";
    this.FormatXML = function(Str)
    {
        if (Str)
            return Str.replace(/&/g, "&amp;").replace(/\"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
        return ""
    }
    this.BeginNode = function(Name)
    {
        if (!Name) return;
        if (this.State=="beg") this.XML.push(">");
        this.State="beg";
        this.Nodes.push(Name);
        this.XML.push("<"+Name);
    }
    this.EndNode = function()
    {
        if (this.State=="beg")
        {
            this.XML.push("/>");
            this.Nodes.pop();
        }
        else if (this.Nodes.length>0)
            this.XML.push("</"+this.Nodes.pop()+">");
        this.State="";
    }
    this.Attrib = function(Name, Value)
    {
        if (this.State!="beg" || !Name) return;
        this.XML.push(" "+Name+"=\""+this.FormatXML(Value)+"\"");
    }
    this.WriteString = function(Value)
    {
        if (this.State=="beg") this.XML.push(">");
        this.XML.push(this.FormatXML(Value));
        this.State="";
    }
    this.Node = function(Name, Value)
    {
        if (!Name) return;
        if (this.State=="beg") this.XML.push(">");
        this.XML.push((Value=="" || !Value)?"<"+Name+"/>":"<"+Name+">"+this.FormatXML(Value)+"</"+Name+">");
        this.State="";
    }
    this.Close = function()
    {
        while (this.Nodes.length>0)
            this.EndNode();
        this.State="closed";
    }
    this.ToString = function(){return this.XML.join("");}
}/* from: http://widgets.batanga.com/scripts/widgets.js 20/11/2009 07:40:08 p.m. */

    var offsetFromTop = 10;    
    
    document.write("<div id=\"widgetModal-Background\" class=\"widgetModalBackground\" style=\"display:none;\"></div>");            
    document.write("<div id=\"modal-widgetBox\" class=\"widgetBox\" style=\"display:none;\"></div>");            
    
    var widgetsImagesDomain;
    
    //widgetsImagesDomain = ".";
    //widgetsImagesDomain  = "http://stagingwidgets.batanga.com";    
    widgetsImagesDomain  = "http://widgets.batanga.com";    
    
    var widgetsCode = new Array();
    var widgetsTitle = new Array();
    var widgetsImageName = new Array();
    
    function PadDigits(n, totalDigits) 
    { 
        n = n.toString(); 
        var pd = ''; 
        if (totalDigits > n.length) 
        { 
            for (i=0; i < (totalDigits-n.length); i++) 
            { 
                pd += '0'; 
            } 
        } 
        return pd + n.toString(); 
    } 

    
    function getRandom()
    {
        var ranNum= Math.floor(Math.random()*1000000);
        return ranNum;
    }

    function populateWidgetsArray()
    {
        var now = new Date();
        var uniqueID = new String();
        
        uniqueID = PadDigits(now.getMonth() + 1, 2).toString() + PadDigits(now.getDate(), 2).toString()  + now.getFullYear().toString() + PadDigits(now.getHours(), 2).toString() + PadDigits(now.getMinutes(), 2).toString() + PadDigits(now.getSeconds(), 2).toString() + PadDigits(getRandom(), 6).toString();
        //alert(uniqueID);
    
        widgetsCode[0] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/reggaeton.widget?uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63228&promo=100000 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Reggaeton Radio</a>';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=0 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[0] = widgetsCode[0] + '</div>'
        widgetsTitle[0] = "Reggaeton";
        widgetsImageName[0] = "reggaeton.gif";
        
        widgetsCode[1] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/top40.widget?uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63845&promo=100001 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Top40 Radio</a>';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=1 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[1] = widgetsCode[1] + '</div>'
        widgetsTitle[1] = "Top 40";
        widgetsImageName[1] = "top40.gif";
      
        widgetsCode[2] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/pop.widget?uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63839&promo=100002 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Pop Radio</a>';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=2 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[2] = widgetsCode[2] + '</div>'
        widgetsTitle[2] = "Pop";
        widgetsImageName[2] = "pop.gif";
        
        widgetsCode[3] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/iluvbatanga.widget?uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63839&promo=100003 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Pop Radio</a>';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=3 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[3] = widgetsCode[3] + '</div>'
        widgetsTitle[3] = "I Love Batanga!";
        widgetsImageName[3] = "iluvbatanga.gif";

        widgetsCode[4] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/batanguero.widget?uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63845&promo=100004 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Top40 Radio</a>';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=4 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[4] = widgetsCode[4] + '</div>'
        widgetsTitle[4] = "I am Batanguero!";
        widgetsImageName[4] = "batanguero.gif";
        
    }
    
    /*
    function populateWidgetsArray(id)
    {
        var now = new Date();
        var uniqueID = new String();
        
        uniqueID = PadDigits(now.getMonth() + 1, 2).toString() + PadDigits(now.getDate(), 2).toString()  + now.getFullYear().toString() + PadDigits(now.getHours(), 2).toString() + PadDigits(now.getMinutes(), 2).toString() + PadDigits(now.getSeconds(), 2).toString() + PadDigits(getRandom(), 6).toString();
        //alert(uniqueID);
    
        widgetsCode[0] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/reggaeton.widget?orginationid=' + id + '&uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63228&promo=100000 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Reggaeton Radio</a>';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[0] = widgetsCode[0] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=0 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[0] = widgetsCode[0] + '</div>'
        widgetsTitle[0] = "Reggaeton";
        widgetsImageName[0] = "reggaeton.gif";
        
        widgetsCode[1] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/top40.widget?orginationid=' + id + '&uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63845&promo=100001 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Top40 Radio</a>';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[1] = widgetsCode[1] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=1 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[1] = widgetsCode[1] + '</div>'
        widgetsTitle[1] = "Top 40";
        widgetsImageName[1] = "top40.gif";
      
        widgetsCode[2] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/pop.widget?orginationid=' + id + '&uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63839&promo=100002 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Pop Radio</a>';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[2] = widgetsCode[2] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=2 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[2] = widgetsCode[2] + '</div>'
        widgetsTitle[2] = "Pop";
        widgetsImageName[2] = "pop.gif";
        
        widgetsCode[3] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/iluvbatanga.widget?orginationid=' + id + '&uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63839&promo=100003 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Pop Radio</a>';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[3] = widgetsCode[3] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=3 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[3] = widgetsCode[3] + '</div>'
        widgetsTitle[3] = "I Love Batanga!";
        widgetsImageName[3] = "iluvbatanga.gif";

        widgetsCode[4] = '<div style="width:150px; height:150px; background-image:url(' + widgetsImagesDomain + '/stations/en/batanguero.widget?orginationid=' + id + '&uid=' + uniqueID + '); overflow:hidden">';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://myradio.batanga.com/Player/player.aspx?PlaylistID=63845&promo=100004 style="display:block; height:125px; padding-left:150px; overflow:hidden">Batanga Top40 Radio</a>';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://www.batanga.com style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga.com</a>';
        widgetsCode[4] = widgetsCode[4] + '<a target="_blank" href=http://widgets.batanga.com/default.aspx?id=4 style="display:block; float:left; padding-top:25px; width:75px; overflow:hidden">Batanga Widgets - Share Me</a>';
        widgetsCode[4] = widgetsCode[4] + '</div>'
        widgetsTitle[4] = "I am Batanguero!";
        widgetsImageName[4] = "batanguero.gif";
        
    }
    */

    function showwidgets(width)
    {
        ShowHideObjects("hidden");
        
        var dlg_background  = document.getElementById("widgetModal-Background");
        
        dlg_background.style.width = Math.max(document.documentElement.scrollWidth, document.body.scrollWidth) + "px";        
        dlg_background.style.height = Math.max(document.documentElement.scrollHeight, document.body.scrollHeight) + "px";
        dlg_background.style.display = "";
        
    	var widgetBox = document.getElementById("modal-widgetBox");
    	widgetBox.style.width = width + "px";
    	widgetBox.innerHTML = getwidgetscode(true);
		
		widgetBox.style.top = document.body.scrollTop + offsetFromTop + "px";		
		widgetBox.style.left = (document.body.clientWidth / 2 ) - (width / 2) + "px";
		
		widgetBox.style.display = "";
    }
    

    function PickThisWidget(widgetIndex)
    {
    
        if(widgetIndex >= widgetsCode.length) return;
        
        var pickedWidget = document.getElementById("pickawidget");
        pickedWidget.src = widgetsImagesDomain + "/stations/en/" + widgetsImageName[widgetIndex] ;
        
        var widgetCodeTextArea = document.getElementById("widgetCodeTextArea");
        if(document.all)        //IE
            widgetCodeTextArea.innerText = widgetsCode[widgetIndex];
        else                    //FF
            widgetCodeTextArea.textContent  = widgetsCode[widgetIndex];            
        
        var widgetTitle = document.getElementById("widgetTitle");
        widgetTitle.value = widgetsTitle[widgetIndex];
        
    }
    
    function closeWidgets()
    {
        ShowHideObjects("visible");
	    
	    closeTag("widgetModal-Background");
	    closeTag("modal-widgetBox");
    }
    
    function getwidgetscode(showclose)
    {
        var widgetHTML;
        
        populateWidgetsArray();
        
        widgetHTML =  "<div class=\"widgetBoxContentFrame\" style=\"background-image:url(" +  widgetsImagesDomain + "/images/background.jpg" + ");\">";                
        
        if(showclose)
            widgetHTML = widgetHTML  + "<a style=\"float:right;font-size:10px;\" href=# onclick=\"closeWidgets();\"><span class=\"widgetFont\">close</span></a>";            
                
            widgetHTML =  widgetHTML + "<div style=\"text-align:left;padding-top:95px;padding-bottom:10px;padding-left:35px;padding-right:30px\">";                            
            //widgetHTML =  widgetHTML + "<div style=\"text-align:left;padding-top:15px;padding-bottom:10px;padding-left:35px;padding-right:30px\">";                            
                //widgetHTML = widgetHTML  + "<img style=\"padding-left:5px;padding-bottom:5px;\" border=0 src=" + widgetsImagesDomain + "/images/widgets_logo.jpg>";
                widgetHTML  = widgetHTML   + "<table border=0  cellpadding=0>";	    			                
                widgetHTML  = widgetHTML  + "<tr>";
                    widgetHTML  = widgetHTML  + "<td valign=top>";
                        widgetHTML  = widgetHTML   + "<table valign=top border=0 cellpadding=0 cellspacing=5 >";	    
                            widgetHTML  = widgetHTML  + "<tr valign=top>";
                                widgetHTML  = widgetHTML  + "<td colspan=3 valign=top>";
                                    widgetHTML  = widgetHTML  + "<span class=\"widgetFont\">1. Pick a widget.</span>";
                                widgetHTML  = widgetHTML  + "</td>";
                            widgetHTML  = widgetHTML  + "</tr>";
                            widgetHTML  = widgetHTML  + "<tr>";
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(0);\"><img border=0  valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/reggaeton.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(1);\"><img border=0 valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/top40.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(2);\"><img border=0 valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/pop.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                            widgetHTML  = widgetHTML  + "</tr>";
                            widgetHTML  = widgetHTML  + "<tr>";
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(3);\"><img border=0 valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/iluvbatanga.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(4);\"><img border=0 valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/batanguero.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                                /*
                                widgetHTML  = widgetHTML  + "<td>";
                                    widgetHTML  = widgetHTML  + "<a href=\"#\" onclick=\"PickThisWidget(5);\"><img border=0 valign=top height=50 width=50 src=" + widgetsImagesDomain + "/stations/en/rock.gif></a>";
                                widgetHTML  = widgetHTML  + "</td>";
                                */
                            widgetHTML  = widgetHTML  + "</tr>";
                            widgetHTML  = widgetHTML  + "<tr>";
                                widgetHTML  = widgetHTML  + "<td colspan=3>";
                                    widgetHTML  = widgetHTML  + "<input id=widgetTitle style=\"font-size:11px;\" readonly value=\"-----------------------------------------\">";
                                widgetHTML  = widgetHTML  + "</td>";
                            widgetHTML  = widgetHTML  + "</tr>";
                        widgetHTML = widgetHTML  + "</table>";
                    widgetHTML  = widgetHTML  + "</td>";
                    widgetHTML  = widgetHTML  + "<td>";
                        widgetHTML  = widgetHTML  + "<img border=0 id=pickawidget valign=top src=" + widgetsImagesDomain + "/stations/en/pickawidget.jpg />";                        
                    widgetHTML  = widgetHTML  + "</td>";
                widgetHTML  = widgetHTML  + "</tr>";
                widgetHTML  = widgetHTML  + "<tr>";
                    widgetHTML  = widgetHTML  + "<td colspan=3>";
                        widgetHTML  = widgetHTML  + "<span class=\"widgetFont\">2. Copy this code into your blog, myspace or myBatanga page to share your favorite music with your friends!</span>";
                        widgetHTML  = widgetHTML  + "<br><textarea onclick=\"javascript:copyToClipboard('widgetCodeTextArea'); return false;\" readonly rows=3 cols=50 id=widgetCodeTextArea style=\"font-size:11px;overflow: scroll;overflow-y: scroll;overflow-x: hidden;overflow:-moz-scrollbars-vertical;\"></textarea>";
                    widgetHTML  = widgetHTML  + "</td>";
                widgetHTML  = widgetHTML  + "</tr>";
                widgetHTML = widgetHTML  + "</table>";
            widgetHTML = widgetHTML  + "</div>";      
        widgetHTML = widgetHTML  + "</div>";      
    
        return widgetHTML;      
    }
 /* from: http://www.batanga.com/menu/hideFunctions.js 20/11/2009 07:40:08 p.m. */
var newMenuhideMaliciousObjectsTimer;

//// PLAYER

function hideWindowsMediaPlayer() {
    try {
    var browserName=navigator.appName; 
    if (browserName=="Microsoft Internet Explorer" && document.getElementById("WMPlayer") != null)
    { document.getElementById("playerdiv").style.visibility = "hidden";} } 
    catch(err) {}
}

function showWindowsMediaPlayer() {
	try {document.getElementById("playerdiv").style.visibility = "visible";} catch(err) {}
}


//// FLASH ADS
var newMenuobjectsToHide = new Array(); 

function newMenuhideMaliciousObjects()
{	    
    newMenuShowHideAllTags("object", "hidden");
    var browserName=navigator.appName; 
    if (browserName!="Microsoft Internet Explorer")
        newMenuShowHideAllTags("embed", "hidden");
    //ShowHideAllTags("img", "hidden");
    
    clearTimeout(newMenuhideMaliciousObjectsTimer);
//    hideMaliciousObjectsTimer = setTimeout("newMenuhideMaliciousObjects()", 200);
}

function newMenuShowHideObjects(displayStyle,position)
{		    
    if(displayStyle == "hidden")
    {
        //newMenuobjectsToHide = new Array(); 
        //newMenuhideMaliciousObjectsTimer = setTimeout("newMenuhideMaliciousObjects()", 200);
    }
    
    if(displayStyle == "visible")
    {	    
        //clearTimeout(newMenuhideMaliciousObjectsTimer);
    }
    
    var browserName=navigator.appName; 
    if (browserName!="Microsoft Internet Explorer")
        newMenuShowHideAllTags("embed", displayStyle,position);
    newMenuShowHideAllTags("object", displayStyle,position);
    newMenuShowHideAllTags("iframe", displayStyle,position);
    //ShowHideAllTags("iframe", displayStyle);
    //ShowHideAllTags("img", displayStyle);	    
}

function newMenuIsHiddenByMeObject(id)
{
    try {
        for(var i = 0; i < newMenuobjectsToHide.length; i++)
        {
//            alert(newMenuobjectsToHide[i]+ " " + id);
            if(newMenuobjectsToHide[i] == id)
                return true;
        }
    } catch (e) {}
    return false;
}

function newMenuShowHideAllTags(objectType, displayStyle,position)
{
    var objects = document.getElementsByTagName(objectType); 
//    alert(displayStyle);
    for (var i = 0; i < objects.length; i++)
    { 
        //if(displayStyle == "hidden"  && objects[i].style.visibility != "hidden" && !IsHiddenByMeObject(objects[i].getAttribute('id')))
        if(
        displayStyle == "hidden"  && 
        //objects[i].getAttribute('wmode')!=null && 
        objects[i].getAttribute('wmode')!="opaque" && 
        //objects[i].getAttribute('wmode')!="transparent" && 
        isAdInDangerousPosition(objects[i],position) &&
        objects[i].style.visibility != "hidden" )
        {
            //alert("ShowHideAllTags:Hiding...visiblity=" + objects[i].style.visibility + ", id = " + objects[i].getAttribute('id') + ", objectsToHide.length = " + objectsToHide.length);
            newMenuobjectsToHide[newMenuobjectsToHide.length] = objects[i].getAttribute('id')+"_"+objectType;            
            objects[i].style.visibility = displayStyle;     
            //alert(objects[i].getAttribute('wmode')+" "+objects[i].getAttribute('id')+" "+objects[i].innerHTML);
        }
        else if(displayStyle == "visible" && newMenuIsHiddenByMeObject(objects[i].getAttribute('id')+"_"+objectType))
        {
            //alert("ShowHideAllTags:visbile...visiblity=" + objects[i].style.visibility + ", id = " + objects[i].getAttribute('id'));            
            objects[i].style.visibility = displayStyle;           
            //alert("ShowHideAllTags:visbile...visiblity=" + objects[i].style.visibility + ", wmode= "+ objects[i].getAttribute('wmode')+" "+objects[i].getAttribute('id')+" "+objects[i].innerHTML);
        }        
        
    }
//    if (displayStyle == "visible")
//        newMenuobjectsToHide = new Array();
    //alert(newMenuobjectsToHide.length);
}

function isAdInDangerousPosition(object,position) {
    var i = 0;
    var parent = object.parentNode;
    try {
    while (i<6 && parent!=null && 
        parent.getAttribute("id") != "ad-"+position)
    {
        i++;
        parent = parent.parentNode;
        //alert(parent.getAttribute("id"));
    }
        return  (parent.getAttribute("id") == "ad-"+position);
    } catch(e) {
        return false;
    } 
}

///// SHOW RADIO BOX

	var sshow = false;
	var stimeout;
	function showRadioMenu()
	{
	    if (document.getElementById('pos-Middle1')==null) {
            newMenuShowHideObjects("hidden","Right");
        } else {
            newMenuShowHideObjects("hidden","Middle1");
        }
        if (isTheHomePage)
            newMenuShowHideObjects("hidden","Middle");
        
	try {
	    window.clearTimeout(stimeout);
		if (sshow) return;
		document.getElementById('radio_box').style.visibility='visible'
		sshow = true;
	   }catch(e){}
	}
	function hideRadioMenu()
	{ 
	    if (document.getElementById('pos-Middle1')==null) {
            newMenuShowHideObjects("visible","Right");
        } else {
            newMenuShowHideObjects("visible","Middle1");
        }
        if (isTheHomePage)
            newMenuShowHideObjects("visible","Middle");
	try {
	    window.clearTimeout(stimeout);
		document.getElementById('radio_box').style.visibility='hidden'
		sshow = false;
	 }catch(e){} 
	}/* from: http://www.batanga.com/scripts/master2008/header.js 20/11/2009 07:40:08 p.m. */
function localLogout()
	{
	Logout();
	}
	
	function addToFavorites()
	{
	window.external.AddFavorite(document.title,document.location.href);
    }

   
      
      function setLinkCookie(linkID) {
        if (getCookie("auxiliary")==null || getCookie("auxiliary")=="") {
        document.cookie = "auxiliary=" + escape(linkID) +
        ";path=/;domain=batanga.com";
      }
        return true;
      }
      
      function doSearch() {
        return doSearch2('Buscar','Error en la b&uacute;squeda');
      }

      function doSearch2(defaultString,errorMessage) {
        mensaje = '';
        querySearch='';
        querySearch =  trim(document.getElementById('q').value);
        if ((querySearch == '') || (querySearch == defaultString)) {
			      mensaje += errorMessage;
        }
        if (mensaje == '') {
        var linkID = "LinkTrack_Search_";
        var menu = getCookie('menu');
        if (menu==null || menu=="")
        linkID += "O";
        else
        linkID += menu;
        setLinkCookie(linkID);
        return true;
        }
        else
        {
        mensaje = mensaje;
        alert(mensaje);
        return false;
        }
      }
      
        function doSearchNew(defaultString,errorMessage) {
        mensaje = '';
        querySearch='';
        querySearch =  trim(document.getElementById('q').value);
        if ((querySearch == '') || (querySearch == defaultString)) {
			      mensaje += errorMessage;
        }
        if (mensaje == '') {
        var linkID = "LinkTrack_Search_";
        var menu = getCookie('menu');
        if (menu==null || menu=="")
        linkID += "O";
        else
        linkID += menu;
        setLinkCookie(linkID);
        return true;
        }
        else
        {
        mensaje = mensaje;
        alert(mensaje);
        return false;
        }
      }

      
      function trim(s)
      {
      // Remove leading spaces and carriage returns
      while ((s.substring(0,1) == ' ') || (s.substring(0,1) == '\n') || (s.substring(0,1) == '\r'))
      {
      s = s.substring(1,s.length);
      }

      // Remove trailing spaces and carriage returns
      while ((s.substring(s.length-1,s.length) == ' ') || (s.substring(s.length-1,s.length) == '\n') || (s.substring(s.length-1,s.length) == '\r'))
      {
      s = s.substring(0,s.length-1);
      }
      return s;
      }


        function getProfileUrl()
        {
            var idioma = unescape(getCookie("idioma"));
            var username = unescape(getCookie("batangausername"));
            
            var sid = "sitelife.es.batanga.com";
            if(idioma == "EN" || idioma == "en") 
                sid = "sitelife.en.batanga.com";
            else
                sid = "sitelife.es.batanga.com";
                    
            profileUrl = 'http://www.batanga.com/community/Persona.aspx?plckPersonaPage=PersonaHome&plckUserId=' + username + '&userid=' + username + '&sid=' + sid;
            
            return profileUrl;
        }
        
        function getSettingsUrl()
        {
            var idioma = unescape(getCookie("idioma"));
            var username = unescape(getCookie("batangausername"));
            
            var sid = "sitelife.es.batanga.com";
            if(idioma == "EN" || idioma == "en") 
                sid = "sitelife.en.batanga.com";
            else
                sid = "sitelife.es.batanga.com";
                    
            settingsUrl = 'http://www.batanga.com/community/Persona.aspx?plckPersonaPage=PersonaSettings&plckUserId=' + username + '&userid=' + username + '&sid=' + sid;
            
            return settingsUrl;
        }

		function updateNewMenuTopBar() {
		var batanga_key = getCookie("batangakey");
		    var idioma = getCookie("idioma");
		    var usuario = unescape(getCookie("DJScreenName"));
		    var username = unescape(getCookie("batangausername"));
		    try {
		        if (!(batanga_key == null || batanga_key== "")) {
		        document.getElementById("newMenuLoggedBox").style.paddingTop = '55px';
		        if (idioma == "ES") {
		        document.getElementById("newMenuLoggedBox").innerHTML = 'Bienvenido <a href="http://my.batanga.com/'+username+'">' + usuario + '<' +'/a>' +'&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="localLogout();return false;">Salir</a>';
		        } else
		        document.getElementById("newMenuLoggedBox").innerHTML = 'Welcome <a href="http://my.batanga.com/'+username+'">' + usuario + '<' +'/a>' +'&nbsp;&nbsp;|&nbsp;&nbsp;<a href="#" onclick="localLogout();return false;">Logout</a>';

		        document.getElementById("newMenuLoginBox").style.display = "none";
		        document.getElementById("newMenuLoggedBox").style.display = "";
		        } else {
		        document.getElementById("loginpassword").value = "";
		        document.getElementById("newMenuLoginBox").style.display = "";
		        document.getElementById("newMenuLoggedBox").style.display = "none";
		        }
		    } catch(ex) {}
		}

		function updateNewMenuTopBar2008() {
		
    		var batanga_key = getCookie("batangakey");
		    try {
		        if (!(batanga_key == null || batanga_key== "")) {
		            var idioma = unescape(getCookie("idioma"));
		            var usuario = unescape(getCookie("DJScreenName"));
		            var username = unescape(getCookie("batangausername"));
		            
                    document.getElementById("after_login").style.display = "block";
                    document.getElementById("before_login").style.display = "none";
                    
                    
                    profileUrl = getProfileUrl();
                    //document.getElementById("batangueroLink").href = "http://my.batanga.com/"+username;                    
                    document.getElementById("batangueroLink").href = profileUrl;
                    document.getElementById("batangueroLink").innerHTML = usuario;
                    //document.getElementById("batangueroProfile").href = "http://my.batanga.com/"+username;
                    document.getElementById("batangueroProfile").href = profileUrl;
                    
                    document.getElementById("batangueroSettings").href = getSettingsUrl();
                    
                    if (getCookie("avatarurl") != null && getCookie("avatarurl") != 'undefined' && getCookie("avatarurl") != "") {
                        setUserImage();
                    } else
                        try {GetUserImage(setUserImage);}catch(imageExc){}
                } else {
                    document.getElementById("after_login").style.display = "none";
                    document.getElementById("before_login").style.display = "block";

                }
            } catch (up2008exc) { //alert("failed "+up2008exc.message);
            }            
                
        }

        function setUserImage() {
            try
            {
               document.getElementById("batangueroImage").src = getCookie("avatarurl");
            } catch(setUserExc) {}

        }

    try 
    {
        var anchor = document.getElementById("externalLinkAutos");
        if (anchor)
            anchor.target = "_blank";
    } catch(selExternalLinksTarget){}
    
	function changeLanguage(aux)
	{   
	    //alert(aux);
		if (aux=="EN" || aux=="en" )
			myLanguage="ES";
		else if (aux=="ES" || aux=="es")
			myLanguage="EN";
		else 
			myLanguage="ES";
		
    	setCookieD("idioma",myLanguage,10,"batanga.com");
	  
	    var browserName=navigator.appName;
	    var browserVersion = new String(navigator.appVersion);
	    if(navigator.appName=='Netscape' && browserVersion.lastIndexOf('Safari')!=-1 ){
		    var url = new String(document.location.href);
		    if(url.lastIndexOf('slang=')!=-1)
			{  //alert('tiene');
				var url_part=url.split('slang=');
				var num=parseInt(url_part[1].toString())+1
				document.location=url_part[0]+'slang='+num.toString();
			}
		    else
			{   //alert(' no tiene');
				if(url.lastIndexOf("?")==-1){
				    document.location=document.location.href+'?slang=1';
				}
				else
				{
				    document.location=document.location.href+'&slang=1';
				}
			}
	    }
	    else 
	    {
	        var url = new String(document.location.href);
	        //url = url.toLowerCase();
	        if(url.lastIndexOf('&sid=') != -1 || url.lastIndexOf('&SID=') != -1){
	            if(myLanguage == "EN"){
	                url = url.replace("sitelife.es.batanga.com", "sitelife.en.batanga.com");
	                url = url.replace("sitelifestage.es.batanga.com", "sitelifestage.en.batanga.com");
	            }
	            else if(myLanguage == "ES"){
	                url = url.replace("sitelife.en.batanga.com", "sitelife.es.batanga.com");
	                url = url.replace("sitelifestage.en.batanga.com", "sitelifestage.es.batanga.com");
	            }
	            
	            document.location = url;
	        }
		    else 
		    {
		        document.location.reload();
		    }
	    }
	}    
	
	
	
function utf8encode2 (string) {
		string = string.replace(/\r\n/g,"\n");
		var utftext = "";
 
		for (var n = 0; n < string.length; n++) {
 
			var c = string.charCodeAt(n);
 
			if (c < 128) {
				utftext += String.fromCharCode(c);
			}
			else if((c > 127) && (c < 2048)) {
				utftext += String.fromCharCode((c >> 6) | 192);
				utftext += String.fromCharCode((c & 63) | 128);
			}
			else {
				utftext += String.fromCharCode((c >> 12) | 224);
				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
				utftext += String.fromCharCode((c & 63) | 128);
			}
 
		}
 
		return utftext;
	};
	
	
	function utf8encode( s )
{
//alert(unescape( encodeURIComponent( s ) ));
  return unescape( encodeURIComponent( s ) );
}

document.domain = "batanga.com";


function getLanguage()
{
    //alert("getLanguage cookie hardcoded");
    //return "EN";
    
    var language =  getCookie("idioma");
    
    if(language  != null)
        language = language.toUpperCase();
    return language;
}
/* from: http://www.batanga.com/scripts/master2008/jsutil.js 20/11/2009 07:40:08 p.m. */
// JScript File

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

function setCookieD(cookieName,cookieValue,nDays,Domain) 
{
    var expString =  "";
    if (nDays) {
        var today = new Date();
        var expire = new Date();
        if (nDays == null || nDays == 0) 
            nDays=1;
            
        expire.setTime(today.getTime() + 3600000*24*nDays);
        expString = ";expires=" + expire.toGMTString();
    }
    
    if (!Domain)
        Domain = "batanga.com";
    
    var theCookie = cookieName + "=" + escape(cookieValue) + expString + ";path=/;domain=" + Domain + ";";
    document.cookie = theCookie;
    //window.alert('setting cookie:\n' + theCookie);
}

/* from: http://www.batanga.com/scripts/openRadioAndLink.js 20/11/2009 07:40:08 p.m. */

/*function CallPlayListWM(StationID,idioma) {
       
    var Format='wm';
    Speed = "2";
    try
    {
        if (document.selectSpeed.Speed[1].checked) { Speed = "3"; }
        else if (document.selectSpeed.Speed[0].checked){ Speed = "1"; }
             else { Speed = "2"; }  
    }
    catch(e){}		
    window.open('http://radio.batanga.com/'+idioma+'/LaunchPlaylistEM.asp?StationID='+StationID+'&Format='+Format+'&Speed='+Speed+'&context=','LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=470,height=426');
}
function openRadioAndLink(stationID, link)
{
    //alert(stationID);
    //alert(link);
    CallPlayListWM(stationID,'<%=oIdioma%>'); 
    window.location=link;
    return false;
}
*/
function openMyRadioAndLink(PlaylistID,link,q)
{
    //http://myradio.batanga.com/Player/player.aspx?PlaylistID=35435&q=Ricky%20Martin
    //alert(q);    
    if (q!=null)    
        window.open('http://myradio.batanga.com/Player/player.aspx?PlaylistID='+PlaylistID+"&q="+q,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
    else
        window.open('http://myradio.batanga.com/Player/player.aspx?PlaylistID='+PlaylistID,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
    
    window.location=link;
    return false;
}

function openMyRadioAndArtist(PlaylistID,q)
{
    //http://myradio.batanga.com/Player/player.aspx?PlaylistID=35435&q=Ricky%20Martin
    //alert(q);    
    if (q!=null)    
        window.open('http://radio.batanga.com/Player/player.aspx?PlaylistID='+PlaylistID+"&q="+q,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
    else
        window.open('http://radio.batanga.com/Player/player.aspx?PlaylistID='+PlaylistID,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
    
}

function openBatangaRadioPlayer(stationID,artist) {
    var myRadioStationID = 63839;
    if (stationID == 4) myRadioStationID = 63839;
    if (stationID == 2) myRadioStationID = 63228;
    if (stationID == 3) myRadioStationID = 63826;
    if (stationID == 7) myRadioStationID = 63820;
    if (stationID == 9) myRadioStationID = 63843;
    if (stationID == 16) myRadioStationID = 59195;
    if (stationID == 27) myRadioStationID = 63849;
    if (stationID == 5) myRadioStationID = 63852;
    if (stationID == 6) myRadioStationID = 63837;
    if (stationID == 8) myRadioStationID = 63719;
    if (stationID == 10) myRadioStationID = 63855;
    if (stationID == 11) myRadioStationID = 63838;
    if (stationID == 12) myRadioStationID = 63831;
    if (stationID == 13) myRadioStationID = 63834;
    if (stationID == 14) myRadioStationID = 63821;
    if (stationID == 15) myRadioStationID = 63829;
    if (stationID == 17) myRadioStationID = 63844;
    if (stationID == 18) myRadioStationID = 63833;
    if (stationID == 19) myRadioStationID = 63724;
    if (stationID == 24) myRadioStationID = 63845;
    if (stationID == 25) myRadioStationID = 58404;
    if (stationID == 26) myRadioStationID = 63842;
    if (stationID == 28) myRadioStationID = 63854;
    if (stationID == 29) myRadioStationID = 40527;
    if (stationID == 30) myRadioStationID = 270192;
    if (stationID == 31) myRadioStationID = 18710;
    if (stationID == 32) myRadioStationID = 404679;
    openMyRadioAndArtist(myRadioStationID,artist);
    
    
    //2: //reggaeton (old=40524)
    //3: //Rock (old=40545)
    //4: //pop (old=39153)
    //5: //tropical (old=40525)
    //6: //mariachi (old=40526)
    //7: //Baladas (old=40527)
    //8: //Alternative (old=40305)
    //9: //Salsa (old=40528)
    //10: //Los Hits (old=40529)
    //11: //merengue (old=40530)
    //12: //dance (old=40531)
    //13: //jazz (old=40532)
    //14: //boleros (old=40533)
    //15: //cubanisimo (old=40534)
    //16: //mexicana  (old=40329)
    //17: //tango (old=40537)
    //18: //Flamenco (old=40538)
    //19: //bachata (old=40540)
    //24: //Top 40 Mix  (old=?)
    //25: //Hiphop  (old=40541)
    //26: //brazil (old=40542)
    //27: //tejano (old=40543)
    //28: //Cumbia (old=40544)
    //29: //Oldies 
    //30: //Vallenato
    //31: //Heavy Metal
    //32: //Rock en espanol
    
       
}


function CallMyRadioPlayListByURL(url) {
		//var Format='wm';
		window.open(url,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
		//window.open('http://radio.batanga.com/'+idioma+'/LaunchPlaylistEM.asp?StationID='+StationID+'&Speed='+Speed+'&context=','LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=470,height=426');
		
}	/* from: http://www.batanga.com/scripts/master2008/dartads.js 20/11/2009 07:40:08 p.m. */
function findPosX(obj) { var curleft = 0; if (obj.offsetParent) { while (obj.offsetParent) { curleft += obj.offsetLeft; obj = obj.offsetParent; } } else if (obj.x) curleft += obj.x; return curleft; } 
function findPosY(obj) { var curtop = 0; if (obj.offsetParent) { while (obj.offsetParent) { curtop += obj.offsetTop;	obj = obj.offsetParent; } } else if (obj.y) curtop += obj.y; return curtop; } 

var windowW=800,windowH=600;
var adPerct = 0.25; //25% to decide if above fold or expandable
//alert(document.body.clientWidth+'x'+document.body.clientHeight);
if (typeof(window.innerWidth)!="undefined") {
    windowW = window.innerWidth;
    windowH = window.innerHeight;
} else { //IE
    windowW = document.documentElement.clientWidth;
    windowH = document.documentElement.clientHeight;
}
//alert("window (infold?): "+windowW+"x"+windowH+", expansion width: "+expTotalW);
//if (typeof(btgdocW)=="undefined") { var btgdocW = 800; var btgdocH = 600; try {btgdocH=document.body.clientHeight;btgdocW=document.body.clientWidth;} catch(btge1){} }
function expansionAllowance(position) {
    try { 
    adplaceholder =document.getElementById(position); 
    var btgsize = position.replace(/_[0-9]/gi,'').replace(/ad\-/gi,'').replace(/pos\-/gi,'');var btgszW=parseInt(btgsize.split("x")[0]);var btgszH=parseInt(btgsize.split("x")[1]); 
    var btgdisexpansion = "";
    if ((findPosX(adplaceholder) > btgszW*adPerct) && (findPosX(adplaceholder)+btgszW < windowW - btgszW*adPerct))
        btgdisexpansion = ";exp=both";
    else if (findPosX(adplaceholder) > btgszW*adPerct)
        btgdisexpansion = ";exp=left";
    else
        btgdisexpansion = ";exp=right";
    } catch (btge2) {  } 
    return btgdisexpansion;
}

function foldPositioning(position) {
    try { 
    adplaceholder =document.getElementById(position); 
    var btgsize = position.replace(/_[0-9]/gi,'').replace(/ad\-/gi,'').replace(/pos\-/gi,'');var btgszW=parseInt(btgsize.split("x")[0]);var btgszH=parseInt(btgsize.split("x")[1]); 
    var btginfold = "";
    if ((findPosX(adplaceholder) < windowW - btgszW*adPerct ) && (findPosY(adplaceholder) < windowH - btgszH*adPerct)) {btginfold = ";loc=af"}
    else {btginfold = ";loc=bf"}
    } catch (btge3) { } 
    return btginfold;
}


function insertIntoPlaceHolder(obj,lyr)
{
//alert("the new with: "+obj);
try {
//Option 1
    //document.getElementById(obj).parentNode.replaceChild(document.getElementById(lyr),document.getElementById(obj));
    //Option 2
    var moveFunc = function() {
        var allscripts = document.getElementById(lyr).getElementsByTagName("script"); 
        for (var i = allscripts.length-1; i >= 0; i--)
        { 
            //document.getElementById(lyr).removeChild(allscripts[i]);
            if(allscripts[i].src.match(/adj\/btg/gi)||allscripts[i].src.match(/1x1/gi)) {
                //alert(allscripts[i].src);
                allscripts[i].parentNode.removeChild(allscripts[i]);
                
            }
        }
        
        /* 1x1 IMAGES ARE REMOVED HERE... RE-ENABLE HERE
        var allimgs = document.getElementById(lyr).getElementsByTagName("img"); 
        for (var i = allimgs.length-1; i >= 0; i--)
        { 
            if(allimgs[i].src.match(/1x1/gi)) {
                allimgs[i].parentNode.removeChild(allimgs[i]);
                
            }
        }
        */
        document.getElementById(obj).appendChild(document.getElementById(lyr));
        //alert("moved "+lyr.id+" to "+obj.id);
        };
        //genAttachListenerToOnLoadEvent(moveFunc);
        moveFunc();
        
        
    //setTimeout('alert("'+obj+'");document.getElementById("'+obj+'").appendChild(document.getElementById("'+lyr+'"));',15000);
    // Get the list of positions on the page





/*    var allscripts = document.getElementById(lyr).getElementsByTagName("script"); 
    for (var i = allscripts.length-1; i >= 0; i--)
    { 
        document.getElementById(lyr).removeChild(allscripts[i]);
    }
    document.getElementById(obj).appendChild(document.getElementById(lyr));*/
} catch(setLyrnewerr){
    //alert("error: "+document.getElementById(lyr).getElementsByTagName("script"));
    }
}

if (typeof(setLyr) == "undefined") 
    setLyr = function(a,b,c) {insertIntoPlaceHolder(a,b);};

function isThereACrawlerInThePage() {
    try {
       return (document.getElementById("catfish") || document.getElementById("crawler") ||document.getElementById("crawler_cont") || bnParsArray['bnsm_name'] == "crawler");
    } catch (istc) {
       return false;
    }
}

/********************* Wall Papper Functions ******************************/

function wall_get_WindowWidth() { 
  var myWidth = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE 
    myWidth = window.innerWidth; 
  } else if( document.documentElement && document.documentElement.clientWidth) { 
    //IE 6+ in 'standards compliant mode' 
    myWidth = document.documentElement.clientWidth; 
  } else if( document.body &&  document.body.clientWidth  ) { 
    //IE 4 compatible
    myWidth = document.body.clientWidth; 
  } 
    return myWidth; 
}

function wallpaper_bg(bg_image,bg_attach,bg_color){
document.write("<style type='text/css'>body {background-color:"+bg_color+";background-image:url("+bg_image+");background-position:center top;background-repeat:no-repeat;background-attachment:"+bg_attach+";_background-attachment: scroll;}#container2{background-color: #FFFFFF;}</style>");	  
}


var linkContainerArray = new Array();
var linkContainersInserted = false;
var linkContainersScheduled = false;
function wallpaper_btn(b_pos,b_img,b_link,b_hor,b_vert,b_attach){

try { 
    if (wall_get_WindowWidth() >= 1220){
		if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
		   var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
			if (ieversion<=6){
			b_attach = "absolute";
    		}
        }         
        var insert_buttons_html = "<div style='position:"+b_attach+"; bottom:"+b_vert+"px; "+b_pos+":"+b_hor+"px'><a href='"+b_link+"' target='_blank'><img src='"+b_img+"'/></div>";
        var div_name = "insert_buttons_"+b_pos+"" 
    			  
	    var link_container = document.createElement('div');         
        link_container.setAttribute('id', div_name);
        link_container.innerHTML = insert_buttons_html;
        linkContainerArray[linkContainerArray.length] = link_container;
        genAttachListenerToOnLoadEvent(insertLinkContainer);
        //attachEventListener(document.body,"load",insertLinkContainer,true,insertLinkContainer);
        //alert(typeof document.body);
        /*if (!linkContainersScheduled) {
            linkContainersScheduled = true
            setTimeout('insertLinkContainer()',12000);
        }*/
    }   
 
} catch(GarE) {}
}

function insertLinkContainer() {
    try {
        //alert("setlink");
        if (!linkContainersInserted) {
            linkContainersInserted = true;
            for (var i=0;i<linkContainerArray.length;i++)
                document.body.appendChild(linkContainerArray[i]);
                
        }
        //alert("setlink done");
    } catch(insertLinkEx) {
        linkContainersInserted = false;
        setTimeout('insertLinkContainer()',5000);
    }
    return !linkContainersInserted;
}

function genAttachListenerToOnLoadEvent(functionRef) {
    if( window.addEventListener ) {
      window.addEventListener('load',functionRef,false);
    } else if( document.addEventListener ) {
      document.addEventListener('load',functionRef,false);
    } else if( window.attachEvent ) {
      window.attachEvent('onload',functionRef);
    }
}


/***************************** VIDE OVERLAY ***********************************/

function setLyrvOff(obj,lyr,container,voffset)
{
 try {
 var o = document.getElementById(obj);
 var newX = findPosX(o);
 var newY = findPosY(o);
 var leftcontainer1= findPosX(document.getElementById(container));
 var x = document.getElementById(lyr);
 x.style.top = (newY+voffset) + 'px';
 newX= newX - leftcontainer1;
 x.style.margin = '0 0' + newX + 'px 0';
 } catch(sLP) {}
}

function hideVideoOverlay() {
    document.getElementById("v-overlay").style.display = "none";
}

function showVideoOverlay(objid,option,var1,var2) {
    if (option == 0) {
        try{$(document).ready(function(){
            $("#"+objid).fadeIn(var2);
            //$("#ad-test").show(2000);
            //$("#ad-test").fadeIn("slow");
        });
        }catch(jqerrorbat){}
    }
    if (option == 1) {
        try{$(document).ready(function(){
            $("#"+objid).animate({"height": "-=80px"}, 0);
            $("#"+objid).animate({"height": "+=80px"}, var2);
            document.getElementById(objid).style.display = "";
            //$("#v-overlay").fadeIn(5000);
            //$("#ad-test").show(2000);
            //$("#ad-test").fadeIn("slow");
        });
        }catch(jqerrorbat){}
    }
    if (option == 2) {
        try{$(document).ready(function(){
            $("#"+objid).animate({"top": "+="+var1+"px"}, 0);
            document.getElementById(objid).style.display = "";
            $("#"+objid).animate({"top": "-="+var1+"px"}, var2);
            //$("#v-overlay").fadeIn(5000);
            //$("#ad-test").show(2000);
            //$("#ad-test").fadeIn("slow");
        });
        }catch(jqerrorbat){}
    }
    if (option == 3) {
        try{$(document).ready(function(){
            $("#"+objid).animate({"height": "=0px"}, 0);
            $("#"+objid).animate({"height": "=80px"}, var2);
            document.getElementById(objid).style.display = "";
            //$("#v-overlay").fadeIn(5000);
            //$("#ad-test").show(2000);
            //$("#ad-test").fadeIn("slow");
        });
        }catch(jqerrorbat){}
    }
}

function overLayTestSimulateDART(option,var1,var2) {
    //showOverLay('http://m1.2mdn.net/2072122/728x90_jd.swf',3,250,3500);
    //showOverLay('http://m1.2mdn.net/2072122/728x90_jd.swf',1,250,3500);
    showOverLay('http://batanga.http.internapcdn.net/batanga_vitalstream_com/traffic/2009/absolut/mango.swf',0,0,5000,5000,20000);
}

function showOverLay(flashUrl,option,var1,var2,showtime,hidetime) {
    document.write('<'+'div id="v-overlay-c" style="width:440px;height:80px;overflow:hidden">');
    document.write('<'+'div id="v-overlay" style="position:absolute; z-index:10001; width:440px; height:80px; padding-top:0px; overflow:hidden;display:none;border">');
    document.write('<'+'embed src="'+flashUrl+'" quality="high" width="440px" height="80px" name="miciudad" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent"><'+'/embed>');
    //document.write('<'+'script src="http://code.jquery.com/jquery-latest.js"><'+'/script>');
    document.write('<'+'/div>');
    document.write('<'+'/div>');
    document.write('<'+'script>');
    document.write('setLyrvOff("playerdiv","v-overlay","v-overlay-c",250);');
    document.write('setTimeout(\'showVideoOverlay("v-overlay",'+option+','+var1+','+var2+')\','+showtime+');');
    if (hidetime > 0)
        document.write('setTimeout(\'hideVideoOverlay()\','+(showtime+hidetime)+');');
    document.write('<'+'/script>');
}

/***************************** Insert 1x1 by time ***********************************/

function b_ad_timer(time,src)
{
setTimeout("insert_pixel_by_time('"+src+"');",time*1000);
}

function insert_pixel_by_time(src){

pixel_image = document.createElement("img");
pixel_image.width = 1;
pixel_image.height= 1;

var random_src = src. replace("b_random",Math.random());

pixel_image.src = random_src;
document.body.appendChild(pixel_image);

}/* from: http://www.batanga.com//scripts/ajax.js 20/11/2009 07:40:08 p.m. */
function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null

	if (navigator.userAgent.indexOf("Opera")>=0)
	{
	alert("This example doesn't work in Opera") 
	return 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP"
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP"
		} 
		try
		{ 			
			objXmlHttp=new ActiveXObject(strName)
			objXmlHttp.onreadystatechange=handler 			
			return objXmlHttp
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return 
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest()
		objXmlHttp.onload=handler
		objXmlHttp.onerror=handler 
		return objXmlHttp
	}
} 
function launchJavascriptFromXML(responseXML) {
    var scripts = responseXML.getElementsByTagName('script');
    var js = '';    
    for(var s = 0; s < scripts.length; s++) {
        if(scripts[s].childNodes[0].nodeValue == null) continue;
           js += scripts[s].childNodes[0].nodeValue;
    }
    eval(js);
}

function launchJavascript(responseText) {
  // RegExp from prototype.sonio.net
  var ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:</script>)';
           
  var match    = new RegExp(ScriptFragment, 'img');
  var scripts  = responseText.match(match);
    if(scripts) {
        var js = '';
        for(var s = 0; s < scripts.length; s++) {
            var match = new RegExp(ScriptFragment, 'im');
            js += scripts[s].match(match)[1];
        }
        eval(js);
    }
}

/* from: http://myradio.batanga.com/include/favorites.js 20/11/2009 07:40:08 p.m. */
var useNewFavoritesButton=false;
var oldLoginCallBack = null;
var oldSignupCallBack = null;
var favoritesDebug = 0;
var OneClickLinksNotBold=false;

var UrlProcessFavorite = "processfavorite.aspx";
var UrlRemoveFromFavoritesImage = "/images/addtofavorites.gif";
var UrlAddToFavoritesImage = "/images/removefromfavorites.gif";
var ImAFanOff = "http://radio.batanga.com/images/favorites/Fan_off.gif";
var ImAFanOn = "http://radio.batanga.com/images/favorites/Fan_on.gif";
var ImAFanOver = "http://radio.batanga.com/images/favorites/Fan_over.gif";

var FanImages=new Array();
FanImages[0] = new Image();
FanImages[0].src=ImAFanOff;
FanImages[1] = new Image();
FanImages[1].src=ImAFanOn;
FanImages[2] = new Image();
FanImages[2].src=ImAFanOver;

var favoriteTagsList = null;
var oneClickTagsList = null;

var xmlObjCheckFavorites = null;
var xmlObjAddFavorite = null;
var xmlObjGetFavorites = null;
var xmlObjRemoveFavorite = null;

var favoritesSupported = new Array("station", "video", "artist", "song");

var language = getCookie("idioma");

var removeFavoriteText;
var addToFavoriteText;
var removeFanText;
var addFanText;
var addedFanText;

var removeFavoriteTip;
var addToFavoriteTip;
var removeFanTip;
var addFanTip;

var favoriteTextCss = "";

if(language == "EN")
{
    removeFavoriteText = "Remove";
    removeFavoriteTip = "Remove from Favorites";
    
    addToFavoriteText = "Save";
    addToFavoriteTip = "Save to Favorites";
    
    addFanText="I'm a Fan &gt;&nbsp;";
    addedFanText="I'm a Fan&nbsp;";
    addFanTip="";
    
    removeFanText="Remove&nbsp;";
    removeFanTip="";
}
else
{
    addToFavoriteTip = "Guardar como Favorito";
    addToFavoriteText = "Guardar";
    
    removeFavoriteTip = "Eliminar de Favoritos";    
    removeFavoriteText = "Eliminar";

    addFanText="Soy Fan &gt;&nbsp;";
    addedFanText="Soy Fan&nbsp;";
    addFanTip="";
    
    removeFanText="Eliminar&nbsp;";
    removeFanTip="";
    
}

if (document.getElementById("ImAFanActive")!=null)
{
    if (document.getElementById("ImAFanActive").value == "1")
    {
        useNewFavoritesButton=true;
    } 
}



function GetFavoriteType(tagName)
{
    for(var j = 0; j < favoritesSupported.length; j++)
        if(tagName.match(favoritesSupported[j]))
            return favoritesSupported[j];
            
    return null;            
}

function GetFavoriteId(tagName, favoriteType)
{
    var favTag = "fav-" + favoriteType + "-";
    var id  = tagName.substr(tagName.indexOf(favTag) + favTag.length);
    
    return id;
}

function GetOneClickId(tagName, favoriteType)
{
    var oneClickTag = "oneclick-";
    var id  = tagName.substr(tagName.indexOf(oneClickTag) + oneClickTag.length);
    
    return id;
}

function GetLoggedInUserID()
{
    //alert("GetLoggedInUserID:hard coded value");
    //return "65";

    var userID = getCookie("batangauserid");
        
    return userID;
}

function IsUserLoggedIn()
{
    //alert("IsUserLoggedIn:hard coded to return true");
    //return true;

    var batangacom = getCookie("batangacom");
    if(batangacom == null || batangacom.length == 0)
        return false;
        
    var batangakey = getCookie("batangakey");
    if(batangakey == null || batangakey.length == 0)
        return false;
        
    return true;            
}

function GetXmlDoc(text)
{
    if (typeof(text)!="undefined")
    {
        var xmlDoc;
       
        if(window.ActiveXObject)
        {
            xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
            xmlDoc.async="false";
            xmlDoc.loadXML(text);
        }
        else
        {
    	    if(favoritesDebug == 1) {alert("Dom Text: " + text);}
            var parser = new DOMParser();
            var xmlDoc = parser.parseFromString(text,"text/xml");
        }
    }

    return xmlDoc;
}

function ResetAllFavoriteTags()
{
    for (var i = 0; i < favoriteTagsList.length; i++)
    { 
        var favoriteTag = favoriteTagsList[i];
        var favoriteTagId = favoriteTag.getAttribute('id');
        
        var favoriteType = GetFavoriteType(favoriteTagId);
        var favoriteID  = GetFavoriteId(favoriteTagId, favoriteType);
        
        favoriteTag.innerHTML = GetAddToFavoriteCode(favoriteID, favoriteType);
        favoriteTag.style.display = "";
    }
}

function ProcessFavorites()
{
    if(favoritesDebug == 1)
        alert("ProcessFavorites()");
    
      ProcessCheckFavorites();  
}

function FavoriteElementAlreadyAdded(id, addedFavoriteTagsList)
{
    for(var i = 0; i < addedFavoriteTagsList.length; i++)
    {
        if(addedFavoriteTagsList[i] == id)
            return true;
    }
    
    return false;
}

function OneClickElementAlreadyAdded(id, addedOneClickTagsList)
{
    for(var i = 0; i < addedOneClickTagsList.length; i++)
    {
        if(addedOneClickTagsList[i] == id)
            return true;
    }
    
    return false;
}

function ProcessCheckFavorites()
{
    favoriteTagsList = new Array();
    oneClickTagsList = new Array();
    
    var alldivs = document.getElementsByTagName("div"); 
    
    //get all the favprite tags into favoriteTagsList
    for (var i = 0; i < alldivs.length; i++)
    { 
	    if (alldivs[i].getAttribute('id') != null && alldivs[i].getAttribute('id').match('fav-'))
	    { 
            favoriteTagsList[favoriteTagsList.length] = alldivs[i];	        
        }
        else if (alldivs[i].getAttribute('id') != null && alldivs[i].getAttribute('id').match('oneclick-'))
        {
            oneClickTagsList[oneClickTagsList.length] = alldivs[i];
        }
    }
    
    var loggedIn = IsUserLoggedIn();
    
//    if(!loggedIn)
//    {
//        ResetAllFavoriteTags();
//        
//        if(favoritesDebug == 1)
//            alert("ProcessFavorites():User not logged in, returning...");        
//            
//        return;
//    }
    

    var addedFavoriteTagsList = new Array();
    var addedOneClickTagsList = new Array();
    var userID = GetLoggedInUserID();
    if (!loggedIn) {userID=0;}
    var XML = new XMLWriter();
    
    XML.BeginNode("OneClickFavorites");
    XML.BeginNode("Favorites");
    
    if (loggedIn)
    {
        XML.BeginNode("checkfavorites");
        XML.Node("userid", userID);
        
        for (var i = 0; i < favoriteTagsList.length; i++)
        {
            var tagObj = favoriteTagsList[i];
            var tagName = tagObj.getAttribute('id');
            if(!FavoriteElementAlreadyAdded(tagName, addedFavoriteTagsList))
            {
                var idValue = -1;
                
                for(var j = 0; j < favoritesSupported.length; j++)
                {
                    if(tagName.match(favoritesSupported[j]))
                    {                
                        XML.BeginNode(favoritesSupported[j]);
                        
                        idValue = GetFavoriteId(tagName, favoritesSupported[j]);
                        XML.Node("id", idValue);
                        addedFavoriteTagsList[addedFavoriteTagsList.length] = tagName;
                        
                        XML.EndNode();
                        
                        break;
                    } 
                }
            }
            else
            {
                if(favoritesDebug == 1)
                    alert("ProcessCheckFavorites: id " + tagName + " already added. Not added again to the check favorites xml");
            }
        }
        
        XML.EndNode();  //checkfavorites
    }
    else
    {
        ResetAllFavoriteTags();
    }

    XML.EndNode();  //Favorites
    XML.BeginNode("OneClick");
    XML.BeginNode("artists");
    for (var i = 0; i < oneClickTagsList.length; i++)
    {
        var tagObj = oneClickTagsList[i];
        var tagName = tagObj.getAttribute('id');
        if(!OneClickElementAlreadyAdded(tagName, addedOneClickTagsList))
        {
            var idValue = -1;
            
            XML.BeginNode("artist");
            
            idValue = GetOneClickId(tagName, favoritesSupported[j]);
            XML.Node("id", idValue);
            addedOneClickTagsList[addedOneClickTagsList.length] = tagName;
            
            XML.EndNode();  //artist
            
        }
        else
        {
            if(favoritesDebug == 1)
                alert("ProcessCheckFavorites: artist one-click id " + tagName + " already added. Not added again to the check favorites xml");
        }
    }    
    XML.EndNode();  //artists
    XML.EndNode();  //OneClick
    XML.EndNode();  //OneClickFavorites
    
    
    var xmlQueryData = XML.ToString();
    
    xmlObjCheckFavorites = CreateFavoritesAJAXRequest();
                
    var parameters = xmlQueryData;
    if(favoritesDebug == 1)
	    alert("ProcessCheckFavorites:UrlProcessFavorite = " + UrlProcessFavorite + ", parameters = " + parameters);
    	    
	xmlObjCheckFavorites.open("POST", UrlProcessFavorite, true);  							
	xmlObjCheckFavorites.setRequestHeader("Content-Type", "text/xml");					
	xmlObjCheckFavorites.setRequestHeader("Content-length", parameters.length);		
	xmlObjCheckFavorites.onreadystatechange = RetrieveCheckFavoritesData;
	xmlObjCheckFavorites.send(parameters);		
}

function RetrieveCheckFavoritesData() 
{
    var outputText;
    
    if(favoritesDebug == 1)
    {
        alert("RetrieveCheckFavoritesData:responseText = " + xmlObjCheckFavorites.responseText);
    }

    if ((xmlObjCheckFavorites != null) && (xmlObjCheckFavorites.readyState == 4) && (xmlObjCheckFavorites.status == 200))
    { 
        try
        {
            var xmlDoc = GetXmlDoc(xmlObjCheckFavorites.responseText);
            var FavoritesXML = xmlDoc.childNodes[0].firstChild;
            var OneClickXML = xmlDoc.childNodes[0].lastChild;
            UpdateCheckFavoritesTags(FavoritesXML);
            UpdateCheckOneClickTags(OneClickXML);
        }
        catch (err)
        {
            return;
        }
        
        xmlObjCheckFavorites = null;                   
    } // if  
    var loggedIn = IsUserLoggedIn();    
    if(!loggedIn)
    {
        ResetAllFavoriteTags();
        
        if(favoritesDebug == 1)
            alert("ProcessFavorites():User not logged in, returning...");        
            
        return;
    }
} 

function UpdateCheckFavoritesTags(xmlDoc) 
{
    var favoriteText;
    var id;
    var isFavorite;
    var favTagName ;
    var favoriteTag;
    
    if(typeof(xmlDoc) == "undefined")
    {
        if(favoritesDebug == 1)
            alert("UpdateCheckFavoritesTags:xmlDoc is undefined");
            
        return;
    }
    for(var j = 0; j < favoritesSupported.length; j++)
    {   
        try
        {         
            myNodes = xmlDoc.getElementsByTagName(favoritesSupported[j]);
        }
        catch (err)
        {
            return;
        }                       
        
        //Extract the different values using a loop.
        for(var k=0; k < myNodes.length; k++) 
        {   
            id = myNodes[k].getElementsByTagName('id')[0].firstChild.data;
            isFavorite = myNodes[k].getElementsByTagName('isfavorite')[0].firstChild.data;           
            
            favTagName = "fav-" + favoritesSupported[j] + "-" + id;
            if(isFavorite == "1")
            {                    
                favoriteText  = GetRemoveFavoriteCode(id, favoritesSupported[j]);
            }
            else
            {                 
                favoriteText  = GetAddToFavoriteCode(id, favoritesSupported[j]);
            }
            
            UpdateFavoriteElemets(favTagName, favoriteText);
        }   

    }
}


function UpdateCheckOneClickTags(xmlDoc) 
{
    var OneClickText;
    var id;
    var PlaylistID;
    var OneClickTagName ;
    var OneClickTag;
    var RelatedArtists;
    
    myNodes = xmlDoc.getElementsByTagName("artist");
    
    //Extract the different values using a loop.
    for(var k=0; k < myNodes.length; k++) 
    {            
        id = myNodes[k].getElementsByTagName('id')[0].firstChild.data;
        PlaylistID = myNodes[k].getElementsByTagName("PlaylistID")[0].firstChild.data;                       
        FeaturedArtistNames = new Array();
        FeaturedArtistIds = new Array();
        
        if (PlaylistID>0)
        {
            OneClickTagName = "oneclick-" + id;
            var RelatedArtistsNodes = myNodes[k].getElementsByTagName("FeaturedArtists")[0].getElementsByTagName("FeaturedArtist");
            for (var i=0; i<RelatedArtistsNodes.length; i++)
            {
                var fa_id = RelatedArtistsNodes[i].getElementsByTagName("id")[0].firstChild.data;
                var fa_name = RelatedArtistsNodes[i].getElementsByTagName("name")[0].firstChild.data;
                FeaturedArtistNames[FeaturedArtistNames.length]=fa_name;
                FeaturedArtistIds[FeaturedArtistIds.length]=fa_id;
            }

            if (OneClickLinksNotBold)
                if (language=='EN')
                    {OneClickText='<a href="#" onclick="OpenArtistRadio(\'' + PlaylistID + '\',\'' + FeaturedArtistNames[0] + '\');">' + FeaturedArtistNames[0] + ' Radio</a> - Featuring Artists like: ';}
                else
                    {OneClickText='<a href="#" onclick="OpenArtistRadio(\'' + PlaylistID + '\',\'' + FeaturedArtistNames[0] + '\');"> Radio ' + FeaturedArtistNames[0] + '</a> - Destacando artistas como: ';}
            else
                if (language=='EN')
                    {OneClickText='<a href="#" onclick="OpenArtistRadio(\'' + PlaylistID + '\',\'' + FeaturedArtistNames[0] + '\');">' + FeaturedArtistNames[0] + ' Radio</a> - Featuring Artists like: ';}
                else
                    {OneClickText='<a href="#" onclick="OpenArtistRadio(\'' + PlaylistID + '\',\'' + FeaturedArtistNames[0] + '\');"> Radio ' + FeaturedArtistNames[0] + '</a> - Destacando artistas como: ';}

            for (var x=0; x<FeaturedArtistNames.length; x++)
            {
                if (x==FeaturedArtistNames.length-2)
                {
                    if (language=='EN')
                        {OneClickText += BuildArtistLink(FeaturedArtistIds[x],FeaturedArtistNames[x]) + ', and ';}
                    else
                        {OneClickText += BuildArtistLink(FeaturedArtistIds[x],FeaturedArtistNames[x]) + ', y ';}
                }
                else if (x==FeaturedArtistNames.length-1)
                {
                    OneClickText += BuildArtistLink(FeaturedArtistIds[x],FeaturedArtistNames[x]);
                }
                else
                {
                    OneClickText += BuildArtistLink(FeaturedArtistIds[x],FeaturedArtistNames[x]) + ', ';
                }
            } 
            
            UpdateOneClickElemets(OneClickTagName, OneClickText);
        }
    }   

}


function BuildArtistLink(ArtistID, ArtistName)
{
    return ArtistName;
}


function CreateFavoritesAJAXRequest()
{
    var http_request = null;
    
    if (window.XMLHttpRequest)
    { // Mozilla, Safari,...
        http_request = new XMLHttpRequest();
        if (http_request.overrideMimeType) 
        {
            // set type accordingly to anticipated content type
            http_request.overrideMimeType('text/xml');            
        }
    } 
    else if (window.ActiveXObject) 
    { // IE
        http_request = new ActiveXObject("Microsoft.XMLHTTP");
    }
    
    if (!http_request) 
    {
        alert("CreateFavoritesAJAXRequest:Cannot create XMLHTTP instance");
        //return false;
    }
    
    return http_request;

}

function GetRemoveFavoriteCode(id, favoriteType)
{
    if (document.getElementById("ImAFanActive")!=null)
    {
        if (document.getElementById("ImAFanActive").value == "1")
        {
            useNewFavoritesButton=true;
        } 
    }
    var removeFavoriteCode;
    if (useNewFavoritesButton==false)
    {
        removeFavoriteCode= "<img style=\"border:0px none;\" border=\"0\" src=\"" + UrlAddToFavoritesImage + "\" /> <a href=\"#\" title=\"" + removeFavoriteTip + "\" onclick=\"javascript:RemoveFromFavorites('" + id + "', '" + favoriteType + "'); return false;\"> <span class=" + favoriteTextCss + ">" + removeFavoriteText + "</span></a>";
    }
    else
    {
        //removeFavoriteCode = "<table cellpadding=0 cellspacing=0 border=0><tr><td width=6 style=\"background: url(" + ImAFanLeft + ")\"></td><td height=22 valign=middle style=\"background: url(" + ImAFanMid + ")\"><img src=\"" + ImAFanNo + "\">&nbsp;<a href=\"#\" title=\"" + removeFanTip + "\" onclick=\"javascript:RemoveFromFavorites('" + id + "', '" + favoriteType + "'); return false;\"> <span class=" + favoriteTextCss + ">" + removeFanText + "</span></a></td><td width=6 style=\"background: url(" + ImAFanRight + ")\"></td></tr></table>";
        removeFavoriteCode="<div onclick='javascript:RemoveFromFavorites(\"" + id + "\", \"" + favoriteType + "\");' style='padding-left:19px;color: #000000; overflow:hidden;height:20px; line-height:20px; cursor: pointer; cursor: hand; font-size: 10px; background-image: url(" + FanImages[1].src + ");background-repeat:no-repeat' onmouseover='this.style.color=\"#FFFFFF\"; this.style.background=\"url(" + FanImages[2].src + ")\";this.innerHTML=removeFanText;' onmouseout='this.style.color=\"#000000\"; this.style.background=\"url(" + FanImages[1].src + ")\";this.innerHTML=addedFanText'>" + addedFanText + "</div>";
    }
    
    return removeFavoriteCode;
}

function GetAddToFavoriteCode(id, favoriteType)
{
    if (document.getElementById("ImAFanActive")!=null)
    {
        if (document.getElementById("ImAFanActive").value == "1")
        {
            useNewFavoritesButton=true;
        } 
    }
    var addToFavoriteCode;
    if (useNewFavoritesButton==false)
    {
        addToFavoriteCode = "<img style=\"border:0px none;\" border=\"0\" src=\"" + UrlRemoveFromFavoritesImage + "\" /> <a href=\"#\" title=\"" + addToFavoriteTip + "\" onclick=\"javascript:AddToFavorites('" + id + "', '" + favoriteType + "'); return false;\"> <span class=" + favoriteTextCss + ">" + addToFavoriteText + "</span></a>";
    }
    else
    {
        //addToFavoriteCode = "<table cellpadding=0 cellspacing=0 border=0><tr><td width=6 style=\"background: url(" + ImAFanLeft + ")\"></td><td height=22 valign=middle style=\"background: url(" + ImAFanMid + ")\"><img src=\"" + ImAFanYes + "\">&nbsp;<a href=\"#\" title=\"" + addFanTip + "\" onclick=\"javascript:AddToFavorites('" + id + "', '" + favoriteType + "'); return false;\"> <span class=" + favoriteTextCss + ">" + addFanText + "</span></a></td><td width=6 style=\"background: url(" + ImAFanRight + ")\"></td></tr></table>";
        addToFavoriteCode="<div onclick='javascript:AddToFavorites(\"" + id + "\", \"" + favoriteType + "\");' style='padding-left:19px; color: #336698; overflow:hidden; height:20px;line-height:21px; font-size: 10px; cursor: pointer; cursor: hand;background-repeat:no-repeat; background-image: url(" + FanImages[0].src + ");'>" +  addFanText + "</div>";
    }
    
    return addToFavoriteCode;
}

function CheckAndAddToFavorites(id, favoriteType, loginType)
{
    var loggedIn = IsUserLoggedIn();
    if(!loggedIn)
        return;
        
    //check to see if that station is already a favorite one, if so then just ignore and do nothing...otherwise add that!
    var userID = GetLoggedInUserID();
        
    if(!IsFavorite(userID, id, favoriteType))
        AddToFavorites(id, favoriteType);    
        
    if(oldLoginCallBack && loginType == 1)          //login happened, make sure to call any handler defined earlier...
    {
        loginCallBack = oldLoginCallBack;
        oldLoginCallBack = null;
        loginCallBack();
    }
        
    if(oldSignupCallBack && loginType == 2)         //signup happened, make sure to call any handler defined earlier...
    {
        signupCallBack = oldSignupCallBack;
        oldSignupCallBack = null;
        signupCallBack();
    }
    
}

function IsFavorite(userID, id, favoriteType)
{
    xmlObjIsFavorite = CreateFavoritesAJAXRequest();
    if(xmlObjIsFavorite == null)
        return;
        
    var parameters = "userid=" + userID + "&id=" + id + "&op=isfavorite" + "&favoritetype=" + favoriteType;
    if(favoritesDebug == 1)
        alert("IsFavorite:UrlProcessFavorite = " + UrlProcessFavorite + ", parameters = " + parameters);	    	    
    
	xmlObjIsFavorite.open("POST", UrlProcessFavorite, false);  							
	//if(UrlProcessFavorite.indexOf(".php") == -1)
	    xmlObjIsFavorite.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");				
	xmlObjIsFavorite.setRequestHeader("Content-length", parameters.length);				
	xmlObjIsFavorite.send(parameters);	
	
	if(favoritesDebug == 1)	
	    alert("IsFavorite:responseText=" + xmlObjIsFavorite.responseText);
	
	var xmlDoc = GetXmlDoc(xmlObjIsFavorite.responseText);
    var isFavorite = xmlDoc.getElementsByTagName('isfavorite')[0].firstChild.data;
    //var isFavorite = GetTagValue(xmlObjIsFavorite.responseText, "isFavorite");
    
    xmlObjIsFavorite = null;
    return (isFavorite == "1");
}

function UpdateFavoriteElemets(id, htmlCode)
{
    for (var i = 0; i < favoriteTagsList.length; i++)
    {
        var tagObj = favoriteTagsList[i];
        var tagName = tagObj.getAttribute('id');
        if(tagName == id)
        {
            if(favoritesDebug == 1)	
                alert("UpdateFavoriteElemets:Updating code for id=" + id);
            tagObj.innerHTML = htmlCode;            
            tagObj.style.display = "";
        }
    }
}

function UpdateOneClickElemets(id, htmlCode)
{
    for (var i = 0; i < oneClickTagsList.length; i++)
    {
        var tagObj = oneClickTagsList[i];
        var tagName = tagObj.getAttribute('id');
        if(tagName == id)
        {
            if(favoritesDebug == 1)	
                alert("UpdateFavoriteElemets:Updating code for id=" + id);
            tagObj.innerHTML = htmlCode;            
            tagObj.style.display = "";
        }
    }
}

function RemoveFromFavorites(id, favoriteType)
{

    var loggedIn = IsUserLoggedIn();
    if(!loggedIn)
        return;
        
    var userID = GetLoggedInUserID();
    if(userID == null)
        return;

    xmlObjRemoveFavorite = CreateFavoritesAJAXRequest();
    
    var favoriteElementID = "fav-" + favoriteType + "-" + id;
    UpdateFavoriteElemets(favoriteElementID, GetRemoveFromFavoriteStatusCode());
    
    var parameters = "userid=" + userID + "&id=" + id + "&favoritetype=" + favoriteType + "&op=removefavorite";    
    if(favoritesDebug == 1)
	    alert("RemoveFromFavorites:UrlProcessFavorite = " + UrlProcessFavorite + ", parameters = " + parameters);	    
    	
	xmlObjRemoveFavorite.open("POST", UrlProcessFavorite, false);  								
	//if(UrlProcessFavorite.indexOf(".php") == -1)
	    xmlObjRemoveFavorite.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");				
	xmlObjRemoveFavorite.setRequestHeader("Content-length", parameters.length);					
	xmlObjRemoveFavorite.send(parameters);	
	
	if(favoritesDebug == 1)	
	    alert("RemoveFromFavorites:responseText=" + xmlObjRemoveFavorite.responseText);
	    
    var xmlDoc = GetXmlDoc(xmlObjRemoveFavorite.responseText);
	var status = xmlDoc.getElementsByTagName('status')[0].firstChild.data;	
	//var status = GetTagValue(xmlObjRemoveFavorite.responseText, "status");
	
	//check for status of removal...
	if(status == "0")
	{		    
        UpdateFavoriteElemets(favoriteElementID, GetAddToFavoriteCode(id, favoriteType));
    }
    else
    {
        var error = xmlDoc.getElementsByTagName('error')[0].firstChild.data;    
        alert(error);
        
        UpdateFavoriteElemets(favoriteElementID, GetRemoveFavoriteCode(id, favoriteType));
    }        
    
    xmlObjRemoveFavorite = null;
}

function AddToFavorites(id, favoriteType)
{
    var loggedIn = IsUserLoggedIn();
    if(!loggedIn)            
    {
        if(loginCallBack)
            oldLoginCallBack = loginCallBack;
            
        if(signupCallBack)
            oldSignupCallBack = signupCallBack;
            
        loginCallBack = function() { CheckAndAddToFavorites(id, favoriteType, 1); };     
        signupCallBack = function() { CheckAndAddToFavorites(id, favoriteType, 2); };            
        
        showLoginDialog();            
        return;            
    }
     
    var userID = GetLoggedInUserID();
    
    xmlObjAddFavorite = CreateFavoritesAJAXRequest();
        
    var favoriteElementID = "fav-" + favoriteType + "-" + id;
    UpdateFavoriteElemets(favoriteElementID, GetAddToFavoriteStatusCode());
    
    var parameters = "userid=" + userID + "&id=" + id + "&favoritetype=" + favoriteType + "&op=addfavorite";    
    if(favoritesDebug == 1)
        alert("AddToFavorites:UrlProcessFavorite = " + UrlProcessFavorite + ", parameters = " + parameters);	    	    
    
	xmlObjAddFavorite.open("POST", UrlProcessFavorite, false);  							
	//if(UrlProcessFavorite.indexOf(".php") == -1)
	    xmlObjAddFavorite.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");				
	xmlObjAddFavorite.setRequestHeader("Content-length", parameters.length);				
	xmlObjAddFavorite.send(parameters);	
	
	if(favoritesDebug == 1)
	    alert("AddToFavorites:responseText= "+ xmlObjAddFavorite.responseText);
	    
	var xmlDoc = GetXmlDoc(xmlObjAddFavorite.responseText);    
    var status = xmlDoc.getElementsByTagName('status')[0].firstChild.data;    
    //var status = GetTagValue(xmlObjAddFavorite.responseText, "status");   
			    
	//check for status of adding..
	if(status == "0")
	{		            
        UpdateFavoriteElemets(favoriteElementID, GetRemoveFavoriteCode(id, favoriteType));
    }
    else if(status == "2")
    {
        UpdateFavoriteElemets(favoriteElementID, GetAddToFavoriteCode(id, favoriteType));
        
        var errorText = "No puedes a&ntilde;adir tu propia estaci&otilde;n de radio como tu favorita.";
        if(language == "EN")
            errorText = "You cannot add your own radio station as your favorite.";
                        
        alert(errorText);        
    }
    else
    {
        var error = xmlDoc.getElementsByTagName('error')[0].firstChild.data;    
        alert(error);
        
        UpdateFavoriteElemets(favoriteElementID, GetAddToFavoriteCode(id, favoriteType));
    }
        
    xmlObjAddFavorite = null;
}

function GetAddToFavoriteStatusCode()
{
    if(language == "EN")
        return "Saving...";
    else
        return "Guardando...";
      
}

function GetRemoveFromFavoriteStatusCode()
{
    if(language == "EN")
        return "Removing...";
    else
        return "Eliminando...";
      
}

function OpenArtistRadio(PlaylistID,ArtistName)
{
    window.open('http://myradio.batanga.com/Player/player.aspx?PlaylistID='+PlaylistID+'&q='+ArtistName,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=650,height=600');        
}
/* from: http://myradio.batanga.com/include/master2008.js 20/11/2009 07:40:08 p.m. */

/*****************
******** From the body, check if variables are set properly for all the pages
******************/

    function loginCompleted(linkID)
    {        
        var menu = getCookie('menu');
        if (menu==null || menu=="")
            linkID += "O";
        else
            linkID += menu;
        setLinkCookie(linkID);
        document.location.reload();
    }

/*
    UrlUserNameCheck = siteRootFolder + "/CheckUserName.aspx";
    UrlUserSignup = siteRootFolder + "/SignupUser.aspx";        
    UrlUserLogin = siteRootFolder + "/LoginUser.aspx";
*/
    
    //UrlRegistrationHelper = siteRootFolder  + "/registrationhelper.aspx";
    loginCallBack = function() { loginCompleted("LinkTrack_Login_"); }
    signupCallBack = function() { loginCompleted("LinkTrack_Signup_"); }
    
    //UrlProgressImage = siteRootFolder + "/images/indicator.gif";
    
    UrlProcessFavorite = "/favoriteshelper/processfavorite.aspx";    
    UrlRemoveFromFavoritesImage = siteRootFolder + "/images/addtofavorites.gif";
    UrlAddToFavoritesImage = siteRootFolder + "/images/removefromfavorites.gif";

    function CallPlayListWM(StationID,idioma) {
           
        var Format='wm';
        Speed = "2";
        window.open('http://radio.batanga.com/'+idioma+'/LaunchPlaylistEM.asp?StationID='+StationID+'&Format='+Format+'&Speed='+Speed+'&context=','LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');
    }

    function OpenMyRadioURL(URL)
    {
        window.open(URL,'LaunchPlayerAndPlaylist','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,width=430,height=745');        
    }

    function OpenMyRadio(PlaylistID)
    {
        OpenMyRadioURL('./Player/player.aspx?PlaylistID='+PlaylistID);
    }

/*****************
******** 
******************/
/* from: http://sitelife.es.batanga.com/ver1.0/SiteLifeScripts?sid=sitelife.es.batanga.com 20/11/2009 07:40:08 p.m. */
var numUploads = 1;
var maxUploads = 4;


function VerifyTOS() {
    if(!document.getElementById("plckTermsOfPhotoService").checked) {
        alert("Please agree to the terms of service before submitting.");
        return false;
    }
    return true;
}

// use to generate more photo submission divs
function AddAnotherPhoto(parentDivID,uploadButtonID, parentFrame){
    divNode = document.createElement('div');
    divNode.id = 'PhotoUpload' + (++numUploads);
    divNode.innerHTML = "<input type='file' name='image" + numUploads + "' value='Get' size=40/><br/><br/>"

    document.getElementById(parentDivID).appendChild(divNode);
    if(numUploads > maxUploads) document.getElementById(uploadButtonID).style.display = 'none';
    setTimeout(function(){autofitIframe(parentFrame, true);}, 100);
    return false;
}


// Returns the value of the radio button that is set in a group of buttons.
function getCheckedValue(radioObj) {
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		if(radioObj.checked) {
			return radioObj.value;
		}
		else {
			return "";
		}
	}
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// this trim was suggested by Tobias Hinnerup
String.prototype.trim = function() {
    return(this.replace(/^\s+/,'').replace(/\s+$/,''));
}

function IsEnter(e)  {
var kc = e.which;
if(kc == null) kc = e.keyCode;
if (e && kc == 13) return true;
return false;
}
function TrimEnd(ct, c) {
    while((ct.length > 0) && (ct.lastIndexOf(c) == (ct.length - 1))){
        if(ct.length > 1 ) {
            ct = ct.substring(0, ct.length - 1);
        }else{ 
            return "";
        }
    }
    return ct;
}
function FixSearchString(str) {
    var ct = str.replace(/[\%\&\/\<\>\\\|]+/g,"");
    ct = ct.replace(/[\.]{2,}/g, ".");
        
    ct = TrimEnd(ct,".");
    if( ct == "" ) return "";
    ct = TrimEnd(ct," ");
    if( ct == "") return "";

    ct = escape(ct);
    // JavaScript's built-in escape() skips plus signs, but we need them for Lucene
    ct = ct.replace(/\+/g, "%2B");
    return ct;
}

var nextGroupID = 1;

function autofitIframe(id, heightOnly){
    if(document.getElementById) {
        if(this.document.body.scrollHeight == 0 || ( !heightOnly && this.document.body.scrollWidth == 0)) {
            //Onload fired, DOM assembled, but scrollHeight/Width is zero. This should not be... Go to
            //sleep and try again
            setTimeout(function(){autofitIframe(id, heightOnly);}, 150);
            return;
        }
        window.parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px";
        if(!heightOnly)window.parent.document.getElementById(id).style.width=this.document.body.scrollWidth+"px";
    }
}

//Determines if the string being tested is a Url.
function isUrl(s) {
	var regexp = /(ftp|https?|file):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;
	return regexp.test(s);
}

function ValidateLogin() {
    function $(id) { return document.getElementById(id) };
    if($("plckUserName").value == '' && $("plckPassword").value == '') {
        alert("You must provide a UserName and Password");
        return false;
    }
    if($("plckUserName").value == '') {
        alert("You must provide a UserName");
        return false;
    }
    if($("plckPassword").value == '') {
        alert("You must provide a Password");
        return false;
    }
}   

function onSearchSubmit(qroupID) {
    if($(qroupID  + "_Search").value == '') {
        alert("You must provide some query text");
        return false;
    }    
}

function LimitLength(control, limitToLength) {
  var str = control.value;
  if(! str || str.length == 0) return false;
  
  var matches = str.match(/\r|\n/g);
  if(! matches) return false;
  
  var offSet = matches.length;
  if (str.length > (limitToLength + offSet)) {
    control.value = str.substring(0, limitToLength + offSet);
  }
  return false;
} 
/* this document is for visual dhtml features */
function mouseX(evt) {
    if (evt.pageX) return evt.pageX;
    else if (evt.clientX)
       return evt.clientX + (document.documentElement.scrollLeft ?
       document.documentElement.scrollLeft :
       document.body.scrollLeft);
    else return null;
}
function mouseY(evt) {
    if (evt.pageY) return evt.pageY;
    else if (evt.clientY)
       return evt.clientY + (document.documentElement.scrollTop ?
       document.documentElement.scrollTop :
       document.body.scrollTop);
    else return null;
}
function HideDiv(id){
    document.getElementById(id).style.display = "none";
}

function ShowDivAtMouse(evt, id) {
    posx = mouseX(evt) - 170;    
    posy = mouseY(evt);
    //normalize to make sure we at least appear on the screen
    if(posx < 0) posx = 10;
    if(posy < 0) posy = 10;
    
    document.getElementById(id).style.left = posx + "px";
	document.getElementById(id).style.top = posy + "px";
	document.getElementById(id).style.display = "block";
}
function ShowReportAbuse(evt, url, command) {
    var doc = document;
    doc.getElementById("ReportAbuse_Url").value = url; 
    doc.getElementById("ReportAbuse_Command").value = command;
    doc.getElementById("ReportAbuse_CommentText").value = "";
    doc.getElementById("ReportAbuse_Reason").selectedIndex = 0;
    ShowDivAtMouse(evt, "ReportAbuse_Menu");
    doc.getElementById('ReportAbuse_CommentText').focus();
}
function ReportAbuse() {
    var url = document.getElementById("ReportAbuse_Url").value; 
    var command = document.getElementById("ReportAbuse_Command").value;
    var text = document.getElementById("ReportAbuse_CommentText").value;
    var reason = document.getElementById("ReportAbuse_Reason").value;
    document.getElementById("ReportAbuse_Menu").style.display='none';
    var sendUrl = command+'&plckReason='+gSiteLife.EscapeValue(reason)+'&plckURL=' + gSiteLife.EscapeValue(url)
    if(text) sendUrl += "&plckAbuseDetail=" + gSiteLife.EscapeValue(text);
    gSiteLife.__Send(sendUrl);
}

function SiteLifeShowHide(id1, id2){
    document.getElementById(id1).style.display = "none";
    document.getElementById(id2).style.display = "block";
    return false;
}

function DebugShowInnerHTML(id, url) {
    var el = document.getElementById(id);
    var floatDiv = document.createElement("div");
      
    floatDiv.style.position = "absolute";    
    floatDiv.style.zIndex='1000';
    floatDiv.innerHTML = "<span style='background-color:red; color:white; cursor:pointer;' onclick='this.parentNode.parentNode.removeChild(this.parentNode);'>[close]</span>";    
    floatDiv.innerHTML += "<div style='background-color:black; color:white;'>" + url + "</div><textarea rows='20' cols='80'>" + el.childNodes[0].childNodes[1].innerHTML + "</textarea>";
    el.insertBefore(floatDiv, el.childNodes[0]);
}


function ToggleState() {
    function $(id) { return document.getElementById(id) };
    var radio1 = $("plckCommentApprovalEveryOne");
    var radio2 = $("plckCommentApprovalNoBody");
    var table = $("commentSettings"); 
    if(radio1.disabled  == true) {
        radio1.disabled  = false;
        radio2.disabled  = false;
        table.className = "";
    }
    else {
        radio1.disabled  = true;
        radio2.disabled  = true;
        table.className = "BlogSettings_Disabled";
    }
}

function getElementsByClassName(classname, node)  {
    if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}


/* from: http://sitelife.es.batanga.com/ver1.0/SiteLifeProxy 20/11/2009 07:40:08 p.m. */
    //multi site enabled -- sid: sitelife.es.batanga.com 
    //document.write("<link href='http://sitelife.es.batanga.com/ver1.0/SiteLifeCss?sid=sitelife.es.batanga.com' rel='stylesheet' type='text/css' />");
    //document.write("<script type='text/javascript' src='http://sitelife.es.batanga.com/ver1.0/SiteLifeScripts?sid=sitelife.es.batanga.com'></script>");
	document.write("<!--link href='http://www.batanga.com/css/pluck.css' rel='stylesheet' type='text/css' /-->");

///<summary>constructor to create a new SiteLifeProxy</summary>
function SiteLifeProxy(url) {
    // User Configurable Properties - these can be set at any time

    // your apiKey, this value must be set!
    this.apiKey = null;
    
    this.siteLifeDomainOverride = null;
    this.siteLifeServerBaseOverride = null;
    this.customerCSSOverride = null;
    this.customerForumPagePathOverride = null;

    // sniff the browser for custom behaviors
    this.__isExplorer = navigator.userAgent.toLowerCase().indexOf('msie') != -1;
    this.__isSafari = navigator.userAgent.toLowerCase().indexOf('safari') != -1;
    this.__isMac = navigator.platform.toLowerCase().indexOf('mac') != -1;
    this.__isMacIE = this.__isMac && this.__isExplorer;
    
    // if enabled, spit out debug information through alert()
    this.debug = false;
    
    // used to track the id of the handler expecting the results from the immediately preceeding method invocation
    // this is used only for testing purposes
    this.lastHandlerId = "";
    
    // Methods You can Overide
    //
    // OnSuccess(returnValue) - is passed the return value at the end of a successful call, default does nothing
    // OnError(msg) - is passed an error message if a problem occurs
    // OnDebug(msg) - is called when debugging is enabled
     
    this.__baseUrl = url;
    this.__sendInvokeCount = 0;
    
    this.__eventHandlers = new Object();
};

SiteLifeProxy.prototype.AddEventHandler = function (event_name, callback) {
	var eventList = this.__eventHandlers[event_name];
	if (!eventList){
		eventList = new Array();
		this.__eventHandlers[event_name] = eventList;
	}
	eventList.push(callback);
};

SiteLifeProxy.prototype.FireEvent = function (event_name) {
    var func;
    if(handlers = this.__eventHandlers[event_name]) {
        var A = new Array(); for (var i = 1; i <  this.FireEvent.arguments.length; i++){ A[i - 1] = this.FireEvent.arguments[i];}
        for(var x=0;x<handlers.length;x++){
			func = handlers[x];
			if (func.__Bound){
			   if (handlers.length == 1) return func();
			   func();
			}
			if (handlers.length == 1) return func.apply(this, A);
			func.apply(this, A);
    }
}
};

SiteLifeProxy.prototype.ScriptId = function() { return this.__scriptId = "_bb_script_" + this.__sendInvokeCount++; }

// Default error handler for the proxy object, simple alert
SiteLifeProxy.prototype.OnError = function(msg) {
   alert("OnError: " + msg);
}

// Default debug handler for the proxy object, simple alert
SiteLifeProxy.prototype.OnDebug = function(msg) {
    if (this.debug)
        alert("Debug: " + msg);
}

// fetch a named request parameter from the page URL
SiteLifeProxy.prototype.GetParameter = function(parameterName) {
    var key = parameterName + "=";
    var parameters = document.location.search.substring(1).split("&");
    for (var i = 0; i < parameters.length; i++)
    {
        if (parameters[i].indexOf(key) == 0)
            return parameters[i].substring(key.length);
    }
    return null;
};

// browser independent method to get elements by ID
SiteLifeProxy.prototype.GetElement = function(id) {
    this.OnDebug("GetElement " + id);
    if (document.getElementById)
        return document.getElementById(id);
    if (document.all)
        return document.all[id];
    this.OnError("No support for GetElement() in this browser");
    return null;
}

// browser independent method to get elements by tag name
SiteLifeProxy.prototype.GetTags = function(tagName) {
    this.OnDebug("GetTags " + tagName);
    if (document.getElementsByTagName)
        return document.getElementsByTagName(tagName);
    if (document.all)
       return document.tags(tagName);
    this.OnError("No support for GetTags() in this browser");
    return null;
}

SiteLifeProxy.prototype.Trim = function(s) {
	return s.replace(/^\s+|\s+$/g,"");

};

SiteLifeProxy.prototype.EscapeValue = function(s) {
    if (s == null) return null;
    return encodeURIComponent(s);
};

SiteLifeProxy.prototype.__ArrayValidation = function(s)
{
    if ((typeof s == 'undefined') || (s.length < 1))
    {
        return false;
    }
    return true;
}

SiteLifeProxy.prototype.__CheckErrorHandler = function(onError) {
    this.OnDebug("__CheckErrorHandler " + onError);
    if ((typeof onError == 'undefined') || (eval("window." + onError) == null))
    {
      return "gSiteLife.OnError";
    }
    return onError;
}
SiteLifeProxy.prototype.SetCookie = function SetCookie( name, value) {
    var today = new Date(); today.setTime( today.getTime() );
    
    var expires_date = new Date( today.getTime() + 126144000000 );
    
    document.cookie = name + "=" +escape( value ) +
    ";expires=" + expires_date.toGMTString() + 
    ";path=/" + ";domain=batanga.com" ;
}
// validate and fetch arguments, if the argument is missing and optional, we return an empty string        
SiteLifeProxy.prototype.__GetArgument = function(variableName, variableValue, isRequired, isArray) {
    this.OnDebug("__GetArgument " + variableName + "," + variableValue + "," + isRequired + "," + isArray);
    if (typeof variableValue == "undefined" || variableValue == null || variableValue == "")
    {
        if (isRequired)
        {
            this.OnError("Missing required parameter " + variableName);
            this.__isValid = false;
            return "";
        }
        else
            return "";
    }
    if (isRequired && isArray) 
    {
        if (!this.__ArrayValidation(variableValue)) 
        {
            this.OnError("Invalid array parameter " + variableName);
            this.__isValid = false;
            return "";
        }
    }
    return "&" + variableName + "=" + this.EscapeValue(variableValue);
};

SiteLifeProxy.prototype.__StripAnchorFromUrl = function(url) {
    var aIdx = url.indexOf("#");
    return aIdx == -1 ? url : url.substring(0, aIdx);
}

SiteLifeProxy.prototype.__SafeAppendUrlValue = function(url, key, value) {
    url += url.indexOf("?") != -1 ? "&" : "?";
    return url + key + "=" + value;
}

SiteLifeProxy.prototype.__AppendUrlValues = function (url)
{
	time = new Date();
    url += this.__GetArgument("plckNoCache", time.getTime(), false, false);
    url += this.__GetArgument("plckApiKey", this.apiKey, true, false);
    url += this.__GetArgument("pcksld", this.siteLifeDomainOverride, false, false);
    url += this.__GetArgument("pcksbu", this.siteLifeServerBaseOverride, false, false);
    url += this.__GetArgument("pckcss", this.customerCSSOverride, false, false);
    url += this.__GetArgument("pckfpp", this.customerForumPagePathOverride, false, false);
                        url += this.__GetArgument("sid", gSiteLife.SID, false, false);
                
    return url;
}

SiteLifeProxy.prototype.ReloadPage = function(params) {
    var sSearch = window.location.search.substring(1);
    var sNVPs = sSearch.split('&');
    var newSearch = "";
    var anchorPoint = "";
    for(var k in params) {
        if(k == "extend") continue;
		if(k == "#") {
			anchorPoint = '#' + params[k];
			continue;
		}		
        if(newSearch == "") newSearch += "?"; else newSearch += "&";
        newSearch += k + '=' + params[k];
    }
    for (var i = 0; i < sNVPs.length; i++) {
        var kv = sNVPs[i].split('=');
        if(kv[0] && kv[0].indexOf('plck') != 0 && ! params[kv[0]]) {
            newSearch += "&" + sNVPs[i];        
        }
    }
            
    if(anchorPoint != ""){ 
        window.location.hash = anchorPoint;
    }
    window.location.search = newSearch;
}

function loadScript (url, callback) {
	var script = document.createElement('script');
	script.type = 'text/javascript';
	script.charset = 'utf-8';
	if (callback)
		script.onload = script.onreadystatechange = function() {
			if (script.readyState && script.readyState != 'loaded' && script.readyState != 'complete')
				return;
			script.onreadystatechange = script.onload = null;
			callback();
		};
	script.src = url;
	document.getElementsByTagName('head')[0].appendChild (script);
}

SiteLifeProxy.prototype.__Send = function(url, scriptToUse, callbackName, args) {
    this.OnDebug("_Send " + url);
    function gLoadScript(url, callbackName) {
      var script = document.createElement('script');
      script.setAttribute('type', 'text/javascript');
    	script.setAttribute('charset', 'utf-8');
    	script.setAttribute('src', url + (callbackName ? '&EVENT_ID=' + callbackName : ''));
    	document.getElementsByTagName('head')[0].appendChild (script);
    }
    function bind(_function, _this, _arguments) {
      var f = function() {
        _function.apply(_this, _arguments);
      };
      f['__Bound'] = true;
      return f;
    };
    var func;
    if ((typeof callbackName == 'string') && (func = this.__eventHandlers[callbackName]) && (typeof func == 'function') && !func['__Bound']) {
      this.__eventHandlers[callbackName] = bind(func, this, args);
    }
    
    //append our various parameters as necessary
    url = this.__AppendUrlValues(url);
    this.OnDebug("_Send (updated) " + url);
    // add the script node to the document
    if (document.createElement && ! this.__isMacIE) {
        gLoadScript(url, callbackName);
        return;
    }

    // could fall back to sync at this point, but will bust if the page is already loaded

    this.OnError("No support for async in this browser");
}

SiteLifeProxy.prototype.Logout = function(ScriptToUse, IsRestPage) {
    var plckRest = IsRestPage ? true : false;
    this.__Send(this.__baseUrl + '/Utility/Logout?plckRedirectUrl=' + escape(window.location.href) + '&plckRest=' + plckRest, ScriptToUse);
    return false;
}

SiteLifeProxy.prototype.AddLoadEvent = function(func) {
if(window.addEventListener){
 window.addEventListener("load", func, false);
}else{
 if(window.attachEvent){
   window.attachEvent("onload", func);
 }else{
   if(document.getElementById){
    var oldonload = window.onload;
    if (typeof window.onload != 'function') {
      window.onload = func;
    } else {
      window.onload = function() {
       if (oldonload) {
        oldonload();
       }
       func();
}}}}}}

SiteLifeProxy.prototype.AdInsertHelper = function() {
    for(var src in gSiteLife.__adsToInsert) {
        if(src == "extend") continue;
        var dest = gSiteLife.__adsToInsert[src];
        var parent = document.getElementById(dest);
		var newChild = document.getElementById(src);
		if( ! parent || ! newChild ) {continue; }
		parent.replaceChild( newChild, document.getElementById(dest + "Child"));
		newChild.style.display = "block"; parent.style.display = "block";
    }
}

SiteLifeProxy.prototype.InsertAds = function(source, destination) {
gSiteLife.__adsToInsert = new Object();
for(ii=0; ii< this.InsertAds.arguments.length; ii+=2) { gSiteLife.__adsToInsert[this.InsertAds.arguments[ii]] = this.InsertAds.arguments[ii+1];}
this.AddLoadEvent(gSiteLife.AdInsertHelper);
}

SiteLifeProxy.prototype.TitleTag = function() {
 var titleTag = document.getElementById("plckTitleTag");
 return titleTag ? titleTag.innerText || titleTag.textContent : null;
 }

SiteLifeProxy.prototype.WriteDiv = function(id, divClass) {
    var cssClass = divClass ? divClass : "";
    document.write('<div id="'+id+'" class="'+cssClass+'"></div>'); return id;
}

SiteLifeProxy.prototype.InnerHtmlWrite = function(elementId, innerContents ) {
    var el = document.createElement("div");
    try {
        if(document.location.href.indexOf("debug=true") > -1) {
            el.innerHTML += "<div style='border:1px solid red;'><span style='background-color:red; color:white; position:absolute; cursor:pointer; font-size:8pt;' onclick='DebugShowInnerHTML(\"${plckElementId}\",\"http://sitelife.es.batanga.com/ver1.0/Proxies/Default.rails?&sid=sitelife.es.batanga.com\");'>&nbsp;?&nbsp;</span><div>" + innerContents + "</div></div>";
        } else {
            el.innerHTML += innerContents;
            el.style.display = "inline";
        }
        var destDiv = document.getElementById(elementId);
        while (destDiv.childNodes.length >= 1) {
             destDiv.removeChild(destDiv.childNodes[0]);
        }
        
        destDiv.appendChild(el);
    } catch (error) {
        alert(elementId + " Error "  + error.number + ": " + error.description);
    }
}

SiteLifeProxy.prototype.SortTimeStampDescending = "TimeStampDescending";
SiteLifeProxy.prototype.SortTimeStampAscending = "TimeStampAscending";
SiteLifeProxy.prototype.SortRecommendationsDescending = "RecommendationsDescending";
SiteLifeProxy.prototype.SortRecommendationsAscending = "RecommendationsAscending";
SiteLifeProxy.prototype.SortRatingDescending = "RatingDescending";
SiteLifeProxy.prototype.SortRatingAscending = "RatingAscending";
SiteLifeProxy.prototype.SortAlphabeticalAscending = "AlphabeticalAscending";
SiteLifeProxy.prototype.SortAlphabeticalDescending = "AlphabeticalDescending";
SiteLifeProxy.prototype.KeyTypeExternalResource = "ExternalResource";
        



SiteLifeProxy.prototype.PersonaHeaderRequest = function(UserId) {
    var url = this.__baseUrl + '/Persona/PersonaHeader?plckElementId=personaHDest&plckUserId='+ UserId;
    this.__Send(url, "personaHeaderScript", 'persona:header', arguments);
}
SiteLifeProxy.prototype.PersonaHeader = function(UserId) {
    this.WriteDiv("personaHDest", "Persona_Main");
        this.AddEventHandler('persona:header', function() { gSiteLife.PersonaHeaderInbox();  });
        this.PersonaHeaderRequest(UserId); 
}
SiteLifeProxy.prototype.PersonaHeaderInbox = function() {
	// if DAAPI proxy is not present, fail gracefully
	if (!document.getElementById('PrivateMessageInbox') || !window.RequestBatch || !window.PrivateMessageFolderList) {
		var pmContainer = document.getElementById('PersonaHeader_PrivateMessageContent');
		if (pmContainer) {
			pmContainer.style.display = 'none';
		}
		return;
	}

	var rb = new RequestBatch();
	rb.AddToRequest(new PrivateMessageFolderList());
	rb.BeginRequest(serverUrl,
		function(responseBatch) {
			var count = '';
			try {
				if (responseBatch && responseBatch.Messages && responseBatch.Messages.length && responseBatch.Messages[0].Message == 'ok') {
					var folders = responseBatch.Responses[0].PrivateMessageFolderList.FolderList;
					for (var i = 0; i < folders.length; i++) {
						var f = folders[i];
						if (f.FolderID == 'Inbox') { count = f.UnreadMessageCount; break; }
					}
				}
			} catch (e) {}
			var inboxStr = "Inbox ({0})";
			var idx = inboxStr.indexOf("{0}");
			if (inboxStr == '' || idx >= -1)
				inboxStr = inboxStr.substring(0, idx) + count + inboxStr.substring(idx+3);
			var inbox = document.getElementById('PrivateMessageInbox');
			inbox.innerHTML = inboxStr;
			if (count > 0) inbox.style.fontWeight = 'bold';
		});
}

SiteLifeProxy.prototype.Persona = function(UserId) {
    this.WriteDiv("personaDest", "Persona_Main");
    var action = this.GetParameter("plckPersonaPage");
    if(action && (typeof this[action] == 'function')) this[action](UserId);
             else this.PersonaHome(UserId);
    }
SiteLifeProxy.prototype.LoadPersonaPage = function(PageName, UserId) {
    var params = new Object(); params['plckPersonaPage'] = PageName; params['plckUserId'] = UserId;
            params['userid'] = UserId;
        for(ii=2; ii< this.LoadPersonaPage.arguments.length; ii+=2) { params[this.LoadPersonaPage.arguments[ii]] = this.LoadPersonaPage.arguments[ii+1];}
    this.ReloadPage(params);
    return false;
}

SiteLifeProxy.prototype.PersonaHome = function(UserId) {

    var me = this;
    this.AddEventHandler('persona:home:complete', function() { me.PopulateGroupsDiv(UserId, 1); });
    return this.PersonaSend('PersonaHome', 'personaDest', 'personaScript', UserId, null, 'persona:home:complete');
	  
}

SiteLifeProxy.htmlEncode = function(str){
	// Fix HTML
	var ret = str;
	var div = document.createElement('div');
	var text = document.createTextNode(str);
	div.appendChild(text);
	ret = new String(div.innerHTML);				
	
	// The above doesn't take care of quotes.
	ret = ret.replace(/"/g, '&quot;');
	
	return ret;
};
			
SiteLifeProxy.prototype.PopulateGroupsDiv = function(UserId, OnPage) {
        // a utility function to compare two urls for purposes of determining site of origin
    var isFromThisSite = function(siteOfOrigin, currentHost) {
        // assume each url has periods in it
        var siteOfOriginDotIndex = siteOfOrigin.indexOf('.');
        var currentHostDotIndex = currentHost.indexOf('.')
        if (siteOfOriginDotIndex < 0 || currentHostDotIndex < 0) {
            return false;
        }
        else {
            return siteOfOrigin.slice(siteOfOriginDotIndex).toLowerCase() == currentHost.slice(currentHostDotIndex).toLowerCase();
        }
    }
        // check for DAAPI objects; if not there, fail gracefully
    if (window.RequestBatch && window.CommunityGroupMembershipPage && window.UserKey) {
        var requestBatch = new RequestBatch();
        requestBatch.AddToRequest(new CommunityGroupMembershipPage(new UserKey(UserId+""), 8, OnPage, "TimeStampAscending", "Member"));
        requestBatch.BeginRequest("http://sitelife.es.batanga.com/ver1.0/Direct/Process", function(responseBatch) {   
            if (responseBatch.Responses.length > 0 && responseBatch.Responses[0].CommunityGroupMembershipPage) {
                // create the div that will house all this info
                var groupsDiv = document.createElement('div');
                groupsDiv.className = 'PersonaStyle_ItemContainer';
                var groupsContainer = document.getElementById('PersonaStyle_GroupsContainer');
                // Check groupsContainer is null because PersonaStyle_GroupContainer may be absent due to private persona files.
                if (groupsContainer != null) {
                    groupsContainer.appendChild(groupsDiv);
                        
                    var groupBaseUrl = "http://www.batanga.com/groups/CommunityGroup.html";
                    var groupMembershipPage = responseBatch.Responses[0].CommunityGroupMembershipPage;
                    var groupsHtml = "<div class=\"PersonaStyle_SectionHead\">Groups</div>";
                    groupsHtml += "<div class=\"PersonaStyle_GroupList\">";
                    for (var index = 0; index < groupMembershipPage.CommunityGroupMemberships.length; index++) {
                        var currentGroup = groupMembershipPage.CommunityGroupMemberships[index].CommunityGroup;
                        // if current group is private and user is non-member, don't display
                        var display = true;
                        if (currentGroup.CommunityGroupVisibility == 'Private') {
                            display = (currentGroup.RequestingUsersMembershipTier != 'NonMember' && currentGroup.RequestingUsersMembershipTier != 'Banned');
                        }
                        if (display) {
                            var groupUrl = groupBaseUrl + "?slGroupKey=" + currentGroup.CommunityGroupKey.Key;
                                                            if (!isFromThisSite(currentGroup.SiteOfOrigin, window.location.host)) {
                                    groupsHtml += "<img height=\"50\" width=\"50\" title=\"" + SiteLifeProxy.htmlEncode(currentGroup.Title) + "\" src=\"" + currentGroup.AvatarImageUrl + "\" />";
                                }
                                else {
                                    groupsHtml += "<a href=\"" + groupUrl + "\"><img height=\"50\" width=\"50\" title=\"" + SiteLifeProxy.htmlEncode(currentGroup.Title) + "\" src=\"" + currentGroup.AvatarImageUrl + "\" /></a>";
                                }
                                                    }
                    }
                    //Pagination for Group List
                    groupsHtml += "<p><ul class=\"PersonaStyle_GroupListPagination\">";
                    
                    if (groupMembershipPage.OnPage > 1)                {
                        groupsHtml += "<li><a href='#PreviousGroup' onclick='gSiteLife.PopulateGroupsDiv(\"" + UserId + "\", " + (parseInt(groupMembershipPage.OnPage) - 1) + ");'>&lt;&lt;Previous</a></li>";
                    }
                    
                    if (groupMembershipPage.NumberOfCommunityGroupMemberships > (groupMembershipPage.NumberPerPage * groupMembershipPage.OnPage))                {
                        groupsHtml += "<li><a href='#NextGroup' onclick='gSiteLife.PopulateGroupsDiv(\"" + UserId + "\", " + (parseInt(groupMembershipPage.OnPage) + 1) + ");'>Next&gt&gt;</a></li>";
                    }
                    groupsHtml += "</p>";
                    
                    //End Pagination for Group List            
                    groupsHtml += "</ul><div class=\"PersonaStyle_GroupListClear\"></div>";                   
                    groupsHtml += "</div>";                   
                    groupsDiv.innerHTML = groupsHtml;
                    
                    while(groupsContainer.hasChildNodes()) {
                        groupsContainer.removeChild(groupsContainer.childNodes[0]);
                    }
                    groupsContainer.appendChild(groupsDiv);
                }   
            }
        });
    }
    // fire any other events
    this.FireEvent('persona:home');
}

SiteLifeProxy.prototype.WatchItem = function(Controller,Method,WatchKey, targetDiv) {
    var url = this.__baseUrl + '/'+Controller+'/' + Method + '?' + 'plckWatchKey=' + WatchKey + '&plckElementId=' + targetDiv + '&plckWatchUrl=' + this.EscapeValue(window.location.href);
    this.__Send(url, "AddWatchScript");
    return false;
}
SiteLifeProxy.prototype.PersonaRemoveWatchItem= function(UserId, WatchKey, Div, View) {
   return this.PersonaSend('PersonaRemoveWatchItem', Div, 'personaScript', UserId, 'plckWatchView=' + View + '&plckWatchKey=' + WatchKey);
}
SiteLifeProxy.prototype.PersonaAddFriend= function(UserId) {
   return this.PersonaSend('PersonaAddFriend', 'personaHDest', 'personaScript', UserId);
}
SiteLifeProxy.prototype.PersonaRemoveFriend = function(UserId, Friend, Div, View, Expanded, confirmMsg) {
   if(!Expanded) Expanded = "false";
   if (confirm(confirmMsg) == true) {
    return this.PersonaSend('PersonaRemoveFriend', Div, 'personaScript', UserId, 'plckFriendView=' + View + '&plckFriend=' + Friend + '&plckExpanded=' + Expanded);
   }
   return false;
}
SiteLifeProxy.prototype.PersonaRemovePendingFriend = function(UserId, PendingFriend, Div, confirmMsg) {
   if (confirm(confirmMsg) == true) {
    return this.PersonaSend('PersonaRemovePendingFriend', Div, 'personaScript', UserId, 'plckPendingFriend=' + PendingFriend);
   }
   return false;
}
SiteLifeProxy.prototype.PersonaAddPendingFriend = function(UserId, PendingFriend, Div) {
    return this.PersonaSend('PersonaAddPendingFriend', Div, 'personaScript', UserId, 'plckPendingFriend=' + PendingFriend);
}
SiteLifeProxy.prototype.PersonaMessages = function(UserId) {
   var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
   var scrl = this.GetParameter('plckScrollToAnchor');  if(scrl){ if(AdParams) {AdParams +='&';} AdParams += 'plckScrollToAnchor=' + scrl;}
   if(this.GetParameter('plckMessageSubmitted')){if(AdParams) {AdParams +='&';} AdParams += 'plckMessageSubmitted=' + this.GetParameter('plckMessageSubmitted');}
   return this.PersonaSend('PersonaMessages', 'personaDest', 'personaScript', UserId, AdParams, 'persona:messages');
}
SiteLifeProxy.prototype.PersonaComments = function(UserId) {
   var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
   return this.PersonaSend('PersonaComments', 'personaDest', 'personaScript', UserId, AdParams, 'persona:comments');
}
SiteLifeProxy.prototype.PersonaBlog = function(UserId) {
   var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
   if(AdParams) {AdParams +='&';} AdParams += 'plckBlogId=' + UserId;
   var url = this.__baseUrl + '/PersonaBlog/PersonaBlog?plckElementId=personaDest&plckUserId='+ UserId + '&' + AdParams;
   this.__Send(url, 'personaScript', 'persona:blog', arguments);
   return false;
}
SiteLifeProxy.prototype.PersonaProfile = function(UserId) {
    return this.PersonaSend('PersonaProfile', 'personaDest', 'personaScript', UserId, null, 'persona:profile');
}
SiteLifeProxy.prototype.PersonaWatchListPaginate = function(UserId, pageNum) { 
    return this.PersonaPaginate('WatchList', pageNum, UserId);
}
SiteLifeProxy.prototype.PersonaFriendsPaginate = function(UserId, pageNum) { 
	var AdParam = "plckFullFriendsList=true";
    return this.PersonaPaginate('Friends', pageNum, UserId, AdParam);
}

SiteLifeProxy.prototype.PersonaFriendsExpand= function(UserId) { 
    var url = this.__baseUrl + '/Persona/PersonaFriends?plckFullFriendsList=true&plckFriendsPageNum=0&plckElementId=PersonaFriendsDest&plckUserId='+ UserId;
    this.__Send(url, 'PersonaFriendsScript');
    return false;
}
SiteLifeProxy.prototype.PersonaFriendsCollapse= function(UserId, pageNum) { 
    var url = this.__baseUrl + '/Persona/PersonaFriends?plckFullFriendsList=false&plckFriendsPageNum=0&plckElementId=PersonaFriendsDest&plckUserId='+ UserId;
    this.__Send(url, 'PersonaFriendsScript');
    return false;
}

SiteLifeProxy.prototype.PersonaPendingFriendsPaginate = function(UserId, pageNum) { 
    var AdParam = "plckPendingFriendsPageNum=" + pageNum;
    return this.PersonaPaginate('Friends', 0, UserId,AdParam);
}
SiteLifeProxy.prototype.PersonaMessagesPreviewPaginate = function(UserId, pageNum) { 
    return this.PersonaPaginate('MessagesPreview', pageNum, UserId);
}
SiteLifeProxy.prototype.PersonaMessageRemove = function(UserId, pageNum, MessageKey, confirmMsg) { 
   if (confirm(confirmMsg) == true) {
        return this.PersonaSend('PersonaRemoveMessage', 'personaDest', 'PersonaMessagesPageScript', UserId, 'plckCurrentPage='+ pageNum + '&plckMessageKey='+MessageKey);
   }
   return false;
}
SiteLifeProxy.prototype.PersonaSend = function(ApiName, DestDiv, ScriptName, UserId, AddParams, eventId){
    var url = this.__baseUrl + '/Persona/' + ApiName + '?plckElementId=' + DestDiv + '&plckUserId='+ UserId;
    if(AddParams) url += '&' + AddParams;
    this.__Send(url, ScriptName, eventId, arguments);
    return false;
}

SiteLifeProxy.prototype.PersonaPaginate = function(ApiName, PageNum, UserId, AddParams){
    var url = this.__baseUrl + '/Persona/Persona' + ApiName + '?plck' + ApiName + 'PageNum=' + PageNum + '&plckElementId=Persona' + ApiName + 'Dest&plckUserId='+ UserId;
    if(AddParams) url += '&' + AddParams;    
    this.__Send(url, 'Persona'+ ApiName + 'Script');
    return false;
}

SiteLifeProxy.prototype.PersonaPhotoSend = function(ApiName, DestDiv, ScriptName, UserId, AddParams, eventId){
    var url = this.__baseUrl + '/PersonaPhoto/' + ApiName + '?plckElementId=' + DestDiv + '&plckUserId='+ UserId;
    if(AddParams) url += '&' + AddParams;
    this.__Send(url, ScriptName, eventId, arguments);
    return false;
}

SiteLifeProxy.prototype.PersonaMostRecent = function(UserId, PhotoID, DestDiv) {
   return this.PersonaPhotoSend('PersonaMostRecent', DestDiv, 'personaScript', UserId,'plckPhotoID=' + PhotoID);
}

SiteLifeProxy.prototype.PersonaCommunityGroupsPaginate = function(UserId, PageNum){
	return this.PersonaPaginate('CommunityGroups', PageNum, UserId);
}

SiteLifeProxy.prototype.PersonaCreateGallery = function(UserId) {
     return this.PersonaPhotoSend('UserGalleryCreate', 'personaDestPhoto', 'personaScript', UserId);
}

SiteLifeProxy.prototype.PersonaEditGallery = function(UserId,GalleryID) {
     return this.PersonaPhotoSend('UserGalleryEdit', 'userGalleryDest', 'personaScript', UserId,'plckGalleryID=' + GalleryID);
}

SiteLifeProxy.prototype.PersonaUploadToUserGallery = function(GalleryId) {
    var url = this.__baseUrl + '/Photo/PhotoUpload?plckElementId=userGalleryDest&plckGalleryID='+ GalleryId;
    this.__Send(url);
    return false;
}

SiteLifeProxy.prototype.PersonaPhotos = function(UserId) {
     return this.PersonaPhotoSend('PersonaPhotos', 'personaDest', 'personaScript', UserId, null, 'persona:photos');
}
SiteLifeProxy.prototype.PersonaAllPhotos = function(UserId) {
     return this.PersonaPhotoSend('PersonaAllPhotos', 'personaDest', 'personaScript', UserId);
}

SiteLifeProxy.prototype.PersonaGalleryPhoto = function(UserId, plckFindCommentKey) {
	var findCommentKey = gSiteLife.ReadFindCommentKey(findCommentKey, "widget:personaGalleryPhoto");
	
    return this.PersonaPhotoSend('PersonaGalleryPhoto', 'personaDest', 'personaScript', UserId, 'plckFindCommentKey=' + findCommentKey, "widget:personaGalleryPhoto");
}
SiteLifeProxy.prototype.PersonaMyRecentPhotos = function(UserId,ElementId, PageNum) {
     return this.PersonaPhotoSend('PersonaMyRecentPhotos', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum);
}

SiteLifeProxy.prototype.PersonaGallery = function(UserId,GalleryId,PageNum) {
     if(!PageNum){
        PageNum = gSiteLife.GetParameter("plckPageNum") ? gSiteLife.GetParameter("plckPageNum") : 0;
     }
     if(!GalleryId) {
        GalleryId = gSiteLife.GetParameter("plckGalleryID");
     }
     return this.PersonaPhotoSend('PersonaGallery', 'personaDest', 'personaScript', UserId,'plckGalleryID='+ GalleryId + '&plckPageNum=' + PageNum);
}

SiteLifeProxy.prototype.UserGalleryList = function(UserId,ElementId, PageNum) {
     return this.PersonaPhotoSend('UserGalleryList', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum);
}
SiteLifeProxy.prototype.PersonaGallerySubmissions = function(UserId,ElementId, PageNum){
     return this.PersonaPhotoSend('PersonaGallerySubmissions', ElementId, 'personaScript', UserId,'plckPageNum=' + PageNum);
} 

SiteLifeProxy.prototype.PersonaGalleryPhoto = function(UserId, plckFindCommentKey) {
	var findCommentKey = gSiteLife.ReadFindCommentKey(findCommentKey, "widget:personaPhoto");
    
    var photoid = gSiteLife.GetParameter('plckPhotoID');
    return this.PersonaPhotoSend('PersonaGalleryPhoto', 'personaDest','personaScript', UserId,'&plckPhotoID=' +photoid + '&plckFindCommentKey=' +findCommentKey, "widget:personaPhoto");
}
SiteLifeProxy.prototype.PersonaRecentGalleryPhoto = function(UserId) {
    var photoid = gSiteLife.GetParameter('plckPhotoID');
    return this.PersonaPhotoSend('PersonaRecentGalleryPhoto', 'personaDest','personaScript', UserId,'&plckPhotoID=' +photoid);
}

SiteLifeProxy.prototype.LoadPersonaGalleryPage = function(UserId,GalleryID) {
    var params = new Object(); params['plckPersonaPage'] = 'PersonaGallery'; params['plckUserId'] = UserId; 
            params['userid'] = UserId;
        params['plckGalleryID'] = GalleryID;
    this.ReloadPage(params);
    return false;
}
SiteLifeProxy.prototype.LoadPersonaPhotoPage = function(UserId,PhotoID) {
    var params = new Object(); params['plckPersonaPage'] = 'PersonaGalleryPhoto'; params['plckUserId'] = UserId;
            params['userid'] = UserId;
        params['plckPhotoID'] = PhotoID;
    this.ReloadPage(params);
    return false;
}
SiteLifeProxy.prototype.LoadPersonaRecentPhotoPage = function(UserId,PhotoID) {
    var params = new Object(); params['plckPersonaPage'] = 'PersonaRecentGalleryPhoto'; params['plckUserId'] = UserId;
            params['userid'] = UserId;
        params['plckPhotoID'] = PhotoID;
    this.ReloadPage(params);
    return false;
}

var fbHelpDialogTimeout;
SiteLifeProxy.prototype.ShowFacebookHelpDialog = function(icon){
	var x = 0;
	var y = icon.clientHeight/2;

	do {
		x += icon.offsetLeft;
		y += icon.offsetTop;
	}
	while(icon = icon.offsetParent);

	var fb_div = document.getElementById("Persona_FacebookHelpDialog");
	
	fb_div.style.position = "absolute";
	fb_div.style.display = "block";
	
	// position div to the left of icon.
	var newX = x - fb_div.clientWidth;
	var newY = y - Math.floor(fb_div.clientHeight/2);
	
	fb_div.style.left = newX + "px";
	fb_div.style.top = newY + "px";

	return false;
}

SiteLifeProxy.prototype.HideFacebookHelpDialog = function(){
	var fb_div = document.getElementById("Persona_FacebookHelpDialog");
	fb_div.style.display = "none";
}

SiteLifeProxy.prototype.CopyRssUrlToClipboard = function(){	
	rssUrl = document.getElementById("rssUrl");
	copy(rssUrl);
	
	return false;
}

/* note: doesn't work with flash 10 */
function copy(inElement) {
  if (inElement.createTextRange) {
    var range = inElement.createTextRange();
    if (range)
      range.execCommand('Copy');
  } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="' + gSiteLife.__baseUrl + '/Content/swf/clipboard.swf" FlashVars="clipboard='+encodeURIComponent(inElement.value)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
  }
}

SiteLifeProxy.prototype.UpdateExternalUserId = function(ExternalSiteName, ExternalSiteUserId) {
	var adParam = this.BaseAdParam();
	adParam += "&externalSiteName=" + ExternalSiteName;
	adParam += "&externalSiteUserId=" + ExternalSiteUserId;
	return this.PersonaSend('UpdateExternalUserId', 'personaHDest', 'personaScript', adParam);
}






SiteLifeProxy.prototype.SolicitPhoto = function(galleryID) {
	var elementId = 'plcksolicit' + galleryID;
	this.WriteDiv(elementId);
    var url = this.__baseUrl + '/Photo/SolicitPhoto?plckElementId=' + elementId + '&plckGalleryID=' +galleryID;
    this.__Send(url);
    return false;
}

SiteLifeProxy.prototype.PhotoUpload = function() {
	var elementId = 'plcksubmit';
	this.WriteDiv(elementId);
    var galleryID = gSiteLife.GetParameter('plckGalleryID');

    var url = this.__baseUrl + '/Photo/PhotoUpload?plckElementId=' + elementId + '&plckGalleryID=' +galleryID;
    this.__Send(url);
    return false;
}

SiteLifeProxy.prototype.PublicGallery = function() {
    var elementId = 'plckgallery';
	this.WriteDiv(elementId);
	var galleryID = gSiteLife.GetParameter('plckGalleryID');
    var pageNum = gSiteLife.GetParameter('plckPageNum');
	
    var url = this.__baseUrl + '/Photo/PublicGallery?plckElementId=' + elementId + '&plckGalleryID=' +galleryID + '&plckPageNum=' +pageNum;
	this.__Send(url);
	return false;
}


SiteLifeProxy.prototype.GalleryPhoto = function() {
	var elementId = 'plckphoto';
	this.WriteDiv(elementId);
    var photoid = gSiteLife.GetParameter('plckPhotoID');
    var findCommentKey = gSiteLife.ReadFindCommentKey(null, "widget:galleryPhoto");

    var url = this.__baseUrl + '/Photo/GalleryPhoto?plckElementId=' + elementId + '&plckPhotoID=' +photoid + '&plckFindCommentKey=' + findCommentKey;
	this.__Send(url, null, "widget:galleryPhoto");
	return false;
}

SiteLifeProxy.prototype.PublicGalleries = function() {
	var elementId = 'plckgalleries';
	this.WriteDiv(elementId);
    var pageNum = gSiteLife.GetParameter('plckPageNum') ?  gSiteLife.GetParameter('plckPageNum') : "0";

    var url = this.__baseUrl + '/Photo/PublicGalleries?plckElementId=' + elementId + '&plckPageNum=' + pageNum;
    this.__Send(url);
    return false;
}

SiteLifeProxy.prototype.PhotoRecommend = function(targetid,recommendDiv,isGallery) {
    var url = this.__baseUrl + '/Photo/Recommend?plckElementId=' + recommendDiv + '&plckTargetid=' +targetid + '&plckIsGallery=' +isGallery ;
    this.__Send(url);
    return false;
}

//<script type="text/javascript">

//parentKeyType can be any gSiteLife.KeyType* value, but for including this widget on an article page the value is 
//typically gSiteLife.KeyTypeExternalResource
SiteLifeProxy.prototype.Comments = function(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, refreshPage, findCommentKey)
{
	return this.CommentsInternal(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, false, false, null, refreshPage, findCommentKey);
};

SiteLifeProxy.prototype.CommentsInput = function(parentKeyType, parentKey, redirectToUrl)
{    
    return this.CommentsInternal(parentKeyType, parentKey, null, "TimeStampDescending", null, null, null, null, true, false, redirectToUrl, false, null);
};

SiteLifeProxy.prototype.CommentsOutput = function(parentKeyType, parentKey, refreshPage, pageSize, sortOrder)
{
    sortOrder = sortOrder || "TimeStampDescending";
	return this.CommentsInternal(parentKeyType, parentKey, pageSize, sortOrder, null, null, null, null, false, true, null, refreshPage, null);
}

SiteLifeProxy.prototype.CommentsRefresh = function(parentKeyType, parentKey, pageSize, sortOrder)
{
    if (!parentKey || parentKey == "") throw "Must pass in value for parentKey!";
    return this.CommentsInternal(parentKeyType, parentKey, pageSize, sortOrder, null, null, null, null, false, false, null, true, null);
}

SiteLifeProxy.prototype.CommentsInternal = function(parentKeyType, parentKey, pageSize, sort, showTabs, tab, parentUrl, parentTitle, hideView, hideInput, redirectToUrl, refreshPage, findCommentKey)
{
    var divId = 'Comments_Container';
    if(this.numCommentsWidgets){ divId += this.numCommentsWidgets++; } else { this.numCommentsWidgets = 1; }
    
    document.write("<div id='" + divId + "'></div>");
    
    return this.GetComments(parentKeyType, parentKey, parentUrl, parentTitle, 0, pageSize, sort, showTabs, tab, hideView, hideInput, redirectToUrl, refreshPage, divId, findCommentKey);
}

SiteLifeProxy.prototype.ReadFindCommentKey = function(plckFindCommentKey, eventName){
	var findCommentKey = plckFindCommentKey || gSiteLife.GetParameter("plckFindCommentKey") || "";
    if(findCommentKey == "none"){
		findCommentKey = "";
    }
    
    if(findCommentKey != "" && eventName){
		this.AddEventHandler(eventName, function(){gSiteLife.ScrollToComment(findCommentKey)});
    }
    
    return findCommentKey;
}

SiteLifeProxy.prototype.GetComments = function(parentKeyType, parentKey, parentUrl, parentTitle, page, pageSize, sort, showTabs, tab, hideView, hideInput, redirectTo, refreshPage, divId, findCommentKey)
{
    parentKeyType = parentKeyType || "ExternalResource";
    parentUrl = parentUrl || gSiteLife.__StripAnchorFromUrl(window.location.href);
    parentUrl = gSiteLife.EscapeValue(parentUrl);
    parentKey = parentKey || gSiteLife.__StripAnchorFromUrl(window.location.href);
    parentTitle = parentTitle || gSiteLife.EscapeValue(gSiteLife.Trim(document.title));
    page = page || gSiteLife.GetParameter('plckCurrentPage') || 0;
    pageSize = pageSize || 10;
    sort = sort || "TimeStampAscending";
    showTabs = showTabs || false;
    tab = tab || "MostRecent";
    hideView = hideView || false;
    hideInput = hideInput || false;
    redirectTo =gSiteLife.EscapeValue(redirectTo) || "";
    refreshPage = refreshPage || false;
    findCommentKey = gSiteLife.ReadFindCommentKey(findCommentKey, "widget:comments");
    
    var url = this.__baseUrl + 
        '/Comment/GetPage.rails?plckTargetKeyType='+ parentKeyType + 
        '&plckTargetKey=' + escape(parentKey) + 
        "&plckCurrentPage=" + page + 
        "&plckItemsPerPage=" + pageSize + 
        "&plckSort=" + sort + 
        "&plckElementId=" + divId +
        "&plckTargetUrl=" + parentUrl +
        "&plckTargetTitle=" + parentTitle +
        "&plckHideView=" + hideView +
        "&plckHideInput=" + hideInput +
        "&plckRefreshPage=" + refreshPage +
        "&plckRedirectToUrl=" + redirectTo +
        "&plckFindCommentKey=" + findCommentKey;

    if (showTabs) {
        url = url + "&plckShowTabs=true&plckTab=" + tab;
    }
    this.__Send(url, null, "widget:comments");
    return false;
};

SiteLifeProxy.prototype.WaitForImages = function(callback){
	var allImgs = document.images;
	
}

SiteLifeProxy.prototype.ScrollToComment = function(commentKey){
		setTimeout(function(){
		window.location.hash = "#" + commentKey;
	}, 300);
}

SiteLifeProxy.prototype.Blog = function(BlogId) {
    this.WriteDiv("blogDest", "Persona_Main");
    var action = this.GetParameter("plckBlogPage");
    // If BlogId was not explicitly stated, grab it from the URL parameter...
    if(!BlogId){
		BlogId = this.GetParameter('plckBlogId');
    }
    
        
	if(action && action != "Blog" && (typeof this[action] == 'function')){
	 return this[action](BlogId);
	}else{
	   var AdParams = this.GetParameter('plckCurrentPage') ? 'plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
	   return this.BlogSend('Blog', 'Blog', 'blogDest', 'blogScript', BlogId, AdParams);
	}
}
SiteLifeProxy.prototype.LoadBlogPage = function(PageName, BlogId) {
    var params = new Object(); params['plckBlogPage'] = PageName; params['plckBlogId'] = BlogId; 
    for(ii=2; ii< this.LoadBlogPage.arguments.length; ii+=2) { params[this.LoadBlogPage.arguments[ii]] = this.LoadBlogPage.arguments[ii+1];}
    this.ReloadPage(params);
    return false;
}

SiteLifeProxy.prototype.BlogViewEdit = function(blogId) {
   return this.BlogSend(null, 'BlogViewEdit', null, null, blogId);
}

SiteLifeProxy.prototype.BlogPostCreate = function(blogId) {
   return this.BlogSend(null, 'BlogPostCreate', null, null, blogId, 'plckRedirectUrl=' + this.GetParameter("plckRedirectUrl"));
}

SiteLifeProxy.prototype.BlogPendingComments = function(blogId, currentPage) {
   if( !currentPage) currentPage = 0;
   return this.BlogSend(null, 'BlogPendingComments', null, null, blogId, 'plckCurrentPage='+currentPage);
}

SiteLifeProxy.prototype.BlogSettings = function(blogId) {
   return this.BlogSend(null, 'BlogSettings', null, null, blogId);
}

SiteLifeProxy.prototype.BlogEditPost = function(blogId, controller, div, script, postId, selection, daysBack) {
	return this.BlogSend(controller, 'BlogPostEdit', div, script, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack + '&plckRedirectUrl=' + this.EscapeValue(window.location.href));
}

SiteLifeProxy.prototype.BlogRemovePost = function(blogId, controller, div, script, postId, selection, daysBack, confirmMsg) {
  if (confirm(confirmMsg) == true) {
    return this.BlogSend(controller, 'BlogRemovePost', div, script, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack );
  }
  return false;
}

SiteLifeProxy.prototype.BlogViewPost = function(blogId, postId, selection, daysBack) {
    if(!postId ) { postId = gSiteLife.GetParameter('plckPostId'); }
    var findCommentKey = gSiteLife.ReadFindCommentKey(null, "widget:blog");
	return this.BlogSend(null, 'BlogViewPost', null, null, blogId, 'plckPostId=' + postId + '&plckSelection=' + selection + '&plckDaysBack=' + daysBack + '&plckCommentSortOrder=' + this.GetParameter('plckCommentSortOrder') + '&plckFindCommentKey=' + findCommentKey);
}

SiteLifeProxy.prototype.BlogViewMonth = function(blogId, monthId) {
	if(!monthId ) { monthId = gSiteLife.GetParameter('plckMonthId'); }
	var AdParams = 'plckMonthId=' + monthId;
	AdParams += this.GetParameter('plckCurrentPage') ? '&plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
	return this.BlogSend(null, 'BlogViewMonth', null, null, blogId,  AdParams);
}

SiteLifeProxy.prototype.AddBlogWatchItem= function(blogId, controller, script, Url, WatchKey) {
   return this.BlogSend(controller, 'AddBlogWatch', 'plckBlogWatchDiv', script, blogId, 'plckWatchKey=' + WatchKey + '&plckWatchUrl=' + this.EscapeValue(Url));
}
SiteLifeProxy.prototype.RemoveBlogWatchItem= function(blogId, controller, script, WatchKey) {
   return this.BlogSend(controller, 'RemoveBlogWatch', 'plckBlogWatchDiv', script, blogId, 'plckWatchKey=' + WatchKey);
}

SiteLifeProxy.prototype.BlogViewTag = function(blogId, tag) {
	if(!tag ) { tag = gSiteLife.GetParameter('plckTag'); }
	var AdParams = 'plckTag=' + tag;
	AdParams += this.GetParameter('plckCurrentPage') ? '&plckCurrentPage=' + this.GetParameter('plckCurrentPage') : "";
	return this.BlogSend(null, 'BlogViewTag', null, null, blogId, AdParams );
}

SiteLifeProxy.prototype.BlogRefreshViewEditList= function(blogId, controller, div, script, selection, daysBack) {
	return this.BlogSend(controller, 'BlogRefreshViewEditList', div, script, blogId, 'plckSelection=' + selection + '&plckDaysBack=' + daysBack  );
}

SiteLifeProxy.prototype.BlogSend = function(controller, apiName, destDiv, scriptName, blogId, addParams){
    if(!controller) controller = this.GetParameter('plckController') || "Blog";
    if(!destDiv) destDiv = this.GetParameter('plckElementId') || "blogDest";
    if(!scriptName) scriptName = this.GetParameter('plckScript') || "blogScript";
    var url = this.__baseUrl + '/' + controller + '/' + apiName + '?plckElementId=' + destDiv + '&plckBlogId=' + blogId + '&' + addParams;
    this.__Send(url, scriptName, 'widget:blog');
    return false;
}

SiteLifeProxy.prototype.Recommend = function(controller, itemId, recommendDiv) {
    var url = this.__baseUrl + '/' + controller + '/Recommend?plckElementId=' + recommendDiv + '&plckItemId=' +itemId;
    this.__Send(url);
    return false;
}
SiteLifeProxy.prototype.BlogSelectPendingComments = function(formId, checked) {   
    var form = document.getElementById(formId);
    for (i=0; i<form.elements.length; i++) {
        var input = form.elements[i];        
        input.checked = checked;
    }
}

SiteLifeProxy.prototype.Forums = function(numPerPage) {    
	this.WriteDiv("forumDest", "Forum_Main");
	
	var action = this.GetParameter("plckForumPage");
		
		
	var forumId = this.GetParameter('plckForumId');        
	if (forumId)
	{
		forumId = unescape(forumId);
		var i = forumId.indexOf('Forum:');
		forumId = forumId.substring(i).replace(':', '_');    
	}
	else
	{
		var discussionId = this.GetParameter('plckDiscussionId');
		if (discussionId)
		{                    
			discussionId = unescape(discussionId);
			var i = discussionId.indexOf('Forum:');
			var j = discussionId.indexOf('Discussion:');
			forumId = discussionId.substring(i, j).replace(':', '_');
		}
	}
    
	var categoryCurrentPage = this.GetParameter('plckCategoryCurrentPage');
	if(action && (typeof this[action] == 'function') && action != 'ForumCategories'){
		this[action]();
	}
	else {     
		if( numPerPage == null ){
			numPerPage = this.GetParameter('plckNumPerPage');
		}
		this.ForumCategories(numPerPage, categoryCurrentPage);
	}
}

SiteLifeProxy.prototype.SetupCallbacks = function(){
	var adParam = "";
    var showFirstUnread = this.GetParameter('plckShowFirstUnread'); 
    var findPostKey = this.GetParameter('plckFindPostKey');
    if(showFirstUnread != null){
		adParam += "&plckShowFirstUnread=" + showFirstUnread;
		this.AddEventHandler("widget:forums", function(){gSiteLife.DiscussionScrollToPost()});
    }
    if(findPostKey != null && findPostKey != ""){
		adParam += "&plckFindPostKey=" + findPostKey;
		this.AddEventHandler("widget:forums", function(){gSiteLife.DiscussionScrollToPost()});
    }
    var showLatestPost = this.GetParameter('plckShowLatestPost'); 
    if(showLatestPost != null){
		adParam += "&plckShowLatestPost=" + showLatestPost;
		this.AddEventHandler("widget:forums", function(){gSiteLife.DiscussionScrollToPost()});
    }
    
    this.AddEventHandler("widget:forums", function(){
		gSiteLife.DiscussionScanForUnread();

		// insert poll widget if the discussion is a poll		

		var me = this;
		var insertPoll = function(retryCount) {
			if (retryCount > 10) {
				return;
			}
			if (typeof(retryCount) === 'undefined') {
				retryCount = 0;
			}
			var pollWidgetDiv = document.getElementById('Discussion_Poll_Container');
			if (pollWidgetDiv) {
				var discussionKey = document.getElementById('DiscussionKeyContainer').value;
				slGetDiscussionPollOnKey = function() {
					return discussionKey;
				}
				window.slPollWidgetDiv = document.getElementById('Discussion_Poll');
				var pollInsertionScript = document.createElement('script');
				pollInsertionScript.type = 'text/javascript';
				pollInsertionScript.src = 'http://sitelife.es.batanga.com/ver1.0/Forums/PollParams?plckDiscussionId=' + discussionKey;
				document.getElementsByTagName('head')[0].appendChild(pollInsertionScript);
			}
			else {
				setTimeout(function() {
					insertPoll(retryCount + 1);
				}, 100);
			}
		}
		insertPoll();

    	});

	// Hack for the anchor on the categories page...
	this.AddEventHandler("widget:forums", function(){
		if(document.location.hash){
			var foo = document.location.hash + "";
			document.location.hash = foo;
		}
	});
    
    return adParam;
}

SiteLifeProxy.prototype.ForumCategories = function(numPerPage, categoryCurrentPage) {
    var pageNum = this.GetParameter('plckCurrentPage'); if(pageNum == null) pageNum = 0;
    var urlPageInfoStr = '';
    urlPageInfoStr = '&plckNumPerPage=' + numPerPage;        
    urlPageInfoStr += '&plckCategoryCurrentPage=' + categoryCurrentPage;
    return this.ForumSend("ForumCategories", "forumDest", "ForumMain", 'plckCurrentPage=' + pageNum + urlPageInfoStr);
}
SiteLifeProxy.prototype.Forum = function() {
    var forumId = this.GetParameter('plckForumId');
    var categoryPageNum = this.GetParameter('plckCategoryCurrentPage');
    if(categoryPageNum == null) { categoryPageNum = 0; }
    var discussionPageNum = this.GetParameter('plckCurrentPage');
    if (discussionPageNum == null) { discussionPageNum = 0; }
    var numPerPage = this.GetParameter('plckNumPerPage');
    var urlPageInfoStr = '';
    if( numPerPage != null ){
        urlPageInfoStr = '&plckNumPerPage=' + numPerPage;
    }
   return this.ForumSend('Forum', 'forumDest', 'ForumMain', 'plckForumId=' + forumId + '&plckCurrentPage=' + discussionPageNum + '&plckCategoryCurrentPage=' + categoryPageNum + urlPageInfoStr );
}
SiteLifeProxy.prototype.ForumDiscussion = function() {
    var dId = this.GetParameter("plckDiscussionId");
    var adParam = "plckDiscussionId=" + dId;
    var showLast = this.GetParameter("plckShowLastPage"); if(showLast) adParam += "&plckShowLastPage=true";
    var pageNum = this.GetParameter('plckCurrentPage'); if(pageNum == null) pageNum = 0;
	adParam += this.SetupCallbacks(); 
    adParam += "&plckCurrentPage=" + pageNum;
    adParam += "&plckCategoryCurrentPage=" + this.GetParameter('plckCategoryCurrentPage');   
    
    return this.ForumSend("ForumDiscussion", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.DiscussionScanForUnread = function(discussionKey){
	var postDatesContainer = document.getElementById("PostDateInfoContainer");
	if(!postDatesContainer){
		return;
	}
	
	this.postDates = eval(postDatesContainer.value);
	this.latestPost = new Date(document.getElementById("LastReadContainer").value);
	this.screenBottom = 0;
	if(discussionKey){
		this.discussionKey = discussionKey;
	}
	else if (document.getElementById('DiscussionKeyContainer')){
		this.discussionKey = document.getElementById('DiscussionKeyContainer').value;
	}
	
	this.checkForReadInterval = setInterval(function(){gSiteLife.DiscussionCheckForLatestPost();}, 1000);
}

SiteLifeProxy.prototype.DiscussionScrollToPost = function(){
	if(!document.getElementById("Discussion_ScrollToPostKey")){
		return false;
	}
	
	var postKey = document.getElementById("Discussion_ScrollToPostKey").value;
	var post = document.getElementById(postKey);
	
	if(!post){
		return false;
	}
	
	var postTop = 0;
	if(post.offsetParent){
		obj = post;
		do{
			postTop += obj.offsetTop;
		}
		while(obj = obj.offsetParent);
		window.scrollBy(0, postTop);
	}
}

SiteLifeProxy.prototype.IsPostOnScreen = function(screenBottom, postIndex){
	var postId = "readIndicator_" + this.postDates[postIndex].Key;
	var post = document.getElementById(postId);
	if(post){
		var postTop = 0;
		if(post.offsetParent){
			obj = post;
			do{
				postTop += obj.offsetTop;
			}
			while(obj = obj.offsetParent);
		}
		var postBottom = postTop + post.offsetHeight;
		
		if(postBottom < screenBottom){
			return true;
		}
	}
	
	return false;
}

SiteLifeProxy.prototype.DiscussionCheckForLatestPost = function(){
	var screenTop = 0;
	if (typeof(window.pageYOffset) !== 'undefined') {
		screenTop = window.pageYOffset;
	}
	else if (typeof(document.documentElement) !== 'undefined' && typeof(document.documentElement.scrollTop) !== 'undefined' && document.documentElement.scrollTop > 0) {
		screenTop = document.documentElement.scrollTop;
	}
	else if (typeof(document.body.scrollTop) !== 'undefined' && document.body.scrollTop > 0) {
		screenTop = document.body.scrollTop;
	}
	
	var screenBottom = Math.pow(2,52); /*Supposing our browser can't get the height, we mark everything as read.*/
	if(window.innerHeight){
		screenBottom = screenTop + window.innerHeight;
	}
	else if(document.documentElement.clientHeight && document.documentElement.clientHeight != 0){
		screenBottom = screenTop + document.documentElement.clientHeight;
	}
	else if(document.body.clientHeight){
		screenBottom = screenTop + document.body.clientHeight;
	}
	
	/* Only update if we've scrolled down since last poll. */
	if(screenBottom <= this.screenBottom){
		return;
	}
	
	/* Just give up if there are no posts. */
	if(!this.postDates || this.postDates.length <= 0){
		clearInterval(this.checkForReadInterval);
		return;
	}
	
	/* If the last post is already marked read, don't bother polling. */
	if(this.postDates[(this.postDates.length - 1)].Timestamp <= this.latestPost){
		clearInterval(this.checkForReadInterval);
		return;
	}
	
	this.screenBottom = screenBottom;
	
	var latestKey = null;
	
	for(i=0; i < this.postDates.length; i++){
		if(this.IsPostOnScreen(screenBottom, i)){
			if(this.postDates[i].Timestamp >= this.latestPost){
				latestKey = this.postDates[i].Key;
				this.latestPost = this.postDates[i].Timestamp;
			}
		}
	}

	if(latestKey){
		this.ForumSetLastRead(this.discussionKey, latestKey);
	}
}

SiteLifeProxy.prototype.ForumCreateDiscussion = function() {
    var adParam = "plckRedirectUrl=" + this.GetParameter("plckRedirectUrl");
    var fId = this.GetParameter("plckForumId"); adParam += "&plckForumId=" + fId;
    var curView = this.GetParameter("plckCurrentView"); if(curView) adParam += "&plckCurrentView=" + curView;
    var curPage = this.GetParameter("plckCurrentPage"); if(curPage) adParam += "&plckCurrentPage=" + curPage;
    var dId = this.GetParameter("plckDiscussionId"); if(dId) adParam += "&plckDiscussionId=" + dId;
    adParam += "&plckCategoryCurrentPage=" + this.GetParameter('plckCategoryCurrentPage');    
    return this.ForumSend("ForumCreateDiscussion", "forumDest", "ForumMain", adParam);
}
SiteLifeProxy.prototype.ForumMain = function() {
    return this.ForumSend("ForumMain", "forumDest", "ForumMain");
}
SiteLifeProxy.prototype.ForumCreatePost = function() {
    var adParam = "plckDiscussionId=" + this.GetParameter("plckDiscussionId") + "&plckRedirectUrl=" + this.EscapeValue(window.location.href);
    var PostId = this.GetParameter("plckPostId"); if(PostId) adParam = adParam + "&plckPostId=" + PostId;
    var IsReply = this.GetParameter("plckIsReply"); if(IsReply) adParam = adParam + "&plckIsReply=" + IsReply;
    var curPage = this.GetParameter("plckCurrentPage"); if(curPage) adParam = adParam + "&plckCurrentPage=" + curPage;
    adParam += "&plckCategoryCurrentPage=" + this.GetParameter("plckCategoryCurrentPage"); 
    return this.ForumSend("ForumCreatePost", "forumDest", "ForumMain", adParam);
}
SiteLifeProxy.prototype.ForumEditPost = function() {
    var adParam = "plckDiscussionId=" + this.GetParameter("plckDiscussionId") + "&plckRedirectUrl=" + this.EscapeValue(window.location.href);
    var PostId = this.GetParameter("plckPostId"); if(PostId) adParam = adParam + "&plckPostId=" + PostId;
    var CurrPage = this.GetParameter("plckCurrentPage"); if(!CurrPage) CurrPage="0"; adParam = adParam + "&plckCurrentPage=" + CurrPage;
    adParam += "&plckCategoryCurrentPage=" + this.GetParameter('plckCategoryCurrentPage');    
    return this.ForumSend("ForumEditPost", "forumDest", "ForumMain", adParam);
}
SiteLifeProxy.prototype.ForumEditProfile = function() {
    return this.ForumSend("ForumEditProfile", "forumDest", "ForumMain", "plckRedirectUrl=" + this.EscapeValue(window.location.href));
}
SiteLifeProxy.prototype.ToggleExpand = function(imageId, tableId) {
  if (!this.collapsedCategories) {
    var cookie = document.cookie && document.cookie.match(/forumCatState=([^;]+)/); 
    cookie = (cookie ? cookie[1].replace(/^\s+|\s+$/g, '') : []); 
    this.collapsedCategories = (cookie.length ? unescape(cookie).split('|') : []);
  }
  var tableElem = document.getElementById(tableId), imgElem = document.getElementById(imageId),
      id = tableId.split(':')[1], cats = this.collapsedCategories, expire;
  if (tableElem.style.display == 'none') {
    tableElem.style.display = 'block';
    imgElem.src = this.__baseUrl + '/Content/images/forums/minus.gif';
    for (var i = 0, length = cats.length; i < length; i++) {
      if ((cats[i] == id) || (cats[i] === ''))
        cats.splice(i,1);
    }
  }
  else {
    tableElem.style.display = 'none';
    cats.push(id); 
    imgElem.src = this.__baseUrl + '/Content/images/forums/plus.gif';
  }
  this.SetCookie('forumCatState', cats.join('|'));
}

SiteLifeProxy.prototype.ForumSearch = function(suffix) {
    var searchText = document.getElementById('plckSearchText'+suffix).value;
    searchText = FixSearchString(searchText);
    var searchArea = document.getElementById('plckSearchArea'+suffix).value;
    this.LoadForumPage("ForumSearchPaginate", "plckSearchText", searchText, "plckSearchArea", searchArea, "plckCurrentPage", "0");
    return false;
}
SiteLifeProxy.prototype.ForumSearchKeyPress = function(event, suffix) {
    if(IsEnter(event)){return this.ForumSearch(suffix);}else{return true;}
}
SiteLifeProxy.prototype.ForumSearchPaginate = function() {	
    return this.ForumSend('ForumSearchPaginate', 'forumDest', 'ForumMain', 'plckSearchArea=' + this.GetParameter('plckSearchArea') + '&plckSearchText=' + this.GetParameter('plckSearchText') + '&plckCurrentPage=' + this.GetParameter('plckCurrentPage'));
}

SiteLifeProxy.prototype.ForumSpecificForumSearchKeyPress = function(event, suffix, forumId) {
    if(IsEnter(event)){return this.ForumSpecificForumSearch(suffix, forumId);}else{return true;}
}
SiteLifeProxy.prototype.ForumSpecificForumSearch = function(suffix, forumId) {
    var searchText = document.getElementById('plckSearchText'+suffix).value;
    searchText = FixSearchString(searchText);
    this.LoadForumPage("ForumSearchSpecificForumPaginate", "plckSearchText", searchText, "plckForumId", forumId, "plckCurrentPage", "0");
    return false;
}
SiteLifeProxy.prototype.ForumSearchSpecificForumPaginate = function(title) {	
    return this.ForumSend('ForumSearchSpecificForumPaginate', 'forumDest', 'ForumMain', 'plckForumId=' + this.GetParameter('plckForumId') + '&plckSearchText=' + this.GetParameter('plckSearchText') + '&plckCurrentPage=' + this.GetParameter('plckCurrentPage'));
}

SiteLifeProxy.prototype.LoadForumPage = function(PageName, paramName, paramVal) {
    var params = new Object(); 
    params['plckForumPage'] = PageName;
    for(ii=1; ii< this.LoadForumPage.arguments.length; ii+=2) { params[this.LoadForumPage.arguments[ii]] = this.LoadForumPage.arguments[ii+1];}
    this.ReloadPage(params);
    return false;
}

SiteLifeProxy.prototype.ForumSend = function(ApiName, DestDiv, ScriptName, AddParams){
    var url = this.__baseUrl + '/Forums/' + ApiName + '?plckElementId=' + DestDiv;
    if(AddParams) url += '&' + AddParams;
    var plckPostSort = this.GetParameter('plckPostSort');
    if (plckPostSort != null){
		url += "&plckPostSort=" + plckPostSort;
	}
    this.__Send(url, ScriptName, 'widget:forums', arguments);
    return false;
}

SiteLifeProxy.prototype.ForumDiscussionEdit = function(discussionId, curView, curPage) {
    return this.ForumSend('ForumDiscussionEdit', 'forumDest', 'ForumMain', 'plckDiscussionId=' + discussionId + '&plckCurrentView=' + curView + '&plckCurrentPage=' + curPage + '&plckRedirectUrl=' + this.EscapeValue(window.location.href));
}

SiteLifeProxy.prototype.ForumPostEdit = function(discussionId, postId, curView, curPage) {
    return this.ForumSend('ForumEditPost', 'forumDest', 'ForumMain', 'plckDiscussionId=' + discussionId + '&plckPostId=' + postId + '&plckCurrentView=' + curView + '&plckCurrentPage=' + curPage + '&plckRedirectUrl=' + this.EscapeValue(window.location.href));
}

SiteLifeProxy.prototype.ForumDiscussionToggleIsSticky = function(discussionId, curView, curPage) {
	return this.ForumSend('ForumDiscussionToggleIsSticky', 'forumDest', 'ForumMain', 'plckDiscussionId=' + discussionId + '&plckCurView=' + curView + '&plckCurrentPage=' + curPage);
}

SiteLifeProxy.prototype.ForumDiscussionToggleIsClosed = function(discussionId, curView, curPage) {
    return this.ForumSend('ForumDiscussionToggleIsClosed', 'forumDest', 'ForumMain', 'plckDiscussionId=' + discussionId + '&plckCurView=' + curView + '&plckCurrentPage=' + curPage );
}

SiteLifeProxy.prototype.ForumDiscussionDelete = function(discussionId, curPage, confirmMsg) {
  if (confirm(confirmMsg) == true) {
    return this.ForumSend('ForumDiscussionDelete', 'forumDest', 'ForumMain', 'plckDiscussionId=' + discussionId + '&plckCurrentPage=' + curPage );
  }
  else {
	return false;
  }
}

SiteLifeProxy.prototype.MoveDiscussion = function(discussionKey, toForum, curView, curPage) {
    return this.ForumSend('MoveDiscussion', 'forumDest', 'ForumMain', 'discussionKey=' + discussionKey + '&toForum=' + toForum + '&plckCurView=' + curView + '&plckCurrentPage=' + curPage );
}

SiteLifeProxy.prototype.ForumEdit = function(forumId, curPage) {
    return this.ForumSend('ForumEdit', 'forumDest', 'ForumMain', 'plckForumId=' + forumId + '&plckCurrentPage=' + curPage  );
}

SiteLifeProxy.prototype.ForumToggleIsClosed = function(forumId, curPage) {
    return this.ForumSend('ForumToggleIsClosed', 'forumDest', 'ForumMain', 'plckForumId=' + forumId + '&plckCurrentPage=' + curPage  );
}

SiteLifeProxy.prototype.ForumDelete = function(forumId, confirmMsg) {
  if (confirm(confirmMsg) == true) {
    return this.ForumSend('ForumDelete', 'forumDest', 'ForumMain', 'plckForumId=' + forumId );
  }
  else {
	return false;
  }
}

SiteLifeProxy.prototype.ForumPostDelete = function(postId, curPage, confirmMsg) {
  if (confirm(confirmMsg) == true) {
    return this.ForumSend('ForumPostDelete', 'forumDest', 'ForumMain', 'plckPostId=' + postId + '&plckCurPage=' + curPage);
  }
  else {
	return false;
  }
}

SiteLifeProxy.prototype.ForumBlockUser = function(postId, userId, value, curPage) {
    return this.ForumSend('ForumBlockUser', 'forumDest', 'ForumMain', 'plckPostId=' + postId + '&plckUserId=' + userId + '&plckValue=' + value + '&plckCurPage=' + curPage);
}

SiteLifeProxy.prototype.ForumMyDiscussionsPaginate = function(pageNum) {
    return this.ForumSend('ForumMyDiscussionsPaginate', 'ForumMyDiscussionsDiv', 'ForumMain', 'plckMyDiscussionsPage=' + pageNum);
}

SiteLifeProxy.prototype.ForumImage = function() {
    var adParam = "plckRedirectUrl=" + this.GetParameter("plckRedirectUrl");
    var pId = this.GetParameter("plckPhotoId"); adParam += "&plckPhotoId=" + pId;
    return this.ForumSend('ForumImage', 'forumDest', 'ForumMain', adParam);
}

SiteLifeProxy.prototype.BaseAdParam = function () {
    var adParam = "plckRedirectUrl=" + this.EscapeValue(window.location.href);
    var fId = this.GetParameter("plckForumId"); adParam += "&plckForumId=" + fId;
    var curView = this.GetParameter("plckCurrentView"); if(curView) adParam += "&plckCurrentView=" + curView;
    var curPage = this.GetParameter("plckCurrentPage"); if(curPage) adParam += "&plckCurrentPage=" + curPage;
    return adParam;
}

SiteLifeProxy.prototype.ForumJoinGroup = function() {
    var adParam = this.BaseAdParam();
    var dId = this.GetParameter("plckDiscussionId"); if(dId) adParam += "&plckDiscussionId=" + dId;
    return this.ForumSend("ForumJoinGroup", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumLeaveGroup = function() {
    var adParam = this.BaseAdParam();
    var dId = this.GetParameter("plckDiscussionId"); if(dId) adParam += "&plckDiscussionId=" + dId;
    return this.ForumSend("ForumLeaveGroup", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumGroupMemberList = function() {
    var adParam = this.BaseAdParam();
    return this.ForumSend("ForumGroupMemberList", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumInviteUser = function() {
    var adParam = this.BaseAdParam();
    return this.ForumSend("ForumInviteUser", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumGroupConfirm = function() {
    var adParam = this.BaseAdParam();
    var confirmType = this.GetParameter("plckConfirmType"); if (confirmType) adParam += "&plckConfirmType=" + confirmType;
    return this.ForumSend("ForumGroupConfirm", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumSendInviteToUser = function(username, email) {
    var adParam = this.BaseAdParam();
    var username = this.GetParameter("plckUsername"); if (username) adParam += "&plckUsername=" + username;
    var email = this.GetParameter("plckUserEmail"); if (email) adParam += "&plckUserEmail" + email;
    return this.ForumSend("ForumSendInviteToUser", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumAddEnemy = function(enemyKey) {
    var adParam = this.BaseAdParam();
    adParam += "&enemyKey=" + enemyKey;
    var dId = this.GetParameter("plckDiscussionId"); if(dId) adParam += "&plckDiscussionId=" + dId;
    return this.ForumSend("ForumAddEnemy", "forumDest", "ForumMain", adParam);
}

SiteLifeProxy.prototype.ForumRemoveEnemy = function(enemyKey) {
    var adParam = this.BaseAdParam();
    adParam += "&enemyKey=" + enemyKey;
    var dId = this.GetParameter("plckDiscussionId"); if(dId) adParam += "&plckDiscussionId=" + dId;
    return this.ForumSend("ForumRemoveEnemy", "forumDest", "ForumMain", adParam);
}

function slGetElementsByClassName(classname, node)  {
    if(!node) node = document.getElementsByTagName("body")[0];
    var a = [];
    var re = new RegExp('\\b' + classname + '\\b');
    var els = node.getElementsByTagName("*");
    for(var i=0,j=els.length; i<j; i++)
        if(re.test(els[i].className))a.push(els[i]);
    return a;
}

	function hideAllPostsFromUser(userKey){
	  var posts = slGetElementsByClassName("postVisibilityContainer_"+userKey, document);
	  var hiddenMessages = slGetElementsByClassName("postHiddenMessage_"+userKey, document);
	  
	  for(i=0; i < posts.length; i++){
	    posts[i].style.display = "none";
	    hiddenMessages[i].style.display = "block";
	  }
	  
	  gSiteLife.ForumAddEnemy(userKey);
	}
	
	function showAllPostsFromUser(userKey){
	  var posts = slGetElementsByClassName("postVisibilityContainer_"+userKey, document);
	  var hiddenMessages = slGetElementsByClassName("postHiddenMessage_"+userKey, document);
	  	  
	  for(i=0; i < posts.length; i++){
	    posts[i].style.display = "block";
	    hiddenMessages[i].style.display = "none";
	  }
	  
	  gSiteLife.ForumRemoveEnemy(userKey);
	}
	
SiteLifeProxy.prototype.ForumChangeSort = function(sortParamName, sortDirection) {
		var currentUrl = document.location.href;
		var newUrl;
		// replace the sort param in the url, if found
		var re = new RegExp("([?|&])" + sortParamName + "=.*?(&|$)","i");
		if (currentUrl.match(re)) {
			newUrl = currentUrl.replace(re, '$1' + sortParamName + "=" + sortDirection + '$2');
		}
		else {
			if(currentUrl.indexOf('?') >= 0){
				newUrl = currentUrl + '&' + sortParamName + "=" + sortDirection;
			}
			else{
				newUrl = currentUrl + '?' + sortParamName + "=" + sortDirection;
			}
		}
		document.location.href = newUrl;
}

SiteLifeProxy.prototype.ForumSetLastRead = function(discussionKey, postKey) {
    var adParam = this.BaseAdParam();
    adParam += "&discussionKey=" + discussionKey;
    if(postKey){
		adParam += "&postKey=" + postKey;
	}
    var ret = this.ForumSend("ForumSetLastRead", "forumDest", "ForumMain", adParam);
    
    if(!postKey){
		location.reload();
    }
    
    return ret;
} 

SiteLifeProxy.prototype.ForumDiscussionSubscribe = function(discussionKey, targetDiv) {
    var url = this.__baseUrl + '/Forums/ForumDiscussionSubscribe?' + 'plckDiscussionId=' + discussionKey + '&plckElementId=' + targetDiv;
    this.__Send(url, "ForumDiscussionSubscribe");
    return false;
}

SiteLifeProxy.prototype.ForumDiscussionUnSubscribe = function(discussionKey, targetDiv) {
    var url = this.__baseUrl + '/Forums/ForumDiscussionUnSubscribe?' + 'plckDiscussionId=' + discussionKey + '&plckElementId=' + targetDiv;
    this.__Send(url, "ForumDiscussionUnSubscribe");
    return false;
}


SiteLifeProxy.prototype.Recommend = function(keyType, targetKey, parentUrl) {
    keyType = keyType || "ExternalResource";
    targetKey = targetKey || gSiteLife.__StripAnchorFromUrl(window.location.href);
    parentUrl = parentUrl || window.location.href;
    targetKey = targetKey;
    var divId = "Recommend" + new Date().getTime();
    this.WriteDiv(divId, "Recommend");
    var url = this.__baseUrl + 
        '/Recommend/Recommend?plckElementId=' + divId + 
        '&plckTargetKey=' + gSiteLife.EscapeValue(targetKey) + 
        '&plckTargetKeyType=' + keyType +
        '&plckTargetUrl=' + gSiteLife.EscapeValue(parentUrl);
    this.__Send(url);
    return false;   
}

SiteLifeProxy.prototype.PostRecommendation = function(keyType, targetKey, recommendDiv, parentTitle, parentUrl) {
    parentUrl = parentUrl || window.location.href;
    var url = this.__baseUrl + 
        '/Recommend/PostRecommendation?plckElementId=' + recommendDiv + 
        '&plckTargetKey=' + gSiteLife.EscapeValue(targetKey) + 
        '&plckTargetKeyType=' + keyType +
        '&plckTargetUrl=' + gSiteLife.EscapeValue(parentUrl);
    if(parentTitle) url += '&plckParentTitle=' + gSiteLife.EscapeValue(parentTitle);
    
    this.__Send(url);
    return false;
}


SiteLifeProxy.prototype.RateItem = function (itemId, itemType, rating, targetDiv, parentTitle, parentUrl) {
    var url = this.__baseUrl + '/Rating/Rate?plckElementId=' + targetDiv + 
        '&plckTargetKey=' + gSiteLife.EscapeValue(itemId) + 
        '&plckTargetKeyType=' + itemType + 
        '&plckRating=' + rating +
        '&plckTargetUrl=' + gSiteLife.EscapeValue(parentUrl);
        if(parentTitle) url += '&plckParentTitle=' + parentTitle;
    this.__Send(url);
    return false;
}

SiteLifeProxy.prototype.Rating = function(itemType, itemId, parentUrl) {
    itemType = itemType || "ExternalResource";
    itemId = itemId || gSiteLife.__StripAnchorFromUrl(window.location.href);
    parentUrl = parentUrl || window.location.href;
    var divId = itemId + "_plckRateDiv_" + new Date().getTime() + Math.floor(Math.random()*1000);
    this.WriteDiv(divId, "Rating");
    var url = this.__baseUrl + '/Rating/GetRating?plckElementId=' + divId +
        '&plckTargetKey=' + gSiteLife.EscapeValue(itemId) + 
        '&plckTargetKeyType=' + itemType +
        '&plckTargetUrl=' + gSiteLife.EscapeValue(parentUrl);
    this.__Send(url);
    return false;   
}

SiteLifeProxy.prototype.RatingClickStar = function (index, targetKey, targetKeyType, targetDiv, parentTitle, parentUrl) {
    gSiteLife.RateItem(targetKey, targetKeyType, index, targetDiv, parentTitle, parentUrl);
    
}

SiteLifeProxy.prototype.RatingFillStar = function(index, targetKey, lbl) {
    var stars = document.getElementsByName(targetKey+"Stars");
    var label = document.getElementById(targetKey + "Rating-label");
    var selectedIndex = parseInt(document.getElementById(targetKey+"Rating-value").value);
    
    if (index < 0 && selectedIndex >= 0) index = selectedIndex;
    for(i=1; i <= stars.length; i++) {
        if (index > 0 && i <= index) {
            stars[i-1].src = this.__baseUrl + "/Content/images/icons/fullstar.gif";
        }else {
            stars[i-1].src = this.__baseUrl + "/Content/images/icons/emptystar.gif";
        }
    }
    label.innerHTML = lbl;
}

SiteLifeProxy.prototype.Review = function(parentKeyType, parentKey, reviewedTitle, reviewCategory, pageSize, sort, currentPage) {
    
    var divId = "Reviews_Container";
    this.WriteDiv(divId);
    return this.GetReviews(parentKeyType, parentKey, reviewedTitle, reviewCategory, pageSize, sort, currentPage);
}

SiteLifeProxy.prototype.ReviewClickStar = function (index, targetKey) {
    document.getElementById(targetKey+"Rating-value").value = index;
}

SiteLifeProxy.prototype.GetReviews = function(parentKeyType, parentKey, reviewedTitle, reviewCategory, pageSize, sort, currentPage) {
    parentKeyType = parentKeyType || "ExternalResource";
    parentKey = gSiteLife.EscapeValue(parentKey) || gSiteLife.EscapeValue(gSiteLife.__StripAnchorFromUrl(window.location.href));
    reviewedTitle = gSiteLife.EscapeValue(reviewedTitle) || gSiteLife.EscapeValue(document.title);
    reviewCategory = reviewCategory || "Uncategorized";
    pageSize = pageSize || 10;
    sort = sort || "TimeStampAscending";
    currentPage = currentPage || 0;
    var url = this.__baseUrl + '/Review/Reviews?plckElementId=Reviews_Container' +
        '&plckTargetKey=' + parentKey + 
        '&plckTargetKeyType=' + parentKeyType +
        '&plckReviewedTitle=' + reviewedTitle +
        '&plckReviewCategory=' + reviewCategory +
        '&plckSort=' + sort + 
        '&plckParentUrl=' + gSiteLife.EscapeValue(gSiteLife.__StripAnchorFromUrl(window.location.href)) + 
        '&plckParentTitle=' + gSiteLife.EscapeValue(document.title) +
        '&plckCurrentPage=' + currentPage +
        '&plckPageSize=' + pageSize;
    this.__Send(url);
    return false;   
}

SiteLifeProxy.prototype.SummaryArticlesMostCommented = function(count) {
 return this.SummaryPanel("SummaryArticlesMostCommented", count); 
} 
SiteLifeProxy.prototype.SummaryArticlesMostRecommended = function(count) {
 return this.SummaryPanel("SummaryArticlesMostRecommended", count); 
} 
SiteLifeProxy.prototype.SummaryPhotosRecentPhotosByTag = function(count, tagFilter, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryPhotosRecentPhotosByTag", count, tagFilter, filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryPhotosRecentUserPhotos = function(count, tagFilter, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryPhotosRecentUserPhotos", count, tagFilter, filterBySiteOfOrigin);
} 
SiteLifeProxy.prototype.SummaryPhotosRecentPhotos = function(count, tagFilter, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryPhotosRecentPhotos", count, tagFilter, filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryPhotosMostRecommendedPhotos = function(count, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryPhotosMostRecommendedPhotos", count, "", filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryPhotosMostRecommendedUserPhotos = function(count, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryPhotosMostRecommendedUserPhotos", count, "", filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryPhotosMostRecommendedGalleries = function(count) {
 return this.SummaryPanel("SummaryPhotosMostRecommendedGalleries", count); 
} 
SiteLifeProxy.prototype.SummaryForumsRecentDiscussions = function(count, filterBySiteOfOrigin, parentIds) {
    var divId= "Summary_Container" + this.SID;
    if(this.numSummaryWidgets){ divId += this.numSummaryWidgets++; } else { this.numSummaryWidgets = 1; }
    this.WriteDiv(divId, divId);
    var methodName = "SummaryForumsRecentDiscussions";
    var tagFilter = "";
    return this.SummarySend(methodName, divId, divId + "Script", "plckCount", count, "plckTagFilter", tagFilter, "plckFilterBySiteOfOrigin", filterBySiteOfOrigin, "plckParentIds", parentIds);
} 
SiteLifeProxy.prototype.SummaryBlogsRecent = function(count, tagFilter) {
    return this.SummaryPanel("SummaryBlogsRecent", count, tagFilter);
}
SiteLifeProxy.prototype.SummaryBlogsRecentPostsByTag = function(count, tagFilter, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryBlogsRecentPostsByTag", count, tagFilter, filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryBlogsRecentPosts = function(count, tagFilter, filterBySiteOfOrigin) {
 return this.SummaryPanel("SummaryBlogsRecentPosts", count, tagFilter, filterBySiteOfOrigin); 
} 
SiteLifeProxy.prototype.SummaryBlogsMostRecommendedPosts = function(count, tagFilter, filterBySiteOfOrigin) {
    return this.SummaryPanel("SummaryBlogsMostRecommendedPosts", count, tagFilter, filterBySiteOfOrigin);
}
SiteLifeProxy.prototype.SummaryPersonaProfileRecent = function(count) {
    return this.SummaryPanel("SummaryPersonaProfileRecent", count);
}
SiteLifeProxy.prototype.SummaryPanel = function(methodName, count, tagFilter, filterBySiteOfOrigin) {
    var divId= "Summary_Container" + this.SID;
    if(this.numSummaryWidgets){ divId += this.numSummaryWidgets++; } else { this.numSummaryWidgets = 1; }
    this.WriteDiv(divId, divId);
    return this.SummarySend(methodName, divId, divId + "Script", "plckCount", count, "plckTagFilter", tagFilter, "plckFilterBySiteOfOrigin", filterBySiteOfOrigin);
}
SiteLifeProxy.prototype.SummarySend = function(ApiName, DestDiv, ScriptName) {
    var url = this.__baseUrl + '/Summary/' + ApiName + '?plckElementId=' + DestDiv;
    for(ii=3; ii< this.SummarySend.arguments.length; ii+=2) { if(this.SummarySend.arguments[ii+1]) { url += "&" + this.SummarySend.arguments[ii] + "=" + this.SummarySend.arguments[ii+1];} }
    this.__Send(url, ScriptName);
    return false;
}




var gSiteLife = new SiteLifeProxy("http://sitelife.es.batanga.com/ver1.0");
gSiteLife.apiKey = "${APIKey}";
gSiteLife.SID = "sitelife.es.batanga.com";



    // We need to return true here as our default behavior allowing normal link navigation
    gSiteLife.AddEventHandler('ExternalResourceLink', function() {return true;});

if(gSiteLife.GetParameter('plckPersonaPage') && gSiteLife.GetParameter('plckPersonaPage').indexOf('PersonaBlog') == 0) {
document.write("<link href=" + "'http://sitelife.es.batanga.com/ver1.0/blog/BlogRss?plckBlogId=" + gSiteLife.GetParameter('userid') + "' title='" + gSiteLife.GetParameter('userid') + " Blog'" + "rel='alternate' type='application/rss+xml' />"); }
/* from: http://sitelife.es.batanga.com/ver1.0/content/direct/scripts/yahoo-min.js 20/11/2009 07:40:08 p.m. */
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
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"});/* from: http://sitelife.es.batanga.com/ver1.0/content/direct/scripts/json-min.js 20/11/2009 07:40:08 p.m. */
/*
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.6.0
*/
YAHOO.lang.JSON=(function(){var l=YAHOO.lang,_UNICODE_EXCEPTIONS=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_ESCAPES=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,_VALUES=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,_BRACKETS=/(?:^|:|,)(?:\s*\[)+/g,_INVALID=/^[\],:{}\s]*$/,_SPECIAL_CHARS=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,_CHARS={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function _revive(data,reviver){var walk=function(o,key){var k,v,value=o[key];if(value&&typeof value==="object"){for(k in value){if(l.hasOwnProperty(value,k)){v=walk(value,k);if(v===undefined){delete value[k];}else{value[k]=v;}}}}return reviver.call(o,key,value);};return typeof reviver==="function"?walk({"":data},""):data;}function _char(c){if(!_CHARS[c]){_CHARS[c]="\\u"+("0000"+(+(c.charCodeAt(0))).toString(16)).slice(-4);}return _CHARS[c];}function _prepare(s){return s.replace(_UNICODE_EXCEPTIONS,_char);}function _isValid(str){return l.isString(str)&&_INVALID.test(str.replace(_ESCAPES,"@").replace(_VALUES,"]").replace(_BRACKETS,""));}function _string(s){return'"'+s.replace(_SPECIAL_CHARS,_char)+'"';}function _stringify(h,key,d,w,pstack){var o=typeof w==="function"?w.call(h,key,h[key]):h[key],i,len,j,k,v,isArray,a;if(o instanceof Date){o=l.JSON.dateToString(o);}else{if(o instanceof String||o instanceof Boolean||o instanceof Number){o=o.valueOf();}}switch(typeof o){case"string":return _string(o);case"number":return isFinite(o)?String(o):"null";case"boolean":return String(o);case"object":if(o===null){return"null";}for(i=pstack.length-1;i>=0;--i){if(pstack[i]===o){return"null";}}pstack[pstack.length]=o;a=[];isArray=l.isArray(o);if(d>0){if(isArray){for(i=o.length-1;i>=0;--i){a[i]=_stringify(o,i,d-1,w,pstack)||"null";}}else{j=0;if(l.isArray(w)){for(i=0,len=w.length;i<len;++i){k=w[i];v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}else{for(k in o){if(typeof k==="string"&&l.hasOwnProperty(o,k)){v=_stringify(o,k,d-1,w,pstack);if(v){a[j++]=_string(k)+":"+v;}}}}a.sort();}}pstack.pop();return isArray?"["+a.join(",")+"]":"{"+a.join(",")+"}";}return undefined;}return{isValid:function(s){return _isValid(_prepare(s));},parse:function(s,reviver){s=_prepare(s);if(_isValid(s)){return _revive(eval("("+s+")"),reviver);}throw new SyntaxError("parseJSON");},stringify:function(o,w,d){if(o!==undefined){if(l.isArray(w)){w=(function(a){var uniq=[],map={},v,i,j,len;for(i=0,j=0,len=a.length;i<len;++i){v=a[i];if(typeof v==="string"&&map[v]===undefined){uniq[(map[v]=j++)]=v;}}return uniq;})(w);}d=d>=0?d:1/0;return _stringify({"":o},"",d,w,[]);}return undefined;},dateToString:function(d){function _zeroPad(v){return v<10?"0"+v:v;}return d.getUTCFullYear()+"-"+_zeroPad(d.getUTCMonth()+1)+"-"+_zeroPad(d.getUTCDate())+"T"+_zeroPad(d.getUTCHours())+":"+_zeroPad(d.getUTCMinutes())+":"+_zeroPad(d.getUTCSeconds())+"Z";},stringToDate:function(str){if(/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})Z$/.test(str)){var d=new Date();d.setUTCFullYear(RegExp.$1,(RegExp.$2|0)-1,RegExp.$3);d.setUTCHours(RegExp.$4,RegExp.$5,RegExp.$6);return d;}return str;}};})();YAHOO.register("json",YAHOO.lang.JSON,{version:"2.6.0",build:"1321"});/* from: http://sitelife.es.batanga.com/ver1.0/content/direct/scripts/pork.iframe.js 20/11/2009 07:40:08 p.m. */
document.iframeLoaders = {};

iframe = function() { this.initialize.apply(this, arguments); };
iframe.prototype = {
	initialize: function(form, options,count){
		if (!options) options = {};
		this.form = form;
		this.uniqueId = count;
		document.iframeLoaders[this.uniqueId] = this;
		var url = form.action + '?jsonRequest=' + escape(form.elements[0].value); // change form submit to string; similar to changing form method to get
		var firstSlash = url.indexOf("/", url.indexOf("//")+2);
		this.transport = this.getTransport((firstSlash > 0) ? url.substring(0, firstSlash) : "");
		this.onComplete = options.onComplete || null;
		this.update = this.$(options.update) || null;
		this.updateMultiple = options.multiple || false;
		if (((navigator.vendor && (navigator.vendor.indexOf('Apple')) > -1) || window.opera) // safari and opera only
     && (/\/Direct\/Process(\?|$)/.test(form.action)) && form.elements && (form.elements.length == 1)) { // only change calls that contain 1 element and whose actions end with /Direct/Process
			var doc = this.transport.contentWindow || this.transport.contentDocument; // retrieve the document of the iframe
			if (url.length < 80000) { // allow fallback to normal submission (80k is the max length for urls in safari)
				if (doc.document) // make sure we have the document and not the window
					doc = doc.document;
				
				try { // if this fails, fallback to normal submission
					doc.location.replace(url); // use location.replace to overwrite elements in history 
					return;
				} catch (e) { };
			}
		}
		form.target= 'frame_'+this.uniqueId;
		form.setAttribute("target", 'frame_'+this.uniqueId); // in case the other one fails.
		form.submit();
	},

	onStateChange: function() {
		this.transport = this.$('frame_'+this.uniqueId);
		try {	 var doc = this.transport.contentDocument.body.innerHTML; this.transport.contentDocument.close(); }	// For NS6
		catch (e){ 
			try{ var doc = this.transport.contentWindow.document.body.innerHTML; this.transport.contentWindow.document.close(); } // For IE5.5 and IE6
			 catch (e){
				 try { var doc = this.transport.document.body.innerHTML; this.transport.document.body.close(); } // for IE5
					catch (e) {
						try	{ var doc = window.frames['frame_'+this.uniqueId].document.body.innerText; } // for really nasty browsers
						catch (e) { //alert(e); 
						} // forget it.
				 }
			}
		}
		this.transport.responseText = doc;
		if (this.onComplete) setTimeout(this.bind(function(){this.onComplete(this.transport);}, this), 10);
		if (this.update) setTimeout(this.bind(function(){this.update.innerHTML = this.transport.responseText;}, this), 10);
		if (this.updateMultiple){ setTimeout(this.bind(function(){ // JSON support!
				try	{ var hasscript = false; eval("var inputObject = "+this.transport.responseText);	// we're expecting a JSON object, eval it to inputObject
					for (var i in inputObject) { if (i == 'script') { hasscript = true; } // check if we passed some javascript along too
						else {if ( elm = this.$(i)) { elm.innerHTML = inputObject[i]; } else { 
						//alert("element "+i+" not found!"); 
						} } // if it's not script, update the corresponding div
					} if (hasscript) eval(inputObject['script']); // some on-the-fly-javascript exchanging support too
				} catch (e) { //alert('There was an error processing: '+this.transport.responseText); 
				} // in case of an error					
			}, this), 10);
		}	
	},

	getTransport: function(baseUrl) {
		var divElm = document.createElement('DIV'), frame;
		divElm.setAttribute('style', 'width: 0; height: 0; margin: 0; padding: 0; visibility: hidden; overflow: hidden');
		if (navigator.userAgent.indexOf('MSIE') > 0 && navigator.userAgent.indexOf('Opera') == -1) {// switch to the crappy solution for IE
			divElm.style.width = 0;
			divElm.style.height = 0;
			divElm.style.margin = 0;
			divElm.style.padding = 0;
			divElm.style.visibility = 'hidden';
			divElm.style.overflow = 'hidden';
			divElm.innerHTML = '<iframe name=\"frame_'+this.uniqueId+'\" id=\"frame_'+this.uniqueId+'\" src=\"' + baseUrl + '/ver1.0/Content/blank.html\" onload=\"setTimeout(function(){document.iframeLoaders['+this.uniqueId+'].onStateChange()},20);"></iframe>';
		} else {
			frame = document.createElement("iframe");
			frame.setAttribute("name", "frame_"+this.uniqueId);
			frame.setAttribute("id", "frame_"+this.uniqueId);
			frame.addEventListener("load", this.bind(function(){ this.onStateChange(); }, this), false);
			divElm.appendChild(frame);
		}
    (RequestBatch.container || document.body).appendChild(divElm);
		return frame;
	},
  
  bind: function(functionObject, referenceObject) {
    return function() {
      return functionObject.apply(referenceObject, arguments);
    }
  },
  
  '$': function(id) {
    return document.getElementById(id);
  }
};
/* from: http://sitelife.es.batanga.com/ver1.0/content/direct/scripts/requestbatch.js 20/11/2009 07:40:08 p.m. */
if (typeof(RequestBatch) === 'undefined') {
    RequestBatch = function() {
      this.initialize.apply(this, arguments);
    };
    // for unique id
    var counter = 0;

    // how many requests are still pending?
    var pendingRequests = 0;

    function DirectAccessErrorHandler(msg,ex){
    //alert(msg);
    }
    (function() {

        function buildJsonpUrl(serverUrl, jsonString, callbackName) {
            var separator = serverUrl.indexOf('?') == -1 ? "?" : "&";
            // use Jsonp endpoint instead of Process
            serverUrl = serverUrl.replace('/Process', '/Jsonp');
            return serverUrl + separator + "r=" + encodeURIComponent(jsonString) + '&cb=' + callbackName;
        }

        function useJsonp(serverUrl, jsonString, callbackName) {
            // use Jsonp endpoint instead of Process
            serverUrl = buildJsonpUrl(serverUrl, jsonString, callbackName);
            var isIE = /*@cc_on!@*/false;
            if ((isIE && serverUrl.length < 2083) || (!isIE && serverUrl.length < 4000)) {
                return serverUrl;
            }
            return false;
        }

        // the core object to request batches
        RequestBatch.prototype = {
            initialize: function() {
                this.UniqueId = counter++;
                this.Requests = new Array()
            },

            HasTemplate: function() {
                return typeof (this["Template"]) != "undefined";
            },

            AddToRequest: function(requestThis) {
                this.Requests[this.Requests.length] = requestThis;
            },

            BeginRequest: function(serverUrl, callback) {
                pendingRequests++;

                if (!RequestBatch.callbacks) {
                    RequestBatch.callbacks = {};
                }

                // the cc_on comment below is important.. if you remove it, it will change the processing of the script
                // see http://msdn.microsoft.com/en-us/library/8ka90k2e(VS.85).aspx for details of conditional compilation
                var jsonString = YAHOO.lang.JSON.stringify(this), ie = /*@cc_on!@*/false;
                if (ie && !RequestBatch.container) { // forcibly take this route only for ie
                    var body = document.body, div;
                    RequestBatch.container = div = body.insertBefore(document.createElement('div'), body.firstChild);
                    div.style.height = div.style.width = div.style.margin = div.style.padding = 0;
                    div.style.visibility = div.style.overflow = 'hidden';
                    div.style.display = 'none';
                }
                // generate our callback function that will call their callback function via closure semantics
                var daapiCallbackName = 'daapiCallback' + this.UniqueId;
                var thisRequest = this;
                if (jsonpServerUrl = useJsonp(serverUrl, jsonString, 'RequestBatch.callbacks.' + daapiCallbackName)) {
                    // insert script node with callback function = daapiCallbackName
                    var jsonpScriptNode = document.createElement('script');
                    jsonpScriptNode.type = "text/javascript";
                    jsonpScriptNode.src = jsonpServerUrl;
                    var headElem = document.getElementsByTagName('head')[0];
                    RequestBatch.callbacks[daapiCallbackName] = (function(userCallback, headElem, scriptNode) {
                        return function(responses) {
                            if (thisRequest.HasTemplate()) {
                                userCallback(responses);
                            } else {
                                // clean up after ourselves
                                userCallback(responses.ResponseBatch);
                                userCallback = headElem = scriptNode = null;
                            }
                        }
                    })(callback, headElem, jsonpScriptNode);
                    headElem.appendChild(jsonpScriptNode);
                }
                else {
                    var form = generateForm(this.UniqueId, serverUrl, jsonString);
                    new iframe(form, { onComplete: function(request) { processResponse(callback, request, thisRequest.HasTemplate()); } }, this.UniqueId);
                }
                // in case they reuse the requestbatch
                this.UniqueId = counter++;
            }
        };
    })();
}

function generateForm(formId, serverUrl, inputVal) {
    // create the form
	var form = document.createElement("form");
	form.acceptCharset = "UTF-8";
	form.name = "f" + formId;
	form.id = "f" + formId;
	form.action = serverUrl;

	// create the input element on the form
	var inputElem = document.createElement("input");
	inputElem.name = "jsonRequest";
	inputElem.type = "hidden";
	inputElem.value = inputVal;
	form.appendChild(inputElem);

	// Firefox has a behavior on refresh that displays a popup confirming that is it reloading a form.
	// We work around this by attempting to perform a get action if the size is below a threshold, else
	// we will run as a post
	form.method = "post";
    if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1) {
        var separator = serverUrl.indexOf('?') == -1 ? "?" : "&";
        var fullRequestURL = serverUrl + separator + "jsonRequest="+ escape(inputVal);
        if (fullRequestURL.length < 4000) {
            // we plan to perform a get, so we need to parse the sid out of the url and place it
            // inside the form
            var sidPos = serverUrl.indexOf('sid=');
            if (sidPos != -1) {
                var endPos = serverUrl.indexOf('&', sidPos);
                var sid = serverUrl.substring(sidPos + 'sid='.length, endPos == -1 ? serverUrl.length : endPos);
	            var sidInputElem = document.createElement("input");
	            sidInputElem.name = "sid";
	            sidInputElem.type = "hidden";
	            sidInputElem.value = sid;
	            form.appendChild(sidInputElem);
	            // remove the sid from the url
	            form.action = serverUrl.substring(0, sidPos-1);
            }
            form.method = "get";
        }
    }

	(RequestBatch.container || document.body).appendChild(form);
	return form;
}

function processResponse(callback, request, isTemplated)
{
    pendingRequests--;
    try {
        if (isTemplated) {
            callback(request.ResponseText);
        } else {
            var jsonResponse = unescape(request.responseText);
            jsonResponse = jsonResponse.replace(/\\\>/g, ">");
            var responseObject = YAHOO.lang.JSON.parse(jsonResponse);
            try {
                callback(responseObject.ResponseBatch);
            } catch (e) {
                DirectAccessErrorHandler("exception during client callback", e);
            }
        }
    } catch (e) {
        DirectAccessErrorHandler("exception during processResponse", e);
    }
}

function getPendingRequestCount()
{
    return pendingRequests;
}
/* from: http://sitelife.es.batanga.com/ver1.0/content/direct/scripts/requesttypes.js 20/11/2009 07:40:09 p.m. */

// ------------------------------------------------------------------------------------
// This file contains all the request type objects for the SiteLife JSON Direct API.
// Create instances of these objects, place them in a RequestBatch, and send them off.
// ------------------------------------------------------------------------------------

(function() { // wrapped in a function to keep the Class variable out of the global scope
var Class = function() {
  return function() {
    this.initialize.apply(this, arguments);
  }
};
// Identify a user
UserKey = Class();
UserKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.UserKey = data;
   }
};
// Identify a comment
CommentKey = Class();
CommentKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CommentKey = data;
   }
};
// Identify an article
ArticleKey = Class();
ArticleKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.ArticleKey = data;
   }
};

// Identify a persona message
PersonaMessageKey = Class();
PersonaMessageKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.PersonaMessageKey = data;
   }
};

// Identify a review
ReviewKey = Class();
ReviewKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.ReviewKey = data;
   }
};

// Identify a gallery
GalleryKey = Class();
GalleryKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.GalleryKey = data;
    }
};

// Identify a photo
PhotoKey = Class();
PhotoKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.PhotoKey = data;
    }
};

// Identify a video
VideoKey = Class();
VideoKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.VideoKey = data;
    }
};

// Identify a blog with this blog key
BlogKey = Class();
BlogKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.BlogKey = data;
   }
};

// Identify a blog post with this blog post key
BlogPostKey = Class();
BlogPostKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.BlogPostKey = data;
   }
};

// Identify a custom item with this CustomItemKey
CustomItemKey = Class();
CustomItemKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CustomItemKey = data;
   }
};

// Identify a custom collection with this CustomCollectionKey
CustomCollectionKey = Class();
CustomCollectionKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CustomCollectionKey = data;
   }
};


// Identify a Forum Category
ForumCategoryKey = Class();
ForumCategoryKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.ForumCategoryKey = data;
    }
};

// Identify a Forum
ForumKey = Class();
ForumKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.ForumKey = data;
    }
};

// Identify a forum discussion with this DiscussionKey 
DiscussionKey = Class();
DiscussionKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.DiscussionKey = data;
   }
};

// Identify a Forum Post
ForumPostKey = Class();
ForumPostKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.ForumPostKey = data;
    }
};

// Identify an Event
EventKey = Class();
EventKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.EventKey = data;
    }
};

// Identify an Event
EventSetKey = Class();
EventSetKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.EventSetKey = data;
    }
};

// Identify a Community Group
CommunityGroupKey = Class();
CommunityGroupKey.prototype = {
    initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CommunityGroupKey = data;
    }
};

// Identify a CommunityGroup Membership
CommunityGroupMembershipKey = Class();
CommunityGroupMembershipKey.prototype = {
    initialize: function(communityGroupKey, userKey) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        this.CommunityGroupMembershipKey = data;
    }
};


// Identify a CommunityGroup Invitation
CommunityGroupInvitationKey = Class();
CommunityGroupInvitationKey.prototype = {
    initialize: function(communityGroupKey, userKey) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        this.CommunityGroupInvitationKey = data;
    }
};

// Identify a CommunityGroup Registrant
CommunityGroupRegistrantKey = Class();
CommunityGroupRegistrantKey.prototype = {
    initialize: function(communityGroupKey, userKey) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        this.CommunityGroupRegistrantKey = data;
    }
};

// Identify a CommunityGroup Banned User
CommunityGroupBannedUserKey = Class();
CommunityGroupBannedUserKey.prototype = {
    initialize: function(communityGroupKey, userKey) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        this.CommunityGroupBannedUserKey = data;
    }
};

PollKey = Class();
PollKey.prototype = {
    initialize: function(pollKey) {
        var data = new Object();
        data.Key = pollKey;
        this.PollKey = data;
    }
}

// Points/Badging
BadgeFamilyKey = Class();
BadgeFamilyKey.prototype = {
    initialize: function(badgeFamilyKey) {
        var data = new Object();
        data.Key = badgeFamilyKey;
        this.BadgeFamilyKey = data;
    }
}

LeaderboardKey = Class();
LeaderboardKey.prototype = {
    initialize: function(leaderboardKey) {
        var data = new Object();
        data.Key = leaderboardKey;
        this.LeaderboardKey = data;
    }
}

// Wrapper to request a comment page
CommentPage = Class();
CommentPage.prototype = {
   initialize: function(articleKey, numberPerPage, onPage, sort, findCommentKey) {
        var data = new Object();
        data.ArticleKey = articleKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        data.FindCommentKey = findCommentKey;
        this.CommentPage = data;
   }
};

// Wrapper to request a persona message page
PersonaMessagePage = Class();
PersonaMessagePage.prototype = {
   initialize: function(userKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.PersonaMessagePage = data;
   }
};

// Wrapper to request a review page
ReviewPage = Class();
ReviewPage.prototype = {
   initialize: function(articleKey, numberPerPage, onPage,sort) {
        var data = new Object();
        data.ArticleKey = articleKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.ReviewPage = data;
   }
};

// wrapper to request a page of reviews by user
UserReviewPage = Class();
UserReviewPage.prototype = {
    initialize: function(userKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.UserReviewPage = data;
    }
};

// Wrapper of types a gallery can contain
MediaType = Class();
MediaType.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.MediaType = data;
    }
};
// Wrapper to request a page of public galleries
PublicGalleryPage = Class();
PublicGalleryPage.prototype = {
    initialize: function(numberPerPage, onPage, mediaType) {
        var data = new Object();
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.MediaType = mediaType;
        this.PublicGalleryPage = data;
    }
};
// Wrapper to request a page of user galleries
UserGalleryPage = Class();
UserGalleryPage.prototype = {
    initialize: function(userKey, numberPerPage, onPage, mediaType) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.MediaType = mediaType;
        this.UserGalleryPage = data;
    }
};
// Wrapper to request a page of photos
PhotoPage = Class();
PhotoPage.prototype = {
    initialize: function(galleryKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.GalleryKey = galleryKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.PhotoPage = data;
    }
};
// Wrapper to request a page of videos
VideoPage = Class();
VideoPage.prototype = {
    initialize: function(galleryKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.GalleryKey = galleryKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.VideoPage = data;
    }
};
// Wrapper to request a comment action
CommentAction = Class();
CommentAction.prototype = {
   initialize: function(commentOnKey, onPageUrl, onPageTitle, commentBody) {
        var data = new Object();
        data.CommentOnKey = commentOnKey;
        data.OnPageUrl = onPageUrl;
        data.OnPageTitle = onPageTitle;
        data.CommentBody = commentBody;
        this.CommentAction = data;
   }
};
// Wrapper to request a review action
ReviewAction = Class();
ReviewAction.prototype = {
   initialize: function(reviewOnThisKey, onPageUrl, onPageTitle, 
                        reviewTitle, reviewRating, reviewBody, reviewPros, reviewCons) {
        var data = new Object();
        data.ReviewOnKey = reviewOnThisKey;
        data.OnPageUrl = onPageUrl;
        data.OnPageTitle = onPageTitle;
        data.ReviewTitle = reviewTitle;
        data.ReviewRating = reviewRating;
        data.ReviewBody = reviewBody;
        data.ReviewPros = reviewPros;
        data.ReviewCons = reviewCons;
        this.ReviewAction = data;
   }
};
// Wrapper to request a recommend action
RecommendAction = Class();
RecommendAction.prototype = {
   initialize: function(recommendThisKey, articleTitle) {
        var data = new Object();
        data.RecommendThisKey = recommendThisKey;
        if(articleTitle){
			data.OnPageTitle = articleTitle;
		}
		
        this.RecommendAction = data;
   }
};
// Wrapper to request a rate action
RateAction = Class();
RateAction.prototype = {
   initialize: function(rateThisKey, rating) {
        var data = new Object();
        data.RateThisKey = rateThisKey;
        data.Rating = rating;
        this.RateAction = data;
   }
};

// Permanently delete a gallery, video or photo
DeleteContentAction = Class();
DeleteContentAction.prototype = {
   initialize: function(deleteThisContent) {
        var data = new Object();
        data.DeleteThisContent = deleteThisContent;
        this.DeleteContentAction = data;
   }
};

// Email from the SiteLife system
EmailContentAction = Class();
EmailContentAction.prototype = {
   initialize: function(toAddress, subject, body) {
        var data = new Object();
        data.ToAddress = toAddress;
        data.Subject = subject;
        data.Body = body;
        this.EmailContentAction = data;
   }
};

// Email from the SiteLife system with user key as target
EmailContentWithUserIDAction = Class();
EmailContentWithUserIDAction.prototype = {
   initialize: function(toUserKey, subject, body) {
        var data = new Object();
        data.UserKey = toUserKey;
        data.Subject = subject;
        data.Body = body;
        this.EmailContentWithUserIDAction = data;
   }
};

// Wrapper to request a report abuse action
ReportAbuseAction = Class();
ReportAbuseAction.prototype = {
   initialize: function(reportThisKey, abuseReason, abuseDescription) {
        var data = new Object();
        data.ReportThisKey = reportThisKey;
        data.AbuseReason = abuseReason;
        data.AbuseDescription = abuseDescription;
        this.ReportAbuseAction = data;
   }
};
// Category used for discovery
Category = Class();
Category.prototype = {
   initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.Category = data;
   }
};
// Section used for discovery
Section = Class();
Section.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.Section = data;
    }
};
// Update or create an article
UpdateArticleAction = Class();
UpdateArticleAction.prototype = {
   initialize: function(updateArticle, onPageUrl, onPageTitle, section,categories) {
        var data = new Object();
        data.UpdateArticle = updateArticle;
        data.OnPageUrl = onPageUrl;
        data.OnPageTitle = onPageTitle;
        data.Section = section;
        data.Categories = categories;
        this.UpdateArticleAction = data;
   }
};
// Update or create a gallery
UpdateGalleryAction = Class();
UpdateGalleryAction.prototype = {
    initialize: function(updateGallery, galleryType, mediaType, title, description, tags, section, galleryPromo) {
        var data = new Object();
        data.UpdateGallery = updateGallery;
        data.GalleryType = galleryType;
        data.MediaType = mediaType;
        data.Title = title;
        data.Description = description;
        data.Tags = tags;
        data.Section = section;
        data.GalleryPromo = galleryPromo;
        this.UpdateGalleryAction = data;
    }
};
// Update or create a photo
UpdatePhotoAction = Class();
UpdatePhotoAction.prototype = {
    initialize: function(updatePhoto, title, description, tags, section) {
        var data = new Object();
        data.UpdatePhoto = updatePhoto;
        data.Title = title;
        data.Description = description;
        data.Tags = tags;
        data.Section = section;
        this.UpdatePhotoAction = data;
    }
};
// Update or create a video
UpdateVideoAction = Class();
UpdateVideoAction.prototype = {
    initialize: function(updateVideo, title, description, tags, section) {
        var data = new Object();
        data.UpdateVideo = updateVideo;
        data.Title = title;
        data.Description = description;
        data.Tags = tags;
        data.Section = section;
        this.UpdateVideoAction = data;
    }
};
// 
GalleryType = Class();
GalleryType.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.GalleryType = data;
    }
};
// GalleryPromo used for setting promotional text for public galleries
GalleryPromo = Class();
GalleryPromo.prototype = {
    initialize: function(title, body, photoKey) {
        var data = new Object();
        data.Title = title;
        data.Body = body;
        data.PhotoKey = photoKey;
        this.GalleryPromo = data;
    }
};
// UserTier used for discovery
UserTier = Class();
UserTier.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.UserTier = data;
    }
};
// MembershipTier used for community groups
MembershipTier = Class();
MembershipTier.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.MembershipTier = data;
    }
};
// Activity used for discovery
Activity = Class();
Activity.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.Activity = data;
    }
};
// Discovery on articles
DiscoverArticlesAction = Class();
DiscoverArticlesAction.prototype = {
   initialize: function(searchSections,searchCategories,limitToContributors,activity,age,maximumNumberOfDiscoveries) {
        var data = new Object();
        data.SearchSections = searchSections;
        data.SearchCategories = searchCategories;
        data.LimitToContributors = limitToContributors;
        data.Activity = activity;
        data.Age = age;
        data.MaximumNumberOfDiscoveries = maximumNumberOfDiscoveries;

        this.DiscoverArticlesAction = data;
   }
};

// Action used to add a friend
AddFriendAction = Class();
AddFriendAction.prototype = {
    initialize: function(friendUserKey) {
        var data = new Object();
        data.FriendUserKey = friendUserKey;
        this.AddFriendAction = data;
    }
};

// Action used to add a message
AddPersonaMessageAction = Class();
AddPersonaMessageAction.prototype = {
    initialize: function(toUserKey, body) {
        var data = new Object();
        data.ToUserKey = toUserKey;
        data.Body = body;
        this.AddPersonaMessageAction = data;
    }
};

// Action used to remove a message
RemovePersonaMessageAction = Class();
RemovePersonaMessageAction.prototype = {
    initialize: function(personaMessageKey) {
        var data = new Object();
        data.PersonaMessageKey = personaMessageKey;
        this.RemovePersonaMessageAction = data;
    }
};

// Action used to approve a friend
ApproveFriendAction = Class();
ApproveFriendAction.prototype = {
    initialize: function(friendUserKey, isApproved) {
        var data = new Object();
        data.FriendUserKey = friendUserKey;
        data.IsApproved = isApproved;
        this.ApproveFriendAction = data;
    }
};

// Action used to remove a friend
RemoveFriendAction = Class();
RemoveFriendAction.prototype = {
    initialize: function(friendUserKey) {
        var data = new Object();
        data.FriendUserKey = friendUserKey;
        this.RemoveFriendAction = data;
    }
};

// Action used to add an enemy
AddEnemyAction = Class();
AddEnemyAction.prototype = {
    initialize: function(enemyUserKey) {
        var data = new Object();
        data.EnemyUserKey = enemyUserKey;
        this.AddEnemyAction = data;
    }
};

// Action used to remove an enemy
RemoveEnemyAction = Class();
RemoveEnemyAction.prototype = {
    initialize: function(enemyUserKey) {
        var data = new Object();
        data.EnemyUserKey = enemyUserKey;
        this.RemoveEnemyAction = data;
    }
};

// Wrapper to request a friend page
FriendPage = Class();
FriendPage.prototype = {
   initialize: function(userKey, numberPerPage, onPage, isPendingList, filterKey, filterValue) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.IsPendingList = isPendingList;
        data.FilterKey = filterKey;
        data.FilterValue = filterValue;
        this.FriendPage = data;
   }
};

// Wrapper to request if a given user key is a friend of the user specified by the second parameter
// if the userKey parameter is not specified, the currently logged-in user is used
IsFriend = Class();
IsFriend.prototype = {
   initialize: function(friendUserKey, userKey) {
        var data = new Object();
        data.FriendUserKey = friendUserKey;
        data.UserKey = userKey;
        this.IsFriend = data;
   }
};
												
// Wrapper to request a friend page
EnemyPage = Class();
EnemyPage.prototype = {
   initialize: function(userKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.EnemyPage = data;
   }
};
												
// Discovery on content
DiscoverContentAction = Class();
DiscoverContentAction.prototype = {
   initialize: function(searchSections,searchCategories,limitToContributors,activity,contentType,age,maximumNumberOfDiscoveries, filterBySiteOfOrigin, parentKeys) {
        var data = new Object();
        data.SearchSections = searchSections;
        data.SearchCategories = searchCategories;
        data.LimitToContributors = limitToContributors;
        data.Activity = activity;
        data.ContentType = contentType;
        data.Age = age;
        data.MaximumNumberOfDiscoveries = maximumNumberOfDiscoveries;
        data.FilterBySiteOfOrigin = filterBySiteOfOrigin;
        if(parentKeys){
			data.ParentKeys = parentKeys;
		}	
        this.DiscoverContentAction = data;
   }
};

// Content type for discovery
ContentType = Class();
ContentType.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.ContentType = data;
    }
};
												
UpdateUserProfileAction = Class();
UpdateUserProfileAction.prototype = {
   initialize: function(   userKey, 
                            aboutMe, 
                            location,
                            signature,
                            dateOfBirth, 
                            sex, 
                            personaPrivacyMode, 
                            commentsTabVisible, 
                            photosTabVisible, 
                            messagesOpenToEveryone, 
                            isEmailNotificationsEnabled, 
                            selectedStyleId, 
                            customAnswers, 
                            extendedProfile) {
                            
        var data = new Object();
        data.UserKey = userKey;
        data.AboutMe = aboutMe;
        data.Location = location;
        data.Signature = signature;
        data.DateOfBirth = dateOfBirth;
        data.Sex = sex;
		data.PersonaPrivacyMode = personaPrivacyMode;
		data.CommentsTabVisible = commentsTabVisible;
		data.PhotosTabVisible = photosTabVisible;
		data.MessagesOpenToEveryone = messagesOpenToEveryone;
		data.IsEmailNotificationsEnabled = isEmailNotificationsEnabled;
		data.SelectedStyleId = selectedStyleId;
		data.CustomAnswers = customAnswers;
		data.ExtendedProfile = extendedProfile;        
        this.UpdateUserProfileAction = data;
   }
};

UpdateUserBlockedSettingAction = Class();
UpdateUserBlockedSettingAction.prototype = {
    initialize: function( userKey, isBlocked ){
        var data = new Object;
        data.UserKey = userKey;
        data.IsBlocked = isBlocked;
        this.UpdateUserBlockedSettingAction = data;
    }    
};

SearchAction = Class();
SearchAction.prototype = {
   initialize: function(searchType, searchString, numberPerPage, onPage ) {
        var data = new Object();
        data.SearchType = searchType;
        data.SearchString = searchString;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.SearchAction = data;
   }
};

// Wrapper to request a watch item page
WatchItemPage = Class();
WatchItemPage.prototype = {
   initialize: function(userKey, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.WatchItemPage = data;
   }
};

// Wrapper to add a watch item
AddWatchItemAction = Class();
AddWatchItemAction.prototype = {
   initialize: function(userKey, watchTargetKey, title, url ) {
        var data = new Object();
        data.UserKey = userKey;
        data.WatchTargetKey = watchTargetKey;
        data.WatchItemTitle = title;
        data.WatchItemUrl = url;
        this.AddWatchItemAction = data;
   }
};

// Wrapper to delete a watch item
DeleteWatchItemAction = Class();
DeleteWatchItemAction.prototype = {
   initialize: function(userKey, watchTargetKey) {
        var data = new Object();
        data.UserKey = userKey;
        data.WatchTargetKey = watchTargetKey;
        this.DeleteWatchItemAction = data;
   }
};

// Wrapper to request a blog post page
BlogPostPage = Class();
BlogPostPage.prototype = {
   initialize: function(blogKey, numberPerPage, onPage, sort, blogPostState, restrictToOwner, includeFuturePosts) {
        var data = new Object();
        data.BlogKey = blogKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        data.BlogPostState = blogPostState;
        if ((typeof(restrictToOwner) == 'undefined') || (restrictToOwner == null)) {
            // Default to false for backwards compatibility
            restrictToOwner = false;
        }
        data.RestrictToOwner = restrictToOwner.toString();
        if ((typeof(includeFuturePosts) == 'undefined') || (includeFuturePosts == null)) {
            // Default to false for backwards compatibility
            includeFuturePosts = false;
        }
        data.IncludeFuturePosts = includeFuturePosts.toString();
        this.BlogPostPage = data;
   }
};

// Wrapper to request a blog post page by Tag
BlogPostsByTagPage = Class();
BlogPostsByTagPage.prototype = {
   initialize: function(blogKey, tag, numberPerPage, onPage, sort) {
        var data = new Object();
        data.BlogKey = blogKey;
        data.Tag = tag;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.BlogPostsByTagPage = data;
   }
};


// Wrapper to request a blog post archive count
BlogPostArchiveCount = Class();
BlogPostArchiveCount.prototype = {
   initialize: function(blogKey) {
        var data = new Object();
        data.BlogKey = blogKey;
        this.BlogPostArchiveCount = data;
   }
};


// Wrapper to request a blog post archive content page
BlogPostArchiveContentPage = Class();
BlogPostArchiveContentPage .prototype = {
   initialize: function(blogKey, month, numberPerPage, onPage, sort) {
        var data = new Object();
        data.BlogKey = blogKey;
        data.Month = month;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.BlogPostArchiveContentPage = data;
   }
};


// Wrapper to request a user comment page
UserCommentPage = Class();
UserCommentPage.prototype = {
   initialize: function(userKey, numberPerPage, onPage, sort, commentsOnly) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        data.CommentsOnly = commentsOnly;
        this.UserCommentPage = data;
   }
};


// Wrapper to request blog tag 
RecentBlogTag = Class();
RecentBlogTag.prototype = {
   initialize: function(blogKey) {
        var data = new Object();
        data.BlogKey = blogKey;
        this.RecentBlogTag = data;
   }
};


// Wrapper to request recent user photo page
RecentUserPhotoPage = Class();
RecentUserPhotoPage.prototype = {
   initialize: function(userKey, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.RecentUserPhotoPage = data;
   }
};

// Wrapper to request recent user video page
RecentUserVideoPage = Class();
RecentUserVideoPage .prototype = {
   initialize: function(userKey, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.RecentUserVideoPage  = data;
   }
};


// Wrapper to request recent public gallery page
RecentPublicGalleryPage = Class();
RecentPublicGalleryPage .prototype = {
   initialize: function(userKey, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.RecentPublicGalleryPage  = data;
   }
};
    
    
// Wrapper to request recent user activity page
RecentUserActivity = Class();
RecentUserActivity .prototype = {
   initialize: function(userKey) {
        var data = new Object();
        data.UserKey = userKey;
       this.RecentUserActivity  = data;
   }
};

  
// Wrapper to request page of user media submission counts
UserMediaSubmissionsCountPage = Class();
UserMediaSubmissionsCountPage .prototype = {
    initialize: function(userKey, mediaType, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.MediaType = mediaType;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.UserMediaSubmissionsCountPage = data;
    }
};


// Wrapper to request recent forum discussion page
RecentForumDiscussionPage = Class();
RecentForumDiscussionPage .prototype = {
   initialize: function(userKey, numberPerPage, onPage) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.RecentForumDiscussionPage = data;
   }
};

    
// Wrapper to request user group forum page
UserGroupForumPage = Class();
UserGroupForumPage .prototype = {
   initialize: function(userKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.UserKey = userKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.UserGroupForumPage = data;
   }
};

// The blogRollEntry used in UpdateBlogAction
BlogRollEntry = Class();
BlogRollEntry.prototype = {
   initialize: function(name, url) {
        var data = new Object();
        data.Name = name;
        data.Url = url;
        this.BlogRollEntry = data;
   }
};

// Bookmark used in UpdateCommunityGroupAction
Bookmark = Class();
Bookmark.prototype = {
    initialize: function(title, link) {
        var data = new Object();
        data.Title = title;
        data.Link = link;
        this.Bookmark = data;
   }
};

// CommunityGroupVisibility used in UpdateCommunityGroupAction
CommunityGroupVisibility = Class();
CommunityGroupVisibility.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.CommunityGroupVisibility = data;
    }
};

// Update or create a blog
UpdateBlogAction = Class();
UpdateBlogAction.prototype = {
   initialize: function(updateBlog, title, tagline, blogRollEntries, blogType) {
        var data = new Object();
        data.BlogKey = updateBlog;
        data.Title = title;
        data.Tagline = tagline;
        data.BlogRollEntries = blogRollEntries;
        data.BlogType = blogType;
        this.UpdateBlogAction = data;
   }
};

// Update or create a blog post, key can be either a post key (update case)
// or a blog key (create case)
UpdateBlogPostAction = Class();
UpdateBlogPostAction.prototype = {
   initialize: function(key, title, body, tags, publishDate, published) {
        var data = new Object();
        data.TargetThis = key;
        data.Title = title;
        data.Body = body;
        data.Tags = tags;
        data.Date = publishDate;
        data.Published = published;
        this.UpdateBlogPostAction = data;
   }
};

// Identify a forum discussion with this DiscussionKey 
DiscussionKey = Class();
DiscussionKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.DiscussionKey = data;
   }
};

// Identify a custom item with this CustomItemKey
CustomItemKey = Class();
CustomItemKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CustomItemKey = data;
   }
};

// Identify a custom collection with this CustomCollectionKey
CustomCollectionKey = Class();
CustomCollectionKey.prototype = {
   initialize: function(key) {
        var data = new Object();
        data.Key = key;
        this.CustomCollectionKey = data;
   }
};

// Update or create a custom item in storage
UpdateCustomItemAction = Class();
UpdateCustomItemAction.prototype = {
   initialize: function(customItemKey, name, mimeType, displayText, content, includeInRecentActivity) {
        var data = new Object();
        data.CustomItemKey = customItemKey;
        data.Name = name;
        data.MimeType = mimeType;
        data.DisplayText = displayText;
        data.Content = content;
        if ((typeof(includeInRecentActivity) == 'undefined') || (includeInRecentActivity == null)) {
            // Default to true for backwards compatibility
            includeInRecentActivity = true;
        }
        data.IncludeInRecentActivity = includeInRecentActivity
        this.UpdateCustomItemAction = data;
   }
};

// Add a new custom collection to storage
AddCustomCollectionAction = Class();
AddCustomCollectionAction.prototype = {
   initialize: function(customCollectionKey, customCollectionName) {
        var data = new Object();
        data.CustomCollectionKey = customCollectionKey;
        data.CustomCollectionName = customCollectionName;
        this.AddCustomCollectionAction = data;
   }
};

// Insert an item into a custom collection
InsertIntoCollectionAction = Class();
InsertIntoCollectionAction.prototype = {
   initialize: function(customCollectionKey, insertThisKey, position) {
        var data = new Object();
        data.CustomCollectionKey = customCollectionKey;
        data.InsertThisKey = insertThisKey;
        data.Position = position;
        this.InsertIntoCollectionAction = data;
   }
};

// Remove an item from a custom collection (position can be null to specify to remove all occurrences of item)
RemoveFromCollectionAction = Class();
RemoveFromCollectionAction.prototype = {
   initialize: function(customCollectionKey, removeThisKey, position) {
        var data = new Object();
        data.CustomCollectionKey = customCollectionKey;
        data.RemoveThisKey = removeThisKey;
        data.Position = position;
        this.RemoveFromCollectionAction = data;
   }
};

// Get a page of items out of a custom collection
CustomCollectionPage = Class();
CustomCollectionPage.prototype = {
   initialize: function(customCollectionKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.CustomCollectionKey = customCollectionKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.CustomCollectionPage = data;
   }
};


// Get a page of items out of a custom collection
EditorMessageRequest = Class();
EditorMessageRequest.prototype = {
   initialize: function() {
      this.EditorMessageRequest = new Object();
   }
};

// Retrieve a user's tags for the given content type
UserTags = Class();
UserTags.prototype = {
   initialize: function(userKey, contentType) {
      var data = new Object();
      data.UserKey = userKey;
      data.ContentType = contentType;
      this.UserTags = data;
   }
};


// Get an item's ContentPolicy
GetContentPolicyAction = Class();
GetContentPolicyAction.prototype = {
    initialize: function(targetKey, userTier, action) {
        var data = new Object();
        data.TargetKey = targetKey;
        data.UserTier = userTier;
        data.ContentPolicyActionType = action;
        this.GetContentPolicyAction = data;
    }
}

// Set an item's ContentPolicy
SetContentPolicyAction = Class();
SetContentPolicyAction.prototype = {
    initialize: function(targetKey, userTier, action, policy) {
        var data = new Object();
        data.TargetKey = targetKey;
        data.UserTier = userTier;
        data.ContentPolicyActionType = action;
        data.ContentPolicy = policy;
        this.SetContentPolicyAction = data;
    }
}

ContentPolicy = Class();
ContentPolicy.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.ContentPolicy = data;
    }
};

ContentPolicyActionType = Class();
ContentPolicyActionType.prototype = {
    initialize: function(name) {
        var data = new Object();
        data.Name = name;
        this.ContentPolicyActionType = data;
    }
};

// Updates a Forum's meta data
UpdateForumAction = Class();
UpdateForumAction.prototype = {
    initialize: function(forumKey, title, description) {
        var data = new Object();
        data.ForumKey = forumKey;
        data.Title = title;
        data.Description = description;
        this.UpdateForumAction = data;
    }
};

//Adds/Updates a Forum Discussion's meta data. If the key is a ForumKey, it will be added as a new Discussion.
//If the key is a ForumDiscussionKey, the existing forum discussion will be updated.
UpdateForumDiscussionAction = Class();
UpdateForumDiscussionAction.prototype = {
    initialize: function(key, title, body, isQuestion, isPoll) {
        var data = new Object();
        data.TargetThis = key;
        data.Title = title;
        data.Body = body;
        data.IsQuestion = typeof(isQuestion) == 'string' ? isQuestion : (isQuestion ? "true" : "false");
        data.IsPoll = typeof(isPoll) == 'string' ? isPoll : (isPoll ? "true" : "false");
        this.UpdateForumDiscussionAction = data;
    }
};

//Adds/Updates a Forum Post's meta data. If the key is a ForumDiscussionKey, it will be added as a new Post.
//If the key is a ForumPostKey, the existing forum post will be updated.
UpdateForumPostAction = Class();
UpdateForumPostAction.prototype = {
    initialize: function(key, title, body, isQuestion) {
        var data = new Object();
        data.TargetThis = key;
        data.Title = title;
        data.Body = body;
        data.IsQuestion = isQuestion;
        this.UpdateForumPostAction = data;
    }
};

//Updates a Forum Discussion's Sticky flag
ForumToggleDiscussionStickyAction = Class();
ForumToggleDiscussionStickyAction.prototype = {
    initialize: function(discussionKey) {
        var data = new Object();
        data.DiscussionKey = discussionKey;
        this.ForumToggleDiscussionStickyAction = data;
    }
};

//Opens/Closes a Forum Discussion
ForumToggleDiscussionClosedAction = Class();
ForumToggleDiscussionClosedAction.prototype = {
    initialize: function(discussionKey) {
        var data = new Object();
        data.DiscussionKey = discussionKey;
        this.ForumToggleDiscussionClosedAction = data;
    }
};

//Retrieves a paginated list of Discussions for a particular Forum
ForumDiscussionsPage = Class();
ForumDiscussionsPage.prototype = {
    initialize: function(forumKey, numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.ForumKey = forumKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.ForumDiscussionsPage = data;
    }
};

//Retrieves a paginated list of Posts for a particular Forum
ForumPostsPage = Class();
ForumPostsPage.prototype = {
    initialize: function(forumDiscussionKey, numberPerPage, oneBasedOnPage, sort, findPostKey) {
        var data = new Object();
        data.DiscussionKey = forumDiscussionKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        data.FindPostKey = findPostKey;
        this.ForumPostsPage = data;
    }
};

//Retrieves a paginated list of forums for a particular category
ForumCategoriesPage = Class();
ForumCategoriesPage.prototype = {
    initialize: function(numberPerPage, oneBasedOnPage) {
        var data = new Object();
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        this.ForumCategoriesPage = data;
    }
};

//Retrieves a paginated list of forums for a particular category
ForumsPage = Class();
ForumsPage.prototype = {
    initialize: function(categoryKey, numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.ForumCategoryKey = categoryKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.ForumsPage = data;
    }
};

ForumSearchAction = Class();
ForumSearchAction.prototype = {
    initialize: function(searchKey, searchString, numberPerPage, onPage) {
        var data = new Object();
        data.TargetThis = searchKey;
        data.SearchString = searchString;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        this.ForumSearchAction = data;
    }
};

// Retrieves a paginated list of community groups
CommunityGroupPage = Class();
CommunityGroupPage.prototype = {
    initialize: function(numberPerPage, oneBasedOnPage, sort, section) {
        var data = new Object();
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        if ((typeof(section) == 'undefined') || (section == null)) {
            // Default section to All
            section = new Section("All");
        }
        data.Section = section;
        this.CommunityGroupPage = data;
    }
};

// Retrieves a paginated list of community groups
CommunityGroupMembership = Class();
CommunityGroupMembership.prototype = {
    initialize: function(groupKey, userKey) {
        var data = new Object();
        data.CommunityGroupKey = groupKey;
        data.UserKey = userKey;
        this.CommunityGroupMembership = data;
    }
};


// Retrieves a paginated list of community groups
CommunityGroupMembershipPage = Class();
CommunityGroupMembershipPage.prototype = {
    initialize: function(key, numberPerPage, oneBasedOnPage, sort, membershipFilter) {
        var data = new Object();
        data.Key = key;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        data.MembershipFilter = membershipFilter;
        this.CommunityGroupMembershipPage = data;
    }
};

// Retrieves a paginated list of registrants
CommunityGroupRegistrantPage = Class();
CommunityGroupRegistrantPage.prototype = {
    initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.CommunityGroupKey = key;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.CommunityGroupRegistrantPage = data;
    }
};

// Retrieves a paginated list of banned users
CommunityGroupBannedUserPage = Class();
CommunityGroupBannedUserPage.prototype = {
    initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.CommunityGroupKey = key;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.CommunityGroupBannedUserPage = data;
    }
};

// Retrieves a paginated list of invited users
CommunityGroupInvitedUserPage = Class();
CommunityGroupInvitedUserPage.prototype = {
    initialize: function(key, numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.CommunityGroupKey = key;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.CommunityGroupInvitedUserPage = data;
    }
};



// Creates a new or updates an existing community group
UpdateCommunityGroupAction = Class();
UpdateCommunityGroupAction.prototype = {
    initialize: function(key, title, description, categories, visibility, bookmarks, section, photoKey) {
        var data = new Object();
        data.CommunityGroupKey = key;
        data.Title = title;
        data.Description = description;
        data.Categories = categories;
        data.Visibility = visibility,
        data.Bookmarks = bookmarks;        
        data.Section = section;
        data.PhotoKey = photoKey;
        this.UpdateCommunityGroupAction = data;
    }
};

// Updates an existing commnity group's bookmarks
UpdateCommunityGroupBookmarksAction = Class();
UpdateCommunityGroupBookmarksAction.prototype = {
    initialize: function(key, bookmarks) {
        var data = new Object();
        data.CommunityGroupKey = key;
        data.Bookmarks = bookmarks;        
        this.UpdateCommunityGroupBookmarksAction = data;
    }
};

// Creates or updates a user's membership in a group, with options to ban the user from the group.
UpdateCommunityGroupMembershipAction = Class();
UpdateCommunityGroupMembershipAction.prototype = {
    initialize: function(communityGroupKey, userKey, membershipTier, isBanned, banMessage) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        data.MembershipTier = membershipTier;
        data.IsBanned = isBanned;
        data.BanMessage = banMessage;
        this.UpdateCommunityGroupMembershipAction = data;
    }
};

// Enables a user to request membership in a community group or an admin to invite a non-member.
RequestCommunityGroupMembershipAction = Class();
RequestCommunityGroupMembershipAction.prototype = {
    initialize: function(communityGroupKey, userKey, message) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.UserKey = userKey;
        data.Message = message;
        this.RequestCommunityGroupMembershipAction = data;
    }
};

//Retrieves a paginated list of Events for a particular EventSetKey
EventsPage = Class();
EventsPage.prototype = {
    initialize: function(eventSetKey, startDate, endDate,numberPerPage, oneBasedOnPage, sort) {
        var data = new Object();
        data.EventSetKey = eventSetKey;
        data.StartDate = startDate;
        data.EndDate = endDate;
        data.NumberPerPage = numberPerPage;
        data.OnPage = oneBasedOnPage;
        data.Sort = sort;
        this.EventsPage = data;
    }
};

// Update or creates an Event, key can be either an EventKey (update case)
// or an EventSetKey (create case)
UpdateEventAction = Class();
UpdateEventAction.prototype = {
    initialize: function(key, title, description, location, bookmarkName, bookmarkUrl, startDate, endDate, utcOffset) {
        var data = new Object();
        data.TargetThis = key;
        data.Title = title;
        data.Description = description;
        data.Location = location;
        data.BookmarkName = bookmarkName;
        data.BookmarkUrl = bookmarkUrl;
        data.StartDate = startDate;
        data.EndDate = endDate;
        data.UtcOffset = utcOffset;
        this.UpdateEventAction = data;
    }
};


// Retrieve a paginated list of recent group activities
RecentMiniFeedActivity = Class();
RecentMiniFeedActivity.prototype = {
    initialize: function(communityGroupKey, onPage, numberPerPage) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.OnPage = onPage;
        data.NumberPerPage = numberPerPage
        this.RecentMiniFeedActivity = data;
    }
}

//Retrieve a list of Most Active Users in a CommunityGroup
CommunityGroupMostActiveMembers = Class();
CommunityGroupMostActiveMembers.prototype = {
    initialize: function(communityGroupKey, age, maximumNumberOfMembers) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.Age = age;
        data.MaximumNumberOfMembers = maximumNumberOfMembers
        this.CommunityGroupMostActiveMembers = data;
    }
}

// perform a search for content within a specific community group
CommunityGroupSearchAction = Class();
CommunityGroupSearchAction.prototype = {
    initialize: function(communityGroupKey, searchType, searchString, numberPerPage, onPage) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.SearchType = searchType;
        data.SearchString = searchString;
        data.OnPage = onPage;
        data.NumberPerPage = numberPerPage;
        this.CommunityGroupSearchAction = data;
    }
}

// perform a search for content within a specific community group
RequestDeleteCommunityGroupAction = Class();
RequestDeleteCommunityGroupAction.prototype = {
    initialize: function(communityGroupKey, deleteReason) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.DeleteReason = deleteReason;
        this.RequestDeleteCommunityGroupAction = data;
    }
}

CommunityGroupRecentForumDiscussions = Class();
CommunityGroupRecentForumDiscussions.prototype = {
    initialize: function(communityGroupKey, age, maximumNumberOfDiscussions) {
        var data = new Object();
        data.CommunityGroupKey = communityGroupKey;
        data.Age = age;
        data.MaximumNumberOfDiscussions = maximumNumberOfDiscussions;
        this.CommunityGroupRecentForumDiscussions = data;
    }
}


SystemTimeInfo = Class();
SystemTimeInfo.prototype = {
    initialize: function(){
        var data = new Object();
        this.SystemTimeInfo = data;
    }
}

PrivateMessageFolderList = Class();
PrivateMessageFolderList.prototype = {
    initialize: function(){
        var data = new Object();
        this.PrivateMessageFolderList = data;
    }
}


PrivateMessage = Class();
PrivateMessage.prototype = {
    initialize: function(folderID, messageID){
        var data = new Object();
        data.FolderID = folderID;
        data.MessageID = messageID;
        this.PrivateMessage = data;
    }
}

PrivateMessagePage = Class();
PrivateMessagePage.prototype = {
    initialize: function(folderID, numberPerPage, onPage, messageReadState){
        var data = new Object();
        data.FolderID = folderID;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.MessageReadState = messageReadState;
        this.PrivateMessagePage = data;
    }
}

PrivateMessageSendAction = Class();
PrivateMessageSendAction.prototype = {
    initialize: function(subject, body, recipientList){
        var data = new Object();
        data.Subject = subject;
        data.Body = body;
        data.RecipientList = recipientList;
        this.PrivateMessageSendAction = data;
    }
}

PrivateMessageMoveMessageAction = Class();
PrivateMessageMoveMessageAction.prototype = {
    initialize: function(sourceFolderID, destinationFolderID, messageIDList){
        var data = new Object();
        data.SourceFolderID = sourceFolderID;
        data.DestinationFolderID = destinationFolderID;
        data.MessageIDList = messageIDList;
        this.PrivateMessageMoveMessageAction = data;
    }
}

PrivateMessageDeleteMessageAction = Class();
PrivateMessageDeleteMessageAction.prototype = {
    initialize: function(sourceFolderID, messageIDList){
        var data = new Object();
        data.SourceFolderID = sourceFolderID;
        data.MessageIDList = messageIDList;
        this.PrivateMessageDeleteMessageAction = data;
    }
}

PrivateMessageEmptyTrashAction = Class();
PrivateMessageEmptyTrashAction.prototype = {
    initialize: function(){
        var data = new Object();
        this.PrivateMessageEmptyTrashAction = data;
    }
}


PrivateMessageCreateFolderAction = Class();
PrivateMessageCreateFolderAction.prototype = {
    initialize: function(){
        var data = new Object();
        data.FolderID = "Inbox";
        this.PrivateMessageCreateFolderAction = data;
    }
}

FirstUnreadPost = Class();
FirstUnreadPost.prototype = {
	initialize: function(discussionKey, numberPerPage, sort){
		var data = new Object();
		data.DiscussionKey = discussionKey;
        data.NumberPerPage = numberPerPage;
        data.Sort = sort;
        this.FirstUnreadPost = data;
	}
}

LatestPost = Class();
LatestPost.prototype = {
	initialize: function(discussionKey, numberPerPage, sort){
		var data = new Object();
		data.DiscussionKey = discussionKey;
        data.NumberPerPage = numberPerPage;
        data.Sort = sort;
        this.LatestPost = data;
	}
}

UpdateDiscussionLastReadAction = Class();
UpdateDiscussionLastReadAction.prototype = {
	initialize: function(discussionKey, postKey, forceUpdate){
		var data = new Object();
		data.DiscussionKey = discussionKey;
		if(postKey){
			data.ForumPostKey = postKey;
		}
		if(forceUpdate){
			data.ForceUpdate = true;
		}
		else{
			data.ForceUpdate = false;
		}
		this.UpdateDiscussionLastReadAction = data;
	}
}

UpdateExternalUserIdAction = Class();
UpdateExternalUserIdAction.prototype = {
	initialize: function(externalSiteName, externalSiteUserId, forUser){
		var data = new Object();
		data.ExternalSiteName = externalSiteName;
		data.ExternalSiteUserId = externalSiteUserId;
		data.ForUser = forUser;
		this.UpdateExternalUserIdAction = data;
	}
}

UpdateSubscriptionAction = Class();
UpdateSubscriptionAction.prototype = {
    initialize: function(discussionKey, subscribe){
        var data = new Object();
        data.DiscussionKey = discussionKey;
        data.Subscribe = subscribe;
        this.UpdateSubscriptionAction = data;
    }
}

UpdatePollAction = Class();
UpdatePollAction.prototype = {
    initialize: function(pollOnKey, question, answers) {
        var data = new Object();
        data.PollOnKey = pollOnKey;
        data.Question = question;
        data.Answers = answers;
        this.UpdatePollAction = data;
    }
}

TogglePollIsClosedAction = Class();
TogglePollIsClosedAction.prototype = {
    initialize: function(pollKey) {
        var data = new Object();
        data.ToggleThisPoll = pollKey;
        this.TogglePollIsClosedAction = data;
    }
}

PostPollAnswerAction = Class();
PostPollAnswerAction.prototype = {
    initialize: function(pollToAnswer, indexOfAnswer) {
        var data = new Object();
        data.PollToAnswer = pollToAnswer;
        data.IndexOfAnswer = indexOfAnswer;
        this.PostPollAnswerAction = data;
    }
}

PollPage = Class();
PollPage.prototype = {
    initialize: function(pollOnKey, numberPerPage, onPage, sort) {
        var data = new Object();
        data.PollOnKey = pollOnKey;
        data.NumberPerPage = numberPerPage;
        data.OnPage = onPage;
        data.Sort = sort;
        this.PollPage = data;
    }
}

CheckFilteredWords = Class();
CheckFilteredWords.prototype = {
    initialize: function(keyValueDictionary) { // key is the string ID, value is the string to be checked - formatted like { "key1":"string1", "key2":"string2" }.
        var data = new Object();
        data.WordDictionary = keyValueDictionary;
        this.CheckFilteredWords = data;
    }
}

//Points&Badging
AwardPointsAction = Class();
AwardPointsAction.prototype = {
    initialize: function(userKey, points, currencyType) { 
        var data = new Object();
        data.UserKey = userKey;
        data.Points = points;
        data.CurrencyType = currencyType;
        this.AwardPointsAction = data;
    }
}

BadgeFamily = Class();
BadgeFamily.prototype = {
    initialize: function(badgeFamilyKey) { 
        var data = new Object();
        data.BadgeFamilyKey = badgeFamilyKey;
        this.BadgeFamily = data;
    }
}

BadgeFamilies = Class();
BadgeFamilies.prototype = {
    initialize: function() { 
        var data = new Object();        
        this.BadgeFamilies = data;
    }
}

BadgingEventAction = Class();
BadgingEventAction.prototype = {
    initialize: function(activityName, activityTags, userTags) { 
        var data = new Object();
        data.ActivityName = activityName;
        data.ActivityTags = activityTags
        data.UserTags = userTags;
        this.BadgingEventAction = data;
    }
}

GrantBadgeAction = Class();
GrantBadgeAction.prototype = {
    initialize: function(userKey, badgeFamilyKey, badgeKey) { 
        var data = new Object();
        data.UserKey = userKey;
        data.BadgeFamilyKey = badgeFamilyKey
        data.BadgeKey = badgeKey;
        this.GrantBadgeAction = data;
    }
}

Leaderboard = Class();
Leaderboard.prototype = {
    initialize: function(leaderboardKey) { 
        var data = new Object();
        data.LeaderboardKey = leaderboardKey;
        this.Leaderboard = data;
    }
}

Leaderboards = Class();
Leaderboards.prototype = {
    initialize: function() { 
        var data = new Object();        
        this.Leaderboards = data;
    }
}

LeaderboardRankingsPage = Class();
LeaderboardRankingsPage.prototype = {
    initialize: function(leaderboardKey, oneBasedOnPage) { 
        var data = new Object();
        data.LeaderboardKey = leaderboardKey;
        data.OnPage = oneBasedOnPage;
        this.LeaderboardRankingsPage = data;
    }
}

RevokeBadgeAction = Class();
RevokeBadgeAction.prototype = {
    initialize: function(userKey, badgeFamilyKey, badgeKey) { 
        var data = new Object();
        data.UserKey = userKey;
        data.BadgeFamilyKey = badgeFamilyKey
        data.BadgeKey = badgeKey;
        this.RevokeBadgeAction = data;
    }
}

PointsAndBadgingRuleValidationAction = Class();
PointsAndBadgingRuleValidationAction.prototype = {
    initialize: function(rules) { 
        var data = new Object();
        data.Rules = rules;
        this.PointsAndBadgingRuleValidationAction = data;
    }
}

AbuseItemPage = Class();
AbuseItemPage.prototype = {
	initialize: function(numberPerPage, onPage, section, maxReportsPerItem){
		var data = new Object();
		data.NumberPerPage = numberPerPage;
		data.OnPage = onPage;
		data.Section = section;
		data.MaxReportsPerItem = maxReportsPerItem;
		this.AbuseItemPage = data;
	}
}

AbuseItem = Class();
AbuseItem.prototype =  {
	initialize: function(targetKey){
		var data = new Object();
		data.TargetKey = targetKey;
		this.AbuseItem = data;
	}
}

ClearAbuseAction = Class();
ClearAbuseAction.prototype =  {
	initialize: function(targetKey){
		var data = new Object();
		data.TargetKey = targetKey;
		this.ClearAbuseAction = data;
	}
}

SetCommentBlockingStateAction = Class();
SetCommentBlockingStateAction.prototype = {
	initialize: function(commentKey, blockingState){
		var data = new Object();
		data.CommentKey = commentKey;
		data.CommentBlockingState = blockingState;
		this.SetCommentBlockingStateAction = data;
	}
}
//Community feed 
RecentActivityRequest = Class();
RecentActivityRequest.prototype = {
    initialize: function(activityForTypes, count) { 
        var data = new Object();
        data.ActivityForTypes = activityForTypes;
        data.Count = count;
        this.RecentActivityRequest = data;
    }
}	
})();
/* from: http://www.batanga.com//include/meebo/meebo.js 20/11/2009 07:40:09 p.m. */

function IMme(uid,screenName)
{
    var loggedIn = IsUserLoggedIn();    
    if(!loggedIn)
    {
        showLoginDialog();            
        return false;
    }
    
    Meebo.im(uid,screenName);
    
    return false;
}

function isMeeboEnabled() {
    return !isThereACrawlerInThePage();
//    return true;
}

function makeSharable(id,w,h) {
    return;
    if (!(typeof(isThereACrawlerInThePage) == 'undefined' || typeof(Meebo) == 'undefined' || isThereACrawlerInThePage())) 
        if (document.getElementById(id))
            Meebo.exec('makeAllSharable', {
                    rootElement:id,
                    minImageWidth:w,
                    minImageHeight:h,
                    minVideoWidth:w,
                    minVideoHeight:h
             });
}