var type=0;
var numBubbles=0;
var to=0;

function MS ()
{
   if (document.layers) { return (0); }
   else                 { return (1); }
}

function moveLayers(anz, timeout, sherlocksub)
{
	NS4 = (document.layers) ? 1 : 0;
	IE4 = (document.all) ? 1 : 0;

   gAnz=anz;
	gCount=1;

	if (NS4)
	{
		screenWidth = 0;
		screenHeight = window.innerHeight;

      if (type==0)
      {
         bubble_x=230;
         bubble_y=292-sherlocksub;
      }
      else
      {
         bubble_x=68;
         bubble_y=115-sherlocksub;
      }

      if (numBubbles>=1)
      {
		   document.layers['bubble1'].left = bubble_x;
		   document.layers['bubble1'].top = screenHeight-bubble_y;
		   document.layers['bubble1'].visibility = true;
      }
      if (numBubbles>=2)
      {
		   document.layers['bubble2'].left = bubble_x;
		   document.layers['bubble2'].top = screenHeight-bubble_y;
      }
      if (numBubbles>=3)
      {
  	  	   document.layers['bubble3'].left = bubble_x;
		   document.layers['bubble3'].top = screenHeight-bubble_y;
      }

      if (type==0)
      {
		   document.layers['man'].left = 102;
		   document.layers['man'].top = screenHeight-310;
		   document.layers['man'].visibility = true;
		   document.layers['man2'].left = 0;
		   document.layers['man2'].top = screenHeight-310+178;
		   document.layers['man2'].visibility = true;
      }
      else
      {
		   document.layers['man'].left = 0;
		   document.layers['man'].top = screenHeight-155;
		   document.layers['man'].visibility = true;
      }
	}
	else
	{
		screenWidth = 0;
		screenHeight = document.body.clientHeight;

      if (type==0)
      {
         bubble_x=230;
         bubble_y=292+20-sherlocksub;
      }
      else
      {
         bubble_x=68;
         bubble_y=115+20-sherlocksub;
      }

      if (numBubbles>=1)
      {
			document.all['bubble1'].style.pixelLeft = bubble_x;
			document.all['bubble1'].style.pixelTop = screenHeight-bubble_y;
			document.all['bubble1'].style.visibility = "visible";
      }
      if (numBubbles>=2)
      {
			document.all['bubble2'].style.pixelLeft = bubble_x;
			document.all['bubble2'].style.pixelTop = screenHeight-bubble_y;
      }
      if (numBubbles>=3)
      {
			document.all['bubble3'].style.pixelLeft = bubble_x;
			document.all['bubble3'].style.pixelTop = screenHeight-bubble_y;
      }

      if (type==0)
      {
		   document.all['man'].style.pixelLeft = 102;
		   document.all['man'].style.pixelTop = screenHeight-310-10;
		   document.all['man'].style.visibility = "visible";
		   document.all['man2'].style.pixelLeft = 0;
		   document.all['man2'].style.pixelTop = screenHeight-310-10+178;
		   document.all['man2'].style.visibility = "visible";
      }
      else
      {
		   document.all['man'].style.pixelLeft = 0;
		   document.all['man'].style.pixelTop = screenHeight-155;
		   document.all['man'].style.visibility = "visible";
      }
	}

	to = window.setTimeout("myTimeout()",timeout);
}

