function winW() {
   if (window.innerWidth)
      /* NN4 a kompatibilní prohlížeče */
      return window.innerWidth;
   else if (document.documentElement && document.documentElement.clientWidth)
      /* MSIE6 v std. režimu - Opera a Mozilla
      již uspěly s window.innerWidth */
      return document.documentElement.clientWidth;
   else if (document.body && document.body.clientWidth)
      /* starší MSIE + MSIE6 v quirk režimu */
      return document.body.clientWidth;
   else
      return null;      
}
function Dotaznik() {
	var cookiestring=""+document.cookie;

	if (cookiestring.indexOf('Znovindotaznik_True') == -1) {
		formObject = document.getElementById('dotaznik');
		disabledObject = document.getElementById('disabled');
		disabledObject.style.height = document.getElementById('PageMozStart').offsetHeight + 'px';
		disabledObject.style.display='block';
		
		formObject.innerHTML='<iframe src="/dotaznik.asp" frameborder="0"></iframe>'
		formObject.style.display='block';
		formObject.style.left = (winW()/2)-390 + 'px';
		window.scrollTo(0, 0);
		
		var vyprs=new Date(); 
		vyprs.setDate(vyprs.getDate() + 365); 

		document.cookie='Data=Znovindotaznik_True; expires='+vyprs.toGMTString()+';'; 
	};
}

function showSearchBox() {
	if(document.getElementById('filter')) {document.getElementById('filter').style.display='none';}
	document.getElementById('searchbox').style.display='block';
	return false
}

function hideSearchBox() {
	if(document.getElementById('filter')) {document.getElementById('filter').style.display='block';}
	document.getElementById('searchbox').style.display='none';
}

function ClickPoll(PollID, PollVoteID, DepartmentID, LanguageID, ArticleID) {
	if(ArticleID!=='0') {
		window.open('article.asp?nArticleID=' + ArticleID + '&nPollID=' + PollID + '&nPollVoteID=' + PollVoteID + '&nDepartmentID=' + DepartmentID + '&nLanguageID=' + LanguageID, '_self')
		}
	else {
		window.open('default.asp?nPollID=' + PollID + '&nPollVoteID=' + PollVoteID + '&nDepartmentID=' + DepartmentID + '&nLanguageID=' + LanguageID, '_self')
		}
	}

function IsDigit()
{
  return (((event.keyCode >= 48) && (event.keyCode <= 57)) || (event.keyCode == 32) || (event.keyCode == 43));
}

/* vrchni menu */
function getAppVersion() {
	appname=navigator.appName;
	appversion=navigator.appVersion;
	majorver=appversion.substring(0,1);
	if((appname=="Netscape")&&(majorver>=3))return 1;
	if((appname=="Microsoft Internet Explorer")&&(majorver>=4))return 1;
	return 0;
}

function ChangeImg(ImgID, ImgName){
	var IMG = document.getElementById(ImgID);
	if (getAppVersion()) IMG.src="data/img/menu/"+ImgName;
}

//Global test for support Regular Expressions
var g_RegExpSupported = 0;
if(window.RegExp)
{
	var tempStr = "a";
	var tempReg = new RegExp(tempStr);
	if(tempReg.test(tempStr)) 
		g_RegExpSupported = 1;
}

function validate(ThisForm){
	var strHTML='';	
	var submitForm = true
 	var msg = ThisForm.sEmailForJS.value;	
	var str = ThisForm.sEmailForm.value;

	if(!g_RegExpSupported){
		if(!(str.indexOf(".") > 2) && (str.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += msg;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}	
	}
	else
	{	
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,3})(\\]?)$");
		if(!(!r1.test(str) && r2.test(str)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += msg;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}
	}

	if(ThisForm.sNameForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sNameForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sSurNameForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sSurNameFormJS.value);
			submitForm = false;
	}

	if(ThisForm.sStreetForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sStreetFormJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sCityForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sCityFormJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sZIPForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sZIPFormJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sWhereaboutsForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sWhereaboutsFormJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sDateForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sDateFormJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sCountPersonForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sCountPersonFormJS.value);
			submitForm = false;
	}

	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{
		return true
	}
}

