function CheckModForm(){
	var objForm = document.forms.device;
	for(i=0; i<objForm.pktblCommoditDevice.length; i++){
		if(objForm.pktblCommoditDevice[i].checked) return true;
	} 
	alert('Zvolte prosím alespoň jedno zařízení'); 
	return false;
}


function jsOrdChangeDelivery(idDelivery)
{
	aBase = gORD_DeliBase.split('|')
	aSum = gORD_DeliSum.split('|')
	eval("aDel = gORD_Deli"+idDelivery.toString()+".split('|')");

	if(parseInt(aDel[0]) > 0)
		getE('idORD_DeliHIDER').className = 'show'
	else
		getE('idORD_DeliHIDER').className = 'hide'

	if(parseInt(aDel[4]) > 0)
		getE('idORD_DelmanHIDER').className = 'show'
	else
		getE('idORD_DelmanHIDER').className = 'hide'
		
	getE('idORD_DeliAsItem1').innerHTML =	jsFormatPrice( aDel[0] )
	getE('idORD_DeliAsItem2').innerHTML =	jsFormatPrice( aDel[0] )

	getE('idORD_DelmanAsItem1').innerHTML =	jsFormatPrice( aDel[4] )
	getE('idORD_DelmanAsItem2').innerHTML =	jsFormatPrice( aDel[4] )
	
	
	//getE('ORD_DeliPriceNV').value=			aDel[0]
	document.forms['OrderForm'].ORD_DeliPriceNV.value = aDel[0];
	//getE('ORD_DeliPriceV').value=			aDel[1]
	document.forms['OrderForm'].ORD_DeliPriceV.value = aDel[1];
	//getE('ORD_DeliPriceWV').value=			aDel[2]
	document.forms['OrderForm'].ORD_DeliPriceWV.value = aDel[2];
	//getE('ORD_DeliVat').value=				aDel[3]
	document.forms['OrderForm'].ORD_DeliVat.value = aDel[3];

	//getE('ORD_DelmanPriceNV').value=		aDel[4]
	document.forms['OrderForm'].ORD_DelmanPriceNV.value = aDel[4];
	//getE('ORD_DelmanPriceV').value=			aDel[5]
	document.forms['OrderForm'].ORD_DelmanPriceV.value = aDel[5];
	//getE('ORD_DelmanPriceWV').value=		aDel[6]
	document.forms['OrderForm'].ORD_DelmanPriceWV.value = aDel[6];

	
	getE('idORD_DeliRowDphNV').innerHTML =	jsFormatPrice( aBase[0]*1 + aDel[0]*1 + aDel[4]*1	)
	getE('idORD_DeliRowDphV').innerHTML =	jsFormatPrice( aBase[1]*1 + aDel[1]*1 + aDel[5]*1	)
	getE('idORD_DeliRowDphWV').innerHTML =	jsFormatPrice( aBase[2]*1 + aDel[2]*1 + aDel[6]*1	)

	getE('idORD_DeliRowSumNV').innerHTML =	jsFormatPrice( aSum[0]*1 + aDel[0]*1 + aDel[4]*1	)
	getE('idORD_DeliRowSumV').innerHTML =	jsFormatPrice( aSum[1]*1 + aDel[1]*1 + aDel[5]*1	)
	getE('idORD_DeliRowSumWV').innerHTML =	jsFormatPrice( aSum[2]*1 + aDel[2]*1 + aDel[6]*1	)	
	getE('idORD_DeliSumSum').innerHTML =	jsFormatPrice( aSum[2]*1 + aDel[2]*1 + aDel[6]*1	)
}

function jsFormatPrice(v)
{
	v = parseInt(v * 100) / 100
	v = v.toString()
	
	if (v.indexOf('.') > 0)
		v = v.replace('.', ',')
	else
		v = v + ',00'

	i = v.indexOf(',')
	v += '000'
	v = v.substring(0, i+3)
	
	if (i>3)
	{
		i -= 3
		v = v.substring(0,i) + ' ' + v.substring(i, v.length)
	}
	
	return v
}

