function showCert(itemID)
{
	window.open("/department/diamond/cert.aspx?itemID=" + itemID,"_black","width=675,height=600,scrollbars=yes,location=0,copyhistory=no");
}

function denyImageInfo(o)
{
	if(rightClick(o))
		alert("Access denied");
}
function rightClick(e)
{
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2))
		return false;
	else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) 
	{
		return true;
	} 
	return false;
}

function emailCheck(obj)
{
	var EmailOk  = true
	var Temp     = obj.value
	var AtSym    = Temp.indexOf('@')
	var Period   = Temp.lastIndexOf('.')
	var Space    = Temp.indexOf(' ')
	var Length   = Temp.length - 1   // Array is from 0 to length-1

	if ((AtSym < 1) ||                     // '@' cannot be in first position
	    (Period <= AtSym+1) ||             // Must be atleast one valid char btwn '@' and '.'
	    (Period == Length ) ||             // Must be atleast one valid char after '.'
	    (Space  != -1))                    // No empty spaces permitted
	   {
	      EmailOk = false;
	      alert('Please enter a valid e-mail address.');
	      obj.value="";
	      obj.selected;
	      return false;
	   }
		
}

function cart_validate(source, arguments)
{

	var quan = document.forms[0].quantity;
	var extAttribute;
	
	if(document.forms[0].extAttribute!=null)
		extAttribute = document.forms[0].extAttribute;
	
	
	if (quantity_validate(quan))
	{	
		if(document.forms[0].extAttribute!=null)
			if(extAttribute_validate(extAttribute))
				arguments.IsValid = true;
			else
				arguments.IsValid = false;
		else
			arguments.IsValid = true;
	}
	else
	{
		arguments.IsValid = false;
	}
}


function extAttribute_validate(o)
{
	if(o.value!="")
		return true;
	else
	{
		alert("Please select a Size");
		return false;
	}
}

function quantity_validate(o)
{
	var quantityValue = o.value;
	if(isNumeric(quantityValue))
	{
		if(quantityValue <=0)
		{
			alert("please enter a quantity greater than 0");
			o.value = "1";
			return false;
		}
		else
			return true;
	}
	else
	{
		o.value="1";
		alert("please enter a numeric quantity");
		return false;
	}
		
}
  
function isNumeric(stringIn) 
{
	validChar = "0123456789";
	var numeric = true;
	var ch;
	for (var i = 0; i < stringIn.length; i++)
	
	if (numeric) 
	{
		ch = stringIn.charAt(i);
		numeric = ( validChar.indexOf(ch) != -1);
	} 

	return numeric;
}

function FieldZoom(val)
{
	window.open('/office/FieldZoom.aspx?FieldName=' + val.name,'Zoom','height=450,width=550,scrollbars=no,toolbar=no,directories=no,menubar=no,status=no,resizable=yes,copyhistory=yes');
}

 //for (var p in arguments)
//(p + ': ' + arguments[p]);



