// JavaScript Document
function checkCForm(){
	var doc = document.forms[0]
	if (doc.categoryName.value == ""){
		alert("Sorry, you need to give the category a name")
		doc.categoryName.focus()
		return false
	}
}

function deleteAlert(msg){
	var doc = document.forms[0]
	var r = confirm(msg)
	if (!r)
		return false
}

function getFocus(field){
	var doc = document.forms[0]	
	document.getElementById(field).focus();
}

function checkIForm(){
	var doc = document.forms[0]
	var priceFormat = /^[0-9,\.\POA]+$/
	if (!doc.iName.value){
		alert("Sorry, you need to give the item a name!")
		doc.iName.focus()
		return false
	}
	if (!doc.iCategory.value){
		alert("Sorry, you need to choose a category for this item!")
		//doc.iCategory.options[0].selected = true
		return false
	}	
}

function goBack(){
	history.go(-1)	
}

function removeImage(imageName,itemID,URL){
	var name = confirm("This is going to delete this image !!!")
	if (name == true){
		window.location = "removeImage.asp?url=" + URL + "&img=" + imageName + "&ID=" + itemID
	}
	else
	return false;

}

function removeGalleryImage(imageName,itemID,URL){
	var name = confirm("This is going to delete this image from gallery !!!")
	if (name == true){
		window.location = "removeGalleryImage.asp?url=" + URL + "&img=" + imageName
	}
	else
	return false;

}


function setAsMain(imageName,itemID){
	window.location = "setasmain.asp?img=" + imageName + "&ID=" + itemID
}

function goURL_drop(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function remove(confirmMessage,url){
	var iConfirm = confirm(confirmMessage)
	if (iConfirm == true){
		window.location = url	
	}
}

function open_win(url,width,height){
	window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width="+width+", height="+height)
}