function validate_Recommend(ThisForm){
	var strHTML='';	
	var submitForm = true
	var sSender = ThisForm.sEmailForm.value;
	var sAcceptor = ThisForm.sEmailFormAcceptor.value;

	if(!g_RegExpSupported){
		if(!(sSender.indexOf(".") > 2) && (sSender.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML +=  ThisForm.sEmailForJS.value;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}	
	}
	else
	{	
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,3})(\\]?)$");
		if(!(!r1.test(sSender) && r2.test(sSender)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML +=  ThisForm.sEmailForJS.value;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}
	}

	if(!g_RegExpSupported){
		if(!(sAcceptor.indexOf(".") > 2) && (sAcceptor.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML +=  ThisForm.sEmailAcceptorForJS.value;
			ThisForm.sEmailFormAcceptor.focus();
			submitForm = false;
		}	
	}
	else
	{	
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,3})(\\]?)$");
		if(!(!r1.test(sAcceptor) && r2.test(sAcceptor)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML +=  ThisForm.sEmailAcceptorForJS.value;
			ThisForm.sEmailFormAcceptor.focus();
			submitForm = false;
		}
	}

	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{
		return true
	}
}
/////////////////////////////////////////////////////////////////////////////////////
// Author: webProgress, s.r.o.
// Programmer: Richard Machát
// Date: 29.5.2002
//
// Dependency: webBlast_PageID_5_LanguageID_(X).xsl - language independent
//
// Description: Pří SUBMIT kontroluje jestli je vyplněno
//								-
//								-
//								-
//								-
//								-
//
/////////////////////////////////////////////////////////////////////////////////////

