
function NewWindow(strURL) {
	
	var intWidth;
	var intHeight;
	
	intWidth = 700;
	intHeight = 500;
	
	aWindow = window.open(strURL,'_blank','toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' + intWidth + ',height=' + intHeight + ',left=10,top=10');
	window.aWindow.focus();
	
}

function SameWindow(strURL) {
	aWindow = window.open(strURL,'_self');
}

function ClickItem(intItemID) {
	window.open('ShoppingCartInfo.aspx?ItemID=' + intItemID, '_self');
}

function DisplayELink(strUser, strDPrefix, strDSuffix) {
   var strH1 = "hr";
   var strH2 = "ef"; 
    var strM1 = "mai";
    var strM2 = "lto";
    var strDisplay = strUser + "@" + strDPrefix + "." + strDSuffix;
    var strFull = "<A class='Hyperlink' " + strH1 + strH2 + "=" + strM1 + strM2 + ":" + strDisplay + ">" + strDisplay + "</a>";
    document.write(strFull);
}

function LaunchELink(strDPrefix, strDSuffix, strUser) {
    var strM1 = "mai";
    var strM2 = "lto";
    var strDisplay = strUser + "@" + strDPrefix + "." + strDSuffix;
    var strURL = strM1 + strM2 + ":" + strDisplay
	aWindow = window.open(strURL,'_self');
}

function ImageDetailWindow(strFile) {
	
	var intWidth;
	var intHeight;
	var strURL;
	
	intWidth = 300;
	intHeight = 400;
	
	strURL = "ImageDetail.aspx?File=" + strFile
	
	aWindow = window.open(strURL,'_blank','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=' + intWidth + ',height=' + intHeight + ',left=75,top=50');
	window.aWindow.focus();
	
}

	function ShowPopup(strLinkID, strPopupID, strType) {
		var objLink = document.getElementById(strLinkID);
		var objPopup = document.getElementById(strPopupID);
		var intLinkLeft = GetXPosition(objLink); //objLink.offsetLeft;
		var intLinkTop = GetYPosition(objLink); //objLink.offsetTop;

		var intLinkWidth = objLink.offsetWidth;
		var intLinkHeight = objLink.offsetHeight;

		document.body.appendChild(objPopup);
		
		if (strType == "Top") {
			objPopup.style.left = intLinkLeft + "px";
			objPopup.style.top = (intLinkTop + intLinkHeight) + "px";
		} else {
			objPopup.style.left = (intLinkLeft + intLinkWidth) + "px";
			//objPopup.style.top = (intLinkTop - 10) + "px";
			objPopup.style.top = intLinkTop + "px";
		}
		objPopup.style.display = "block";
//	alert("Here88");
	}
	function HidePopup(strImageID) {
		document.getElementById(strImageID).style.display = "none";
	}
	
	function GetXPosition(objElement) {
		var intX = 0;
		while(objElement != null ) {
			intX += objElement.offsetLeft;
			objElement = objElement.offsetParent;
		}
		return intX;
	}			
	function GetYPosition(objElement) {
		var intY = 0;
		while(objElement != null ) {
			intY += objElement.offsetTop;
			objElement = objElement.offsetParent;
		}
		return intY;
	}			

	//Validation Functions
	
	//Integer
	function IsInteger(strValue) {
		if (parseInt(strValue) == strValue - 0) {
			return true;
		} else {
			return false;
		}
	}

//Conversion/Formatting Functions
function FormatCurrency(decAmount)
{
	var strMinus = '';
	if(decAmount < 0) { 
	  strMinus = '-';
	}
	decAmount = Math.abs(decAmount);
	decAmount = parseInt((decAmount + .005) * 100);
	decAmount = decAmount / 100;
	strAmount = new String(decAmount);
	if(strAmount.indexOf('.') < 0) { 
	  strAmount += '.00';
	}
	if(strAmount.indexOf('.') == (strAmount.length - 2)) {
	  strAmount += '0';
	}
	strAmount = "$" + strMinus + strAmount;
	return strAmount;
}

function CommaFormatted(amount) //Not used right now
{
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + '.' + d; }
	amount = minus + amount;
	return amount;
}


