function help(URL,nHeight) {
	var leftposition = (screen.width-784)/2+427
	var win = (URL,"_blank",'leftmargin=5,topmargin=5,marginwidth=0,marginheight=0,toolbar=0,titlebar=0,menubar=0,location=0,scrollbars=1,resizable=0,width=400,height='+nHeight+',left='+leftposition+',top=200');
	var msgWindow = window.open (URL, 'URL', win);
}

function article(ArticleID) {
	var URL = "article.asp?nArticleID="+ArticleID+"&sAction=newwindow";
	var leftposition = (screen.width/2)-250;
	var win = (URL,"_blank",'leftmargin=0,topmargin=0,marginwidth=0,marginheight=0,toolbar=0,titlebar=0,menubar=0,location=0,scrollbars=1,resizable=0,width=500,height=400,left='+leftposition+',top=200');
	var msgWindow = window.open (URL, 'URL', win);
}

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 IsDigit() {
  return (((event.keyCode >= 48) && (event.keyCode <= 57)) || (event.keyCode == 32) || (event.keyCode == 43));
}

function sendEmail() {
	if(document.getElementById('div_send').style.display=='block') {
		document.getElementById('div_send').style.display='none';
	}
	else {
		document.getElementById('div_send').style.display='block';
	}
}

//nastaveni obrazku s linkama do prava
function showlink(refresh) {
	if(refresh==1) {
		document.getElementById("link").style.display = "none";
		if(navigator.appName == "Netscape") {location.replace(location.href);}
		else {location.reload();}
	}
	else {
		var leftposition = (document.body.scrollWidth)/2+380;
		document.getElementById("link").style.left = leftposition;
		document.getElementById("link").style.display = "block";
	}
	;
}
// zobrazeni podrobnych technickych informaci
function Infoshow(div) {
	document.getElementById(div).style.display="block";
}
function Infohide(div) {
	document.getElementById(div).style.display="none";
}
//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_mail(ThisForm){
	var strHTML='';	
	var submitForm = true
 	var sSendTo = ThisForm.sSendTo.value;
	var sSendFrom = ThisForm.sSendFrom.value;

	if(!g_RegExpSupported){
		if(!(sSendTo.indexOf(".") > 2) && (sSendTo.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += ThisForm.sSendToForJS.value;
			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(sSendTo) && r2.test(sSendTo)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += ThisForm.sSendToForJS.value;
			submitForm = false;
		}
	}
	
	if(!g_RegExpSupported){
		if(!(sSendFrom.indexOf(".") > 2) && (sSendFrom.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += ThisForm.sSendFromForJS.value;
			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(sSendFrom) && r2.test(sSendFrom)))
		{
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += ThisForm.sSendFromForJS.value;
			submitForm = false;
		}
	}

	if(ThisForm.sSubject.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sSubjectForJS.value);
			submitForm = false;
	}

	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{
		return true
	}
}

function validate_sendinfo(ThisForm){
	var strHTML='';	
	var submitForm = true
 	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.sEmail.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.sName.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sNameForJS.value);
			submitForm = false;
	}

	if(ThisForm.sCity.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sCityForJS.value);
			submitForm = false;
	}

	if(ThisForm.sPhone.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sPhoneForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sText.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sTextForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.bPersonalAgency_YES.checked==false && ThisForm.bPersonalAgency_NO.checked==false){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sPersonalAgencyForJS.value);
			submitForm = false;
	}

	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{
		return true
	}
}

 function validate_SendReview(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.sTitle.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sTitleForJS.value);
			submitForm = false;
	}
	
	if(ThisForm.sText.value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sTextForJS.value);
			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 chooseCountry(select, registration) {
	
	var selIndex = select.selectedIndex;

	if (select.options[selIndex].text == 'jiný stát (zadejte vpravo)') {
		document.getElementById('sCountryInput').value = '';
		document.getElementById('sCountryInput').className = 'input_1';
		document.getElementById('sCountryInput').focus();
		document.getElementById('sCountryInput').readOnly = false;
	} else {
		document.getElementById('sCountryInput').value = select.value;
		document.getElementById('sCountryInput').className = 'input_1 Input_1_dis';
		document.getElementById('sCountryInput').readOnly = true;
	}
	
	if (registration==0) countCountryPrice()
		
}

