//<script>
var selectedID=''
var cOCJ=new Object()
var wwidth
var SLW=false
var xprop=0
var Sdiference=0
var currentPos=-1
var FF=!document.all


function ShowImg(iName) 
	{
	var pURL='shwbig.php?obr='+iName;
	pInfo='toolbar=0,';
	pInfo+='location=0,';
	pInfo+='directories=0,';
	pInfo+='status=0,';
	pInfo+='menubar=0,';
	pInfo+='scrollbars=0,';
	pInfo+='resizable,';
	pInfo+='width=200,';
	pInfo+='height=200';
	window.open(pURL, 'bigPop', pInfo);
	}
var slideCatPos=5
var slideCatTmo
function slideCat(d,tmp) 
	{
	clearTimeout(slideCatTmo);
	if (d=='down') 
		{
		slideCatPos=slideCatPos*1.2+40
		limita=888//winwidth()
		document.getElementById('catalog').style.left=((slideCatPos)*-1)+'px'
		//alert((slideCatPos-600)+">"+(limita/2))
		if (  (slideCatPos)<(limita/2)+1200  ) {slideCatTmo=setTimeout("slideCat('down','"+tmp+"')",40)}
		else 
			{
			cont_loadZbozi(tmp)
			slideCatTmo=setTimeout("slideCat('up')",40);
			};
		}
	else if (d=='up') 
		{
		slideCatPos=(slideCatPos-40)/1.2
		document.getElementById('catalog').style.left=((slideCatPos)*-1)+'px'
		if (  slideCatPos>5  ) {slideCatTmo=setTimeout("slideCat('up','')",40)}
		else {slideCatPos=5};
		};
	
	}

function dn() {}

function loadZbozi(e)
	{
	zb=(window.event?window.event.srcElement:e.target)
	loadZboziObj(zb)
	}
function loadZboziObj(zb)
	{
	//alert(selectedID)
	if (  selectedID  ) {document.getElementById(selectedID).style.borderColor='silver';};
	//alert(zb.id)
	document.getElementById(zb.id).style.borderColor='red';
	selectedID=zb.id
	if (  !getCurPos  ) 
		{
		aktPos=0
		curpos=zb.parentNode
		while (curpos.previousSibling)
			{
			aktPos++
			curpos=curpos.previousSibling
			}
		};
	tmp=selectedID.split("_")[1]
	slideCat('down',tmp)
	}

var aktLenght=false;
var aktPos=0;
var getCurPos=false;
function goPrevNext(posGo)
	{
	getCurPos=true
	sm=document.getElementById('slider').firstChild.childNodes
	if (  !aktLenght  ) 
		{
		aktLenght=sm.length
		};
	if (  posGo=="L" && aktPos>0  ) 
		{
		aktPos--;
		aktPos--;
		loadZboziObj(sm.item(aktPos).firstChild);
		};
	if (  posGo=="R" && aktPos<aktLenght  ) 
		{
		aktPos++;
		aktPos++;
		loadZboziObj(sm.item(aktPos).firstChild);
		};
	getCurPos=false
	}

impth=['','big/','mid/'];

function cont_loadZbozi(tmp)
	{
	
	zbi=document.getElementById('zbimg')
	zbi.style.visibility='hidden'
	tmsrc="imgs/new-zbozi-sml/"+Kdata[tmp][9]+"/"+Kdata[tmp][2]//impth[Number(Kdata[tmp][7])]+
	//prompt('zdroj',tmsrc)
	zbi.src=tmsrc
	presetColor(Kdata[tmp][2])
	document.getElementById('Knadpis').innerHTML=Kdata[tmp][0]
	document.getElementById('Kdescr').innerHTML=(Kdata[tmp][1]+'<br/><br/>Velikosti: '+Kdata[tmp][4]).split("[br]").join("<br/>")
	document.getElementById('imglink').title=Kdata[tmp][0]
	document.getElementById('imglink').href='Javascript:ShowImg("'+"imgs/new-zbozi/"+Kdata[tmp][12]+"/"+Kdata[tmp][2]+'")'
	document.getElementById('cena').innerHTML=( (Kdata[tmp][10]=="VY") ? ( "VYPRODÁNO" ) : (Kdata[tmp][5]+",- Kč") )
	document.getElementById("oddpridej").value=document.getElementById("zbozi").value=tmp
	presetColor(Kdata[tmp][3]);
	//document.getElementById("ks").name="ks["+tmp+"]";
	document.getElementById("bskt").disabled=!( Kdata[tmp][6]=="IS" && Kdata[tmp][10]!="VY"  );
	opts=document.getElementById('velikost')
	//opts.name="velikost["+tmp+"]"
	opts.options.length = 0;
	list=Kdata[tmp][4].split(',')
	for(i=0;i<list.length;i++)
		{
		opts.options[i] = new Option(list[i],list[i]);
		}
	//return Math.random()
	
	zbi.alt=Kdata[tmp][0]
	//prompt("","imgs/zbozi/big/"+Kdata[tmp][2])
	}

