
window.onunload=function(){$('embed').each(function(){if($(this).parent().is('object'))
$(this).parent().remove();else
$(this).remove();});}
function registerExpandEvent(){$(document).keydown(function(event){if($(event.target).hasClass('expand'))
adjustTextAreaLength(event.target);});}
String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,'');};if(!Array.indexOf){Array.prototype.indexOf=function(obj,start){for(var i=(start||0);i<this.length;i++){if(this[i]==obj){return i;}}}}
jQuery.fn.elementlocation=function(){return({x:this.offset().left,y:this.offset().top});};var fadeMessageTimer=null;var menuSpeed=250;var currentSubMenu=null;function showMainSubMenus(element){currentSubMenu=$(element).attr('id');$('.mainSubMenu').each(function(){if($(this).attr('parentID')!=currentSubMenu){$(this).slideUp();$(this).attr('status',0);var slideUpParent=$(this).attr('parentID');$('#'+slideUpParent).find('div:first').css('background-color','#BD0000');$('#'+slideUpParent).find('a:first').css('color','white');}});setTimeout("$('#' + currentSubMenu +'Contents').slideDown(menuSpeed)",menuSpeed*1.2);setTimeout("$('#' + currentSubMenu +'Contents').attr('status','1')",menuSpeed*1.2);if(GRAY_DAY==1){setTimeout("$('#' + currentSubMenu +'Contents img').each(function() {Pixastic.process(this, 'desaturate', {average : false});});",menuSpeed*1.2);}}
function hideMainSubMenus(element){}
function resetFeedMenu(){$('.feedTabs div').attr('selected','0');$('.feedTabs div').css('border-bottom','0px');if(GRAY_DAY!=1)
$('.feedTabs div').css('color','#3485d7');$('.feedTabs div').removeClass('fontWeight');}
function selectElement(elem){if(GRAY_DAY!=1)
$(elem).css('color','#ff0000');$(elem).addClass('fontWeight');$(elem).css('border-bottom','1px solid white');$(elem).attr('selected','1');}
function registerConfirmation(){$('.deleteItem').click(function(event){if($(this).attr('tagName')=='A')
location.href=$(this).attr('href');else if($(this).attr('formSubmitButton')=='1'){var result=eval($(this).attr('fireEvent'));return result;}
else
eval($(this).attr('fireEvent'));}).confirm({timeout:10000});}
$(document).ready(function(){registerConfirmation();$('.mainSubMenu').css('opacity','0.95');$('.newMenu').click(function(event){window.location.href=$(this).find(':first-child').attr('href');});$('.formSubmitButton').click(function(event){if($(this).parents('form:first').valid()){if($(this).attr('manualValidation')){var result=eval($(this).attr('manualValidation'));if(result==false)
return false;}
var waitingMessage='<span><img src="'+$('#ROOT').val()+'views/images/loading2.gif" align="absmiddle">&nbsp;请求正在处理，请稍候</span>';$(this).hide();$(this).next().hide();$(this).after(waitingMessage);}});$('.feedTabs div').mouseover(function(){$(this).addClass('fontWeight');});$('.feedTabs div').mouseout(function(){if($(this).attr('selected')!='0')
return;$(this).removeClass('fontWeight');});if(GRAY_DAY!=1)
$('.feedTabs div:first').css('color','#ff0000');$('.feedTabs div:first').addClass('fontWeight');$('.feedTabs div:first').css('border-bottom','1px solid white');$('.feedTabs div').attr('selected','0');$('.feedTabs div:first').attr('selected','1');$(".dateTime").prettyDate();setInterval(function(){$(".dateTime").prettyDate();},5000);var pageNumber=getParameterByName('pageNumber');if(pageNumber!=""){$('#pageLink'+pageNumber).css('color','#fff');$('#pageLink'+pageNumber).css('background-color','#f00000');}
else{$('#pageLink1').css('color','#fff');$('#pageLink1').css('background-color','#f00000');}
$('.menuLeft div').hover(function(){$(this).addClass("lightRedBG");},function(){$(this).removeClass("lightRedBG");});$('.menuLeft div').click(function(){if($(this).find('a').length>0){window.location.href=$(this).find('a').attr('href');}
return false;});var config={sensitivity:3,interval:200,over:showMainSubMenus,timeout:500,out:hideMainSubMenus};$(".hasMainSubMenu").hover(function(){showMainSubMenus($(this));},function(){hideMainSubMenus($(this));});$('div[id!="gameMenuContents"],div[id!="appMenuContents"]').click(function(event){if($(this).attr('id')=='gameMenu'||$(this).attr('id')=='apppMenu'){event.stopPropagation();return;}
$('.mainSubMenu').slideUp(menuSpeed);$('.mainSubMenu').attr('status','0');$('.hasMainSubMenu').find('div:first').css('background-color','#BD0000');$('.hasMainSubMenu').find('a:first').css('color','white');});$('.grayButtonMenuItem').hover(function(){$(this).removeClass('grayButton');$(this).addClass('redButton');},function(){$(this).removeClass('redButton');$(this).addClass('grayButton');});$(".clickClear").focus(function(){if($(this).val()==$(this).attr('message'))
$(this).val('');});$(".clickClear").blur(function(){if($(this).val()==''){$(this).val($(this).attr('message'));}});fadeMessageOut();$('.values').each(function(){if(this.value.trim()!=""){var index=this.value.indexOf(" ");var id;var value;if(index>0){id=this.value.substr(0,index);if(index<this.value.length){value=this.value.substr(index+1);if(value=="")
return;if($('#'+id).is(":checkbox"))
$('#'+id).attr('checked',value.trim().toLowerCase()!="false"&&value.trim()!="0");else if($('#'+id).is(":radio")||$('.'+id).is(":radio")){$('input:radio').each(function(){if(this.id==id&&this.value==value){this.checked="checked";}});}
else if($('#'+id).is(":input"))
$('#'+id).val(value);}}}});$("body").ajaxComplete(function(event,request,settings){if(request.responseText.indexOf('indexPageLoginMessage')!=-1){window.location=location.protocol+"//"+window.location.host+"/index.php?target="+urlencode(window.location.href);}
$(".dateTime").prettyDate();});$(".itemList").hover(function(){$(this).addClass('grayBG');},function(){$(this).removeClass('grayBG');});$('#updateMicroBlog').click(function(){var ROOT='./';if($('#ROOT'))
ROOT=$('#ROOT').val();if($('#microBlogText').attr("message")==$('#microBlogText').val()){$('#emptyMicroBlogMessage').show();if(GRAY_DAY==1){$('.userMessageTop img').each(function(){Pixastic.process(this,'desaturate',{average:false});});}
return;}
if($('#microBlogText').val().length>$('#microblogMaxLimit').val()){$('#microBlogLimit').show();if(GRAY_DAY==1){$('.userMessageTop img').each(function(){Pixastic.process(this,'desaturate',{average:false});});}
return;}
$('#emptyMicroBlogMessage').remove();$('#updateMicroBlog').hide();$('#updateMicroBlogWaitingMessage').show();$.post(ROOT+"ajaxlib/home.ajax.php",{"microBlogText":$('#microBlogText').val()},function(data){if(data.trim()=='filterFail'){$('#microBlogMsgSuccess').hide();$('#emptyMicroBlogMessage').hide();var filterFailStr;if($('#filterFailTopMicroblog').is('#filterFailTopMicroblog')){filterFailStr='#filterFailTopMicroblog';}else{filterFailStr='#filterFail';}
$(filterFailStr).show();setTimeout(function(){$(filterFailStr).slideUp("slow");},3000);}else if(data.trim()!="false"){$('#status').click();$('#newsFeedContainer').prepend($(data).html());var postedData=$(this).attr('data');var ids=postedData.split('&');var microBlog=urlDecode(decodeURI(ids[0].split("=")[1]).replace(/[\n]+/g,"<br/>"));$('#microBlogMsgDeleted').hide();$('#microBlogMsgSuccess').show();if(microBlog.length>33){microBlog=microBlog.substring(0,30);microBlog=microBlog+"...";}
var microBlogIDIndex=data.indexOf("<div class='microBlogFeed");var microBlogID="";for(i=microBlogIDIndex+25;i<data.length;i++){if(data.charAt(i)==' ')
break;microBlogID+=data.charAt(i);}
if($('#maxLimitMessage').length!=0){if(typeof(microblogMaxLimit)!='undefined'){$('#maxLimitMessage').html(microblogMaxLimit);}else{$('#maxLimitMessage').html('210');}}
microBlog=microBlog+"&nbsp;&nbsp;<span  class='pointer orange deleteItem' fireEvent=\"removeMicroBlog("+microBlogID+",'header')\">删除</span>";$('#currentMicroBlog').html(microBlog);$('#microBlogUpdateTime').html('刚刚');registerConfirmation();$('#currentMicroBlog').show();$('#microBlogUpdateTime').parent().css('visibility','visible');setTimeout(function(){$('#microBlogMsgSuccess').slideUp("slow");},10000);$('#microBlogText').val("");$('#microBlogText').blur();if(GRAY_DAY==1){$('.microBlogFeed'+microBlogID+" img").each(function(){Pixastic.process(this,'desaturate',{average:false});});$('#microBlogMsgSuccess img').each(function(){Pixastic.process(this,'desaturate',{average:false});});}}
else{$(this).next().remove();$(this).show();}
if(GRAY_DAY==1){$('.userMessageTop img').each(function(){Pixastic.process(this,'desaturate',{average:false});});}
$('#updateMicroBlogWaitingMessage').hide();$('#updateMicroBlog').show();});});$(".showTos").click(function(){var popupHeight=500;var popupWidth=445;var left=document.documentElement.clientWidth/2-popupWidth/2;var top=document.documentElement.clientHeight/2-popupHeight/2;window.open($('#ROOT').val()+'tos.html','_blank','scrollbars=yes, resizable=no,height='+popupHeight+',width='+popupWidth+',left='+left+',top='+top);});$(".showPrivacyStatement").click(function(){var popupHeight=500;var popupWidth=445;var left=document.documentElement.clientWidth/2-popupWidth/2;var top=document.documentElement.clientHeight/2-popupHeight/2;window.open($('#ROOT').val()+'privacystatement.html','_blank','scrollbars=yes, resizable=no,height='+popupHeight+',width='+popupWidth+',left='+left+',top='+top);});});function fadeMessageOut(){fadeMessageTimer=setTimeout(function(){$('.fadeMessage').slideUp("slow");},10000);}
var selectCounter=0;$(document).ready(function(){if(typeof(menuDiv)!="undefined"){$('#'+menuDiv).css('background-color','#bd0000');$('#'+menuDiv).find('a').css('color','white');$('#'+menuDiv).find('a').addClass('fontWeight');}
$('.topSubMenuDiv').mouseover(function(){$(this).css('background-color','#FBEFEF');});$('.topSubMenuDiv').mouseout(function(){if(typeof(menuDiv)=="undefined"||$(this).children(':first-child').attr('id')!=menuDiv)
$(this).css('background-color','#FFFFCC');});$('#email').focus();$('.roundTop').corner("top");$('.roundBottom').corner("bottom");});function changeCode(){var img=document.getElementById("captcha");img.src="appglobals/captcha.php?t="+new Date().getTime();return;}
String.prototype.ReplaceAll=function(stringToFind,stringToReplace){var temp=this;var index=temp.indexOf(stringToFind);while(index!=-1){temp=temp.replace(stringToFind,stringToReplace);index=temp.indexOf(stringToFind);}
return temp;}
if(!Array.indexOf){Array.prototype.indexOf=function(obj){for(var i=0;i<this.length;i++){if(this[i]==obj){return i;}}
return-1;}}
function removeMicroBlog(id,element){var ROOT=$('#ROOT').val();var isHeader='0';if(element=='header')
isHeader='1';else{$(element).parent().html('<img src="'+ROOT+'views/images/loading2.gif">&nbsp;请求正在处理，请稍候');}
$.ajax({type:"POST",url:ROOT+"ajaxlib/home.ajax.php",data:{'removeMicroBlogID':id,'isHeader':isHeader},success:function(data){if(data>-1){var postedData=$(this).attr('data');var ids=postedData.split('&');var isHeader=(ids[1].split("=")[1]);if(isHeader=='1'){$('#currentMicroBlog').hide();$('#microBlogUpdateTime').parent().css('visibility','hidden');$('#microBlogMsgSuccess').hide();$('#microBlogMsgDeleted').show();setTimeout(function(){$('#microBlogMsgDeleted').slideUp("slow");},10000);}else{$('.microBlogFeed'+data).slideUp('slow');$('#microBlog'+data).hide('slow');}}}});}
function urlDecode(url){var o=url;var binVal,t,b;var r=/(%[^%]{2}|\+)/;while((m=r.exec(o))!=null&&m.length>1&&m[1]!=''){if(m[1]=='+'){t=' ';}else{b=parseInt(m[1].substr(1),16);t=String.fromCharCode(b);}
o=o.replace(m[1],t);}
return o;}
function urlencode(str){return escape(str).replace(/\+/g,'%2B').replace(/%20/g,'+').replace(/\*/g,'%2A').replace(/\//g,'%2F').replace(/@/g,'%40');}
function getParameterByName(name)
{name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);if(results==null)
return"";else
return results[1];}
function removeWallMessage(wallMessageID,element){var html="<img src='views/images/loading2.gif'/><span class='orangeColor'>正在删除</span>";$(element).after(html);$(element).css('display','none');$.ajax({type:"POST",url:'ajaxlib/profile.ajax.php',dataType:"html",data:{'funcCall':'removeWallMessage','wallMessageID':wallMessageID},success:function(response){if(response>0){$('.wallMessageFeed[wallMessageID="'+response+'"]').hide();$('#wallMessages').find('.wallMessageFeed[wallMessageID="'+response+'"]').hide();$('#latestActivitesDiv').find('.wallMessageFeed[wallMessageID="'+response+'"]').hide();$('#activeContent').find('.wallMessageFeed[wallMessageID="'+response+'"]').hide();$('#wallMessageDeleteSuccess').slideDown('slow');fadeMessageOut();}}});}
function downImage(imgD,maxWidth,maxHeight,zoom){var image=new Image();image.onload=function(){if(image.width>0&&image.height>0){var rate=(maxWidth/image.width<maxHeight/image.height)?maxWidth/image.width:maxHeight/image.height;var wid=0;var hid=0;if(rate<=1||zoom)
{wid=imgD.width=image.width*rate;hid=imgD.height=image.height*rate;}
else
{wid=imgD.width=image.width;hid=imgD.height=image.height;}
var ii=(maxWidth-wid)/2;imgD.style.marginLeft=imgD.style.marginRight=ii+"px";var ii=(maxHeight-hid)/2;imgD.style.marginTop=imgD.style.marginBottom=ii+"px";}}
image.src=imgD.src;}
function getValue(str){var nResult=0;switch(str){case"scrollTop":if(typeof(window.pageYOffset)!='undefined'){nResult=window.pageYOffset}else if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollTop}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollTop}
break;case"clientWidth":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.clientWidth}else if(typeof(document.body)!='undefined'){nResult=document.body.clientWidth}
break;case"clientHeight":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.clientHeight}else if(typeof(document.body)!='undefined'){nResult=document.body.clientHeight}
break;case"scrollWidth":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollWidth}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollWidth}
break;case"scrollHeight":if(typeof(document.compatMode)!='undefined'&&document.compatMode!='BackCompat'){nResult=document.documentElement.scrollHeight}else if(typeof(document.body)!='undefined'){nResult=document.body.scrollHeight}
break;default:break}
return nResult};function setBackgroundSize(selectStr){$(selectStr).hide(1,function(){var getValueWidth;var getMaxValueWidth=[getValue("clientWidth")-2,getValue("scrollWidth")-2];getValueWidth=eval("Math.max("+getMaxValueWidth.toString()+")");var getValueHeight;var getMaxValueHeight=[getValue("clientHeight"),getValue("scrollHeight")];getValueHeight=eval("Math.max("+getMaxValueHeight.toString()+")");$(selectStr).show();$(selectStr).css({"height":getValueHeight,"width":getValueWidth});});}
function setPopPosition(selectStr){var windowWidth=getValue('clientWidth');var windowHeight=getValue('clientHeight');var popupHeight=$(selectStr).height();var popupWidth=$(selectStr).width();$(selectStr).css({"position":"absolute","top":windowHeight/2-popupHeight/2+getValue('scrollTop'),"left":windowWidth/2-popupWidth/2});}
