var isIE = document.all?true:false;
var _x;
var _y;
if (!isIE) {
	document.captureEvents(Event.MOUSEMOVE);
}
var _heElTop;
var _heElLeft;
function getMousePosition(mp){
if (!isIE) {
	_x = mp.pageX;
	_y = mp.pageY;
	_heElTop = window.innerHeight;
	_heElLeft = window.innerWidth;
} else {
	_x = event.clientX + document.body.scrollLeft;
	_y = event.clientY + document.body.scrollTop;
	_heElTop = document.body.offsetHeight;
	_heElLeft = document.body.offsetWidth;
}
return true;
}
document.onmousemove = getMousePosition;
function getScroll(){
	var scrollTop=0;
	if( typeof( window.pageYOffset ) == 'number' ) {
		scrollTop = window.pageYOffset;
	} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
		scrollTop = document.body.scrollTop;
	} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
		scrollTop = document.documentElement.scrollTop;
	}
	return scrollTop;
}
function heightTopLeft(){
	if (!isIE) {
		_heElTop = window.innerHeight;
		_heElLeft = window.innerWidth;
	}
	if (isIE) {
		_heElTop = document.body.offsetHeight;
		_heElLeft = document.body.offsetWidth;
	}
}
function PosDrag(param){
//	if (param != 0){
//		el='dragDiv'+param;
//		var scrollTop=0;
//
//		scrollTop=getScroll();
//
//		z=document.getElementById(el).style.top;
//		tmp=z.split("px");
//		alert(tmp[0]);
//		document.getElementById(el).style.top=eval(tmp[0]+"+"+scrollTop)+'px';
//	}
}
function PosDrag2(param){
	if (param != 0){
		el='dragDiv'+param;
		var scrollTop=0;
		heightTopLeft();
		scrollTop=getScroll();

		var newLeft=eval(_heElLeft+"/"+2);
		newLeft=eval(newLeft+"-"+350);

		z=document.getElementById(el).style.top;
		tmp=z.split("px");
		document.getElementById(el).style.top=eval(75+"+"+scrollTop)+'px';
		document.getElementById(el).style.left=newLeft+'px';
	}
}
function posWin10(){
	el='tutorialBox';
	var scrollTop=0;
	scrollTop=getScroll();
	z=document.getElementById(el).style.top;
	w=document.getElementById(el).style.width;
	h=document.getElementById(el).style.height;
	if(document.getElementById('dTutorial').style.display=='none'){
		var isIE = document.all?true:false;
		if (!isIE) {
			_heElLeft = window.innerWidth;
		}
		if (isIE) {
			_heElLeft = document.body.offsetWidth;
		}
		document.getElementById('dTutorial').style.left=eval(_heElLeft/2-331/2)+'px';
		$('#dTutorial').css('display','block');
		var height = $('#'+el).css('height');
		$('#'+el).css('height',"0px").animate({'height':height},1500,function(){});
		up=1;

	}else{
		$('#'+el).slideUp(1500, function(){
			$('#dTutorial').hide();
		});
		document.getElementById('tutorialBox').innerHTML='Loading......'
	}
}
function posWin(el,pnl){
	if(typeof(pnl)=='undefined'){
		pnl=0;
	}
	if(pnl==0){
		window.setTimeout("xajax_ShowTutorial('tutorialBox')",0);
		writeDrag7.set();
		return;
	}
		var scrollTop=0;
		scrollTop=getScroll();
		z=document.getElementById(el).style.top;
		w=document.getElementById(el).style.width;
		h=document.getElementById(el).style.height;
		tmp=z.split("px");
		tmpw=w.split("px");
		tmph=h.split("px");
		if(document.getElementById(el).style.display=='none'){
			document.getElementById(el).style.display="block";
			up=1;
		}else{up=0;scrollTop=0;document.getElementById('tutorialBox').innerHTML='Loading......'}
		if(typeof(pnl)=='undefined'){
//			pnl=2;
			pnl=0;
		}
		moveEl(el,tmpw[0],tmph[0],eval(tmp[0]+"+"+scrollTop),up,eval(tmp[0]+"+"+scrollTop),pnl);
}
function moveEl(el,amw,amh,amt,up,base,pnl){
//if(pnl==2){
//	document.getElementById(el).style.display='none'
//	window.setTimeout("xajax_ShowTutorial('tutorialBox')",0);
//	writeDrag7.set();
//	return;
//
//}
if(up==1){
	var isIE = document.all?true:false;
	if (!isIE) {
		_heElLeft = window.innerWidth;
	}
	if (isIE) {
		_heElLeft = document.body.offsetWidth;
	}
	document.getElementById(el).style.left=eval(_heElLeft/2-331/2)+'px';
	amw=eval(amw+"+"+20);
	amw2=amw;
	amh=eval(amh+"+"+18);
	amh2=amh;
	amt=eval(amt+"+"+2);
	amw=311;
	amw2=301;
	if(amh>=371){
//		alert("e te tuk e xajax-a");
//		callc xajax function of the tutorial
			if(pnl==0){
				window.setTimeout("xajax_ShowTutorial('tutorialBox')",0);
			}else{
				window.setTimeout("xajax_heroNotesLoader()");
			}
			writeDrag7.set();
			return;

		return;
	}
//	if(amt>=eval(base+100)){xajaxRequestUri='xinfo_server.php';xajax_ShowTutorial('tutorialBox');writeDrag7.set();return;}
}else{
	amw=eval(amw+"-"+20);
	amw2=amw;
	amh=eval(amh+"-"+18);
	amh2=amh;
	amt=eval(amt+"-"+2);
	amw=311;
	amw2=301;
	if((amw<=eval(0))||(amh<=eval(0))){document.getElementById(el).style.display="none";return;}
//	if(amt<=eval(base-100)){document.getElementById(el).style.display="none";return;}
}
		document.getElementById(el).style.top=amt+'px';
		document.getElementById(el).style.width=amw+'px';
		document.getElementById(el).style.height=amh+'px';
		if((amw2-18)<0){amw2=18;}
		if((amh2-18)<0){amh2=18;}
		document.getElementById('tutorialBox').style.width=amw2-10+'px';
		document.getElementById('tutorialBox').style.height=amh2-18+'px';
		document.getElementById('tutorialBox2').style.width=amw2-10+'px';
		document.getElementById('tutorialBox2').style.height=amh2-18+'px';
//		alert(amw+" "+amh+" "+amt+" "+base);
		window.setTimeout('moveEl("'+el+'",'+amw+','+amh+','+amt+','+up+','+base+','+pnl+')',10);
}
function displayflash2(source, width, height,id,hID,type)
{
	var add='';
	if(type==2){add="s_";}
	if(type==3){add="d_";}
//	alert(add);
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+add+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="static_url='+add+'only_avatar.php&dynamic_url='+add+'hero_dynamic.php">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+add+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url='+add+'only_avatar.php&dynamic_url='+add+'hero_dynamic.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML= text;

}
function displayflashSkills(source, width, height,id,hID,type)
{
	var add='';
	if(type==2){add="s_";}
	if(type==3){add="d_";}
//	alert(add);
//	alert(add);
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+add+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="static_url='+add+'battleSkillAvat.php&dynamic_url='+add+'battleDynamic.php">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+add+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url='+add+'battleSkillAvat.php&dynamic_url='+add+'battleDynamic.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML=text;

}
function displayflashSkillsMob(source, width, height,id,hID,type)
{
	var add='';
	if(type==2){add="s_";}
	if(type==3){add="d_";}
//	alert(add);
//	alert(add);
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+add+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="static_url='+add+'mob_static.php&dynamic_url='+add+'mob_dinam.php">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+add+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url='+add+'mob_static.php&dynamic_url='+add+'mob_dinam.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML=text;

}
function displayflashProfile(source, width, height,id,vars)
{
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="Small_avatar_v02" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="'+vars+'">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="Small_avatar_v02" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+vars+'"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML=text;
}
function displayflash(source, width, height,id)
{
	var add='';
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+add+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+add+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>' + "\n";
	text=text+'</object>' + "\n\n\n\n";
	document.getElementById(id).innerHTML=text;
}
function callHeroAvatar2(id,hID,type){
//	id=GetFreeWindowID();

	displayflash2(static_dir+"swf/Avatar_only_v01.swf",220,420,id,hID,type);
//	InitDrag(id);
}
function callHeroAvatarBattle(id,hID,type){
	if(id=="avatart2"){type=3;}
	displayflash2(static_dir+"swf/avatar200x200_v01.swf",200,200,id,hID,type);
}
function callHeroAvatarBattle2(id,hID,type){
//	alert(id);
	if(id=="avatart2"){type=3;}
	else{type=2;}
	displayflashSkills(static_dir+"swf/avatar200x200_v03.swf",200,200,id,hID,type);
}
function callMobAvatarBattle(id,hID,type){
//	alert(id);
	if(id=="avatart2"){type=3;}
	else{type=2;}
	displayflashSkills(static_dir+"swf/mobavatar200x200_v01.swf",200,200,id,hID,type);
}
function callHeroAvatar3(id){

//	displayflash3("View_avatar_v02.swf",686,472,id);
//	displayflash3(static_dir+"swf/ViewHero_v02.swf?r=3",686,472,id);
	displayflash3(static_dir+"swf/Hero_Doll_v03.swf?r=3",686,472,id);
}