function jsOnLoad()
{
//	getE('idOnUnload_Hide').className = 'Show';
//	getE('idOnUnload_Show').className = 'Hide';
}
function jsOnUnload()
{
//	getE('idOnUnload_Hide').className = 'Hide';
//	getE('idOnUnload_Show').className = 'Show';
}
function jsOnBeforeUnload()
{
	oh=getE('idOnUnload_Hide');	
	os=getE('idOnUnload_Show');	

	if(oh && os)
	{
		w = oh.offsetWidth
		oh.className = 'Hide';
		
		os.style.width = w;
		os.className = 'Show';
	}
}

function getE(objectID)
{
	if (Br.IE)
		return document.all[objectID]
	else
		return document.getElementById(objectID)
}

function getF(formName)
{
//alert(document.forms[formName])
	return document.forms[formName]
}


// ###   FCE PRO DIALOG ZADANI VOLITELNYCH PARAMETRU   ###
var gsFormSuffix, gsFormIndex, gStateTimer;

function ShowState(ID, x, y)
{

	window.clearTimeout(gStateTimer);

	// nastavime box do spravne pozice
	getE('StateInfo2').innerHTML = '<br>probíhá<br>připojování...<br>&nbsp;';
	getE('StateInfo1').style.top = y;
    getE('StateInfo1').style.left= x;
    getE('StateInfo3').innerHTML = 'd o s t u p n o s t'
    getE('StateInfo4').innerHTML = "X"
    getE('StateInfo1').className = "Show"

	getE('idWinStat').src = '/InfoState_IFRAME.asp?ID=' + ID.toString();
}

//////////////////////////////////////////////////////////////////////////////////////////
function BuyOrSetVariableParams(sFormSuffix,sFormIndex, x, y)
{

	var f = getF('FormBuy' + sFormSuffix.toString() + sFormIndex.toString())

	if (!Br.OK_BuyIframe) {f.submit(); return;}

	var s = getE('DivForPars' + sFormSuffix.toString() + sFormIndex.toString()).innerHTML;

	gsFormIndex = sFormIndex;
	gsFormSuffix = sFormSuffix;
		
	// nastavime box do spravne pozice
	getE('StateInfo2').innerHTML = '<br>probíhá<br>připojování...<br>&nbsp;';
	getE('StateInfo1').style.top = y;
    getE('StateInfo1').style.left= x;
    getE('StateInfo4').innerHTML = "X"


// nactu si variabilni parametry konkretniho zbozi



	window.clearTimeout(gStateTimer);


	if (s == "")
	{
	    getE('StateInfo3').innerHTML = "k o š í k"
	    getE('StateInfo1').className = "Show"

		f.action = '/Order_Add_IFRAME.asp';
		f.target = 'WinStat';
		f.submit();
	}
	else 
	{
	    getE('StateInfo3').innerHTML = "p a r a m e t r y"
	    
		getE('StateInfo2').innerHTML = 
			'<table width="100%" border=0 cellpadding=1 cellspacing=0>' +
			'<tr><td colspan=3 align=center>zvolte parametry zboží</td></tr>' +
			'<tr><td colspan=3 height=5></td></tr>' +
			'<tr><td colspan=3 align=center id=StateInfoParams>' +
		s +
				'</td></tr>' +
			'<tr><td colspan=3 height=5></td></tr>' +
			'<tr>' +
				'<td><input type=button class=SubmitBack onClick="getE(\'StateInfo1\').className=\'Hide\';"" value="zrušit " style="width:70;"></td>' +
				'<td>&nbsp;</td>' +
				'<td><input type=button class=SubmitTxt onClick="CopyParamsBack(); getE(\'StateInfo1\').className=\'Hide\';"" value=" koupit" style="width:70;"></td>' +
			'</tr>'
			'</table>'
	    
	    getE('StateInfo1').className = "Show"

//		getE('ParamTbl').style.display = 'inline';
	}
}

