var flag=0;
var Msg_loopNum = 5;
function showMsg(){
  if (typeof(redmsg)!= 'undefined') {
    if (!redmsg || redmsg.length < 1) { return; }
    document.getElementById('mnum').innerHTML = redmsg;
  }
  else
  {
    if(Msg_loopNum > 0) {setTimeout(function(){showMsg();},100);Msg_loopNum--;}
  }
}
function g(){var ls=location.search;if(ls.indexOf("q=")!=-1){try{var q=(ls.match(new RegExp("q=[^&$]*")).toString());document.f1.word.value=decodeURIComponent(q.substr(2));}catch(e){}}}
function s(o,p){if(document.f1.word.value.length>0){var oh=o.href;var wd=encodeURIComponent(document.f1.word.value);if(oh.indexOf("q=")!=-1){o.href=oh.replace(new RegExp("q=[^&$]*"),"q="+wd);}else{var s=p?"&":"?";o.href=o.href+s+"q="+wd};}}
function formatPic(jsonPic){ 
  for (var name in jsonPic) {
    var maxWidth=jsonPic[name][0];
    var maxHeight=jsonPic[name][1];
    var image=document.getElementsByName(name);
    for(var i=0;i<image.length;i++)
    {
        if(image[i].width>0 && image[i].height>0){ 
        var rate = (maxWidth/image[i].width < maxHeight/image[i].height)?maxWidth/image[i].width:maxHeight/image[i].height;
        if(rate <= 1){      
          image[i].width = image[i].width*rate;
        }
        } 
    }
  }
}
var sid=((new Date()).getTime()+"_"+Math.round(Math.random()*2147483637));
function sendPfScrollStat() { if(document.images){(new Image()).src='/js/blank.js?func=pfscroll&sid='+sid+'&t='+(new Date()).getTime();} }


function G(id){ return document.getElementById(id); }
function switchPhb(n){
	G("t1").className=(1==n)?"on":"";
	G("phbCon1").style.display=(1==n)?"":"none";
	G("t2").className=(2==n)?"on":"";
	G("phbCon2").style.display=(2==n)?"":"none";
  G("listtitle").href=G("morelist").href=(1==n)?"/star/contribution/grow.html?func=congrow":"/star/contribution/highquality_grow.html?func=conhqgrow";
}
function cutText(jsonText) {
  for (var name in jsonText) {
    var length=jsonText[name];
    var elems=document.getElementsByName(name);
    for (var i=0; i<elems.length; i++) {
      var text=elems[i].innerHTML;
      if (text.length>length) { elems[i].innerHTML=text.substr(0,length)+"бн" }
    }
  }
}