<!--

function openWindow(theURL,winName,features) {
  window.open(theURL,winName,features);
}

function changeSelect(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function previewImage(img_id) 
{
	if (img_id == 0) 
	{
		alert('Valitse kuva!');
	} 
	else 
	{
  		window.open('preview_image.php?kuva_id='+img_id,'preview_image', 'scrollbars=no,width=100,height=100');
	}
}

function checkEmail(emailFieldName) 
{
	//var email = document.getElementById('registered_email');
	var email = document.getElementById(emailFieldName);
	var filter = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (!filter.test(email.value)) 
	{
		//alert('Please provide a valid email address!');
		email.focus;
		return false;
	} 
	else 
	{
		return true;
	}
}

function submitForm()
{
	document.edit.submit();
}

function postComment()
{
	if (document.blogi_lisays.blog_title.value == '') 
	{
		alert("Please fill all required fields!");
	}
	else if (document.blogi_lisays.blog_text.value == '') 
	{
		alert('Please fill all required fields!');
	}
      else if (document.blogi_lisays.blog_writer.value == '') 
	{
		alert('Please fill all required fields!');
	}
      else if (document.blogi_lisays.blog_writer_email.value == '') 
	{
		alert('Please fill all required fields!');
	}
      else if (document.blogi_lisays.blog_checkbox.checked == false) 
	{
		alert('Please check the checkbox to allow the saving of your ip-address!');
	}
	else if (checkEmail('email') == false) 
	{
		alert('Please provide a valid email address!');
	} 
	else 
	{
            document.blogi_lisays.check.value = '1';
		document.blogi_lisays.submit();
	}
}

function deletePageComment(blog_id, page_id, lan)
{
	var answer = confirm("Haluatko varmasti poistaa kommentin?");
	if (answer) 
	{
		window.location = "main.php?lan="+lan+"&mode=admin_blog_del&page_id="+page_id+"&blog_id="+blog_id;
	}
}

function deleteTiedoteComment(blog_id, tiedote_id, lan)
{
	var answer = confirm("Haluatko varmasti poistaa kommentin?");
	if (answer) 
	{
		window.location = "main.php?lan="+lan+"&mode=admin_blog_del&tiedote_id="+tiedote_id+"&blog_id="+blog_id;
	}
}

//-->