function GetDate() {
	cdate 	= new Date();
	cday 	= cdate.getDate();
	cmonth 	= cdate.getMonth();
	cmonth++;

	if (cmonth < 10)
		cmonth = "0" + cmonth;

	if (cday < 10)
		cday = "0" + cday;

	cyear = cdate.getYear();

	if (cyear < 1000)
		cyear += 1900;

	fulldate = cday + "." + cmonth + "." + cyear;

	return fulldate;
}

function NewWindow (site, language) {
	//if (site == "eic") {
	//	var org = "_eic";
	//}
	//else {
	//	var org = "";
	//}
	
	//newwin=window.open('index' + org + '.php?lang=' + language, site);
	newwin=window.open(site + '_' + language + '.html', site);
	newwin.focus();
}

function NewWindow1 (site, language) {
	if (site == "eic") {
		var org = "_eic";
	}
	else {
		var org = "";
	}
	
	newwin=window.open('index' + org + '.php?lang=' + language, site);
	//newwin=window.open(site + '_' + language + '.html', site);
	newwin.focus();
}

function ValidEmail(email){
	var invalidChars = "/:,;";
	
	if (email == "") {return false}
	
	for (i = 0; i,invalidChars.legth; i++) {
		badChar = invalidChars.charAt(i)
		if (email.indexOf(badChar, 0) > -1) {return false}
	}
	
	var atPos = email.indexOf("@", 1);
	if (atPos == -1) {return false}
	if (email.indexOf("@", atPos + 1) > -1) {return false}
	
	var periodPos = email.indexOf(".", atPos);
	if (periodPos == -1) {return false}
	if (periodPos + 3 > email.length) {return false}
	
	return true;
}


function CheckIt() {
	var all_is_ok = true;
		
	if (document.form1.firm_name.value == '' || document.form1.phone.value == '' || document.form1.question.value == '' || document.form1.e_mail.value == '') {
		window.alert('Моля, попълнете всички маркирани със * полета.');
		all_is_ok = false;
	}
	
	if (all_is_ok) {
		if(!ValidEmail(document.form1.e_mail.value)) {
			window.alert('E-mail адреса не е валиден.\nМоля, въведете валиден E-mail.');
			document.form1.e_mail.focus();
			document.form1.e_mail.select();
			all_is_ok = false;
		}
	}
	
	return all_is_ok;
}