function winwidth()
	{
	
	if (document.getElementById)
		{
		if (window.innerWidth) return window.innerWidth;
		if (document.documentElement&&document.documentElement.clientWidth) return document.documentElement.clientWidth;
		if (document.body&&document.body.clientWidth) return document.body.clientWidth;
		}
	return 887;
	}

function getSliderWidth()
	{
	return document.getElementById("slider").firstChild.offsetWidth
	}
function nfo(tx)
	{
		nf=document.getElementById('NFO')
	if (nf)	{nf.innerHTML=tx}
	}
function cursorInfo(e)
	{
	xprop=(document.all?window.event.clientX:e.pageX)
	yprop=(document.all?window.event.clientY:e.pageY)
	//c=document.getElementById("slider")
	//c.innerHTML=xprop+'x'+yprop
	//c.style.left=xprop+'px'
	//currentPos=xprop
	}
function slide()
	{
	Sdiference=xprop-currentPos
	if (Sdiference<2 && Sdiference>-2) {return}
	tmp=Sdiference/5
	
	wwidth=winwidth()
	
	cOCJ.style.left=Math.max(Math.min((currentPos+tmp-27),(wwidth-55)),0)+'px'
	currentPos=(currentPos+tmp)
	}
function slide2()
	{stav="0"
	tempW=SLW-wwidth
	if (  tempW>0 || true  ) 
		{
		if (  xprop<wwidth/5 && currentPos < -3  ) 
			{stav="A"
			cOCJ.style.left=(currentPos+(((wwidth/5)-xprop)*0.1))+'px'
			currentPos=(currentPos+(((wwidth/5)-xprop)*0.1))
			};
		if (  xprop>wwidth/5*4 && wwidth+Math.abs(currentPos) < SLW+(wwidth-888)  ) 
			{stav="B"
			cOCJ.style.left=(currentPos-((xprop-wwidth/5*4)*0.1))+'px'
			currentPos=(currentPos-((xprop-wwidth/5*4)*0.1))
			};
		};
	nfo('Sdiference:'+Sdiference
		 +'<br />xprop:'+xprop
		 +'<br />wwidth:'+wwidth
		 +'<br />currentPos:'+currentPos
		 +'<br />SLW:'+SLW
		 +'<br />tempW:'+tempW
		 )
		/*
	c=document.getElementById("content").innerHTML=stav
	+"<br />xprop "+xprop
	+"<br />wwidth "+wwidth
	+"<br />currentPos "+currentPos
	+"<br />SLW "+SLW
	*/
	}

function presetColor(val) 
	{
	colors=val.split(',')
	tmp='';
	defcol='';
	if (  colors.length==1  ) 
		{
		atoms=colors[0].split('+');
		for (i2=0; i2<atoms.length ; i2++) {atoms[i2]='<span class="colorSel kc'+atoms[i2]+'"></span>';};
		defcol=atoms.join('+')
		document.getElementById("Kbuy-0").innerHTML=defcol;
		}
	else
		{
		document.getElementById("Kbuy-0").innerHTML="Vyberte barvu zde"
		for (i=0; i<colors.length ; i++) 
			{
			atoms=colors[i].split('+');
			tmp+='<a class="item2 arrow" id="Kbuy-0-'+i+'"  href="javascript:void(0)" onclick="useColor(this,\''+colors[i]+'\')">'
			for (i2=0; i2<atoms.length ; i2++) {atoms[i2]='<span class="colorSel kc'+atoms[i2]+'"></span>';};
			tmp+=atoms.join('+')
			tmp+='</a>\n'
			};
		};
	//tmp+='<IFRAME id=Kbuy-0-section-iframe style="DISPLAY: block; Z-INDEX: -1; FILTER: alpha(opacity=0); LEFT: -1px; WIDTH: 108px; POSITION: absolute; TOP: -1px; HEIGHT: 92px" src="about:blank;" frameBorder=0 scrolling=no></IFRAME>'
	tmp+='<DIV id=Kbuy-0-section-iframe style="DISPLAY: block; padding-right:10px; Z-INDEX: 1200; FILTER: alpha(opacity=0); LEFT: -1px; WIDTH: 108px; POSITION: absolute; TOP: -1px; HEIGHT: 92px"></DIV>'
	document.getElementById('Kbuy-0-section').innerHTML=tmp
	document.getElementById("OBJcolor").value=val
	}
	
