function AddToShoppingCart(myKey,myItem,url,CartType,Mon,Y)
{
	var myURL = "addremoveshoppingcartresponse.asp?myAdd=ADD&myKey="+myKey+"&myItem="+myItem+"&url="+url+"&CartType="+CartType+"&MonthName="+Mon+"&YearName="+Y;
	document.location.replace(myURL);
}

function RemoveFromShoppingCart(myKey,myItem,url,CartType)
{
	var myURL = "addremoveshoppingcartresponse.asp?myRemove=DELETE&myKey="+myKey+"&myItem="+myItem+"&url="+url+"&CartType="+CartType;
	document.location.replace(myURL)
}

function numbersonly(e)
{
	var unicode=e.charCode? e.charCode : e.keyCode
	if (unicode!=8) //backkey
	{
		if (unicode<48||unicode>57) //if not a number
		return false //disable key press
	}
}

function PopupRichTextEditor(ID,EventType,obj)
{
	//var myTop = (screen.height/2)-510;
	var myLeft = (screen.width/2)-408;
	var myurl = "RichTextDescription.asp?ID="+ID+"&ObjectName="+obj+"&EventType="+EventType;
	var wMainApp = window.open(myurl, "wMainApp", "top=80,left="+myLeft+",height="+600+",width="+790+",status=yes,toolbar=no,menubar=no,location=no,scrollbars=yes, resizable=no");
}


function PopupCalendar(anchorname,myparameter) 
{
	var coordinates=GetObjectPosition(anchorname);
	var x=0;
	var y=0;
	if (document.getElementById) {
		if (isNaN(window.screenX)) {
			x=coordinates.x-document.body.scrollLeft+window.screenLeft;
			y=coordinates.y-document.body.scrollTop+window.screenTop;
			}
		else {
			x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
			y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
			}
		}
	else if (document.all) {
		x=coordinates.x-document.body.scrollLeft+window.screenLeft;
		y=coordinates.y-document.body.scrollTop+window.screenTop;
		}
	else if (document.layers) {
		x=coordinates.x+window.screenX+(window.outerWidth-window.innerWidth)-window.pageXOffset;
		y=coordinates.y+window.screenY+(window.outerHeight-24-window.innerHeight)-window.pageYOffset;
		}
	coordinates.x=x;
	coordinates.y=y;
	
	x = x+0+'px';
	y = y+20+'px';
	
	returnval = window.showModalDialog ('../IncludeFiles/Calendar.asp?myParameter='+myparameter,window.document,'dialogLeft:'+x+';dialogTop:'+y+';dialogheight:227px;dialogwidth:220px;v-scrollbar:no;help:no;status:no');

}

function PopupWin(ID,EType)
{
	window.open('../IncludeFiles/ItemDetail.asp?ID='+ID+"&EventType="+EType,'mywindow','menubar=0,resizable=1,location=0,status=1,width=600,height=600');
}

function GetObjectPosition(ObjectName) 
{
	var useWindow=false;
	var x=0
	var use_gebi=false, use_css=false, use_layers=false;
	if (document.getElementById) { use_gebi=true; }
	else if (document.all) { use_css=true; }
	else if (document.layers) { use_layers=true; }

 	if (use_gebi && document.all) 
 	{
		x=ObjectPosition_getPageOffsetLeft(document.all[ObjectName]);
	}
	else if (use_gebi) 
	{
		var o=document.getElementById(ObjectName);
		x=ObjectPosition_getPageOffsetLeft(o);
	}
 	else if (use_css) {
		x=ObjectPosition_getPageOffsetLeft(document.all[ObjectName]);
	}
	else if (use_layers) 
	{
		var found=0;
		for (var i=0; i<document.anchors.length; i++) 
		{
			if (document.anchors[i].name==ObjectName) { found=1; break; }
		}
		if (found==0) 
		{
			x=0; return x;				
		}
		x=document.anchors[i].x;
	}
	else 
	{
		x=0; return x;
	}
	return x;
}


function ObjectPosition_getPageOffsetLeft(el) 
{
	var ol=el.offsetLeft;
	while ((el=el.offsetParent) != null) { ol += el.offsetLeft; }
	return ol;
}

function ObjectPosition_getWindowOffsetLeft(el) 
{
	return ObjectPosition_getPageOffsetLeft(el)-document.body.scrollLeft;
}

function myFormatMask(myString,myControl,myPosition,myLength,myMask)
{   
	var Pos = myPosition.split(',');
	for (var x = 0; x <= Pos.length; x++)
	{
		for (var y = 0; y <= myString.length; y++)
		{
	 		if (y == Pos[x])
	 		{
	  			if (myString.substring(y, y+1) != myMask)
	  			{
	   				if (event.keyCode != 8)
	   				{
	   				    myString = myString.substring(0,y) + myMask + myString.substring(y,myString.length);
       				}
	  			}
	 		}
		}
 	}
	myControl.value = myString
}


