
function checkString(path,arrayNumber) {
	var newPath = trim(path);
	if(arrayNumber == 1) {
		if (!validate(newPath)){
			return false;
		} else {
			return newPath;	
		}
	} else {
		if(newPath.length<1) return ""; else return newPath
	}
}

function trim(strText) { 
    // this will get rid of leading spaces 
    while (strText.substring(0,1) == ' ') 
        strText = strText.substring(1, strText.length);

    // this will get rid of trailing spaces 

    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);

   return strText;
}

function validate(address) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   //var address = newPath;
   if(reg.test(address) == true) {
      //alert('Invalid Email Address');
      return address;
   }
}

function imageRollover() {
	// rollover function for all link/img rollovers
	var cache = new Array();
	$('.rollover_image').each(function() {
	
		// preload over images
		var src = $(this).attr('src');
		var ext = src.substring(src.length-4);
		var over_src = src.replace(ext, "_over"+ext);
		var cache_image = document.createElement("img");
		cache_image.src = over_src;
		cache.push(cache_image);
	
		// rollover image
		$(this).hover(function() {
			$(this).attr('src', over_src);
		}, function() {
			$(this).attr('src', src);
		});
	
	});	
}

// ADMIN DELETE CONFIRMATION
function confirmDelete(name) {
var agree=confirm("Are you sure you'd like to delete "+name+"?");
if (agree)
	return true ;
else
	return false ;
}

