function rotate(id)
{
  current[id.substring(1)]=Math.floor(Math.random()*solutions.length);
  for(var x=9;x>=0;x-- )
  {
    setTimeout('document.getElementById("'+id+'").style.opacity="'+(x/10)+'";document.getElementById("'+id+'").style.filter="alpha(opacity='+(x*10)+')";',1000-((x+1)*100));
  }
  setTimeout('rotate2("'+id+'")',1000);
}

function rotate2(div_id)
{
  document.getElementById(div_id).innerHTML='<div style="display: table; height: 100%;  #position: relative; overflow: hidden;"><div style="#position: absolute;  _top: 50%;display: table-cell; vertical-align: middle;"><div style=" #position: relative;  #top: -50%;text-align:center;">'+solutions[current[div_id.substring(1)]][0]+'</div></div></div>';
  //document.getElementById(div_id).onclick='return clickCloud('+div_id.substring(1)+');';
  for(var x=1;x<=10;x++)
  {
    setTimeout('document.getElementById("'+div_id+'").style.opacity="'+(x/10)+'";document.getElementById("'+div_id+'").style.filter="alpha(opacity='+(x*10)+')";',x*100);
  }
  setTimeout('rotate("'+div_id+'")',Math.floor(Math.random()*4+4)*1000);
}

function clickCloud(n)
{
  showArticle(solutions[current[n]][1]);
  return false;
}

function showArticle(a)
{
  for(var x=0;x<articles;x++)
  {
    document.getElementById('a'+x).style.display=(x==a)?'inline':'none';
  }
}

function getCSSRule(ruleName)
{
  ruleName=ruleName.toLowerCase();
  if(document.styleSheets)
  {
    for(var i=0; i<document.styleSheets.length; i++)
	{
      var styleSheet=document.styleSheets[i];
      var ii=0;
      var cssRule=false;
      do
	  {
        if(styleSheet.cssRules)
		{
          cssRule = styleSheet.cssRules[ii];
        }else{
          cssRule = styleSheet.rules[ii];
        }
        if(cssRule)
        {
          if(cssRule.selectorText.toLowerCase()==ruleName)
	      {
            return cssRule;
          }
        }
        ii++;
      }while(cssRule)
    }
  }
  return false;
}
function lookup()
{
alert(current[0]);
alert(current[1]);
alert(current[2]);
alert(current[3]);
alert(current[4]);
}