function displayflash3(source, width, height,id)
{
	//str_tab_1="test";
	text='';
	//text=text+'<a href="#">' + str_tab_1+'</a>';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+id+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="static_url=enemy_avatar_nets.php&dynamic_url=d_enemy_avatar_nets.php&url_request=veiw_avatar.php&have_store=3&type_store=1&pic_static_url=only_avatar.php&pic_dynamic_url=hero_dynamic.php">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+id+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url=enemy_avatar_nets.php&dynamic_url=d_enemy_avatar_nets.php&url_request=veiw_avatar.php&have_store=3&type_store=1&pic_static_url=only_avatar.php&pic_dynamic_url=hero_dynamic.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById("messagebox"+id).innerHTML=text;
}
function displayHeroFlash3(id)
{
//	source=static_dir+'swf/ViewHero_v02.swf';
	source	= static_dir+'swf/Hero_Doll_v03.swf';
	width	= 686;
	height	= 468;

	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="'+id+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
//	text=text+'    <param name="flashVars" value="static_url=hero_doll_st_nets.php&dynamic_url=hero_doll_dinam_nets.php&url_request=hero_doll.php&have_store=0&type_store=1&pic_static_url=only_avatar3.php&pic_dynamic_url=pic_doll_dinam.php">' + "\n";
//	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+id+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url=hero_doll_st_nets.php&dynamic_url=hero_doll_dinam_nets.php&url_request=hero_doll.php&have_store=0&type_store=1&pic_static_url=only_avatar3.php&pic_dynamic_url=pic_doll_dinam.php"></embed>' + "\n";
	text=text+'    <param name="flashVars" value="static_url=hero_doll_static.php&dynamic_url=hero_doll_dynamic.php&pic_static_url=picture_avatar_s.json">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+id+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url=hero_doll_static.php&dynamic_url=hero_doll_dynamic.php&pic_static_url=picture_avatar_s.json"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById("messagebox"+id).innerHTML=text.replace(/&amp;/g, "&");
}
function CountTime2( timername, seconds ){
		v = new Date();
		el = document.getElementById(timername);
		n = new Date();
		s = seconds-Math.round((n.getTime()-v.getTime())/1000.);
		m = 0;
		h = 0;

		if( s>59 ){
			m=Math.floor( s/60 );
			s = s-m*60;
		}
		if( m>59 ){
			h = Math.floor( m/60 );
			m = m-h*60;
		}
		if( s<10 ){
			s = "0" + s;
		}
		if( m<10 ){
			m = "0" + m;
		}
//		alert(h+":"+m+":"+s);
		el.innerHTML = h+":"+m+":"+s;

		seconds = seconds - 1;
		if(seconds < 0){
			document.getElementById(''+timername+'').innerHTML='00:00:00';
		}else{
			window.setTimeout( "CountTime2('"+timername+"',"+seconds+");", 999 );
		}
}
function checkSelectedRadio(name){
	radioObj=document.getElementsByName(name);
	for(i=0;i<radioObj.length;i++){
		if(radioObj[i].checked==true){return radioObj[i].value;break;}
	}
	return 0;
}
function checkSelectedPremiumOption(id){
	var z=0;
	z=document.getElementById(id).options[document.getElementById(id).selectedIndex].value;
	return z;
}
function checkCheck(name){
	var temp=new Array();
	checkboxObj=document.getElementsByName(name);
	h=0;
//    alert(checkboxObj);
	for(i=0;i<checkboxObj.length;i++){
		if(checkboxObj[i].checked==true){
			temp[h]=checkboxObj[i].value;
			h++;
		}
	}
	return temp;
}
function checkCheck2(name){
	var temp=0;
	checkboxObj=document.getElementsByName(name);;

//    alert(checkboxObj);

	if(checkboxObj[0].checked==true){

		temp=1;
	}
//    alert(temp);
	return temp;
}
function showHideDiv(id){
	if (document.getElementById(id).style.display == 'none'){
		document.getElementById(id).style.display='block';
	}else{
		document.getElementById(id).style.display='none';
	}
}
function new_page(param){
	if(param==1){
		location.href="hero_main.php?tip=2";
	}
}
function callHeroMainAvatar(userData){
	id=GetFreeWindowID();
	tmp=xajax.config.requestURI;
	xajax.config.requestURI='xajax_loader.php';
	xajax_movementCheck(id,userData);
	xajax.config.requestURI=tmp;
	PosDrag2(id);
	InitDrag(id);
	PosDrag2(id);
}
function SetFocusTop(){
self.scrollTo(0, 0);
return true;
}
function checkOpen(id){
	if(document.getElementById('dragDiv'+id).style.visibility == 'hidden'){
		return 1;
	}
	return 0;
}
function Test_symbols_left(iText,id){
	cur_broj=iText.length;
	var broj=2000;
	document.getElementById(id).innerHTML=broj-cur_broj;
}

