function CheckEmail(e){
	e = e.toLowerCase();
	var ch="@";
	var count=0;
	var error=false;
	
	for (var i=0; i<e.length; i++){
		if(e.charAt(i)==ch || e.charAt(i)=="."){
			error = (count==0) ? true : error;
			ch = (ch==".") ? 0 : ch;
			ch = (e.charAt(i)=="@") ? "." : ch;
			count=0;
			continue;
		}
		count++;
	
		if((e.charAt(i)<"a" || e.charAt(i)>"z") && (e.charAt(i)<"0" || e.charAt(i)>"9") && e.charAt(i)!="_" && e.charAt(i)!="-"){
			error = true;
			break;
		}
	}
	error = (count==0) ? true : error;
	error = (ch==0) ? error : true;
	return !error;
}
function GoURL(url, target) {
	var w;
	if (target == "_blank") {
		w = window.open(url,"w","");
		w.focus();
	}	else {
		document.location = url;
	}
	return false;
}

function ShowPhoto(photoname, w, h) {
	url = "/showphoto/?img="+photoname;
	h += 70;
	if (h > 600) {
		h = 600
	}
	w += 40;
	Win=window.open(url, 'viewPhoto',  'toolbar=0,scrollbars=1,location=0,directories=0,status=0,menubar=0,resizable=1,width='+w+',height='+h+',border=thin,top=50,left=50,help=0');
	Win.focus();
}

function descr_order (act,prg_date,prg_time) {
	if (act == 'descr') {
		document.getElementById('prg_descr').style.display = 'block';
		document.getElementById('prg_order').style.display = 'none';
	}
	else {
		document.getElementById('prg_descr').style.display = 'none';
		document.getElementById('prg_order').style.display = 'block';

		if (document.getElementById('prg_date')) {
			if (prg_date) document.prg_order_form["prg_date"].value = prg_date;
			if (prg_time) document.prg_order_form["prg_time"].value = prg_time;
		}
	}
}
