function support_cs()
{
window.open("http://psd-html.cz/webim/client.php?locale=cs", "_blank", "width=640,height=480");
}

function support_en()
{
window.open("http://psd-html.cz/webim/client.php?locale=en", "_blank", "width=640,height=480");
}


function checkOrderForm()
{
	var jmeno = document.getElementById('jmeno').value;
	var prijmeni = document.getElementById('prijmeni').value;
	var email = document.getElementById('email').value;
	var telefon = document.getElementById('telefon').value;
	var ulice = document.getElementById('ulice').value;
	var mesto = document.getElementById('mesto').value;
	var psc = document.getElementById('psc').value;
	var pages = document.getElementById('pages').value;
	var digits = /^([0-9])+$/;
	var emailformat = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (jmeno.length == 0)
	{
		alert('Prosím, vložte jméno!');
		return false;
	}
	if (prijmeni.length == 0)
	{
		alert('Prosím, vložte příjmení!');
		return false;
	}
	if (!emailformat.test(email))
	{
		alert('Prosím, vložte správný formát e-mailu!');
		return false;
	}
	if (!digits.test(telefon))
	{
		alert('Telefon musí být zadán číslem!');
		return false;
	}
	if (telefon.length == 0)
	{
		alert('Prosím, vložte telefon!');
		return false;
	}
	if (ulice.length == 0)
	{
		alert('Prosím, vložte ulici!');
		return false;
	}
	if (mesto.length == 0)
	{
		alert('Prosím, vložte město!');
		return false;
	}
	if (psc.length == 0)
	{
		alert('Prosím, vložte PSČ!');
		return false;
	}
	if (!digits.test(pages))
	{
		alert('Počet stránek musí být číslovka!');
		return false;
	}
	else if (pages < 1 || pages > 99)
	{
		alert('Vložte počet stránek (1 - 99)!');
		return false;
	}

	return true;
}



function checkOrderForm_en()
{
	var name = document.getElementById('name').value;
	var surname = document.getElementById('surname').value;
	var email = document.getElementById('email').value;
	var phone = document.getElementById('phone').value;
	var street = document.getElementById('street').value;
	var city = document.getElementById('city').value;
	var zip = document.getElementById('zip').value;
	var pages = document.getElementById('pages').value;
	var digits = /^([0-9])+$ /;
	var emailformat = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	if (name.length == 0)
	{
		alert('Please type your name!');
		return false;
	}
	if (surname.length == 0)
	{
		alert('Please type your surname!');
		return false;
	}
	if (!emailformat.test(email))
	{
		alert('Please type your e-mail in correct format!');
		return false;
	}

	if (phone.length == 0)
	{
		alert('Please type your telephone number!');
		return false;
	}
	if (street.length == 0)
	{
		alert('Please type your street name!');
		return false;
	}
	if (city.length == 0)
	{
		alert('Please type your city name!');
		return false;
	}
	if (zip.length == 0)
	{
		alert('Please type your zip code!');
		return false;
	}
	if (!digits.test(pages))
	{
		alert('Number of pages must be number!');
		return false;
	}
	else if (pages < 1 || pages > 99)
	{
		alert('Number of pages must be between 1 - 99!');
		return false;
	}

	return true;
}