function comment_symbols_left(iText,id){
	cur_broj=iText.length;
	var broj=255;
	document.getElementById(id).innerHTML=broj-cur_broj;
}

function textLimitCheck(field, maxlen) {
//	if (field.value.length > maxlen + 1)

	if (field.value.length > maxlen)
	field.value = field.value.substring(0, maxlen);
}
function textLimit(field, maxlen) {
if (field.value.length > maxlen + 1)
alert('<?php echo _max_lenth_reach?>');
if (field.value.length > maxlen)
field.value = field.value.substring(0, maxlen);
}
function Simvoli_left(iText){
cur_broj=iText.length;
var broj=500;
document.getElementById('leftSimv').innerHTML=broj-cur_broj;
}
function callAuctionFlash(piclink,pic_width,pic_height,glow,color,id,images_dir,url_link){
	source=static_dir+'swf/SmallPic_v01.swf';
	width=78;
	height=141;
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+width+'" height="'+height+'" id="'+id+'main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="background_link='+images_dir+'BackAuctionNet.swf&picture_link='+piclink+'&wep_width='+pic_width+'&wep_height='+pic_height+'&glow='+glow+'&color_glow='+color+'&url_link='+url_link+'">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="'+id+'main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="background_link='+images_dir+'BackAuctionNet.swf&picture_link='+piclink+'&wep_width='+pic_width+'&wep_height='+pic_height+'&glow='+glow+'&color_glow='+color+'&url_link='+url_link+'"></embed>' + "\n";
	text=text+'</object>' + "\n\n\n\n";
	document.getElementById(id).innerHTML=text;
}
function CountTimeCommand( timername, seconds ){
		v = new Date();
		el = document.getElementById(timername);
		n = new Date();
		s = seconds-Math.round((n.getTime()-v.getTime())/1000.);
		m = 0;
		h = 0;

		if( s>59 ){
			m=Math.floor( s/60 );
			s = s-m*60;
		}
		if( m>59 ){
			h = Math.floor( m/60 );
			m = m-h*60;
		}
		if( s<10 ){
			s = "0" + s;
		}
		if( m<10 ){
			m = "0" + m;
		}
//		alert(h+":"+m+":"+s);
		el.innerHTML = h+":"+m+":"+s;

		seconds = seconds - 1;
		if(seconds < 0){
//			alert(command);
			if(typeof commandString=='undefined'){
				document.getElementById(''+timername+'').innerHTML='00:00:00';
			}else{
				document.getElementById(''+timername+'').innerHTML='00:00:00';
				eval(commandString);

			}

		}else{
			window.setTimeout( "CountTimeCommand('"+timername+"',"+seconds+");", 999 );
		}
}
function showHeroMainAvatar(danni){
	callHeroMainAvatar(danni);
}
function IsNumericInit(sText){
	var ValidChars = "0123456789";
	var IsFirst=true;
	var Char;
	var h=0;
	var z='';

	for (i = 0; i < sText.length; i++){
		Char = sText.charAt(i);

		if (ValidChars.indexOf(Char) == -1){

		}else{
			if((sText.charAt(i)!=0)||(h==1)){
				z=z + sText.charAt(i);
				h=1;
			}
		}
	}
	if(z==''){z="";}
	return z;
}
function changeAtrPoint(el,type){
	currentMax=document.getElementById('numAttribpoint').innerHTML;
//	alert(el);
//	alert(document.getElementById(el).value);
	curVal=document.getElementById(el).value;
	IsNumericInit(curVal);
	if(curVal==''){
		curVal=0;
	}
//	alert(curVal);
	if((currentMax==0)&&(type==2)){
		return;
	}
	if(type==1){
		if(curVal>0){
			currentMax=eval(currentMax+"+"+1);
			curVal=eval(curVal+"-"+1);
		}else{return;}
	}else{
		currentMax=eval(currentMax+"-"+1);
		curVal=eval(curVal+'+'+1);
	}
	document.getElementById(el).value=curVal;
	document.getElementById('numAttribpoint').innerHTML=currentMax;
	setPluses();
}
function setPluses(){
	elArr=new Array('atribute1','atribute2','atribute3','atribute4','atribute5');
	heroClass=baseClass;
//	alert(heroClass);
//	Warrior - 0,1;
//	Ranger - 1,2;
//	Mistyc - 2,4;
	for(k=0;k<5;k++){
		tmp=IsNumericInit(document.getElementById(elArr[k]).value);
		if(tmp==''){tmp=0;}
		if(((k==0)||(k==1))&&(heroClass==1)&&(tmp!=0)){tmp=eval(tmp+"*"+1.5);}
		if(((k==2)||(k==3))&&(heroClass==2)&&(tmp!=0)){tmp=eval(tmp+"*"+1.5);}
		if(((k==2)||(k==4))&&(heroClass==3)&&(tmp!=0)){tmp=eval(tmp+"*"+1.5);}
		document.getElementById(elArr[k]+'plus').innerHTML="+"+tmp;
	}
}
function reCalcMax(fromId){

	elArr=new Array('atribute1','atribute2','atribute3','atribute4','atribute5');
	maximumAtt=baseAttribute;
//	alert(maximumAtt);
	var attSumCur=0;
	for(k=0;k<5;k++){
		tmp=IsNumericInit(document.getElementById(elArr[k]).value);
		if(tmp==''){
			tmp=0;
		}
		attSumCur=eval(attSumCur+"+"+tmp);
		document.getElementById(elArr[k]).value=tmp;
//		alert(i);
	}
	var newCur=eval(maximumAtt+"-"+attSumCur);
	if(newCur<0){
		leftMore=Math.abs(newCur);
		tmp2=IsNumericInit(document.getElementById(fromId).value);
		if(tmp2==''){
			tmp2=0;
		}
		if(tmp2>leftMore){tmp2=eval(tmp2+"-"+leftMore);newCur=0;}
		else{newCur=eval(newCur+'+'+tmp2);tmp2=0;}
		document.getElementById(fromId).value=tmp2;
	}
	document.getElementById('numAttribpoint').innerHTML=newCur;
	setPluses();
}