function myTimeout()
{
    gCount++;

    if (to) window.clearTimeout(to);
    to=0;

    if (gCount==2 && gCount<=numBubbles)
    {
		if (NS4)
		{
			document.layers['bubble1'].visibility = false;
			document.layers['bubble2'].visibility = true;
		}
		else
		{
			document.all['bubble1'].style.visibility = "hidden";
			document.all['bubble2'].style.visibility = "visible";
		}
    }
    if (gCount==3 && gCount<=numBubbles)
    {
		if (NS4)
		{
			document.layers['bubble2'].visibility = false;
			document.layers['bubble3'].visibility = true;
		}
		else
		{
			document.all['bubble2'].style.visibility = "hidden";
			document.all['bubble3'].style.visibility = "visible";
		}
    }

	if (gCount<=numBubbles)
	{
		to = window.setTimeout("myTimeout()",8000);
	}
	else
	{
		if (gCount<1000)
		{
			if (NS4)
			{
				if (numBubbles>=1) { document.layers['bubble1'].visibility = false; }
				if (numBubbles>=2) { document.layers['bubble2'].visibility = false; }
				if (numBubbles>=3) { document.layers['bubble3'].visibility = false; }
			}
			else
			{
				if (numBubbles>=1) { document.all['bubble1'].style.visibility = "hidden"; }
				if (numBubbles>=2) { document.all['bubble2'].style.visibility = "hidden"; }
				if (numBubbles>=3) { document.all['bubble3'].style.visibility = "hidden"; }
			}

			gCount=1000;
			to = window.setTimeout("myTimeout()",6000);
		}
	}

	if (gCount>=1000 && gCount<1300)
	{
      screenWidth -= 15;

      if (type==0)
      {
		   if (NS4)
		   {
			   document.layers['man'].left = screenWidth+102;
			   document.layers['man2'].left = screenWidth;
		   }
		   else
		   {
			   document.all['man'].style.pixelLeft = screenWidth+102;
			   document.all['man2'].style.pixelLeft = screenWidth;
		   }
      }
      else
      {
		   if (NS4) { document.layers['man'].left = screenWidth+2;}
		   else	   { document.all['man'].style.pixelLeft = screenWidth+2; }
      }

      window.setTimeout("myTimeout()",30);
	}
}

function hideDummy()
{
	if (NS4)
	{
		document.t.tt.visibility = false;
	}
	else
	{
		document.t.tt.style.visibility = "hidden";
   }
}

function hideAll()
{
	if (NS4)
	{
		if (numBubbles>=1) { document.layers['bubble1'].visibility = false; }
		if (numBubbles>=2) { document.layers['bubble2'].visibility = false; }
		if (numBubbles>=3) { document.layers['bubble3'].visibility = false; }
	}
	else
	{
      document.all['man'].focus();

		if (numBubbles>=1) { document.all['bubble1'].style.visibility = "hidden"; }
		if (numBubbles>=2) { document.all['bubble2'].style.visibility = "hidden"; }
		if (numBubbles>=3) { document.all['bubble3'].style.visibility = "hidden"; }
	}

	if (gCount<1000)
	{
    	gCount=1000;
	}

	window.setTimeout("myTimeout()",100);
}