function useColor(obj,val) 
	{
	document.getElementById("OBJcolor").value=val
	setcol=document.getElementById("Kbuy-0")
	if (  setcol  ) {setcol.innerHTML=obj.innerHTML};
	}

function setWwidth() {wwidth=winwidth()}
function Hilite(e) {
	//evt=(window.event?window.event.srcElement:e.target);evt.style.borderColor='#3366cc';if ( evt.filters   ) {evt.filters.alpha.opacity=100;};
	}//
function Restore(e) {
	//evt=(window.event?window.event.srcElement:e.target);evt.style.borderColor=( ( evt.id==selectedID ) ? ('red') : ('silver') );if (  evt.filters  ) {evt.filters.alpha.opacity=75;};
	}

window.onload = function() 
	{
	cOCJ=document.getElementById("slider")
	if (  cOCJ  ) 
		{
		wwidth=winwidth()
		SLW=cOCJ.firstChild.offsetWidth
		//cOCJ.attachEvent
		ctmp= cOCJ.getElementsByTagName("A") 
		//alert(ctmp.length)
		//alert(ctmp(ci).length)
		
		if (  cOCJ.addEventListener  ) 
			{
			document.getElementById('zbimg').addEventListener ('load', function () 
				{
				zbi=document.getElementById('zbimg')
				mod=zbi.offsetHeight/-2;
				zbi.style.top=mod+'px';
				zbi.style.visibility="visible";
				}, false);
			for (ci=0; ci<ctmp.length ; ci++) 
				{
				ctmp[ci].addEventListener ('mouseover', Hilite, false);
				ctmp[ci].addEventListener ('mouseout', Restore, false);
				ctmp[ci].addEventListener ('click', loadZbozi, true);
				//tmp=ctmp[ci].firstChild.id.split("_")[1]
				ctmp[ci].href="javascript:void(0);";
				};
			}
		else
			{
			document.getElementById('zbimg').attachEvent ('onload',function () {document.getElementById('zbimg').style.visibility="visible";});
			for (ci=0; ci<ctmp.length ; ci++) 
				{
				ctmp[ci].attachEvent ('onmouseover', Hilite);
				ctmp[ci].attachEvent ('onmouseout', Restore);
				ctmp[ci].attachEvent ('onclick', loadZbozi);
				//tmp=ctmp[ci].firstChild.id.split("_")[1]
				ctmp[ci].setAttribute("href", "#")
				};
			};
		/*
			*/
		setInterval('slide2()',40)
		};
	
	if (FF && false)
		{
		zbi=document.getElementById('zbimg')
		mod=zbi.offsetHeight/-2;
		zbi.style.top=mod+'px';
		}
	
    var ddmx = new DropDownMenuX('menu1');
    ddmx.delay.show = 0;
    ddmx.delay.hide = 400;
    ddmx.position.levelX.left = 2;
    ddmx.init();
	
	};
	