function changediamond( diamondname, counter, speed ) {
	el = document.getElementById(diamondname);
	var images_dir = '../static/images';
	var my_diamond = 0;
	var diamond = new Array();
	//diamond[1] = '<img class="fixme" height="20" width=25"" src="'+images_dir+'/icons/diamant4e2.png" onclick="id=GetFreeWindowID();xajax_premiumTimer(id);InitDrag(id);PosDrag(id)" />';
	diamond[1] = '<img class="fixme" height="20" width=25"" src="'+images_dir+'/icons/diamant4e_red.png" onclick="id=GetFreeWindowID();xajax_premiumTimer(id);InitDrag(id);PosDrag(id)" />';
	//diamond[2] = '<img class="fixme" height="20" width=25"" src="'+images_dir+'/icons/diamant4e_red2.png" onclick="id=GetFreeWindowID();xajax_premiumTimer(id);InitDrag(id);PosDrag(id)" />';
	diamond[2] = '<img class="fixme" height="20" width=25"" src="'+images_dir+'/icons/diamant4e.png" onclick="id=GetFreeWindowID();xajax_premiumTimer(id);InitDrag(id);PosDrag(id)" />';

	var new_speed = speed*200;

	if (counter == 1) my_diamond = 2;
	if (counter == 2) my_diamond = 1;
	document.getElementById(''+diamondname+'').innerHTML=diamond[my_diamond];
	window.setTimeout( "changediamond('"+diamondname+"', "+my_diamond+", "+speed+");", new_speed );
}
function viewProfile(hId){
	id=GetFreeWindowID();
	xajax_movementCheck(id,hId);
	InitDrag(id);
}

