function deleteit(url,target,id){
if(confirm('Are you sure you want to delete this?'))
{
	 var html = $.ajax({
	  url: url + '/' + id ,
	  async: false
	 }).responseText;
		
	 var isValid = parseInt(html);
	 
	 	if( isValid == 1  )
		{
			$('#'+target).fadeOut();
		}	
}
 
}
function delImage(index,name,url)
{
	url += '/' + index + '/' + name;
	var html = $.ajax({
	 url: url,
	 async: false
	}).responseText;
	
	document.getElementById('imgContainer').innerHTML = html;
}
function delFile(index,name,url)
{
	url += '/' + index + '/' + name;
	var html = $.ajax({
	 url: url,
	 async: false
	}).responseText;
	
	document.getElementById('fileContainer').innerHTML = html;
}
function setFeatured(url,msg)
	{
		 var html = $.ajax({
		  			url: url ,
		  			async: false
		 			}).responseText;
		 html = parseInt(html);
		 if(html==1)
		 {
		 	$('#up').html(msg );
		 }
	}
function validateEmail(email)
{
// a very simple email validation checking. 
// you can add more complex email checking if it helps 
    if(email.length <= 0)
	{
	  return false;
	}
    var splitted = email.match("^[^0-9_-](.+)@[A-Za-z0-9](.+)$");
    if(splitted == null) return false;
    if(splitted[1] != null )
    {
      var regexp_user=/^\"?[\w-_\.]*\"?$/;
      if(splitted[1].match(regexp_user) == null) return false;
    }
    if(splitted[2] != null)
    {
      var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
      if(splitted[2].match(regexp_domain) == null) 
      {
	    var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	    if(splitted[2].match(regexp_ip) == null) return false;
      }// if
      return true;
    }
return false;
}
	