// JavaScript Document
/**********		IN HOUSE TRADING	**********/
/*VALIDATE ITEM INPUT*/
function validateItem(frm)
{
	if(frm.Item_Cat_ID.value==0)
	{		
		alert('Please select a category !');
		frm.Item_Cat_ID.focus();		
		return false;
	}
	if(frm.Item_Name.value.search(/\S/)==-1)
	{		
		alert('Please enter item name !');
		frm.Item_Name.focus();		
		return false;
	}
	if(FCKeditorAPI.GetInstance('Item_Descirption').GetXHTML(true)=='')
	{
		alert('Please enter item description !');
		frm.Item_Descirption.focus();		
		return false;
	}
	if(frm.Item_Price.value.search(/\S/)==-1)
	{		
		alert('Please enter item price !');
		frm.Item_Price.focus();		
		return false;
	}
	if(frm.Item_List_Date.value.search(/\S/)==-1)
	{		
		alert('Please select a listing date !');
		frm.Item_List_Date.focus();		
		return false;
	}
	if(frm.Item_Expiry_Date.value.search(/\S/)==-1)
	{		
		alert('Please select an expiry date !');
		frm.Item_Expiry_Date.focus();		
		return false;
	}
	else
		return true;
}

//FOR POPUP WINDOW
var win=null;
//javascript:popWin('category_add.php', 400, 300, 0, 0, 0, 0)
function popWin(URL, Width, Height, Resizable, Scrollbars, Status, Toolbar)
	{
		
		if(win) win.close();
		if ((Width == null) || (Width == "")) { Width = 420; }
		if ((Height == null) || (Height == "")) { Height = 300; }
		if ((Resizable == null) || (Resizable == "")) { Resizable = "No"; }
		if ((Scrollbars == null) || (Scrollbars == "")) { Scrollbars = "yes"; }
		if ((Status == null) || (Status == "")) { Status = "no"; }
		if ((Toolbar == null) || (Toolbar == "")) { Toolbar = "no"; }
	
		var positionX = (screen.availWidth - Width) / 2;
		var positionY = (screen.availHeight - Height) / 2;
	
		Day = new Date();
		WindowName = Day.getTime();
		Resizable = 'yes';
		win=window.open(URL,WindowName,"width=" + Width + ",height=" + Height + ",left=" + positionX + ",top=" + positionY + ",channelmode=0,dependent=0,directories=0,location=0,menubar=0,resizable=" + Resizable + ",scrollbars=" + Scrollbars + ",status=" + Status + ",toolbar=" + Toolbar);
	}
	
function keep_in_list_check()
{
	if(document.frm.Item_Is_Sold.checked)
		document.getElementById('list').style.display='';
	else
		document.getElementById('list').style.display='none';	
}