function displayflashAvatarInId(source, width, height,id)
{
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+width+'" height="'+height+'" id="main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+source+'">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#FFFFFF">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="static_url=only_avatar.php&dynamic_url=hero_dynamic.php">' + "\n";
	text=text+'    <embed src="'+source+'" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="'+width+'" height="'+height+'" name="main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="static_url=only_avatar.php&dynamic_url=hero_dynamic.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML=text;
}
function printBattleData(id){
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="686" height="526" id="main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+static_dir+'swf/bat7.swf?r=2">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#ffffff">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="dynAvatar=s_battleDynamic.php&statAvatar=s_battleSkillAvat.php&dynXML=testBattle.php">' + "\n";
	text=text+'    <embed src="'+static_dir+'swf/bat7.swf?r=2" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="686" height="526" name="main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="dynAvatar=s_battleDynamic.php&statAvatar=s_battleSkillAvat.php&dynXML=testBattle.php"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById(id).innerHTML=text;
}
function pringWarrStat(warId){
	id=GetFreeWindowID();
	text='';
	text=text+'<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="686" height="526" id="main" align="middle">' + "\n";
	text=text+'    <param name="allowScriptAccess" value="always">' + "\n";
	text=text+'    <param name="movie" value="'+static_dir+'swf/batTeams3.swf?v=3">' + "\n";
	text=text+'    <param name="menu" value="false">' + "\n";
	text=text+'    <param name="quality" value="high">' + "\n";
	text=text+'    <param name="scale" value="noscale">' + "\n";
	text=text+'    <param name="bgcolor" value="#ffffff">' + "\n";
	text=text+'    <param name="wmode" value="transparent">' + "\n";
	text=text+'    <param name="flashVars" value="warId='+ warId +'">' + "\n";
	text=text+'    <embed src="'+static_dir+'swf/batTeams3.swf?v=3" menu="false" wmode="transparent" quality="high" scale="noscale" bgcolor="#FFFFFF" width="686" height="526" name="main" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="warId='+ warId +'"></embed>' + "\n";
	text=text+'</object>' + "\n";
	document.getElementById('messagebox'+id).innerHTML=text;
	InitDrag(id);
}

/**
 * Calls a xajax function. This function is taking care of:
 *    - the used dragable window contents
 *    - free dragable window id
 *    - initialization
 *
 * @param string functionName the xajax function leaving out the 'xajax_' part from name
 * @param optional array with params to pass
 * <code>
 *     callXajaxFunction('function_name', ['param1', 'param2', 3]);
 * </code>
 */
function callXajaxFunction(functionName)
{
	var args = '';
	if (arguments.length > 1) {
		args = eval(arguments[1]);
		args = ', \'' + args.join('\', \'') + '\'';
	}

	var id = GetFreeWindowID();
	document.getElementById('messagebox' + id).innerHTML = 'Loading...';
	eval('xajax_' + functionName + '(' + id + args + ');');
	InitDrag(id);
}


/**
 * Same as the top but not generating new window id
 * @param functionName
 * @return
 */
function callXajaxFunctionNW(functionName)
{
	var args = '';
	if (arguments.length > 1) {
		args = eval(arguments[1]);
		args = '\'' + args.join('\', \'') + '\'';
	}

	eval('xajax_' + functionName + '(' + args + ');');
}


function callXajaxFunctionTo(functionName, targetScriptName)
{
	var args = '';
	if (arguments.length > 2) {
		args = eval(arguments[2]);
		args = ', \'' + args.join('\', \'') + '\'';
	}

	var id = GetFreeWindowID();
	var tmp = xajax.config.requestURI;

	document.getElementById('messagebox' + id).innerHTML = 'Loading...';
	xajax.config.requestURI = 'xajax_' + targetScriptName + '.php';
	eval('xajax_' + functionName + '(' + id + args + ');');

	xajax.config.requestURI = tmp;
	InitDrag(id);
}


function confirmationExpand() {
	msg ="<?=$msg?>";
	var answer = confirm(msg);
	return answer;
}