function ShowHidePriceTransport(id) {

     if (id == 1) {
          var praha4 = 'osobní odběr - Proutěná 408, 149 00 Praha 4'
          var praha5 = 'osobní odběr - Štefánikova 18/25, 150 00 Praha 5'
          var praha6 = 'osobní odběr - Na Hanspaulce 25, 160 00 Praha 6'
          var brno = 'osobní odběr - Herčíkova 10, 612 00 Brno - Královo pole'
          var ostrava = 'osobní odběr - Betonářská 1, Slezská Ostrava'
          var beroun = 'osobní odběr - Okružní 1467, 266 01 Beroun'
          var budejovice = 'osobní odběr - Jírovcova 10, České Budějovice'
          var zlin = 'osobní odběr - Náves 36, Zlín-Prštné'
          var znojmo = 'osobní odběr - Loucký Klášter Znojmo'
          var privat = 'Privátní box v Moravském sklípku v Šatově'
          var posta = 'Zasilková služba, poštou na dobírku'
          var dpl = 'Rozvážková služba vín do domu nebo firmy, dovoz zdarma již od nákupu za 5 000 Kč'
     } else {
          var praha4 = 'PERSONAL COLLECTING - Proutěná 408, 149 00 Praha 4'
          var praha5 = 'PERSONAL COLLECTING - Štefánikova 18/25, 150 00 Praha 5'
          var praha6 = 'PERSONAL COLLECTING - Na Hanspaulce 25, 160 00 Praha 6'
          var brno = 'PERSONAL COLLECTING - Bubeníčkova 6, 615 00 Brno – Židenice'
          var ostrava = 'PERSONAL COLLECTING - Betonářská 1, Slezská Ostrava'
          var beroun = 'PERSONAL COLLECTING - Okružní 1467, 266 01 Beroun'
          var budejovice = 'osobní odběr - Jírovcova 10, České Budějovice'
          var zlin = 'PERSONAL COLLECTING - Náves 36, Zlín-Prštné'
          var znojmo = 'PERSONAL COLLECTING - Loucký Klášter Znojmo'
          var privat = 'PRIVATE WINE CELLAR BOX IN MORAVIAN CELLAR'
          var posta = 'MAILING SERVICE, CASH ON DELIVERY'
          var dpl = 'DELIVERY TO YOUR HOME OR COMPANY BY CAR, ORDER MINIMUM CZK 5.000 FREE OF CHARGE'
     }
     
	var SumPrice = document.getElementById('TotalPrice').value
	var DefaultTransportPrice = document.getElementById('DefaultTransportPrice').value
	
	if ((
          document.getElementById('Transport2').checked == true || 
          document.getElementById('Transport2a').checked == true || 
          document.getElementById('Transport2b').checked == true || 
          document.getElementById('Transport2c').checked == true || 
          document.getElementById('Transport2g').checked == true ||
          document.getElementById('Transport2j').checked == true ||
          document.getElementById('Transport2h').checked == true ||
          document.getElementById('Transport2k').checked == true ||
          document.getElementById('Transport2i').checked == true
          )) {
          
//	if ((document.getElementById('Transport2').checked == true || document.getElementById('Transport2a').checked == true || document.getElementById('Transport2b').checked == true || document.getElementById('Transport2c').checked == true || document.getElementById('Transport2d').checked == true || document.getElementById('Transport2e').checked == true || document.getElementById('Transport2f').checked == true || document.getElementById('Transport2g').checked == true)){
		document.getElementById('mTotalPrice').value = SumPrice;
		document.getElementById('cTransportPrice').value = 0;
		if (document.getElementById('Transport2').checked == true) document.getElementById('sTransportName').value = praha4;
		if (document.getElementById('Transport2a').checked == true) document.getElementById('sTransportName').value = praha6;
		if (document.getElementById('Transport2b').checked == true) document.getElementById('sTransportName').value = brno;
		if (document.getElementById('Transport2c').checked == true) document.getElementById('sTransportName').value = beroun;
		/*
		if (document.getElementById('Transport2d').checked == true) document.getElementById('sTransportName').value = "osobní odběr - Hlinky 88, Brno";
		if (document.getElementById('Transport2e').checked == true) document.getElementById('sTransportName').value = "osobní odběr - Jírovcova 10, České Budějovice";
		if (document.getElementById('Transport2f').checked == true) document.getElementById('sTransportName').value = "osobní odběr - nám. Zachariáše z Hradce, Telč";
		*/
		if (document.getElementById('Transport2g').checked == true) document.getElementById('sTransportName').value = zlin;
		if (document.getElementById('Transport2k').checked == true) document.getElementById('sTransportName').value = znojmo;
		/* nove pobočky po ENG verzi - obchodu */
		if (document.getElementById('Transport2j').checked == true) document.getElementById('sTransportName').value = praha5;
		if (document.getElementById('Transport2h').checked == true) document.getElementById('sTransportName').value = ostrava;
		if (document.getElementById('Transport2i').checked == true) document.getElementById('sTransportName').value = budejovice;
	}
	else if (document.getElementById('Transport3').checked == true) {
		document.getElementById('mTotalPrice').value = SumPrice;
		document.getElementById('cTransportPrice').value = 0;
		document.getElementById('sTransportName').value = privat;
	}
	else if (document.getElementById('Transport1').checked == true && SumPrice < 5000) {
		document.getElementById('mTotalPrice').value = Math.abs(SumPrice) + Math.abs(DefaultTransportPrice);
		document.getElementById('cTransportPrice').value = DefaultTransportPrice;
		document.getElementById('sTransportName').value = posta;
	}
	else if (document.getElementById('Transport1').checked == true && SumPrice >= 5000) {
		document.getElementById('mTotalPrice').value = SumPrice;
		document.getElementById('cTransportPrice').value = 0;
		document.getElementById('sTransportName').value = dpl;
	}
	else {
		if(SumPrice < 5000) {
			document.getElementById('mTotalPrice').value = Math.abs(SumPrice) + Math.abs(DefaultTransportPrice);
			document.getElementById('cTransportPrice').value = DefaultTransportPrice;
			document.getElementById('sTransportName').value = posta;
		}
		else {
			document.getElementById('mTotalPrice').value = SumPrice;
			document.getElementById('cTransportPrice').value = 0;
			document.getElementById('sTransportName').value = dpl;
		}
	}
}

 function validateOrder(ThisForm){
	var strHTML=ThisForm.TitleTextForJS.value+'\n';	
	var submitForm = true

	if(ThisForm.sName.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}	
		strHTML += (ThisForm.sNameForJS.value);
		submitForm = false;
	}

	if(ThisForm.sSurName.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sSurNameForJS.value);
		submitForm = false;
	}
	
	if(ThisForm.sStreet.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sStreetForJS.value);
		submitForm = false;
	}
	
	if(ThisForm.sStreetNumber.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sStreetNumberForJS.value);
		submitForm = false;
	}

	if(ThisForm.sCity.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sCityForJS.value);
		submitForm = false;
	}
	
	if(ThisForm.sZIP.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sZIPForJS.value);
		submitForm = false;
	}

	if(ThisForm.sPhone.value==''){
		if(strHTML != ''){
		strHTML += "\n"
		}
		strHTML += (ThisForm.sPhoneForJS.value);
		submitForm = false;
	}
 	var msg = ThisForm.sEmailForJS.value;	
	var str = ThisForm.sEmail.value;

	if(!g_RegExpSupported){
		if(!(str.indexOf(".") > 2) && (str.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += msg;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}	
	}
	else
	{	
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,3})(\\]?)$");
		if(!(!r1.test(str) && r2.test(str)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += msg;
			ThisForm.sEmail.focus();
			submitForm = false;
		}
	}

	if(ThisForm.sLoginName){
		if(ThisForm.sLoginName.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sLoginNameForJS.value);
			submitForm = false;
		}
	}

	if(ThisForm.sPassword && ThisForm.sPasswordConfirm){
		if(ThisForm.sPassword.value=="" && ThisForm.sPasswordConfirm.value==""){
			if(strHTML != '') strHTML += "\n\n"
			
			strHTML += (ThisForm.sPassWordForJS.value);
			submitForm = false;
		}
		
		if(ThisForm.sPassword.value!=ThisForm.sPasswordConfirm.value){
			if(strHTML != '') strHTML += "\n\n"
			
			strHTML += (ThisForm.sConfirmPassWordForJS.value);
			submitForm = false;
		}
	}
	
	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{
		if(ThisForm.sMessage) {
			ThisForm.sMessage.value=ThisForm.sTransportName.value + ";|;"
			ThisForm.sMessage.value+=ThisForm.sMessage1.value
			if (ThisForm.sClientNumber.value!==''){
				if (ThisForm.sMessage1.value !== '') {ThisForm.sMessage.value += ". "}
				ThisForm.sMessage.value += "Zákaznické číslo: "+ThisForm.sClientNumber.value
			}
		}
		return true
	}
}