function ShowState_Timer(secStart, secActual)
{

	if (isNaN(secActual))
	{
		getE('StateInfo4').innerHTML = secStart.toString();
		secActual = secStart;
	}

	if (secActual < 2)
		getE('StateInfo1').className = "Hide"
	else
	{
		secActual--;
		if (secActual < 1) {secTime=50}
		getE('StateInfo4').innerHTML = secActual.toString();
		gStateTimer = setTimeout('ShowState_Timer(\''+secStart+'\', \''+secActual+'\')', 1000)
	}
}

function CopyParamsBack() {
	getE('DivForPars' + gsFormSuffix.toString() + gsFormIndex.toString()).innerHTML = getE('StateInfoParams').innerHTML;
	getF('FormBuy' + gsFormSuffix.toString() + gsFormIndex.toString()).submit();
}

// ###   FCE PRO ROZKLIKAVANI KATEGORII   ###

function InsertCookiesCat(intId,idTree){
	document.cookie="category"+idTree+"="+intId+";";
	document.cookie="category"+idTree+"="+intId+";";
}
function checkParent(src, dest) {
	while (src!=null) {
		if (src.tagName == dest) return src;
			src = src.parentElement;
	}
	return null;
}

function outlineCat() {    
	var open = event.srcElement;
	var el = checkParent(open, "TD");
	if (null!=el) {
		var pos = 0;
		for (var pos=0; pos<el.children.length; pos++) {
			if ("TABLE"==el.children[pos].tagName) {
				if (el.children[0].src.indexOf("/img/catTree/plus.gif")>0) {
					el.children[0].src = "/img/catTree/minus.gif";
				}else{
					el.children[0].src = "/img/catTree/plus.gif";
				}
				break;
			}
		}
	    if (pos==el.children.length) return;
	} else return;
	el = el.children[pos];
	if ("TABLE"==el.tagName) {
		if (""==el.style.display) {
			el.style.display = "none";
		} else {
			el.style.display = "";
		}
	}
	event.cancelBubble = true;
}

// ###   FCE PRO PriceList ###

function SHModalDlgPricelist()
{
	var strReturn = showModalDialog("/Includes/EmailPricelist.htm","","status:no; center:yes; help:no; minimize:no;dialogWidth=320px;dialogHeight=124px;");

    if (strReturn == "") return;
	document.location.href = "/EmailPricelist.asp?EmailPricelist=" + strReturn;
}

// ##########

function onAction(imgName){
       document.all[imgName].src = eval(imgName + "on.src")
}

function offAction(imgName){
	if (oldImgName.substring(0,4)!=imgName.substring(0,4)){
		document.all[imgName].src = eval(imgName + "off.src")
	}
}

function OpenWnd(strURL){
	var objWnd = window.open(strURL,"InfoDetail","scrollbars=no,height=500,width=400,left=10,top=10");
	objWnd.focus();
}