function showStepTarifs(id){

	if (document.getElementById(id).style.display == 'none'){
		document.getElementById('stepPic').src='<?=static_dir?>payments/cifri2.jpg';
		document.getElementById('stepPicDesc').innerHTML='<?=str_current_payment_step2?>';
		document.getElementById('stepPicDesc').className='premSt2';
	}else{
		var checkExpand = checkPicWhat(id);
		if(checkExpand > 0){
			document.getElementById('stepPic').src='<?=static_dir?>payments/cifri2.jpg';
			document.getElementById('stepPicDesc').innerHTML='<?=str_current_payment_step2?>';
			document.getElementById('stepPicDesc').className='premSt2';
		}else{
			document.getElementById('stepPic').src='<?=static_dir?>payments/cifri1.jpg';
			document.getElementById('stepPicDesc').innerHTML='<?=str_current_payment_step1?>';
			document.getElementById('stepPicDesc').className='premSt1';
		}
	}
}
function checkPicWhat(id){
	var idsArr = new Array('pPal_id','creditCard_id','tr_sms','PayByCodeTr_id','es_sms','pl_sms','hr_sms','ro_sms','ch_sms','at_sms','de_sms','it_sms','mx_sms','co_sms','ar_sms','ve_sms','pe_sms','cl_sms','gr_sms','ru_sms','ua_sms','bg_sms','ePay_id','b_Pay_id','easy_Pay_id','Wallie_id','PayByCash_id','PayByCodeNoTr_id','ro_sms2','PayByPhone_id','PayByPhoneIt_id','br_sms');
	var returbValue = 0;
	for(i=0;i<idsArr.length;i++){
		if((document.getElementById(idsArr[i])!=null)&&(idsArr[i]!=id)){
			if(document.getElementById(idsArr[i]).style.display == 'block'){
			   returbValue++;
			}
		}
	}
	return returbValue;
}
function showOpenArr(){
	var idsArr = new Array('pPal_id','creditCard_id','tr_sms','PayByCodeTr_id','es_sms','pl_sms','hr_sms','ro_sms','ch_sms','at_sms','de_sms','it_sms','mx_sms','co_sms','ar_sms','ve_sms','pe_sms','cl_sms','gr_sms','ru_sms','ua_sms','bg_sms','ePay_id','b_Pay_id','easy_Pay_id','Wallie_id','PayByCash_id','PayByCodeNoTr_id','ro_sms2','PayByPhone_id','PayByPhoneIt_id','br_sms');
	var returnArray = new Array();
	var j=0;
	for(i=0;i<idsArr.length;i++){
		if((document.getElementById(idsArr[i])!=null)){
			if(document.getElementById(idsArr[i]).style.display == 'block'){
			   returnArray[j]=idsArr[i];
			   j++;
			}
		}
	}
	if(returnArray.length == 0){
		returnArray[0]=1;
	}
	return returnArray;
}

function closeAvatarAlliance()
{
	containersStuff.hideContainer(containersStuff.findContaner({'saveName':'avatarAlly'}));
	//xajax_avatar_refresh('ally');
}

function ToggleNewClass( newClassId ){
	switch (newClassId)
	{
	case 1:
	  document.getElementById('class_warrior_img').style.borderColor	= "#FFFFFF";
	  document.getElementById('class_warrior_img').style.borderStyle	= "solid";
	  document.getElementById('class_warrior_img').style.borderWidth	= "3px";
	  
	  document.getElementById('class_ranger_img').style.borderColor	= "";
	  document.getElementById('class_ranger_img').style.borderStyle	= "";
	  document.getElementById('class_ranger_img').style.borderWidth	= "";
	  
	  document.getElementById('class_mystic_img').style.borderColor	= "";
	  document.getElementById('class_mystic_img').style.borderStyle	= "";
	  document.getElementById('class_mystic_img').style.borderWidth	= "";
	  break;
	case 2:
	  document.getElementById('class_warrior_img').style.borderColor	= "";
	  document.getElementById('class_warrior_img').style.borderStyle	= "";
	  document.getElementById('class_warrior_img').style.borderWidth	= "";
	  
	  document.getElementById('class_ranger_img').style.borderColor	= "#FFFFFF";
	  document.getElementById('class_ranger_img').style.borderStyle	= "solid";
	  document.getElementById('class_ranger_img').style.borderWidth	= "3px";
	  
	  document.getElementById('class_mystic_img').style.borderColor	= "";
	  document.getElementById('class_mystic_img').style.borderStyle	= "";
	  document.getElementById('class_mystic_img').style.borderWidth	= "";
	  break;
	case 3:
	  document.getElementById('class_warrior_img').style.borderColor	= "";
	  document.getElementById('class_warrior_img').style.borderStyle	= "";
	  document.getElementById('class_warrior_img').style.borderWidth	= "";
	  
	  document.getElementById('class_ranger_img').style.borderColor	= "";
	  document.getElementById('class_ranger_img').style.borderStyle	= "";
	  document.getElementById('class_ranger_img').style.borderWidth	= "";
	  
	  document.getElementById('class_mystic_img').style.borderColor	= "#FFFFFF";
	  document.getElementById('class_mystic_img').style.borderStyle	= "solid";
	  document.getElementById('class_mystic_img').style.borderWidth	= "3px";
	  break;
	}
	document.getElementById('hero_new_class').value = newClassId;
	
	hero_class	= document.getElementById('hero_new_class').value;
	bonus_att	= document.getElementById('hero_new_att_bonus').value;
	updAttBonusCoefs( hero_class, bonus_att);
}
function ToggleNewBonus( newBonusId ){
	switch (newBonusId)
	{
	case 1:
	  document.getElementById('bonus_fighter_img').style.borderColor	= "#FFFFFF";
	  document.getElementById('bonus_fighter_img').style.borderStyle	= "solid";
	  document.getElementById('bonus_fighter_img').style.borderWidth	= "3px";
	  
	  document.getElementById('bonus_crafter_img').style.borderColor	= "";
	  document.getElementById('bonus_crafter_img').style.borderStyle	= "";
	  document.getElementById('bonus_crafter_img').style.borderWidth	= "";
	  
	  document.getElementById('bonus_fighter_info').style.display		= "block";
	  document.getElementById('bonus_crafter_info').style.display		= "none";
	  break;
	case 2:
	  document.getElementById('bonus_fighter_img').style.borderColor	= "";
	  document.getElementById('bonus_fighter_img').style.borderStyle	= "";
	  document.getElementById('bonus_fighter_img').style.borderWidth	= "";
	  
	  document.getElementById('bonus_crafter_img').style.borderColor	= "#FFFFFF";
	  document.getElementById('bonus_crafter_img').style.borderStyle	= "solid";
	  document.getElementById('bonus_crafter_img').style.borderWidth	= "3px";
	  
	  document.getElementById('bonus_fighter_info').style.display		= "none";
	  document.getElementById('bonus_crafter_info').style.display		= "block";
	  
	  document.getElementById('hero_new_att_bonus').value = 0;
	  
	  document.getElementById('att_img_1').style.borderColor	= "";
	  document.getElementById('att_img_1').style.borderStyle	= "";
	  document.getElementById('att_img_1').style.borderWidth	= "";
	  
	  document.getElementById('att_img_2').style.borderColor	= "";
	  document.getElementById('att_img_2').style.borderStyle	= "";
	  document.getElementById('att_img_2').style.borderWidth	= "";
	  
	  document.getElementById('att_img_3').style.borderColor	= "";
	  document.getElementById('att_img_3').style.borderStyle	= "";
	  document.getElementById('att_img_3').style.borderWidth	= "";
	  
	  document.getElementById('att_img_4').style.borderColor	= "";
	  document.getElementById('att_img_4').style.borderStyle	= "";
	  document.getElementById('att_img_4').style.borderWidth	= "";
	  
	  document.getElementById('att_img_5').style.borderColor	= "";
	  document.getElementById('att_img_5').style.borderStyle	= "";
	  document.getElementById('att_img_5').style.borderWidth	= "";
	  break;
	}
	
	document.getElementById('hero_new_bonus').value = newBonusId;
	
	hero_class	= document.getElementById('hero_new_class').value;
	bonus_att	= document.getElementById('hero_new_att_bonus').value;
	updAttBonusCoefs( hero_class, bonus_att);
}

