function createXmlHttp(){var xmlHttp=null;try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}}if(xmlHttp==null){xmlHttp=new XMLHttpRequest()}return xmlHttp}var xmlHttp=null;xmlHttp=createXmlHttp();var ajax_result;function ajaxPerform(async,xmlMessage,responser,method,callback){if(async){if(xmlHttp.readyState==4){xmlHttp=createXmlHttp()}xmlHttp.onreadystatechange=callback}if(method=="POST"){xmlHttp.open(method,responser,async);xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xmlHttp.send(xmlMessage)}else{if(method=="GET"){xmlHttp.open(method,responser+"?"+xmlMessage,async);xmlHttp.send(null)}}if(!async){return xmlHttp.responseText}else{return true}}function getServerMessage(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){return xmlHttp.responseText}else{alert("Problem retrieving XML data");return false}}}function buildPOST(theForm){var qs="";for(e=0;e<theForm.elements.length;e++){if(theForm.elements[e].name!=""&&!theForm.elements[e].disabled){if((theForm.elements[e].type=="checkbox"&&theForm.elements[e].checked)||theForm.elements[e].type!="checkbox"){var name=theForm.elements[e].name;qs+=(qs=="")?"":"&";qs+=name+"="+escape(theForm.elements[e].value)}}}return qs}function checkNicknameAvailability(nick){var response=ajaxPerform(false,"action=checkNicknameAvailability&nickname="+nick,"/ajax_responser.php","POST");document.getElementById("nickname_msgs").innerHTML=response}function loadCombobox(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var msg=eval("("+xmlHttp.responseText+")");for(var content in msg){combo=document.getElementById(load_combo[content]);combo.length=0;for(var subcontent in msg[content]){opt=new Option(msg[content][subcontent],subcontent);combo[combo.length]=opt}}}else{alert("Problem retrieving XML data");return false}}}function loadOrderCombobox(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var msg=eval("("+xmlHttp.responseText+")");function sortName(a,b){return(a[1]<b[1])?-1:1}for(var content in msg){combo=document.getElementById(load_combo[content]);combo.length=0;var m=msg[content];var temp=[];for(var subcontent in m){temp.push([subcontent,m[subcontent]])}temp.sort(sortName);for(var i in temp){o=document.createElement("option");o.value=temp[i][0];o.text=temp[i][1];try{combo.add(o,null)}catch(e){combo.add(o)}}}}else{alert("Problem retrieving XML data");return false}}}function loadMultiCombobox(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var msg=eval("("+xmlHttp.responseText+")");for(var content in msg){combo2=document.getElementById(load_combo[content+"2"]);combo2.length=0;combo=document.getElementById(load_combo[content]);combo.length=0;for(var subcontent in msg[content]){opt=new Option(msg[content][subcontent],subcontent);opt2=new Option(msg[content][subcontent],subcontent);combo[combo.length]=opt;combo2[combo2.length]=opt2}}}else{alert("Problem retrieving XML data");return false}}}var load_combo=Array();function getStates(country,combo_state,combo_city,noloadCity,titleValue){if(!combo_state){load_combo.state="state"}else{load_combo.state=combo_state}if(!combo_city){load_combo.city="city"}else{load_combo.city=combo_city}if(typeof(combo_city)=="undefined"){combo_city=false}if(typeof(noloadCity)=="undefined"){noloadCity=false}if(typeof(titleValue)=="undefined"){titleValue=0}ajaxPerform(true,"action=getStates&country="+country+"&titleValue="+titleValue+"&noloadCity="+noloadCity,"ajax_responser.php","POST",loadOrderCombobox)}function getCities(country,state,combo_id,titleValue,noOthers){if(titleValue==undefined){titleValue="Seleccionar"}if(noOthers==undefined){noOthers=false}if(!combo_id){load_combo.city="city"}else{load_combo.city=combo_id}ajaxPerform(true,"action=getCities&country="+country+"&state="+state+"&titleValue="+titleValue+"&no_others="+noOthers,"ajax_responser.php","POST",loadOrderCombobox)}function getMultiStates(country,combo_state,combo_city,noloadCity,titleValue){load_combo.state=combo_state[0];load_combo.state2=combo_state[1];load_combo.city=combo_city[0];load_combo.city2=combo_city[1];if(typeof(combo_city)=="undefined"){combo_city=false}if(typeof(noloadCity)=="undefined"){noloadCity=false}if(typeof(titleValue)=="undefined"){titleValue=0}ajaxPerform(true,"action=getStates&country="+country+"&titleValue="+titleValue+"&noloadCity="+noloadCity,"ajax_responser.php","POST",loadMultiCombobox)}function change_city(id,value){if(value==-2){document.getElementById(id).style.display="inline"}else{document.getElementById(id).style.display="none"}}function loadVideoData(){if(xmlHttp.readyState==4){if(xmlHttp.status==200){var msg=eval("("+xmlHttp.responseText+")");for(var content in msg){if(content=="error"){alert(msg[content]);return false}str=msg[content]+"";if(document.getElementById("video_"+content)){document.getElementById("video_"+content).value=str}}showVideoAdded();return true}else{alert("Problem retrieving Video data");return false}}}function getVideoData(url){ajaxPerform(true,"action=getVideoData&v="+url,"ajax_responser.php","POST",loadVideoData);return true}function joinFanPage(id){var ajp=$(".addFanPage"+id);href1=pages_url+"/pages_index.php?fpid="+id;ajp.fadeOut("normal",function(){$(this).after('<p class="JoinedPage"><span class="newfan'+id+'" style="display: none">'+_("Te has hecho fan")+'. <a href="'+href1+'">'+_("Ir a la pagina")+" &raquo;</a></span></p>");$(".newfan"+id).fadeIn()});url="ajax_responser.php?getaction=joinPage&q="+id;$.getJSON(url,function(j){if(j=="ERROR"){ajp.fadeIn();alert(msg_retry_err)}});return false}var idxLoadPage=0;function ignoreSuggestedFanPage(id){var $ajp=$("#suggestedPage"+id);$ajp.fadeOut("normal",function(){if(newsfeedEventSponsorPages[idxLoadPage]){var obj=newsfeedEventSponsorPages[idxLoadPage];$("a.link-close",$ajp).attr("onclick","").unbind().click(function(){return ignoreSuggestedFanPage(obj.id)});$(".thumb",$ajp).attr("href",obj.link).html(obj.img);$(".note.block",$ajp).attr("href",obj.link).html(obj.name);var $objafp=$(".addFanPage"+id);if(obj.isFan){$objafp.after('<p class="JoinedPage"><span class="newfan'+obj.id+'" >'+_("Te has hecho fan")+'. <a href="'+obj.link+'">'+_("Ir a la pagina")+" &raquo;</a></span></p>");$objafp.hide()}else{$(".JoinedPage",$ajp).remove();$("a",$objafp).attr("onclick","").unbind().click(function(){return joinFanPage(obj.id)}).show();$objafp.removeClass("addFanPage"+id).addClass("addFanPage"+obj.id).show()}$ajp.attr("id","suggestedPage"+obj.id);$ajp.fadeIn(100);idxLoadPage++}else{$ajp.remove();setTimeout("if ($('.gridItem.suggestedPages').length == 0){$('.suggestedPagesItem').fadeOut('normal');}",500)}});sajax({action:"PublicPagesIgnore",data:{ignorePageId:id}});return false};