function AddBuy(strName, intPrice, intDph, strCode) {
	var strData,strReturn
	strData = strName+"&"+intPrice+"&"+intDph+"&"+strCode
	strReturn = showModalDialog("/AddUpdBuy.asp",strData,"status:no; center:yes; help:no; minimize:no;dialogWidth=350pt;dialogHeight=200pt");
	if (strReturn == "1")
		ActionCookies('BZbuy');
	else if (strReturn == "2")
		window.location.href = "/order.asp";
}
function AddBuyDetail(strName, intPrice, intDph, strCode) {
	var strData,strReturn
	strData = strName+"&"+intPrice+"&"+intDph+"&"+strCode
	strReturn = showModalDialog("/AddUpdBuy.asp",strData,"status:no; center:yes; help:no; minimize:no;dialogWidth=350pt;dialogHeight=200pt");
	if (strReturn == "1"){
		window.opener.ActionCookies('BZbuy')
	}else if (strReturn == "2"){
		window.opener.location.href="/order.asp";
		window.close();
	}
}
function ActionCookies(strName){
	var strString,strSum1,strSum2,intSuma;
	strSum2 = new Array();
	intSuma = 0;

	strString = ExtractCookies(strName);
	if (strString > ""){
		strSum1 = strString.split("#");
		for (var i=0; i< strSum1.length-1; i++){
			strSum2[i] = strSum1[i].split("&");
			intSuma += BarterComma(strSum2[i][1])*BarterComma(strSum2[i][4]);
		}
		getE('CompletPrice').value =  FormatNumber(intSuma);
	}
}
function DeleteCookies(strName){
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() - 365);
	document.cookie=strName+"=; expires="+vyprs.toGMTString()+";";
	vyprs.setDate(365 + 365 + vyprs.getDate());
	document.cookie=strName+"=; expires="+vyprs.toGMTString()+";";
	getE('CompletPrice').value = "0.00";
}
function InsTreeCook(intId,idTree){
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() - 365);
	document.cookie="category"+idTree+"="+intId+"; expires="+vyprs.toGMTString()+";";
	vyprs.setDate(365 + 365 + vyprs.getDate());
	document.cookie="category"+idTree+"="+intId+"; expires="+vyprs.toGMTString()+";";
}
function InsertCookies(strName,strData){
	var vyprs=new Date();
	vyprs.setDate(vyprs.getDate() - 365);
	document.cookie=strName+"="+strData+"; expires="+vyprs.toGMTString()+";";
	vyprs.setDate(365 + 365 + vyprs.getDate());
	document.cookie=strName+"="+strData+"; expires="+vyprs.toGMTString()+";";
}

function ExtractCookies(strName){
	var cookieList=document.cookie.split("; ");
	var cookieArray = new Array();
	var name = "#"
	for (var i=0; i < cookieList.length; i++){
		if(cookieList[i].indexOf(strName)>-1){
			if( cookieList[i].indexOf("=")>-1){name = cookieList[i].split("=");}
		}
	}
	if (name != "#"){
		return name[1];
	}else{
		return "none";
	}
}
function ParseCookies(strName){
	var strCook = ExtractCookies(strName)
	if (strCook != "none"){
		var strList = strCook.split("a");
		for (var i=0; i < strList.length-1; i++){
			if(typeof(document.all[strList[i]+'a']) == "object"){document.all[strList[i]+'a'].click();}
		}
	}
}
function FormatNumber(text){
	var mezi = BarterComma(text);
	mezi = ''+Math.round(parseFloat(mezi) * 100);
	var desetiny = mezi.substring(mezi.length-2, mezi.length);
	var cele = mezi.substring(0,mezi.length-2);
	if (parseFloat(mezi) < 1){
	        var mezi = "0."+desetiny;
	}else{
	        var mezi = cele+"."+desetiny;
	}
	return mezi;
}
function BarterComma(text){
	var mezi = ''+text;
	if (mezi.indexOf(',') != -1){
		mezi = mezi.split(",");
		mezi = mezi[0]+"."+mezi[1];
	}else{
		mezi = text;
	}
	return parseFloat(mezi);
}
function ControlNumber(){
     if ((event.keyCode <48) || (event.keyCode >57)) event.returnValue = false;
}
//----------info okno-------------------------------------------------------
function InfoWindow(strAddress) {
       showModalDialog(strAddress,"Info","status:no; center:yes; help:no; minimize:no;dialogWidth=450pt;dialogHeight=320pt");
}
function WriteDate(){
	var strDay=new Date();
	var d=strDay.getDay();
	if (d==1) document.writeln('pondělí');
	else { if (d==2) document.writeln('úterý');
	else { if (d==3) document.writeln('středa');
	else { if (d==4) document.writeln('čtvrtek');
	else { if (d==5) document.writeln('pátek');
	else { if (d==6) document.writeln('sobota');
	else { if (d==0) document.writeln('neděle'); }}}}}};
	document.writeln(strDay.getDate(),'.',strDay.getMonth()+1,'.',strDay.getFullYear());
	}