function ToggleNewAttBonus( newBonusAttId ){
	switch (newBonusAttId)
	{
	case 1:
	  document.getElementById('att_img_1').style.borderColor	= "#FFFFFF";
	  document.getElementById('att_img_1').style.borderStyle	= "solid";
	  document.getElementById('att_img_1').style.borderWidth	= "3px";
	  
	  document.getElementById('att_img_2').style.borderColor	= "";
	  document.getElementById('att_img_2').style.borderStyle	= "";
	  document.getElementById('att_img_2').style.borderWidth	= "";
	  
	  document.getElementById('att_img_3').style.borderColor	= "";
	  document.getElementById('att_img_3').style.borderStyle	= "";
	  document.getElementById('att_img_3').style.borderWidth	= "";
	  
	  document.getElementById('att_img_4').style.borderColor	= "";
	  document.getElementById('att_img_4').style.borderStyle	= "";
	  document.getElementById('att_img_4').style.borderWidth	= "";
	  
	  document.getElementById('att_img_5').style.borderColor	= "";
	  document.getElementById('att_img_5').style.borderStyle	= "";
	  document.getElementById('att_img_5').style.borderWidth	= "";
	  break;
	case 2:
	  document.getElementById('att_img_1').style.borderColor	= "";
	  document.getElementById('att_img_1').style.borderStyle	= "";
	  document.getElementById('att_img_1').style.borderWidth	= "";
	  
	  document.getElementById('att_img_2').style.borderColor	= "#FFFFFF";
	  document.getElementById('att_img_2').style.borderStyle	= "solid";
	  document.getElementById('att_img_2').style.borderWidth	= "3px";
	  
	  document.getElementById('att_img_3').style.borderColor	= "";
	  document.getElementById('att_img_3').style.borderStyle	= "";
	  document.getElementById('att_img_3').style.borderWidth	= "";
	  
	  document.getElementById('att_img_4').style.borderColor	= "";
	  document.getElementById('att_img_4').style.borderStyle	= "";
	  document.getElementById('att_img_4').style.borderWidth	= "";
	  
	  document.getElementById('att_img_5').style.borderColor	= "";
	  document.getElementById('att_img_5').style.borderStyle	= "";
	  document.getElementById('att_img_5').style.borderWidth	= "";
	  break;
	case 3:
	  document.getElementById('att_img_1').style.borderColor	= "";
	  document.getElementById('att_img_1').style.borderStyle	= "";
	  document.getElementById('att_img_1').style.borderWidth	= "";
	  
	  document.getElementById('att_img_2').style.borderColor	= "";
	  document.getElementById('att_img_2').style.borderStyle	= "";
	  document.getElementById('att_img_2').style.borderWidth	= "";
	  
	  document.getElementById('att_img_3').style.borderColor	= "#FFFFFF";
	  document.getElementById('att_img_3').style.borderStyle	= "solid";
	  document.getElementById('att_img_3').style.borderWidth	= "3px";
	  
	  document.getElementById('att_img_4').style.borderColor	= "";
	  document.getElementById('att_img_4').style.borderStyle	= "";
	  document.getElementById('att_img_4').style.borderWidth	= "";
	  
	  document.getElementById('att_img_5').style.borderColor	= "";
	  document.getElementById('att_img_5').style.borderStyle	= "";
	  document.getElementById('att_img_5').style.borderWidth	= "";
	  break;
	case 4:
	  document.getElementById('att_img_1').style.borderColor	= "";
	  document.getElementById('att_img_1').style.borderStyle	= "";
	  document.getElementById('att_img_1').style.borderWidth	= "";
	  
	  document.getElementById('att_img_2').style.borderColor	= "";
	  document.getElementById('att_img_2').style.borderStyle	= "";
	  document.getElementById('att_img_2').style.borderWidth	= "";
	  
	  document.getElementById('att_img_3').style.borderColor	= "";
	  document.getElementById('att_img_3').style.borderStyle	= "";
	  document.getElementById('att_img_3').style.borderWidth	= "";
	  
	  document.getElementById('att_img_4').style.borderColor	= "#FFFFFF";
	  document.getElementById('att_img_4').style.borderStyle	= "solid";
	  document.getElementById('att_img_4').style.borderWidth	= "3px";
	  
	  document.getElementById('att_img_5').style.borderColor	= "";
	  document.getElementById('att_img_5').style.borderStyle	= "";
	  document.getElementById('att_img_5').style.borderWidth	= "";
	  break;
	case 5:
	  document.getElementById('att_img_1').style.borderColor	= "";
	  document.getElementById('att_img_1').style.borderStyle	= "";
	  document.getElementById('att_img_1').style.borderWidth	= "";
	  
	  document.getElementById('att_img_2').style.borderColor	= "";
	  document.getElementById('att_img_2').style.borderStyle	= "";
	  document.getElementById('att_img_2').style.borderWidth	= "";
	  
	  document.getElementById('att_img_3').style.borderColor	= "";
	  document.getElementById('att_img_3').style.borderStyle	= "";
	  document.getElementById('att_img_3').style.borderWidth	= "";
	  
	  document.getElementById('att_img_4').style.borderColor	= "";
	  document.getElementById('att_img_4').style.borderStyle	= "";
	  document.getElementById('att_img_4').style.borderWidth	= "";
	  
	  document.getElementById('att_img_5').style.borderColor	= "#FFFFFF";
	  document.getElementById('att_img_5').style.borderStyle	= "solid";
	  document.getElementById('att_img_5').style.borderWidth	= "3px";
	  break;
	}
	document.getElementById('hero_new_att_bonus').value = newBonusAttId;
	
	hero_class	= document.getElementById('hero_new_class').value;
	bonus_att	= document.getElementById('hero_new_att_bonus').value;
	updAttBonusCoefs( hero_class, bonus_att);
}

