Your IP : 162.158.182.92


Current Path : /var/www/element/data/www/opter.ru/js/
Upload File :
Current File : /var/www/element/data/www/opter.ru/js/form.js

$(function(){
	$('#select_service').click(function(){
		$('div.popup').slideToggle();
	});
	$('input.btn').click(function(){
		$('div.popup').slideUp();
	});
	$('div.popup input[type=checkbox]').click(function(){
		if($(this).attr('checked'))
		{
			$('#selected_service').after($('label[for='+$(this).attr('id')+']').text());
//			$('#selected_service').after('<li></li>');
//			val += $('label[for='+$(this).attr('id')+']').text() +', ';
//			alert($('label[for='+$(this).attr('id')+']').text());
		}
	});
});


function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } }
function doDefault(theText) { if (theText.value == "") { theText.value = theText.defaultValue } }

function sel()
{
var val='';

	for (var i=1; i<= 6; i++)
	{
		el = document.getElementById('st'+i);
		if (el.checked)
			val += el.value + ' / ';
	}
//	alert(val.slice(0,val.length-2));

	text = document.getElementById('selected_servises');
	text.innerHTML = val.slice(0,val.length-3);

	inp = document.getElementById('selected');
	inp.value = val.slice(0,val.length-3);
}

function test(form)
{
	var emailtemplate = /^[A-Za-z0-9](([_\.\-]?[a-zA-Z0-9]+)*)@([A-Za-z0-9]+)(([\.\-]?[a-zA-Z0-9]+)*)\.([A-Za-z])+$/;
	if (form.name.value == "" || form.name.value == "Имя") 
	{
		alert("Введите имя!");
		return false;
	}
	else 
	if (!emailtemplate.test(form.email.value))
	{
		alert("Неправильно введён адрес e-mail");
		return false;
	}
	/*	if ((form.email.value.indexOf('@', 0)<1)||(form.email.value.indexOf('@', 0)==form.email.value.length-1))
	{
		alert("Неправильно введён адрес e-mail");
		return false;
	}*/
	else 
	if (form.key.value == "" || form.key.value == "Сообщение и ключевые слова")
	{
		alert("Введите Сообщение!");				
		return false;
	}

	alert("Сообщение отправлено") ;
	return true;
}