function EmailControl(f){
	if ((f=='' || f=='vas@email.cz') ||(f.indexOf('@') < 1 || f.indexOf('@') != f.lastIndexOf('@') || f.lastIndexOf('.') < f.lastIndexOf('@')+2  || f.lastIndexOf('.') > (f.length-3) || f.lastIndexOf('.') < (f.length-4))){
		alert('Nesprávný formát emailu');
		return false;
		}
	return true;
}
function ShowSearchMenu(x){
    if (x == 1){
        getE('SearchTable').style.display='';
    }else{
        getE('SearchTable').style.display='none';
    }
}
function LocInfo(){
	getE('StateInfo2').innerHTML="  probíhá připojování...";
	var e = event.srcElement;
	var y = 0;
	var x = 0;
	while (typeof e == 'object' && e.tagName != 'BODY'){
		y += e.offsetTop;
		e = e.offsetParent;
	};
	x = (window.screen.width/2)+375
	getE('StateInfo1').style.top=y-140;
	getE('StateInfo1').style.left=x;
}

function PositionInfo(strText){
	getE('StateInfo3').innerHTML=strText;
	getE('StateInfo2').innerHTML="  probíhá připojování...";
	var e = event.srcElement;
	var y = 0;
	var x = 0;
	//var x = event.clientX;
	while (typeof e == 'object' && e.tagName != 'BODY'){
		y += e.offsetTop;
		x += e.offsetLeft;
		e = e.offsetParent;
	};
	getE('StateInfo1').style.top=y-4;
    getE('StateInfo1').style.left=x - 262;
}

function LocState(strCode,intCount){
	window.parent.frames['WinStat'].location.href="/InfoState.asp?ID="+strCode+"&CN="+intCount
	PositionInfo("On-line stav");
}
function ChangeStorage(bState){
	if(bState){
		for(var i = 0; i < document.all['S'].length; i++){
			document.all['S'][i].value="0"
		}
	}else{
		for(var i = 0; i < document.all['S'].length; i++){
			document.all['S'][i].value="-1"
		}
	}
}
function ChangeCloseout(bState){
	if(bState){
		for(var i = 0; i < document.all['C'].length; i++){
			document.all['C'][i].value="1"
		}
	}else{
		for(var i = 0; i < document.all['C'].length; i++){
			document.all['C'][i].value="3"
		}
	}
}

function ShowImage(ID, strImg, x, y)
{

	//alert(x + ' : ' + y)


	window.open('/ShowImage.asp?IMG='+strImg+'', 'Foto'+ID.toString(), 'scrollbars=auto,height=150,width=150,left='+x+',top='+y+'');
}