function chooseDeliveryCountry(select, registration) {

	var selIndex = select.selectedIndex;

	if (select.options[selIndex].text == 'jiný stát (zadejte vpravo)') {
		document.getElementById('sDeliveryCountryInput').value = '';
		document.getElementById('sDeliveryCountryInput').className = 'input_1';
		document.getElementById('sDeliveryCountryInput').focus();
		document.getElementById('sDeliveryCountryInput').readOnly = false;
	} else if(select.options[selIndex].text == '--- vyberte stát ---') {
		document.getElementById('sDeliveryCountryInput').value = '';
		document.getElementById('sDeliveryCountryInput').className = 'input_1 Input_1_dis';
		document.getElementById('sDeliveryCountryInput').readOnly = true;
	} else {
		document.getElementById('sDeliveryCountryInput').value = select.value;
		document.getElementById('sDeliveryCountryInput').className = 'input_1 Input_1_dis';
		document.getElementById('sDeliveryCountryInput').readOnly = true;
	}
	
	if (registration==0) countCountryPrice()

}





function countCountryPrice() {
	
	var totalPrice 		= Math.abs(document.getElementById('totalPrice').value);
	var countryInput 		= document.getElementById('sCountryInput');
	var deliverCountryInput 	= document.getElementById('sDeliveryCountryInput');
	
	
	
	var longorder
	if (document.getElementById('longorder')) {
		longorder			= true;
	} else {
		longorder			= false;
	}
	
	//když je objednávka do zahraničí, platba je možná pouze platební kartou
	if (countryInput.value != 'Česká republika') {
		document.getElementById('Payment_2').checked = false;
		document.getElementById('Payment_2').disabled = true;
		document.getElementById('Payment_1').checked = true;
	} else {
		document.getElementById('Payment_2').disabled = false;
	}
	
	if (document.getElementById('serviceInputPrice')) {
		if (countryInput.value == 'Česká republika') {

			if ((deliverCountryInput.readOnly==true && deliverCountryInput.value=='') || deliverCountryInput.value == 'Česká republika') {
				
				if (totalPrice >= 2000 || longorder==true) {
				
					document.getElementById('serviceInputPrice').value = 0;
					document.getElementById('cTransportPrice').value = 0;
					document.getElementById('completeInputPrice').value = 0 + totalPrice;
				
				} else {
				
					document.getElementById('serviceInputPrice').value = 90;
					document.getElementById('cTransportPrice').value = 90;
					document.getElementById('completeInputPrice').value = 90 + totalPrice;
				
				}
				
			} else if (deliverCountryInput.value == 'Slovenská republika') {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			} else {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			}
				
		} else if (countryInput.value == 'Slovenská republika') {

			if (deliverCountryInput.value == 'Česká republika') {
		
				if (totalPrice >= 2000 || longorder==true) {
				
					document.getElementById('serviceInputPrice').value = 0;
					document.getElementById('cTransportPrice').value = 0;
					document.getElementById('completeInputPrice').value = 0 + totalPrice;
				
				} else {
				
					document.getElementById('serviceInputPrice').value = 90;
					document.getElementById('cTransportPrice').value = 90;
					document.getElementById('completeInputPrice').value = 90 + totalPrice;
				
				}
				
			} else if ((deliverCountryInput.readOnly==true && deliverCountryInput.value=='') || deliverCountryInput.value == 'Slovenská republika') {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			} else {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			}
				
		} else {
			
			if (deliverCountryInput.value == 'Česká republika') {
		
				if (totalPrice >= 2000 || longorder==true) {
				
					document.getElementById('serviceInputPrice').value = 0;
					document.getElementById('cTransportPrice').value = 0;
					document.getElementById('completeInputPrice').value = 0 + totalPrice;
				
				} else {
				
					document.getElementById('serviceInputPrice').value = 90;
					document.getElementById('cTransportPrice').value = 90;
					document.getElementById('completeInputPrice').value = 90 + totalPrice;
				
				}
				
			} else if (deliverCountryInput.value == 'Slovenská republika') {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			} else {
			
				document.getElementById('serviceInputPrice').value = 250;
				document.getElementById('cTransportPrice').value = 250;
				document.getElementById('completeInputPrice').value = 250 + totalPrice;
			
			}
			
		}
	}
	
	if (deliverCountryInput.value == ' ') {
		deliverCountryInput.value  = '';
	}

}