function calcOrderForm()
{
	
	var turnaround2 = document.getElementById('turnaround2');
	var turnaround4 = document.getElementById('turnaround4');
	var option1 = document.getElementById('option1');

	var option3 = document.getElementById('option3');

	var option5 = document.getElementById('option5');
	var pages = document.getElementById('pages').value;
	var cost;
	var days;
	
	if (2 >= pages > 0)
	{

		if (turnaround2.checked)
		{
			cost = (1800 + (pages - 1) * 1100) * 2;
			days = 'méně než 1 den';
		}

		else
		{
			cost = 1800 + (pages - 1) * 1100;
			days = 'méně než 3 dny';
		}		
		if (option1.checked) cost = cost + 240 * pages;
		 
		if (option3.checked) cost = cost + 650;
		
		if (option5.checked) cost = cost + 340;
		document.getElementById("totalprice").value = cost + ' Kč';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 3)
	{

		if (turnaround2.checked)
		{
			cost = (1800 + (pages - 1) * 1100) * 2;
			days = 'méně než 2 dny';
		}

		else
		{
			cost = 1800 + (pages - 1) * 1100;
			days = 'méně než 5 dní';
		}		
		if (option1.checked) cost = cost + 240 * pages;
		 
		if (option3.checked) cost = cost + 650;
		
		if (option5.checked) cost = cost + 340;
		document.getElementById("totalprice").value = cost + ' Kč';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 6)
	{

		if (turnaround2.checked)
		{
			cost = (1800 + (pages - 1) * 1100) * 2;
			days = 'méně než 3 dny';
		}

		else
		{
			cost = 1800 + (pages - 1) * 1100;
			days = 'méně než 8 dní';
		}		
		if (option1.checked) cost = cost + 240 * pages;
		
		if (option3.checked) cost = cost + 650;
	
		if (option5.checked) cost = cost + 340;
		document.getElementById("totalprice").value = cost + ' Kč';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 9)
	{

		if (turnaround2.checked)
		{
			cost = (1800 + (pages - 1) * 1100) * 2;
			days = 'individuální';
		}

		else
		{
			cost = 1800 + (pages - 1) * 1100;
			days = 'individuální';
		}		
		if (option1.checked) cost = cost + 240 * pages;
		
		if (option3.checked) cost = cost + 650;
	
		if (option5.checked) cost = cost + 340;
		document.getElementById("totalprice").value = cost + ' Kč';
		document.getElementById("totaldays").value = days;
    }
	if (pages <=0)
	{

		if (turnaround2.checked)
		{
			cost = 0;
			days = 'počet stran není definován';
		}

		else
		{
			cost = 0;
			days = 'počet stran není definován';
		}		
		if (option1.checked) cost = cost + 240 * pages;
		
		if (option3.checked) cost = cost + 650;
	
		if (option5.checked) cost = cost + 340;
		document.getElementById("totalprice").value = cost + ' Kč';
		document.getElementById("totaldays").value = days;
    }
	
	
}


function calcOrderForm_en()
{
	
	var turnaround2 = document.getElementById('turnaround2');
	var turnaround4 = document.getElementById('turnaround4');
	var option1 = document.getElementById('option1');

	var option3 = document.getElementById('option3');

	var option5 = document.getElementById('option5');
	var pages = document.getElementById('pages').value;
	var cost;
	var days;
	
	if (2 >= pages > 0)
	{

		if (turnaround2.checked)
		{
			cost = (90 + (pages - 1) * 50) * 2;
			days = 'less than 1 day';
		}

		else
		{
			cost = 90 + (pages - 1) * 50;
			days = 'less than 3 days';
		}		
		if (option1.checked) cost = cost + 10 * pages;
		 
		if (option3.checked) cost = cost + 30;
		
		if (option5.checked) cost = cost + 15;
		document.getElementById("totalprice").value = cost + ' $';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 3)
	{

		if (turnaround2.checked)
		{
			cost = (90 + (pages - 1) * 50) * 2;
			days = 'less than 2 days';
		}

		else
		{
			cost = 90 + (pages - 1) * 50;
			days = 'less than 5 days';
		}		
		if (option1.checked) cost = cost + 10 * pages;
		 
		if (option3.checked) cost = cost + 30;
		
		if (option5.checked) cost = cost + 15;
		document.getElementById("totalprice").value = cost + ' $';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 6)
	{

		if (turnaround2.checked)
		{
			cost = (90 + (pages - 1) * 50) * 2;
			days = 'less than 3 days';
		}

		else
		{
			cost = 90 + (pages - 1) * 50;
			days = 'less than 8 days';
		}		
		if (option1.checked) cost = cost + 10 * pages;
		
		if (option3.checked) cost = cost + 30;
	
		if (option5.checked) cost = cost + 15;
		document.getElementById("totalprice").value = cost + ' $';
		document.getElementById("totaldays").value = days;
    }
	if (pages >= 9)
	{

		if (turnaround2.checked)
		{
			cost = (90 + (pages - 1) * 50) * 2;
			days = 'individual';
		}

		else
		{
			cost = 90 + (pages - 1) * 50;
			days = 'individual';
		}		
		if (option1.checked) cost = cost + 10 * pages;
		
		if (option3.checked) cost = cost + 30;
	
		if (option5.checked) cost = cost + 15;
		document.getElementById("totalprice").value = cost + ' $';
		document.getElementById("totaldays").value = days;
    }
	if (pages <=0)
	{

		if (turnaround2.checked)
		{
			cost = 0;
			days = 'number of pages is not defined';
		}

		else
		{
			cost = 0;
			days = 'number of pages is not defined';
		}		
		if (option1.checked) cost = cost + 10 * pages;
		
		if (option3.checked) cost = cost + 30;
	
		if (option5.checked) cost = cost + 15;
		document.getElementById("totalprice").value = cost + ' $';
		document.getElementById("totaldays").value = days;
    }
	
	
}






function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}