function ControlUserDataSubmit(ID)
{
	var f = getF('UserDataForm')

	if (getE('bFirm1').checked == true)
	{
		if(f.Firm.value == "")		{alert("Vyplňte název firmy");								f.Firm.focus();		return false}
	}else{
		if(f.FirstName.value == "")	{alert("Vyplňte jméno");									f.FirstName.focus();return false}
		if(f.LastName.value == "")	{alert("Vyplňte příjmení");									f.LastName.focus();	return false}
	}
	if(f.Street.value == "")		{alert("Vyplňte ulici.");									f.Street.focus();	return false}
	if(f.City.value == "")			{alert("Vyplňte město.");									f.City.focus();		return false}
	if(f.ZipCode.value == "")		{alert("Vyplňte PSČ.");										f.ZipCode.focus();	return false}
	if(f.Phone.value == "")			{alert("Vyplňte telefon.");									f.Phone.focus();	return false}
	if(f.Email.value == "")			{alert("Vyplňte email.");									f.Email.focus();	return false}
	if(f.Login.value == "")			{alert("Vyplňte přihlašovací jméno.");						f.Login.focus();	return false}
	if(f.Login.value.length < 5)	{alert("Přihlašovací jméno musí mít minimálně 5 znaků.");	f.Login.focus();	return false}
	if(ID==0)
	{
		if(f.Password.value == "")		{alert("Vyplňte heslo.");									f.Password.focus();	return false}
		if(f.Password.value.length < 5)	{alert("Heslo musí mít minimálně 5 znaků.");				f.Password.focus();	return false}
	}
	else
	{
		if(f.Password.value.length < 5 && f.Password.value.length > 0)	{alert("Chcete-li změnit heslo, zadejte minimálně 5 znaků.");				f.Password.focus();	return false}
	}
	return true
}
function ControlUserAccountSubmit(f)
{
	if(f.AccFirstName.value == "")	{alert("Vyplňte jméno");									f.AccFirstName.focus();return false}
	if(f.AccLastName.value == "")	{alert("Vyplňte příjmení");									f.AccLastName.focus();	return false}
	if(f.AccEmail.value == "")	{alert("Vyplňte email.");									f.AccEmail.focus();	return false}
	if(f.AccLogin.value == "")	{alert("Vyplňte přihlašovací jméno.");						f.AccLogin.focus();	return false}
	if(f.AccDelivery.value == "")	{alert("Vyplňte dodací adresu.");						f.AccDelivery.focus();	return false}
	if(f.AccLogin.value.length < 5)	{alert("Přihlašovací jméno musí mít minimálně 5 znaků.");	f.AccLogin.focus();	return false}
	if(parseInt(f.AccId)==0)
	{
		if(f.AccPassword.value == "")		{alert("Vyplňte heslo.");									f.AccPassword.focus();	return false}
		if(f.AccPassword.value.length < 5)	{alert("Heslo musí mít minimálně 5 znaků.");				f.AccPassword.focus();	return false}
	}
	else
	{
		if(f.AccPassword.value.length < 5 && f.AccPassword.value.length > 0)	{alert("Chcete-li změnit heslo, zadejte minimálně 5 znaků.");				f.AccPassword.focus();	return false}
	}
	return true
}

function ControlDataOrder()
{
	var f = document.OrderForm
	if(f.DeliveryType.value == "")	{alert("Vyberte způsob dopravy.");							f.DeliveryType.focus();	return false}
	if(f.PaymentType.value == "-")	{alert("Vyberte způsob platby.");							f.PaymentType.focus();	return false}
	if(f.YourInternalOrderNumber.value == "")	{alert("Zadejte interní číslo objednávky.");	f.YourInternalOrderNumber.focus();	return false}
	
	return true;
}

function UserDataChange_bFirm(v)
{
	if (v == 1)
	{
		getE('id_bFirm1').innerHTML = "*"
		getE('id_bFirm0j').innerHTML = ""
		getE('id_bFirm0p').innerHTML = ""
	}
	else
	{
		getE('id_bFirm1').innerHTML = ""
		getE('id_bFirm0j').innerHTML = "*"
		getE('id_bFirm0p').innerHTML = "*"
	}
}