function Bubble(name, text)
{
   numBubbles++;

   if (type==0) { bubble="blase_"; sline='3'; lline='26'; }
   if (type!=0) { bubble="tiny_";  sline='2'; lline='8'; }

   document.open();

	if (MS()) { document.write('<DIV ID="'+name+'" STYLE="POSITION: absolute; Z-INDEX: 30; VISIBILITY: hidden; TOP: 0px; LEFT: 0px; WIDTH: 400px">'); }
	else      { document.write("<LAYER ID='"+name+"' top=0 left=0 width=400 visibility=hide z-index=30>"); }

   document.write('<table width=400><tr><td align=left>');
   document.write('<table cellpadding=0 cellspacing=0 border=0>');
   document.write('   <tr>');
   document.write('     <td colspan=1 rowspan=2><img src="/crime/pics/'+bubble+'ro2.gif"></td>');
   document.write('     <td colspan=2 rowspan=2><img src="/crime/pics/'+bubble+'ro.gif"></td>');
   document.write('     <td bgcolor="#000080" height='+sline+'><img src="/crime/pics/trans.gif" width='+sline+' height='+sline+'></td>');
   document.write('     <td colspan=2 rowspan=2><img src="/crime/pics/'+bubble+'lo.gif"></td>');
   document.write('   </tr>');

   document.write('   <tr>');
   document.write('     <td bgcolor="#ffffff" height='+lline+'><img src="/crime/pics/trans.gif" width=2 height='+lline+'></td>');
   document.write('   </tr>');

   document.write('   <tr>');
   document.write('     <td></td>');
   document.write('     <td bgcolor="#000080" width='+sline+'><img src="/crime/pics/trans.gif" width='+sline+' height='+sline+'></td>');
   document.write('     <td bgcolor="#ffffff" width='+lline+'><img src="/crime/pics/trans.gif" width='+lline+' height='+sline+'></td>');
   document.write('<td bgcolor="#ffffff"><b>');

   if (type!=0) document.write('<font color="#000000" size=-1>');
   document.write(text);
   if (type!=0) document.write('</font>');

   document.write('</b></td>');
   document.write('     <td bgcolor="#ffffff" width='+lline+'><img src="/crime/pics/trans.gif" width='+lline+' height='+sline+'></td>');
   document.write('     <td bgcolor="#000080" width='+sline+'><img src="/crime/pics/trans.gif" width='+sline+' height='+sline+'></td>');
   document.write('   </tr>');

   document.write('   <tr>');
   document.write('     <td></td>');
   document.write('     <td colspan=2 rowspan=2><img src="/crime/pics/'+bubble+'ru.gif"></td>');
   document.write('     <td bgcolor="#ffffff" height='+lline+'><img src="/crime/pics/trans.gif" width=2 height='+lline+'></td>');
   document.write('     <td colspan=2 rowspan=2><img src="/crime/pics/'+bubble+'lu.gif"></td>');
   document.write('   </tr>');

   document.write('   <tr>');
   document.write('     <td></td>');
   document.write('     <td bgcolor="#000080" height='+sline+'><img src="/crime/pics/trans.gif" width='+sline+' height='+sline+'></td>');
   document.write('   </tr>');
   document.write('</table>');
   document.write('</td></tr></table>');

   if (MS()) { document.write('</DIV>'); }
   else      { document.write("</LAYER>"); }

   document.close;
}

function Copilot (newtype)
{
   type = newtype;

   document.open();

   if (type==0)
   {
		if (MS()) { document.write('<DIV ID="man" STYLE="POSITION: absolute; Z-INDEX: 20; VISIBILITY: hidden; TOP: 0px; LEFT: 0px; WIDTH: 300px">'); }
		else      { document.write("<LAYER ID='man' top=0 left=0 width=300 visibility=hide z-index=20>"); }
       
      document.write('<A HREF="javascript:hideAll();"><img src="/crime/pics/sherlock1.gif" id=pic2 border=0></A>');
      
      if (MS()) { document.write('</DIV>'); }
      else      { document.write("</LAYER>"); }
      
		if (MS()) { document.write('<DIV ID="man2" STYLE="POSITION: absolute; Z-INDEX: 20; VISIBILITY: hidden; TOP: 0px; LEFT: 0px; WIDTH: 300px">'); }
		else      { document.write("<LAYER ID='man2' top=0 left=0 width=300 visibility=hide z-index=20>"); }
       
      document.write('<A HREF="javascript:hideAll();"><img src="/crime/pics/sherlock2.gif" id=pic1 border=0></A>');
   }
   else
   {
		if (MS()) { document.write('<DIV ID="man" STYLE="POSITION: absolute; Z-INDEX: 40; VISIBILITY: hidden; TOP: 0px; LEFT: 0px; WIDTH: 80px">'); }
		else      { document.write("<LAYER ID='man' top=0 left=0 width=300 visibility=hide z-index=20>"); }
       
      document.write('<A HREF="javascript:hideAll();"><img src="/crime/pics/sherlock'+type+'.gif" id=pic1 border=0 width=79 height=153></A>');
   }
      
   if (MS()) { document.write('</DIV>'); }
   else      { document.write("</LAYER>"); }

   document.close;
}