function AllowNumerAccount(transfer) {
		document.getElementById('Payment_2a').disabled = !transfer
		
		if (document.getElementById('Payment_2a').disabled) {
			document.getElementById('Payment_2a').value=''
			document.getElementById('Payment_2a').className += ' Input_1_dis';
		}
		else {
			document.getElementById('Payment_2a').focus();
			document.getElementById('Payment_2a').className = 'input_1';
		}
	}
	
	
	

// ****************************************************
// ****************************************************
// ****************************************************
//
//
//	!! v novém nákupním procesu se již nepoužívá !!
//	!! v novém nákupním procesu se již nepoužívá !!
//
//
// ****************************************************
// ****************************************************
// ****************************************************


function Ubytovani(input) {
	document.getElementById('sUbytovaniTermin' + input).disabled = !(document.getElementById('bUbytovani' + input).checked)
	document.getElementById('sUbytovaniSpolubydlici' + input).disabled = !(document.getElementById('bUbytovani' + input).checked)
}



function Accommodation(GoodsID, NameCourse) {
	if(document.getElementById('bAccommodation' + GoodsID).checked) {
		document.getElementById('sMessage').value += '||/||' + NameCourse + ', Ubytování: ANO'
		if(!document.getElementById('sAccommodation' + GoodsID).value=='') {
			document.getElementById('sMessage').value += ', Termín: ' + document.getElementById('sAccommodation'+GoodsID).value
			}
		}
	}
function AllowAccommodation(GoodsID) {
		document.getElementById('sAccommodation' + GoodsID).disabled = !(document.getElementById('bAccommodation' + GoodsID).checked)
	}


