function PresentDelete(number,st)
{
    if (confirm(st)) { document.present_delete.num.value = number;
    						       document.present_delete.submit(); }
}

function GetBlockTitle(name)
{
	var s = "";

	s += "<TABLE cellpadding='0' cellspacing='0' align='center'><TR>";
	s += "<TD><img src='/images/buttons/tab_l.gif' width='30' height='15'></TD>";
	s += "<TD class='cell_title'><small><b>&nbsp;" + name + "&nbsp;</b></small></TD>";
	s += "<TD><img src='/images/buttons/tab_r.gif' width='30' height='15'></TD>";
	s += "</TR></TABLE>";

	return s;
}

function GetBlockTop(width)
{
	var s = "";

	s += "<TABLE width='" + width + "' cellpadding='0' cellspacing='0'>";
	s += "<TR height='15'>";
	s += "<TD><img src='/images/buttons/point_c0_b.gif' width='12' height='15'></TD>";
	s += "<TD background='/images/buttons/line_t.gif' align='center'>";

	return s;
}

function GetBlockMiddle()
{
	var s = "";

	s += "</TD>";
	s += "<TD><img src='/images/buttons/point_c1_b.gif' width='12' height='15'></TD>";
	s += "</TR>";

	s += "<TR height='12'>";
	s += "<TD background='/images/buttons/line_l.gif' width='12'></TD>";
	s += "<TD class='cell_scroll'>";

	return s;
}

function GetBlockBottom()
{
	var s = "";

	s += "</TD>";
	s += "<TD background='/images/buttons/line_r.gif' width=12></TD>";
	s += "</TR>";

	s += "<TR height=12>";
	s += "<TD><img src='/images/buttons/point_c2.gif' width=12 height=12></TD>";
	s += "<TD background='/images/buttons/line_b.gif'></TD>";
	s += "<TD><img src='/images/buttons/point_c3.gif' width=12 height=12></TD>";
	s += "</TR>";
	s += "</TABLE>";

	return s;
}

function ShowBlockTitle(name)
{
	document.write(GetBlockTitle(name));
}

function ShowBlockTop(width)
{
	document.write(GetBlockTop(width));
}

function ShowBlockMiddle()
{
	document.write(GetBlockMiddle());
}

function ShowBlockBottom()
{
	document.write(GetBlockBottom());
}

function ShowClanBonus(stat_img, clan_bonus_name, bonus)
{
	document.write("<TR><TD class='cell' width='470'><img ALIGN='ABSMIDDLE' width='20' height='20' src='/images/miscellaneous/"+stat_img+"' alt='"+clan_bonus_name+"' title='"+clan_bonus_name+"'>&nbsp;"+clan_bonus_name+" +"+bonus+"</TD></TR>");
}


function ShowEffect(image,w,h,tip,fc)
{
  fc = fc || '';

	var w1 = w + 4;
	var h1 = h + 4;

	s = "<table cellspacing=0 cellpadding=0 border=0 width="+w1+" height="+h1+">";
	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c0.gif width=2 height=2></td>";
	
	s += "<td height=2 background=/images/borders/b0t.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c1.gif width=2 height=2></td>";

	s += "</tr>";
	s += "<tr>";

	s += "<td width=2 background=/images/borders/b0l.gif bgcolor=342E29></td>";
	
	s += "<td align=center valign=middle bgcolor=656565 width="+w+" height="+h+">";
	s += "<img src=/images/medals/"+image+" alt='"+tip+"' title='"+tip+"' ";
  if( fc != '' )
  { // Это травма из какого-то боя
    s += "class='cp' onclick=\"window.open('show_combat_details.php?num="+fc+"', '_blank', 'scrollbars=yes,width=730,height=610,resizable=yes');\"";
  }
  s += ">";
	//s += "<img src=/images/medals/"+image+" width="+w+" height="+h+" alt=\""+tip+"\" title=\""+tip+"\">";
	s += "</td>";
	s += "<td width=2 background=/images/borders/b0r.gif bgcolor=342E29></td>";

	s += "</tr>";

	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c2.gif width=2 height=2></td>";

	s += "<td height=2 background=/images/borders/b0b.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c3.gif width=2 height=2></td>";
		
	s += "</tr>";
	s += "</table>";
  
	document.write(s);
}

