
var current_radio = 0;

function check_radio(id)
{
	if (current_radio!=id && current_radio){
		var box_id='t'+current_radio;
		var frm_id='r'+current_radio;
		var b=document.getElementById(box_id);
		b.style.background='#FFFFFF';
	}
	current_radio=id;
	var box_id='t'+current_radio;
	var frm_id='r'+current_radio;
	var f=document.getElementById(frm_id).value;
	var b=document.getElementById(box_id);
	b.style.background='#FFDFBD';
	//document.getElementById(id).value=el;
}

function form_colorize(id)
{
	var box_id='t'+id;
	var b=document.getElementById(box_id);
	b.style.background='#FFDFBD';
	current_radio=id;
}

function dropCart(url)
{
	if ( confirm('Opravdu chcete košík vysypat?') ){
		pageRedir( url );
	}
}

function ifConfirm(url, str)
{
	if ( confirm('Opravdu '+str+'?') ){
		pageRedir( url );
	}
}

function check_if_show_address()
{
	var el = document.getElementById('idAddrDelivery');
	var it = document.getElementById('is_delivery');
	if (!it.checked){
		divShow('idAddrDelivery');
	} else {
		divHide('idAddrDelivery');
	}
}

function changeImage(path, title)
{
        var pic = document.getElementById('changer');
	
	var view  = '/view.php?image='+path;

	//var zoom = '<a href="'+view+'" title=""><img src="/img/ico_zoom.gif" alt="Zoom" rel="lightbox[him]" border="0">plus</a>';

	var str = '<a class="navibtn" title="'+title+'" href="'+view+'" rel="lightbox[him]"><img src="/resample.php?w=300&image='+path+'" alt="'+title+'"  border="0"/></a>';
  //      var str = '<img src="/resample.php?w=300&h=400&image='+path+'" border="0" align="middle" alt="'+title+'" />';
        pic.innerHTML = str;
}

function update_other_email()
{
	var el = document.getElementById('klientUsermail');
	var it = document.getElementById('klientEmail');
	it.value = el.value;
}

function chooselang(forum)
{
	var el = document.getElementById('Language');
	if ( el.value != '' )
	{
		if ( forum )
		{
			var path='/'+el.value+'/goto/forum';
		}
		else
		{
			var path='/'+el.value;
		}
		pageRedir( path );
	}
}

function show_hlt( smenu, menu)
{
	divShow(smenu);
	hlt(menu);
	set_distance(smenu, menu);

}

function hide_unhlt(smenu, menu, layout)
{
	divHide(smenu);
	if (layout=="GOLFSKI"){
		unhlt(menu);
	} else {
		unhlt_skopovy(menu);
	}
}


function open_mailto()
{
	id = 'corn';
	var _sub = document.getElementById(id);
	_sub.style.width = '300px';
	_sub.style.height = '500px';
	divShow(id);
}


function set_distance(smenu, menu)
{
	var _sub = document.getElementById(smenu);
	var _m = document.getElementById(menu);
	_sub.style.left = (_m.offsetLeft-10)+'px';
	//alert(_sub.offsetLeft);
}

function hlt(id)
{
	var el = document.getElementById(id);
	if (el){
		el.style.background = 'white';
		el.style.color='black';
		//el.style.border='1px solid white';
		//alert(el.offsetWidth + ' | ' + el.offsetLeft);
	}
}

function unhlt(id)
{
	var el = document.getElementById(id);
	if (el){
		el.style.background = '';
		el.style.color='white';
		//el.style.border='0';

	}
}

function unhlt_skopovy(id)
{
	var el = document.getElementById(id);
	if (el){
		el.style.background = '';
		el.style.color='black';
		//el.style.border='0';

	}
}




function show_hlt2( smenu, menu)
{
	divShow(smenu);
	//hlt2(menu);
	set_distance(smenu, menu);

}

function hide_unhlt2(smenu, menu)
{
	divHide(smenu);
	//unhlt2(menu);
}



function hlt2(id) // petrskopovy
{
	var el = document.getElementById(id);
	if (el){
		el.style.backgroundImage = "url('../img/petrskopovy/menu_sel_hover.png')";
		el.style.backgroundPosition ="left center";
		el.style.backgroundRepeat = "no-repeat";
		el.style.color='black';
		//el.style.border='1px solid white';
		//alert(el.offsetWidth + ' | ' + el.offsetLeft);
	}
}

function unhlt2(id)
{
	var el = document.getElementById(id);
	if (el){
		el.style.background = '';
		el.style.color='black';
		//el.style.border='0';
	}
}


function inputWin(text)
{
	var answer = prompt(text);
	return answer;
}

function checkAddr(id, id2)
{
	alert(id + id2);
	if (document.id.checked){
		divHide(id2);
	} else {
		divShow(id2);
	}
}

function divHide(id)
{
	var mid=document.getElementById(id);
	mid.style.visibility='hidden';
	mid.style.display='none';
}

function divShow(id)
{
	var mid=document.getElementById(id);
	//alert(id + ' - ' + mid);
	//alert(mid.innerHTML);
	mid.style.visibility='visible';
	mid.style.display='block';
}

function pageRedir(id){
	document.location.replace( id );
}

function OpenWin(adresa,jake,nastaveni)
{
	msg=open(adresa,jake,nastaveni);
}

function OpenWinEdit(url, file)
{
	msg=OpenWin(url + '&fsrc='+file, 'WinEdit', 'toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,top=50,left=120,width=950,height=650');
}

function OpenWinImg(url, width, height)
{
	//window.imgdetail.close();
	msg=OpenWin(url, 'imgdetail', 'toolbar=no,menubar=no,resizable=no,scrollbars=no,status=no,top=150,left=100,width='+width+',height='+height);
}





function fAddInput(tableName, text4Input) 
{		// pridej do tabuky radek s inputem
	var oTable= document.getElementById(tableName);
	var vNewRow = oTable.insertRow(oTable.rows.length);
	var vFileCell1= vNewRow.insertCell(0);
	var vFileCell2= vNewRow.insertCell(1);
	var vFileCell3= vNewRow.insertCell(2);
	vFileCell1.innerHTML= '<input type="text" name="data[NewVoteAnswer][][sort_order]" value="" size="2" />';
	vFileCell2.innerHTML= '<input type="text" name="data[NewVoteAnswer][][answer]" value="'+text4Input+'" size="90" />';
	vFileCell3.innerHTML= '<input type="button" id="'+eval(oTable.rows.length-1)+'" class="btSmall" onClick="fDelInput(\''+tableName+'\', this)" value="Smazat" />';
}

function fDelInput(tableName, oInput)
{ 	// smazni drive pridany radek inputu , ktery jeste neni v DB
	var oTable= document.getElementById(tableName);
	oTable.deleteRow(oInput.id);
}

function _gel(id)
{
	var e = document.getElementById(id);
	return e;
}

function adjust_inc(id)
{
	var f = _gel(id);
	var l = f.value;
	l++;
	if (l>50){
		l=50;
	}
	f.value=l;
}


function adjust_dec(id)
{
	var f = _gel(id);
	var l = f.value;
	l--;
	if (l<=0){
		l=1;
	}
	f.value=l;
}

