function open_window(sURL, iHeight, iWidth, iTop, iLeft, sWinName, sScrollbars, sStatus)
{
	return window.open (sURL, sWinName,'height=' + iHeight + ',width=' + iWidth + ',scrollbars=' + sScrollbars + ',toolbar=no,location=no,directories=no,status=' + sStatus + ',menubar=no,titlebar=yes,alwaysRaised=yes,fullscreen=no,resize=no,top=' + iTop + ',left=' + iLeft);
}

function show_feedback()
{
	open_window("Feedback.asp", 540, 540, 132, 226, "winFeedback", "no", "no") ;
}

function show_checkout()
{
	return open_window("about:blank", 500, 600, 50, 50, "winCheckout", "yes", "yes") ;
}

function show_product(iProductID)
{
	open_window("ProductDetail.asp?ProductID=" + iProductID, 610, 560, 132, 226, "winProduct", "yes", "no") ;
}

function amend_area(iParentAreaID, iAreaID, iActionType)
{
	open_window("ManagerAmendArea.asp?ActionType=" + iActionType + "&ParentAreaID=" + iParentAreaID + "&AreaID=" + iAreaID, 250, 500, 200, 200, "winArea", "no", "no") ;
}
function amend_newstore(iActionType)
{
	open_window("ManagerAddNewStore.asp?ActionType=" + iActionType, 450, 700, 200, 200, "winArea", "no", "no") ;
}

/* Validation... */

var oNonEmptyRegex = new RegExp("^[\\w]") ;

function is_not_empty(sTheString)
{
	return (oNonEmptyRegex.test(sTheString)) ;
}

function validate_email(sEMailAddress)
{
	
	var sEmailReg = "^([\.a-zA-Z0-9_-])+@([a-zA-Z0-9_\-])+[\.]+(\.[a-zA-Z0-9])+" ;
	var oRegex = new RegExp(sEmailReg) ;
     
	return (oRegex.test(sEMailAddress)) ;
}

function validate_date(sTheDate, sTodaysDate)
{
	if (sTheDate.indexOf("/") >= 0)
		var parsedDate = sTheDate.split ("/") ;
	else if (sTheDate.indexOf("-") >= 0)
		var parsedDate = sTheDate.split ("-") ;
	else
		return false ;
		
	if (parsedDate.length != 3) return false ;
   
	var day = parsedDate[0] ;
	var month = parsedDate[1] ;
	var year = parsedDate[2] ;

	var oDate = new Date (month + "/" + day + "/" + year) ;
	var oDateNow = new Date(sTodaysDate) ;
   
	if (day != oDate.getDate()) return false ;
	if (month - 1 != oDate.getMonth()) return false ;
	if (year != oDate.getFullYear()) return false ;
   
	if (oDate > oDateNow) return false ;

	return true ;
} 