function ShowPresent(image,w,h,own,tip,num,id)
{
	var w1 = w + 4;
	var h1 = h + 4;

	s = "<table cellspacing=0 cellpadding=0 border=0 width="+w1+" height="+h1+">";
	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c0.gif width=2 height=2></td>";
	
	s += "<td height=2 background=/images/borders/b0t.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c1.gif width=2 height=2></td>";

	s += "</tr>";
	s += "<tr>";

	s += "<td width=2 background=/images/borders/b0l.gif bgcolor=342E29></td>";
	
	s += "<td align=center valign=middle bgcolor=656565 width="+w+" height="+h+">";
	s += "<div style='position:relative;'><img src=/images/presents/"+image+" width="+w+" height="+h+"  alt=\""+tip+"\" title=\""+tip+"\"";

  if ((id>11000 && id<12000) || id>100000)
  {
    s += " class='cp' onClick=\"JavaScript:window.open('present_desc.php?id="+num+"','_blank','scrollbars=yes,width=580,height=495,resizable=yes')\"";
  }
  if (own == 1)
  {
    s += " onmouseover=\"ImgIn("+num+");\" onmouseout=\"ImgOut("+num+");\"";
  }
  s += ">";

	if(own == 1)
	{
    s += "<img title='Выкинуть' class='cp' style='position:absolute; left:0px; top:0px' src='/images/empty.gif' id='imgDel"+num+"' width='15px' height='15px' onmouseover=\"this.src='/images/drop_icon.gif'\" onmouseout=\"this.src='/images/empty.gif'\" onclick=\"javascript:PresentDelete("+num+",'Вы действительно хотите выбросить подарок?')\"></div>";
	}

	s += "</td>";
	s += "<td width=2 background=/images/borders/b0r.gif bgcolor=342E29></td>";

	s += "</tr>";

	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c2.gif width=2 height=2></td>";

	s += "<td height=2 background=/images/borders/b0b.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c3.gif width=2 height=2></td>";
		
	s += "</tr>";
	s += "</table>";
  
	document.write(s);
}

function ShowRank(image,w,h,tip,rid)
{
	var w1 = w + 4;
	var h1 = h + 4;

	s = "<table cellspacing=0 cellpadding=0 border=0 width="+w1+" height="+h1+">";
	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c0.gif width=2 height=2></td>";
	
	s += "<td height=2 background=/images/borders/b0t.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c1.gif width=2 height=2></td>";

	s += "</tr>";
	s += "<tr>";

	s += "<td width=2 background=/images/borders/b0l.gif bgcolor=342E29></td>";
	
	s += "<td align=center valign=top bgcolor=656565 width="+w+" height="+h+">";
	s += "<div style='position:relative;'>";
	s +="<img src=/images/medals/"+image+" title=\""+tip+"\"";
	if(rid==5034 || rid==5035 || rid==5036 || rid==5360 || rid==5361 || rid==5362)
	{
		if(rid==5034) s +=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=1','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";
		else if(rid==5035) s+=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=2','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";
		else if(rid==5036) s+=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=3','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";
		else if(rid==5360) s+=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=4','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";
		else if(rid==5361) s+=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=5','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";
		else if(rid==5362) s+=" class='cp' onClick=\"JavaScript:window.open('about_cups.php?type=6','_blank','scrollbars=yes,width=520,height=495,resizable=yes')\"";

	}
	s +="></div>";

	s += "</td>";
	s += "<td width=2 background=/images/borders/b0r.gif bgcolor=342E29></td>";

	s += "</tr>";

	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c2.gif width=2 height=2></td>";

	s += "<td height=2 background=/images/borders/b0b.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c3.gif width=2 height=2></td>";
		
	s += "</tr>";
	s += "</table>";
  
	document.write(s);
}

function ShowRelikt(image,w,h,tip, num)
{
	var w1 = w + 4;
	var h1 = h + 4;

	s = "<table cellspacing=0 cellpadding=0 border=0 width="+w1+" height="+h1+">";
	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c0.gif width=2 height=2></td>";
	
	s += "<td height=2 background=/images/borders/b0t.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c1.gif width=2 height=2></td>";

	s += "</tr>";
	s += "<tr>";

	s += "<td width=2 background=/images/borders/b0l.gif bgcolor=342E29></td>";
	
	s += "<td align=center valign=middle bgcolor=656565 width="+w+" height="+h+">";
	s += "<div style='position:relative;'><img src=/images/medals/"+image+" width="+w+" height="+h+"  alt=\""+tip+"\" title=\""+tip+"\"";

  s += " class='cp' onClick=\"window.open('relikt_desc.php?id="+num+"','_blank','scrollbars=yes,width=580,height=495,resizable=yes')\" > </div>";

	s += "</td>";
	s += "<td width=2 background=/images/borders/b0r.gif bgcolor=342E29></td>";

	s += "</tr>";

	s += "<tr>";

	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c2.gif width=2 height=2></td>";

	s += "<td height=2 background=/images/borders/b0b.gif bgcolor=342E29></td>";
	s += "<td width=2 height=2 bgcolor=342E29><img src=/images/borders/b0c3.gif width=2 height=2></td>";
		
	s += "</tr>";
	s += "</table>";
  
	document.write(s);
}

function ImgIn(num)
{
  var el = document.getElementById('imgDel'+num);
  el.src = "/images/drop_icon.gif";
}
function ImgOut(num)
{
  var el = document.getElementById('imgDel'+num);
  el.src = "/images/empty.gif";
}
