/* ------------------------------------------------------
------------------Form Functions         ----------------
-------------------------------------------------------*/

function checkCat(formName) {
//checks values of various form fields
var illegalChars= /[\\\/\<\>\,\;\:\"\[\]\?\*\'\&\(\)/(\s)/]/;
	if (formName.cat_description.value == "") {
		alert("Please Enter a Gallery Name!")
		formName.cat_description.focus();
		return false;
	}
	if (formName.cat_description.value.match(illegalChars)){
		alert("Gallery Names cannot contain any of these characters: \ / < > , ; : [ ] ? * \'& ( ) {spaces}")
		formName.cat_description.focus();
		return false;
	}
return true;
}//end function CheckForm

function checkPhoto(formName) {
	if (formName.filename.value == "") {
		alert("Filename cannot be empty")
		formName.filename.focus();
		return false;
	}
return true;
}//end function checkPhoto

function MoveFiletoGallery(cat_value){
	if (cat_value == "none"){
		alert("You cannot move this file to this Gallery.  It contains other Gallerys. \n Select another Gallery that contains only photos.")
		document.getElementById("categorysel").selectedIndex = "0"
	}
}

function MoveGallery(cat_value){
	if (cat_value == "none"){
		alert("You cannot move this Gallery to the Selected Gallery.  It contains only photos. \n Select another gallery that contains other gallerys or create a new gallery.")
		document.getElementById("categorysel").selectedIndex = "0"
	}
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function checkSearch(formName){

   return true;
}

function galdelete(url){
	var answer=confirm("Are you sure you want to delete this Gallery? \n It will also delete all the files!")
		if(answer){
			window.location.href = url;
		}
}

function photodelete(url){
	var answer=confirm("Are you sure you want to delete this Photo?")
		if(answer){
			window.location.href = url;
		}
}

function AddtoProfile(url){
	var answer=confirm("Are you sure you want to add this photo to your profile?")
		if(answer){
			window.location.href = url;
		}
}

function EmailPhoto(photourl){ 
     width = 500
	 height = 500
	 var url = "../forum/pop_send_photo_to_friend.asp?url=" + photourl
     popupWin = window.open(url, 'Email_Photo', 'scrollbars=yes,width=' + width + ',height=' + height)
     popupWin.focus(); 
     return false;
}

function ChangeGallery(cat_id){
	window.location.href = "default.asp?cat_id=" + cat_id;
}

/* ------------------------------------------------------
------------------Misc Functions         ----------------
-------------------------------------------------------*/

function Upload_Resize(pcat_id, curPage)
{
	var url = "aspupload.asp?cat_id=" + pcat_id + "&curPage=" + curPage
	//alert(url)
	popupWin = window.open(url, 'Image_Upload', 'scrollbars=yes,width=640,height=650')
}