//////////////////////////////////////////////////////////////////////////////////////////////////////////////
// VALIDACE FORMULARE PREHLEDU OBJEDNAVEK ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrded_change_fEnable(no, typ)
{
	var f = getF('FFF')
	f.fType.value   = typ;
	f.fEnable.value = no;
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrder_ByLast()
{
	var f = getF('FFF')
	if(isNaN(f.LastOrder.value))	{alert('Zadaný počet posledních objednávek není číslo!');	f.LastOrder.focus();	return;}
	if(f.LastOrder.value == '')		{alert('Zadejte počet posledních objednávek!');				f.LastOrder.focus();	return;}
	if(f.LastOrder.value == 0)		{alert('Ale ale, posledních 0 ...??... \n8-)');				f.LastOrder.focus();	return;}
	validateOrded_change_fEnable(1);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrder_One()
{
	var f = getF('FFF')
	if(f.n_Doklad.value == '')		{alert('Zadejte její číslo!');								f.n_Doklad.focus();	return;}
	if(f.n_Doklad.value == 0)		{alert('Ale ale, č. 0 ...??... \n8-)');						f.n_Doklad.focus();	return;}
	validateOrded_change_fEnable(1, 'One');
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrder_Serial()
{
	var f = getF('FFF')
	if(f.s_Serial.value == '')		{alert('Zadejte seriové číslo!');								f.s_Serial.focus();	return;}
	if(f.s_Serial.value == 0)		{alert('Ale ale, č. 0 ...??... \n8-)');						f.s_Serial.focus();	return;}
	validateOrded_change_fEnable(1, 'Serial');
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrder_ByDate()
{
	var f = getF('FFF')
	if(!isDate(f.OneDay.value))	{alert('Neplatný formát data!');								f.OneDay.focus();		return;}
	validateOrded_change_fEnable(1);
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function validateOrder_List()
{
	var f = getF('FFF')
	if(!isDate(f.d_D1.value))		{alert('Neplatný formát data OD!');							f.d_D1.focus();		return;}
	if(!isDate(f.d_D2.value))		{alert('Neplatný formát data DO!');							f.d_D2.focus();		return;}
	if(!validatedateftomto(f.d_D1.value, f.d_D2.value))
	{
		alert('Datum OD je větší než DO!');
		f.d_D1.focus();
		return;
	}
	validateOrded_change_fEnable(1, 'List');
}

/////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////

function isDate(fDate)
{	var status = true
	a = fDate.split(".")
	if (a.length!=3) {status = false}
	if (isNaN(a[0]) || a[0]<1 || a[0]>31) {status = false}
	if (isNaN(a[1]) || a[1]<1 || a[1]>12) {status = false}
	if (isNaN(a[2]) || a[2]<1900 || a[2]>2100) {status = false}
	if ((a[1]==4 || a[1]==6 || a[1]==9 || a[1]==11) && (a[0]>30)) {status = false}
	if (a[1]==2 && a[2]%4==0) {if ((a[0]>29)) {status = false}}
	if (a[1]==2 && a[2]%4!=0) {if ((a[0]>28)) {status = false}}
	return status
}

function validatedateftomto(pdateFrom, pdateTo)
{	dF = pdateFrom.split(".")
	dT = pdateTo.split(".")
	OK=true

	if ((parseInt(dF[2])<parseInt(dT[2])) && OK) return true;
	if ((parseInt(dF[2])<=parseInt(dT[2])) && OK) OK=true; else OK=false;
	if ((parseInt(dF[1])<parseInt(dT[1])) && OK)  return true;
	if ((parseInt(dF[1])<=parseInt(dT[1])) && OK) OK=true; else OK=false;
	if ((parseInt(dF[0])<parseInt(dT[0])) && OK) return true;
	if ((parseInt(dF[0])<=parseInt(dT[0])) && OK) OK=true; else OK=false;
	if (!OK) return false;
	return true;
}

/////////////////////////////////////////////////////////////////////////////////////////////////

var SrchAndLog_HideTimer

function SrchAndLog_Over(bSearch, showTempClass)
{
	var strEval = ''
	
	if (bSearch == 1)
	{
		if (showTempClass)
		{
			window.clearTimeout(SrchAndLog_HideTimer)
			
			if (getE('idSrchMore_DIV').className == 'Hide'){
				getE('idSrchMore_DIV').className = 'ShowTmp';
				
				if (getE('idLogMore_DIV').className != 'Hide')
					getE('idLogMore_DIV').className = 'HideTmp';
			}
		}else{
			if (getE('idSrchMore_DIV').className == 'ShowTmp')
				strEval += "getE('idSrchMore_DIV').className = 'Hide';"
				
			if (getE('idLogMore_DIV').className == 'HideTmp')
				strEval += "getE('idLogMore_DIV').className = 'Show';"
				
			if (strEval != ''){
				strEval = "SrchAndLog_HideTimer = window.setTimeout(\"" + strEval + "\",500);"
				eval(strEval)
			}
			
		}
	}
	else
	{
		if (showTempClass)
		{
			window.clearTimeout(SrchAndLog_HideTimer)
			
			if (getE('idLogMore_DIV').className == 'Hide')
			{
				getE('idLogMore_DIV').className = 'ShowTmp'
				
				if (getE('idSrchMore_DIV').className != 'Hide')
					getE('idSrchMore_DIV').className = 'HideTmp'
			}
		}
		else
		{
			if (getE('idLogMore_DIV').className == 'ShowTmp')
				strEval += "getE('idLogMore_DIV').className = 'Hide';"
				
			if (getE('idSrchMore_DIV').className == 'HideTmp')
				strEval += "getE('idSrchMore_DIV').className = 'Show';"

			if (strEval != ''){
				strEval = "SrchAndLog_HideTimer = window.setTimeout(\"" + strEval + "\",500);"
				eval(strEval)
			}
		}
	}

}

/////////////////////////////////////////////////////////////////////////////////////////////////

function SrchAndLog_Switch(bShowSrch)
{
	window.clearTimeout(SrchAndLog_HideTimer)
			
	if (bShowSrch == 1)
	{
		getE('idLogMore_DIV').className = 'Hide';
		getE('idSrchMore_DIV').className = 'Show';

		getE('idSrchMore_IMG').src = '/img/SrchMorePasiv.gif'
		getE('idLogMore_IMG').src = '/img/LogMoreActiv.gif'

		getE('idSrchMore_HAND1').className = 'empty'
		getE('idSrchMore_HAND2').className = 'empty'
		getE('idLogMore_HAND').className = 'Hand'
	}
	else
	{
		getE('idSrchMore_DIV').className = 'Hide';
		getE('idLogMore_DIV').className = 'Show';

		getE('idSrchMore_IMG').src = '/img/SrchMoreActiv.gif'
		getE('idLogMore_IMG').src = '/img/LogMorePasiv.gif'

		getE('idSrchMore_HAND1').className = 'Hand'
		getE('idSrchMore_HAND2').className = 'Hand'
		getE('idLogMore_HAND').className = 'empty'
	}
}

/////////////////////////////////////////////////////////////////////////////////////////////////


function fnClientInfoRefresh_Write(msg)
{
	if (getE('idClientInfoBox'))
		getE('idClientInfoBox').innerHTML = msg
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function fnDPG_Load(id, isLichy, objClick)
{
	id = id.toString()
	var L = getE('idDPG_Load'+id)
	var I = getE('idDPG_Ifra'+id)
	
	
	if((L) && (I))
	{
		if(I.className == 'Hide')
		{
			isLichy == 0 ? isLichy = '' : isLichy = "&DPGBodyLichy=DPGBodyLichy" //posilam styl lichych radku..
		
			if (L.innerHTML.length > 0)
			{
				L.className = 'Hide'
				objClick.className = 'DPGRunOn'
				
				if(L.innerHTML.substring(1, 5) != 'SPAN')
				{
					I.className = 'DPGIfra'
				}
				else
				{
					objClick.className = 'DPGRunOff'
					//objClick.title = 'žádné doplňující informace'
				}
			}
			else
			{
				L.className = 'DPGLoad'
				L.innerHTML = '<b>n a č í t á m&nbsp;&nbsp;&nbsp;d e t a i l&nbsp;&nbsp;&nbsp;z b o ž í . . .</b>'
				I.innerHTML = '<iframe src="/DetailPage_IFRAME.asp?DPG=' + id + isLichy + '" onLoad="/*fnDPG_OnLoad(' + id + ', this);*/" class=DPGIframe FRAMEBORDER=0 marginwidth=0 marginheight=0 marginleft=0 marginright=0 margintop=0 marginbottom=0 SCROLLING="auto"></iframe>'
			}
		}
		else
		{
			I.className = 'Hide'
			L.className = 'Hide'
		}
	}
}

function fnDPG_OnLoad(id, bodyLength)
{
	id = id.toString()
	var L = getE('idDPG_Load'+id)
	var I = getE('idDPG_Ifra'+id)

	if((L) && (I))
	{
		if (bodyLength < 10)
		{
			L.innerHTML = '<SPAN><b>n a č t e n o . . .</b></span>&nbsp;&nbsp;&nbsp;<span class=red>Detail zboží bohužel neobsahuje doplňující informace !</span>'
		}
		else
		{
			I.className = 'DPGIfra'
			L.className = 'Hide'
		}
	}
}