function validate_OrderForm(ThisForm, Submit){

	var strHTML='';	
	var submitForm = true
 	var msg = ThisForm.sEmailForJS.value;	
	var str = ThisForm.sEmailForm.value;
	var SumProduct

var CountProduct_1 = Math.abs(ThisForm.CountProduct_1.value)
var CountProduct_2 = Math.abs(ThisForm.CountProduct_2.value)
var CountProduct_3 = Math.abs(ThisForm.CountProduct_3.value)
var CountProduct_4 = Math.abs(ThisForm.CountProduct_4.value)
var CountProduct_5 = Math.abs(ThisForm.CountProduct_5.value)
var CountProduct_6 = Math.abs(ThisForm.CountProduct_6.value)
var CountProduct_7 = Math.abs(ThisForm.CountProduct_7.value)
var CountProduct_8 = Math.abs(ThisForm.CountProduct_8.value)
var CountProduct_9 = Math.abs(ThisForm.CountProduct_9.value)
var CountProduct_10 = Math.abs(ThisForm.CountProduct_10.value)


SumProduct = CountProduct_1 + CountProduct_2 + CountProduct_3 + CountProduct_4 + CountProduct_5 + CountProduct_6 + CountProduct_7 + CountProduct_8 + CountProduct_9 + CountProduct_10

	if(str!=''){
	if(!g_RegExpSupported){
		if(!(str.indexOf(".") > 2) && (str.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += msg;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}	
	}
	else
	{	
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,5}|[0-9]{1,3})(\\]?)$");
		if(!(!r1.test(str) && r2.test(str)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += msg;
			ThisForm.sEmailForm.focus();
			submitForm = false;
		}
	}
	}

	if(ThisForm.sNameForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sNameForJS.value);
			submitForm = false;
	}

	if(ThisForm.sStreetForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sStreetForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sCityForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sCityForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sZIPForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sZIPForJS.value);
			submitForm = false;
	}

	if(ThisForm.sPhoneForm.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sPhoneForJS.value);
			submitForm = false;
	}
	
	if (!ThisForm.Transport1.checked && !ThisForm.Transport2.checked && !ThisForm.Transport3.checked && !ThisForm.Transport4.checked && !ThisForm.Transport5.checked){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sTransportForJS.value);
			submitForm = false;
	}

	if(ThisForm.Transport5.checked && ThisForm.IC_DIC.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sIC_DICForJS.value);
			submitForm = false;
	}
		
	if(ThisForm.Transport5.checked && ThisForm.nNumberBox.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sNumberBoxForJS.value);
			submitForm = false;
	}
	
	if (!ThisForm.TypeLabel1.checked && !ThisForm.TypeLabel2.checked/* && !ThisForm.TypeLabel3.checked && !ThisForm.TypeLabel4.checked && !ThisForm.TypeLabel5.checked*/){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sTypeLabelForJS.value);
			submitForm = false;
	}
/*	
	if (SumProduct < 49) {
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sNotProductForJS.value);
			submitForm = false;
	}
*/
	if (SumProduct < 1) {
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sMinCountProductForJS.value);
			submitForm = false;
	}

	if(Submit==1) {
		if(!submitForm){
			alert(strHTML);
		}
		else{
			ThisForm.submit()
		}
	}
	else {
		if(!submitForm){
			alert(strHTML);
			return false
		}
		else{
			return true
		}
	}
}