function updAttBonusCoefs ( hero_class, bonus_att){
	
	if( hero_class == 1 ){
		coef_1	= 1.5;
		coef_2	= 1.5;
		coef_3	= 1;
		coef_4	= 1;
		coef_5	= 1;
	}
	
	if( hero_class == 2 ){
		coef_1	= 1;
		coef_2	= 1;
		coef_3	= 1.5;
		coef_4	= 1.5;
		coef_5	= 1;
	}
	
	if( hero_class == 3 ){
		coef_1	= 1;
		coef_2	= 1;
		coef_3	= 1.5;
		coef_4	= 1;
		coef_5	= 1.5;
	}
	
	if( bonus_att == 1 ){
		coef_1	= coef_1 + 1;
	}
	if( bonus_att == 2 ){
		coef_2	= coef_2 + 1;
	}
	if( bonus_att == 3 ){
		coef_3	= coef_3 + 1;
	}
	if( bonus_att == 4 ){
		coef_4	= coef_4 + 1;
	}
	if( bonus_att == 5 ){
		coef_5	= coef_5 + 1;
	}
	
	document.getElementById('coef_1').innerHTML = ''+coef_1+'';
	document.getElementById('coef_2').innerHTML = ''+coef_2+'';
	document.getElementById('coef_3').innerHTML = ''+coef_3+'';
	document.getElementById('coef_4').innerHTML = ''+coef_4+'';
	document.getElementById('coef_5').innerHTML = ''+coef_5+'';	
}

function openDivs(arrToOpen2){
//			alert(arrToOpen2);
	arrToOpen = new Array();
	arrToOpen = arrToOpen2.split(",");
	for(i=0;i<arrToOpen.length;i++){
//				alert(arrToOpen[i]);
		if(document.getElementById(arrToOpen[i])!=null){
			setTimeout("showStepTarifs('"+arrToOpen[i]+"')",100);
			document.getElementById(arrToOpen[i]).style.display="block";
		}
	}
}



/**
 * Pretty Select jQuery Plugin
 *
 * @author stoyan
 */
(function()
{
	jQuery.fn.prettySelect = function(settings)
	{
		var config = {
			toggleClass: 'opened'
		};

		var $target = this;

		var Select = {
			show: function($target)
			{
				jQuery('ul', $target).slideToggle('fast', function()
				{
					jQuery('em', $target).toggleClass(config.toggleClass);
				});
				this._save($target);
			},


			hide: function($target)
			{
				jQuery('ul', $target).slideUp('fast', function()
				{
					jQuery('em', $target).removeClass(config.toggleClass);
				});
				this._save($target);
			},


			_save: function($target)
			{
				jQuery($target).data('__opened__', jQuery('ul', $target).is(':visible'));
			}
		};

		if (settings !== null) {
			jQuery.extend(config, settings);
		}

		this.each(function(index)
		{
			var $this = $(this);

			jQuery('a:first', $this).click(function()
			{
				if (jQuery('ul', $this).is(':visible') === false) {
					Select.hide($target);
				}
				Select.show($this);

				return false;
			});


			jQuery('body').click(function()
			{
				if (jQuery($this).data('__opened__')) {
					Select.hide($this);
				}
			});

		});

		return this;
	};
})(jQuery);