function controllForm(cnt)
	{
	var chyba=""
	if (cnt.usern.value.length < 4) {chyba+="uživatelské jméno musí mít min. 4 znaky.\n";};
	if (cnt.heslo.value.length < 1) {chyba+="doplňte heslo\n";}
	else
		{
		if (cnt.heslo.value.length<5) {chyba+="minimální délka hesla je 5 znaků\n";}
		if (cnt.heslo.value!=cnt.hesloz.value) {chyba+="heslo a kontrolní heslo se neshodují\n";}
		};
	if (cnt.jmeno.value.length < 1) {chyba+="doplňte jméno\n";};
	if (cnt.prijmeni.value.length < 1) {chyba+="doplňte příjmení\n";};
	if (cnt.regtypFirm.checked) 
		{
		if (cnt.firma.value.length < 1) {chyba+="doplňte název firmy\n";};
		if (cnt.ico.value.length != 8 ) {chyba+="neplatné IČO firmy (doplňte na 8 míst)\n";};
		};
	if (cnt.ulice.value.length < 1) {chyba+="doplňte ulici\n";};
	if (cnt.mesto.value.length < 1) {chyba+="doplňte město\n";};
	if (cnt.psc.value.length < 5) {chyba+="neplatné PSČ\n";};
	if (cnt.telefon.value.length < 1) {chyba+="doplňte telefon\n";};
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cnt.email.value)) {chyba+="e-mail je neplatný \n";};
	if (cnt.dodadr.checked) 
		{
		if (cnt.dulice.value.length < 1) {chyba+="doplňte ulici dodací adresy\n";};
		if (cnt.dmesto.value.length < 1) {chyba+="doplňte město dodací adresy\n";};
		if (cnt.dpsc.value.length < 5) {chyba+="neplatné PSČ dodací adresy\n";};
		};
	if (  chyba.length==0  ) 
		{
		cnt.submit()
		}
	else 
		{
		alert("Ve formuláři se vyskytly chyby.\nZkontrolujte prosím následující položky\n\n"+chyba)
		};
	}

function controllUpdate(cnt)
	{
	var chyba=""
	if (cnt.heslo.value.length > 0 ) 
		{
		if (cnt.heslo.value.length<5) {chyba+="minimální délka hesla je 5 znaků\n";}
		if (cnt.heslo.value!=cnt.hesloz.value) {chyba+="heslo a kontrolní heslo se neshodují\n";}
		};
	if (cnt.jmeno.value.length < 1) {chyba+="doplňte jméno\n";};
	if (cnt.prijmeni.value.length < 1) {chyba+="doplňte příjmení\n";};
	if (cnt.regtypFirm.checked) 
		{
		if (cnt.firma.value.length < 1) {chyba+="doplňte název firmy\n";};
		};
	if (cnt.ulice.value.length < 1) {chyba+="doplňte ulici\n";};
	if (cnt.mesto.value.length < 1) {chyba+="doplňte město\n";};
	if (cnt.psc.value.length < 5) {chyba+="neplatné PSČ\n";};
	if (cnt.telefon.value.length < 1) {chyba+="doplňte telefon\n";};
	if (!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cnt.email.value)) {chyba+="e-mail je neplatný \n";};
	if (cnt.dodadr.checked) 
		{
		if (cnt.dulice.value.length < 1) {chyba+="doplňte ulici dodací adresy\n";};
		if (cnt.dmesto.value.length < 1) {chyba+="doplňte město dodací adresy\n";};
		if (cnt.dpsc.value.length < 5) {chyba+="neplatné PSČ dodací adresy\n";};
		};
	if (  chyba.length==0  ) 
		{
		cnt.submit()
		}
	else 
		{
		alert("Ve formuláři se vyskytly chyby.\nZkontrolujte prosím následující položky\n\n"+chyba)
		};
	}
/**/
window.document.onmousemove = cursorInfo;
window.onresize = setWwidth;

function controllSubmit(frm)
	{
	if (frm.OBJcolor.value.length==0)
		{
		alert("Před nákupem prosím vyberte barvu!");
		return false;
		}
	}

function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
else
{intializemarquee2()}
}

function intializemarquee2(){
if (  document.getElementById("marq")  ) {document.getElementById("marq").innerHTML=marqueecontents};
}

function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write('<nobr>'+marqueecontents+'</nobr>')
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.width
scrollit()
}

function scrollit(){
if (document.cmarquee01.document.cmarquee02.left>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.left-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.left=marqueewidth
scrollit()
}
}

function logoff()
  	{
	document.lgf.reurl.value=document.location.href
	document.lgf.submit()
	}
function moveLogin(m)
	{
	lgn=document.getElementById("loginfrm")
	ot=lgn.offsetTop+( (m) ? ( 5 ) : (-5) )
	lgn.style.top=ot+'px'
	if (m && ot<-40) {setTimeout("moveLogin(true)",10);}
	if (!m && ot>-160) {setTimeout("moveLogin(false)",10);}
	}