function validateOrder(ThisForm){
 	var strHTML=ThisForm.TitleTextForJS.value+'\n';	
	var submitForm = true

 	var msg = ThisForm.sEmailForJS.value;	
 	//email se bere dle ID protože pro více lidí se k názvu přidává ID klienta
	var str = document.getElementById('sEmail').value;

	if(!g_RegExpSupported){
		if(!(str.indexOf(".") > 2) && (str.indexOf("@") > 0))
		{
			if(strHTML != ''){
			strHTML += '\n'
			}
			strHTML += msg;
			document.getElementById('sEmail').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;
			document.getElementById('sEmail').focus();
			submitForm = false;
		}
	}

		
	if(document.getElementById('sName').value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}	
			strHTML += (ThisForm.sNameForJS.value);
			submitForm = false;
	}

	if(document.getElementById('sSurName').value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sSurNameForJS.value);
			submitForm = false;
	}
	
	if(document.getElementById('sStreet').value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sStreetForJS.value);
			submitForm = false;
	}

	if(document.getElementById('sCity').value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sCityForJS.value);
			submitForm = false;
	}
	
	var sICO = document.getElementById('sICO').value
	if(sICO != '') {
		if(isICO(sICO)==null){
				if(strHTML != ''){
				strHTML += "\n"
				}
				strHTML += (ThisForm.sICOForJS.value);
				submitForm = false;
		}
	}
	
	var sDIC = document.getElementById('sDIC').value
	if(sDIC!='') {
		if(isDIC(sDIC)==null){
				if(strHTML != ''){
				strHTML += "\n"
				}
				strHTML += (ThisForm.sDICForJS.value);
				submitForm = false;
		}
	}
	
	var sZIP = document.getElementById('sZIP').value
	if(sZIP.length!=5 || isNaN(sZIP)==true){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sZIPForJS.value);
			submitForm = false;
	}
	if(document.getElementById('sPhone').value==''){
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sPhoneForJS.value);
			submitForm = false;
	}
	if(ThisForm.bConfirm) {
	if(ThisForm.bConfirm.checked==false || ThisForm.bConfirm.value=='true') {
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += ("Musíte souhlasit se všeobecnými podmínkami!");
			submitForm = false;
	}}


	if(document.getElementById('bKDP_ANO')) {
		if(document.getElementById('bKDP_ANO').checked && ThisForm.sKDP_ANO.value=='') {
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sKDP_ANOForJS.value);
			submitForm = false;
			}
		if(ThisForm.sKDP_NE) {
			if(document.getElementById('bKDP_NE').checked && ThisForm.sKDP_NE.value=='') {
				if(strHTML != ''){
				strHTML += "\n"
				}
				strHTML += (ThisForm.sKDP_NEForJS.value);
				submitForm = false;
			}
		}
	}
	else if(document.getElementById('bKDP_NE') && ThisForm.sKDP_NE) {
		if(document.getElementById('bKDP_NE').checked && ThisForm.sKDP_NE.value=='') {
			if(strHTML != ''){
			strHTML += "\n"
			}
			strHTML += (ThisForm.sKDP_NEForJS.value);
			submitForm = false;
			}
	}


	if(!submitForm){
		alert(strHTML);
		return false
	}
	else{

		if(document.getElementById('sMessage')){
		//slouceni prijmeni a titulu
			if(document.getElementById('sDegree').value!=='') {
				document.getElementById('sSurName').value+= ', ' + document.getElementById('sDegree').value
			}
		//slouceni zpravy obchodnika a dopravy platby
			if(document.getElementById('Payment1')) {
				if(document.getElementById('Payment1').checked) {
					document.getElementById('sMessage').value += ";|;Pro kurzy a přednášky: " + document.getElementById('Payment1').value;
					if(document.getElementById('Payment_2')) {
						document.getElementById('sMessage').value += ", Pro daňovou akademii: převodem z účtu č.: " + document.getElementById('Payment_2a').value;
						}
					if(ThisForm.Payment3) {
						document.getElementById('sMessage').value += ", Pro publikace: " + ThisForm.Payment3.value;
						}
					document.getElementById('sMessage').value += ";|;";
					}
				else if(document.getElementById('Payment2').checked) {
					document.getElementById('sMessage').value += ";|;Pro kurzy a přednášky: převodem z účtu č.: " + document.getElementById('Payment2a').value;
					if(document.getElementById('Payment_2')) {
						document.getElementById('sMessage').value += ", Pro daňovou akademii: převodem z účtu č.: " + document.getElementById('Payment_2a').value;
						}
					if(ThisForm.Payment3) {
						document.getElementById('sMessage').value += ", Pro publikace: " + ThisForm.Payment3.value;
						}
					document.getElementById('sMessage').value += ";|;";
					}
				}
			else if(document.getElementById('Payment_2')) {
				document.getElementById('sMessage').value += ";|;Pro daňovou akademii: převodem z účtu č.: " + document.getElementById('Payment_2a').value;
				document.getElementById('sMessage').value += ";|;";
				}
			else {
				document.getElementById('sMessage').value += ";|;Pro publikace: " + ThisForm.Payment3.value + ";|;";
				}
			
			if(document.getElementById('bKDP_ANO')) {
				if(document.getElementById('bKDP_ANO').checked) {
					document.getElementById('sMessage').value += "|||||Člen KDP: ANO, číslo osvědčení:" + document.getElementById('sKDP_ANO').value;
					}
				if(document.getElementById('bKDP_NE').checked) {
					document.getElementById('sMessage').value += "|||||Člen KDP: NE";//, rodné číslo:" + ThisForm.sKDP_NE.value;
					}
				}
			else if(document.getElementById('bKDP_NE')) {
				if(document.getElementById('bKDP_NE').checked) {
					document.getElementById('sMessage').value += "|||||Člen KDP: NE";//, rodné číslo:" + ThisForm.sKDP_NE.value;
					}
				}
			
		}

		return true
	}
}

function isICO(x) {
//kontrola dle regulárního výrazu
//	^ 		začátek řetězce
//	\d 		musí být číslo
//	{8}		pouze 8 znaků
//	$		konec řetězce
var RegExp = /^(\d{8})$/; // Note: this WILL allow a number that ends in a decimal: -452.

var result = x.match(RegExp);
return result;
}

function isDIC(x) {
//kontrola dle regulárního výrazu
//	^ 		začátek řetězce
//	[a-zA-Z] 	musí být znaky mezi A až Z (jak malá tak velká písmenka)
//	{2} 		musí být pouze dvě písmena
//	\d 		musí být číslo
//	{8,10}	min. 8 a max. 10 znaků
//	$		konec řetězce
var RegExp = /^([a-zA-Z]{2})(\d{8,10})$/;

var result = x.match(RegExp);
return result;
}
