function imgOrg() {
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function preloadImages() {
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) {
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function imgShow() {
  var i,j=0,x,a=imgShow.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function showPopup(sImage) {
	var myWin= open('', 'popupWindow', 'width=805,height=605,status=no,scrollbars=1,toolbar=no,resizable=1,status=0,menubar=no,screenX=100,screenY=100,');
	posX = (screen.availWidth / 2) - (805 / 2);
	posY = (screen.availHeight / 2) - (605 / 2);
	myWin.moveTo(posX, posY);
	myWin.focus()
	myWin.document.writeln('<html><head><title>Honda Rider\'s Club of America: Popup Image</title></head><body marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" bgcolor="#000000">')
	myWin.document.writeln('<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" align="center"><tr><td align="center">');
	myWin.document.writeln('<img src="' + sImage + '" alt="Popup Image">');
	myWin.document.writeln('</td></tr></table>')
	myWin.document.writeln('</body></html>')
}
function popup(sUrl,w,h) 
{
  var oNewWin = window.open(sUrl, '', 'resizable=0,scrollbars=0,titlebar=0,toolbars=0,margin=0,status=0,directories=0,location=0,menubar=0,height='+h+'px,width='+w+'px,left='+((screen.width -w) / 2)+',top='+((screen.height - h)/2)+'');
  return;
}
function popup_card(sUrl,w,h) 
{
  var oNewWin = window.open(sUrl, '', 'resizable=0,scrollbars=0,titlebar=0,toolbars=0,margin=0,status=0,directories=0,location=0,menubar=0,height='+h+'px,width='+w+'px,left='+((screen.width -w) / 2)+',top='+((screen.height - h)/2)+'');
  return;
}
var isDHTML = 0;
var isID = 0;
var isAll = 0;
var isLayers = 0;


if (document.getElementById) {isID = 1; isDHTML = 1;}
else {
if (document.all) {isAll = 1; isDHTML = 1;}
else {
browserVersion = parseInt(navigator.appVersion);
if ((navigator.appName.indexOf('Netscape') != -1) && (browserVersion == 4)) {isLayers = 1; isDHTML = 1;}
}}

function findDOM(objectID,withStyle) {
	if (withStyle == 1) {
		if (isID) { return (document.getElementById(objectID).style) ; }
		else { 
			if (isAll) { return (document.all[objectID].style); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
	else {
		if (isID) { return (document.getElementById(objectID)) ; }
		else { 
			if (isAll) { return (document.all[objectID]); }
		else {
			if (isLayers) { return (document.layers[objectID]); }
		};}
	}
}


function showLAYER(idName){ 

  if(document.getElementById) {//NN6,Mozilla,IE5
    document.getElementById(idName).style.visibility = 'visible'
}
  else if(document.all)       //IE4
    document.all(idName).style.visibility   = 'visible' 
    
  else if(document.layers)    //NN4
    document.layers[idName].visibility     = 'show' 

}


function hideLAYER(idName){ 
	var Layer = findDOM(idName, 1);
	Layer.visibility = 'hidden';
/*  if(document.getElementById) //NN6,Mozilla,IE5
    document.getElementById(idName).style.visibility
                                           = 'hidden' 
    
  else if(document.all)       //IE4
    document.all(idName).style.visibility  = 'hidden' 
    
  else if(document.layers && document.layers[idName]) {
    document.layers[idName].visibility = 'hidden';
  }
*/
}

//-->

/************************************************HRCA TICKETS STARTS HERE*****************************************************/
function openWindow(url,winName,w,h) {
// parameters:	url = URL of the popup window
// 				winName = window name
// 				w = width
// 				h = height
	leftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	topPosition = (screen.height) ? (screen.height-h)/2 : 0;
	var windowprops = 'width=' + w + ',height=' + h + ',top='+ topPosition +',left='+ leftPosition +',toolbar=no,location=no,directories=no,status=no,scrollbars=no,menubar=no';
	var popup = window.open(url,winName,windowprops);
	// opener allows popup windows to communicate with its owner (the window from which it came)
	// please review http://www.webreference.com/js/tutorial1/opener.html for more information on opener
	if (popup.opener == null) { 	// check if opener property exists
		popup.opener = self; 		// define opener property
	}
	popup.focus();
}

function sniffIt(){
	this.opera= (navigator.userAgent.indexOf('Opera')>-1);
	this.nn4= (document.layers);
	this.ie4= (document.all && !document.getElementById);
	this.ie5= (document.getElementById && document.all && !this.opera);
	this.nn6= (document.getElementById && !document.all && !this.opera);
	this.mac= (navigator.userAgent.indexOf('Mac')>-1); // For excluding IE4 macs only
	this.ok= (this.nn4 || this.ie4 || this.ie5 || this.nn6 && !this.mac && !this.opera);
}
who= new sniffIt();

function adjWidth(val,offset){
	if(who.nn6){
		return val-offset;
	}else{
		return val;
	}
}


/*********************************************************************************/


/********************************************************************************
Description:	this is the method to insert a row in the html table and add the seating class
Logic:			this is designed for add ticket UI only because the new row will display as 
				non-editable strings
Revision:		
*********************************************************************************/
function insertAddTicketClass()
{
	
	var iClassIndex=Number(document.getElementById("JSSeatingClassCount").value);
	var sSeatingClass=(document.getElementById("TicketClassSelection").options[document.getElementById("TicketClassSelection").selectedIndex].text);
	ValidateClass(sSeatingClass);
	if (document.getElementById(sSeatingClass)==null&&
		isMoney(document.getElementById("MemberPriceInsert").value)&&
		isMoney(document.getElementById("GuestPriceInsert").value)&&
		isNumber(document.getElementById("TicketQuantityInsert").value)&&
		isNumber(document.getElementById("LowStockInsert").value)&&
		isNumber(document.getElementById("SoldOutInsert").value))
	{
		var sMemberPrice=(document.getElementById("MemberPriceInsert").value);
		var sGuestPrice=(document.getElementById("GuestPriceInsert").value);
		var sTotalQuantity=(document.getElementById("TicketQuantityInsert").value);
		var sLowQuantity=(document.getElementById("LowStockInsert").value);
		var sSoldOut=(document.getElementById("SoldOutInsert").value);
		var sTaxInc="Yes";
		var sColor;
		if (document.getElementById("TicketClassTable").rows.length % 2 == 0)
		{
			sColor="#EEEEEE";
		}
		else
			sColor="#dddddd";
	
		if(!checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut)){
		eval("document.getElementById('TicketQuantityInsert').focus()");
		return;
		}
		
		//checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut);
	
		if (sSeatingClass!="select..." && sMemberPrice != '' && sGuestPrice!='' && sTotalQuantity!='' &&sLowQuantity!='' && sSoldOut!='' )
		{
			var newrow =document.getElementById("TicketClassTable").insertRow(iClassIndex+2);
			var newcell0 = newrow.insertCell(0);
			var newcell1 = newrow.insertCell(1);
			var newcell2 = newrow.insertCell(2);
			var newcell3 = newrow.insertCell(3);
			var newcell4 = newrow.insertCell(4);
			var newcell5 = newrow.insertCell(5);
			var newcell6 = newrow.insertCell(6);
			var newcell7 = newrow.insertCell(7);
			var newcell8 = newrow.insertCell(8);
			newrow.insertCell(9);
			newrow.insertCell(10); 
			newrow.insertCell(11);

			
			newrow.id=sSeatingClass
			newrow.bgColor=sColor
			newcell0.innerHTML=	"<td width='190' style='padding:5px 0px 5px 10px' valign='top' id='"+ sSeatingClass +"' class='purchase_nml'>" + sSeatingClass + "</td>" + "\n" +
					"<input type='hidden'  id='txtTicketClass" + iClassIndex +"' name='txtTicketClass" + iClassIndex +"' value='" + sSeatingClass + "'/>" + "\n";
			newcell0.style.padding='5px 0px 5px 15px';
			newcell0.style.fontFamily='Verdana';
			newcell0.style.fontSize='11px';
			newcell0.style.color='#333333';
			newcell0.valign='top'


			newcell1.innerHTML=			"<td width='100' style='padding:5px 0px 5px 0px;font-family:Verdana;font-size:11px;	color:#333333;' valign='top' class='purchase_nml'>$" + sMemberPrice +"</td>" +"\n" +
					"<input type='hidden'  name='txtMemberPrice" + iClassIndex +"' value='$" + sMemberPrice + "'/>" +"\n";
			newcell1.style.padding='5px 0px 5px 2px';
			newcell1.style.fontFamily='Verdana';
			newcell1.style.fontSize='11px';
			newcell1.style.color='#333333';
			newcell1.valign='top'
			newcell2.innerHTML=			"<td width='110' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'>$" + sGuestPrice + "</td>" +"\n" +
					"<input type='hidden'  name='txtGuestPrice" + iClassIndex +"' value='$" + sGuestPrice + "'/>" +"\n" ;
			newcell2.style.padding='5px 0px 5px 2px';
			newcell2.style.fontFamily='Verdana';
			newcell2.style.fontSize='11px';
			newcell2.style.color='#333333';
			newcell2.valign='top'
			newcell3.innerHTML=	"<td width='100' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'>" + sTotalQuantity + "</td>" +"\n" +
					"<input type='hidden'  name='txtTotalQuantity" + iClassIndex +"' value='" + sTotalQuantity + "'/>" +"\n" ;
			newcell3.style.padding='5px 0px 5px 2px';
			newcell3.style.fontFamily='Verdana';
			newcell3.style.fontSize='11px';
			newcell3.style.color='#333333';
			newcell3.valign='top'
			newcell4.innerHTML=	"<td width='100' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'>" + sLowQuantity + "</td>" +	"\n" +
					"<input type='hidden'  name='txtLowStockWarningQuantity" + iClassIndex +"' value='" + sLowQuantity + "'/>" +"\n";
			newcell4.style.padding='5px 0px 5px 2px';
			newcell4.style.fontFamily='Verdana';
			newcell4.style.fontSize='11px';
			newcell4.style.color='#333333';
			newcell4.valign='top'
			newcell5.innerHTML=	"<td width='85' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'>" + sSoldOut + "</td>" +"\n" +
					"<input type='hidden'  name='txtSoldOutQuantity" + iClassIndex +"' value='" + sSoldOut + "'/>" +"\n";
			newcell5.style.padding='5px 0px 5px 2px';
			newcell5.style.fontFamily='Verdana';
			newcell5.style.fontSize='11px';
			newcell5.style.color='#333333';
			newcell5.valign='top'
			newcell6.innerHTML=	"<td width='77' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'></td>" +"\n" +
					"<input type='hidden'  name='optTaxIncluded" + iClassIndex +"' value='" + sSeatingClass + "'/>"+ "\n";
			newcell6.style.padding='5px 0px 5px 2px';
			newcell6.style.fontFamily='Verdana';
			newcell6.style.fontSize='11px';
			newcell6.style.color='#333333';
			newcell6.valign='top'
			newcell7.innerHTML=	"<td><img src='images/trans.gif' width='1' height='1' alt='' /><input type='hidden' name='txtSoldQuantity" + iClassIndex + "' value='0'/></td>"+"\n";
			

			newcell8.innerHTML=	"<td class='asterisk' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'><b><a href='#' onclick='javascript:RemoveTicketClass(this)' class='validate'>Remove</a></b></td>";
			newcell8.style.padding='5px 0px 5px 0px';
			newcell8.style.fontFamily='Verdana';
			newcell8.style.fontSize='11px';
			newcell8.style.color='#333333';			
			newcell8.valign='top'
							
			
			document.getElementById("SeatingClassCount").value=Number(document.getElementById("SeatingClassCount").value)+1;
			document.getElementById("JSSeatingClassCount").value=Number(document.getElementById("JSSeatingClassCount").value)+1;
		}
			else
			alert("Not all Ticket Class information has been filled in. Please fill in all required fields before continuing.");

	}
	if(	document.getElementById(sSeatingClass)==null&&
	(!isMoney(document.getElementById("MemberPriceInsert").value) ||
		!isMoney(document.getElementById("GuestPriceInsert").value) ||
		!isNumber(document.getElementById("TicketQuantityInsert").value) ||
		!isNumber(document.getElementById("LowStockInsert").value) ||
		!isNumber(document.getElementById("SoldOutInsert").value)))
	alert("Not all Ticket Class information has been filled in correctly.");
	
	
	document.close();
}

/********************************************************************************
Description:	Use this to remove the row of assigned ticket class
Logic:			this will remove an entire table row include any hidden form in it thus
				to induce an update that doesn't have the removed ticket class
Revision:	
*********************************************************************************/
function RemoveTicketClass(oElement,oid)
{
	


	var i;
	while (!isNumber(String(oElement.rowIndex)))
	{
		oElement=oElement.parentNode;
	}

	//alert(oElement.innerHTML);
	//alert(document.txtTicketClass0.value);
	i=oElement.rowIndex;

	if (confirm('To confirm the removal of this seating class you will need to click the "OK" button. After the seating class is removed from the seating class list you must click the "Save Changes" button to finalize the removal of this seating class. If you do not click the "Save Changes" button, the seating class will not be removed from this event. Are you sure you want to continue?'))
	{
		var sColor = "#dddddd"
		document.getElementById('TicketClassTable').deleteRow(i);
		//var newrow =document.getElementById("TicketClassTable").insertRow(i);
		//var newcell = newrow.insertCell();
		var index=2;
		while (index<document.getElementById("TicketClassTable").rows.length)
		{
			if (sColor == "#eeeeee")
				sColor = "#dddddd"
			else
				sColor = "#eeeeee"
			document.getElementById("TicketClassTable").rows[index].bgColor=sColor
			index++;
		}
		document.getElementById("JSSeatingClassCount").value=Number(document.getElementById("JSSeatingClassCount").value)-1;
		if (oid!="")
		{
			var newrow =document.getElementById("DeleteTable").insertRow(document.getElementById("DeleteTable").rows.length-1);
			var newcell = newrow.insertCell();
			newcell.innerHTML="<input type='hidden' id='whiteRow' name='txtDeleteTicketClass' value='" + oid + "'/>";
		}
	}
}

/********************************************************************************
Description:	this is the method to insert a row in the html table and add the seating class
Logic:			this is designed for edit ticket UI only because the new row will display as 
				input boxes.
Revision:	
*********************************************************************************/
function insertEditTicketClass()
{

	var iClassIndex=Number(document.getElementById("SeatingClassCount").value);
	var sSeatingClass=(document.getElementById("TicketClassSelection").options[document.getElementById("TicketClassSelection").selectedIndex].text);
	ValidateClass(sSeatingClass);
	if (document.getElementById(sSeatingClass)==null&&
		isMoney(document.getElementById("MemberPriceInsert").value)&&
		isMoney(document.getElementById("GuestPriceInsert").value)&&
		isNumber(document.getElementById("TicketQuantityInsert").value)&&
		isNumber(document.getElementById("LowStockInsert").value)&&
		isNumber(document.getElementById("SoldOutInsert").value))
	{
	var sMemberPrice=(document.getElementById("MemberPriceInsert").value);
	var sGuestPrice=(document.getElementById("GuestPriceInsert").value);
	var sTotalQuantity=(document.getElementById("TicketQuantityInsert").value);
	var sLowQuantity=(document.getElementById("LowStockInsert").value);
	var sSoldOut=(document.getElementById("SoldOutInsert").value);
	var sTaxInc="Yes";
	var sColor;
	if (document.getElementById("TicketClassTable").rows.length % 2 == 0)
	{
		sColor="#EEEEEE";
	}
	else
		sColor="#dddddd";
	
	if(!checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut)){
		eval("document.getElementById('TicketQuantityInsert').focus()");
	return;
	}
	//checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut);	

	if (sSeatingClass!="select..." && sMemberPrice != '' && sGuestPrice!='' && sTotalQuantity!='' &&sLowQuantity!='' && sSoldOut!='' )
	{
		var newrow =document.getElementById("TicketClassTable").insertRow(document.getElementById("TicketClassTable").rows.length);
		var newcell = newrow.insertCell();
		newrow.bgColor=sColor;
		newrow.id=sSeatingClass

		var newcell0 = newrow.insertCell(0);
		var newcell1 = newrow.insertCell(1);
		var newcell2 = newrow.insertCell(2);
		var newcell3 = newrow.insertCell(3);
		var newcell4 = newrow.insertCell(4);
		var newcell5 = newrow.insertCell(5);
		//var newcell6 = newrow.insertCell(6);
		var newcell7 = newrow.insertCell(6);
		//var newcell8 = newrow.insertCell(7);
		var newcell9 = newrow.insertCell(8);
		newrow.insertCell(9);
		newrow.insertCell(10); 
		newrow.insertCell(11);
		
		newcell0.innerHTML = "<td id='"+ sSeatingClass +"' width='190' style='padding:5px 0px 5px 10px' valign='top'><input name='txtTicketClass" + iClassIndex + "' type='Text' style='width:130px' class='input_edit' value='" + sSeatingClass + "' disabled><input name='txtTicketClass" + iClassIndex + "' type='hidden' style='width:130px' class='input_edit' value='" + sSeatingClass + "'></td>";
		newcell0.style.padding='5px 0px 5px 10px';
		newcell0.style.fontFamily='Verdana';
		newcell0.style.fontSize='11px';
		newcell0.style.color='#333333';
		newcell0.valign='top'
		newcell1.innerHTML = 	"<td width='100' style='padding:5px 0px 5px 0px' valign='top'><input name='txtMemberPrice" + iClassIndex + "' type='Text' style='width:50px' 	response.write	class='input_edit' value='" + sMemberPrice + "'></td>";
		newcell1.style.padding='5px 0px 5px 0px';
		newcell1.style.fontFamily='Verdana';
		newcell1.style.fontSize='11px';
		newcell1.style.color='#333333';
		newcell1.valign='top'
		newcell2.innerHTML = 	"<td width='110' style='padding:5px 0px 5px 0px' valign='top'><input name='txtGuestPrice" + iClassIndex + "' type='Text' style='width:50px' 	class='input_edit' value='" + sGuestPrice + "'></td>";
		newcell2.style.padding='5px 0px 5px 0px';
		newcell2.style.fontFamily='Verdana';
		newcell2.style.fontSize='11px';
		newcell2.style.color='#333333';
		newcell2.valign='top'
		newcell3.innerHTML = 	"<td width='100' style='padding:5px 0px 5px 0px' valign='top'><input name='txtTotalQuantity" + iClassIndex + "' type='Text' style='width:50px' 	class='input_edit' value='" + sTotalQuantity + "'></td>";
		newcell3.style.padding='5px 0px 5px 0px';
		newcell3.style.fontFamily='Verdana';
		newcell3.style.fontSize='11px';
		newcell3.style.color='#333333';
		newcell3.valign='top'
		newcell4.innerHTML = 	"<td width='100' style='padding:5px 0px 5px 0px' valign='top'><input name='txtLowStockWarningQuantity" + iClassIndex + "' type='Text' style='width:50px' class='input_edit' value='" + sLowQuantity + "'></td>";
		newcell4.style.padding='5px 0px 5px 0px';
		newcell4.style.fontFamily='Verdana';
		newcell4.style.fontSize='11px';
		newcell4.style.color='#333333';
		newcell4.valign='top'
		newcell5.innerHTML = 	"<td width='85' style='padding:5px 0px 5px 0px' valign='top'><input name='txtSoldOutQuantity" + iClassIndex + "' type='Text' style='width:50px' class='input_edit' value='" + sSoldOut + "'></td>";
		newcell5.style.padding='5px 0px 5px 0px';
		newcell5.valign='top'
		newcell7.innerHTML = 	"<td class='edit_sold' style='padding:5px 0px 5px 0px' valign='top'><b>sold:</b>0</td>";
		newcell7.style.padding='5px 0px 5px 0px';
		newcell7.style.fontFamily='Verdana';
		newcell7.style.fontSize='10px';
		newcell7.style.color='#666666';
		newcell7.valign='top'
		newcell9.innerHTML = 	"<td class='asterisk' style='padding:5px 0px 5px 0px' valign='top' class='purchase_nml'><b><a href='#' onclick='javascript:RemoveTicketClass(this)' class='validate'>Remove</a></b></td>";
		newcell9.style.padding='5px 0px 5px 0px';
		newcell9.style.fontFamily='Verdana';
		newcell9.style.fontSize='11px';
		newcell9.style.color='#333333';
		newcell9.valign='top'
		document.getElementById("SeatingClassCount").value=Number(document.getElementById("SeatingClassCount").value)+1;
		document.getElementById("JSSeatingClassCount").value=Number(document.getElementById("JSSeatingClassCount").value)+1;
		}
		else
			alert("Please complete all fields before adding a ticket class");

	}
if(	document.getElementById(sSeatingClass)==null&&
	(!isMoney(document.getElementById("MemberPriceInsert").value)||
		!isMoney(document.getElementById("GuestPriceInsert").value)||
		!isNumber(document.getElementById("TicketQuantityInsert").value)||
		!isNumber(document.getElementById("LowStockInsert").value)||
		!isNumber(document.getElementById("SoldOutInsert").value)))
	alert("Please enter in numeric values for Member price, Guest price, Ticket Qty, Low stock, and Sold out Qty");
}


/********************************************************************************
Description:	this is the method to insert a row in the html table and add the shipping method
Logic:			insert a simple input and a remove button, before the insert, the name will be validated
Revision:	
*********************************************************************************/
function AddShippingMethod(oForm,tableName)
{
	var sShippingMethodName = (document.getElementById("txtShippingMethodName").value);
	var sShippingPrice=(document.getElementById("txtShippingPrice").value);
	var sDaysBeforeDisable=(document.getElementById("txtDaysBeforeDisable").value);
	
		sShippingPrice = stringReplace(sShippingPrice, ",", "");
	
		if (isMoney(sShippingPrice) && sShippingPrice >= 10000)
		{
			alert("Shipping Price must be less than $10,000.");
			return;
		}
		if (sDaysBeforeDisable!='' && sShippingPrice!='' && sShippingMethodName!='' && isNumber(sDaysBeforeDisable) && isMoney(sShippingPrice))
		{
			ValidateClass(sShippingMethodName);
			if (document.getElementById(sShippingMethodName)==null)
			{
			var sRowColor = "#eeeeee";
			
			if (document.getElementById("ShippingMethodTable").rows.length % 2 == 0)
		
				sRowColor = "#eeeeee";
			else
				sRowColor = "#dddddd"
			
			var newrow =document.getElementById("ShippingMethodTable").insertRow(document.getElementById("ShippingMethodTable").rows.length);
			newrow.bgColor= sRowColor
			newrow.id=sShippingMethodName;
			var newcell1 = newrow.insertCell(0);
			var newcell2 = newrow.insertCell(1);
			var newcell3 = newrow.insertCell(2);
			var newcell4 = newrow.insertCell(3);
			var newcell5 = newrow.insertCell(4);
			var TableLength = "this.parentNode.parentNode.parentNode.rowIndex";
					
			newcell1.innerHTML = '<td style="padding:5px 20px 5px 10px" valign="top"><input type="Text" style="width:230px;height:17px;color:#666666" name="txtAddShippingMethodNameInsert" class="input" value="' + sShippingMethodName + '"></td>'; 
			newcell1.style.padding='5px 20px 5px 10px';
			newcell1.valign='top'
			newcell2.innerHTML = '<td style="padding:5px 0px 5px 0px" valign="top"><input type="Text" style="width:50px;height:17px;color:#666666" name="txtAddInsertShippingPrice" class="input" value="' + sShippingPrice + '"></td>';
			newcell2.style.padding='5px 0px 5px 0px';
			newcell2.valign='top'
			newcell3.innerHTML = '<td style="padding:5px 0px 5px 0px" valign="top"><input type="Text" style="width:30px;height:17px;color:#666666;text-align:right" name="txtAddInsertDisableDays" class="input" value="' + sDaysBeforeDisable +'"></td>'; 
			newcell3.style.padding='5px 0px 5px 0px';
			newcell3.valign='top'
			newcell4.innerHTML = '<td class="purchase_nml" style="padding:5px 0px 5px 0px" valign="top"><b><a href="#" onClick="javascript:RemoveRowGeneral(' + TableLength + ',\'ShippingMethodTable\')"class="validate">Remove</a></b></td><input type="hidden" name="txtAddInsertShippingMethodID" value="none"/>';
			newcell4.style.padding='5px 0px 5px 0px';
			newcell4.style.fontFamily='Verdana'
			newcell4.style.fontSize='11px'
			newcell4.style.color='#333333'
			newcell4.valign='top'
			var newrow =document.getElementById(tableName).insertRow(document.getElementById(tableName).rows.length-1);
			var newcell = newrow.insertCell();
			newcell.innerHTML="<input type='hidden' name='sUpdateShippingMethod' value='true'/>";
			oForm.submit();
			}
			
		}
		else
			alert("Please insert the correct information");
	
}


/********************************************************************************
Description:	this is the method to insert a row in the html table and add a new seating class that will be
				available as seating class option for all events
Logic:			this is designed for add ticket UI only because the new row will display as 
				non-editable strings
Revision:	
*********************************************************************************/
function AddTicketClass(oForm,tableName)
{
	var sSeatingClassName = (document.getElementById("txtSeatingClassName").value);

	
	if (sSeatingClassName!="")
	{
		ValidateClass(sSeatingClassName);
		if (!ValidTicketClassName(sSeatingClassName)){
		return;
		}
		if (document.getElementById(sSeatingClassName)==null)
		{
			var sRowColor = "#eeeeee";
			
			if (document.getElementById("InsertTicketClassTable").rows.length % 2 == 0)
				sRowColor = "#eeeeee";
			else
				sRowColor = "#dddddd"
			
			var newrow =document.getElementById("InsertTicketClassTable").insertRow(document.getElementById("InsertTicketClassTable").rows.length);
			newrow.bgColor= sRowColor;
			
			newrow.id=sSeatingClassName;


			var newcell1 = newrow.insertCell(0);
			var newcell2 = newrow.insertCell(1);
			var TableLength = "this.parentNode.parentNode.parentNode.rowIndex";
					
			newcell1.innerHTML = '<td style="padding:5px 20px 5px 10px" valign="top"><input name="txtInsertTicketClassName" type="Text" style="width:230px;height:17px;color:#666666" class="input" value="' + sSeatingClassName + '"></td><input type="hidden" value="' + sSeatingClassName + '" name="txtOriginalTicketOption">';
			newcell1.style.padding='5px 20px 5px 10px';
			newcell1.valign='top'
			newcell2.innerHTML = '<td class="purchase_nml"><b><a onClick="javascript:RemoveRowGeneral(' + TableLength + ',\'InsertTicketClassTable\')" href="#"  class="validate">Remove</a></b></td>';
			newcell2.style.fontFamily='Verdana'
			newcell2.style.fontSize='11px'
			newcell2.style.color='#333333'
			var newrow =document.getElementById(tableName).insertRow(document.getElementById(tableName).rows.length-1);
			var newcell = newrow.insertCell();
			newcell.innerHTML="<input type='hidden' name='sUpdateTicketClass' value='true'/>";
			oForm.submit();
		}
	}
		else
			alert("Please enter a ticket class name");
	
}


/********************************************************************************
Description:	this is the method to remove a row in the table, this is used for ticket_setting page only
Logic:			remove the row thus removed all the form information of that ticket class
Revision:	
*********************************************************************************/
function RemoveRowGeneral(i,tableName,oForm)
{
	if (confirm("Are you sure you want to delete this ticket class?","Yes","No"))
	{
		document.getElementById(tableName).deleteRow(i);
		var index=2;
		var sColor="#dddddd"
		while (index<document.getElementById(tableName).rows.length)
		{
			if (sColor == "#eeeeee")
				sColor = "#dddddd"
			else
				sColor = "#eeeeee"
			document.getElementById(tableName).rows[index].bgColor=sColor
			index++;
		}
		var newrow =document.getElementById(tableName).insertRow(document.getElementById(tableName).rows.length-1);
		var newcell = newrow.insertCell();
		newcell.innerHTML="<input type='hidden' name='sUpdateTicketClass' value='true'/>";
		oForm.submit();
	}
	
}


/********************************************************************************
Description:	this is the method to remove an existing row from database in the html table
Logic:			this is designed so that a hidden form field will be created to generate a delete 
				list,for Shipping method only
Revision:	
*********************************************************************************/
function RemoveExistingRowGeneral(i,tableName,id,oForm)
{
	if (confirm("Are you sure you want to delete this shipping method?","Yes","No"))
	{
		//document.getElementById(tableName).deleteRow(i);
		var sColor="#dddddd"
		var index=2;
		/*while (index<document.getElementById(tableName).rows.length)
		{
			if (sColor == "#eeeeee")
				sColor = "#dddddd"
			else
				sColor = "#eeeeee"
			document.getElementById(tableName).rows[index].bgColor=sColor
					
			index++;
		}*/
		var tbl = document.getElementById("DeleteTable");
		var i = tbl.rows.length - 1;
	  	var newRow = tbl.insertRow(i); 
	  	var newCell;
		
		newCell = newRow.insertCell(i);	
		//var newrow = document.getElementById("DeleteTable").insertRow(document.getElementById("DeleteTable").rows.length-1);
		//var newcell = newrow.insertCell();
		newCell.innerHTML="<input type='hidden' id='whiteRow' name='txtDeleteInsertShippingMethodID' value='" + id + "'/>";
		oForm.submit();
	}
	
}

/********************************************************************************
Description:	this is the method to disable an existing row from database in the html table
*********************************************************************************/
function DisableExistingRowGeneral(i,tableName,id,oForm)
{
	if (confirm("Are you sure you want to disable this shipping method?","Yes","No"))
	{
		//document.getElementById(tableName).deleteRow(i);
		var sColor="#dddddd"
		var index=2;
		/*while (index<document.getElementById(tableName).rows.length)
		{
			if (sColor == "#eeeeee")
				sColor = "#dddddd"
			else
				sColor = "#eeeeee"
			document.getElementById(tableName).rows[index].bgColor=sColor
					
			index++;
		}*/
		var tbl = document.getElementById("DeleteTable");
		var i = tbl.rows.length - 1;
	  	var newRow = tbl.insertRow(i); 
	  	var newCell;
		
		newCell = newRow.insertCell(i);	
		newCell.innerHTML="<input type='hidden' id='whiteRow' name='txtDisableShippingMethodID' value='" + id + "'/>";
		oForm.submit();
	}
	
}
/********************************************************************************
Description:	this is the method to enable an existing shipping method from database in the html table
Revision:	
*********************************************************************************/
function EnableExistingRowGeneral(i,tableName,id,oForm)
{
	if (confirm("Are you sure you want to enable this shipping method?","Yes","No"))
	{
		//document.getElementById(tableName).deleteRow(i);
		var sColor="#dddddd"
		var index=2;
		/*while (index<document.getElementById(tableName).rows.length)
		{
			if (sColor == "#eeeeee")
				sColor = "#dddddd"
			else
				sColor = "#eeeeee"
			document.getElementById(tableName).rows[index].bgColor=sColor
					
			index++;
		}*/
		var tbl = document.getElementById("EnableTable");
		var i = tbl.rows.length - 1;
	  	var newRow = tbl.insertRow(i); 
	  	var newCell;
		
		newCell = newRow.insertCell(i);	
		//var newrow =document.getElementById("EnableTable").insertRow(document.getElementById("EnableTable").rows.length-1);
		//var newcell = newrow.insertCell();
		newCell.innerHTML="<input type='hidden' id='whiteRow' name='txtEnableShippingMethodID' value='" + id + "'/>";
		oForm.submit();
	}
	
}


/********************************************************************************
Description:	validate class name to see if they are repeated in real time
Revision:	
*********************************************************************************/
function ValidateClass(ClassName)
{
	if (ClassName == "")
	{
		alert("Please enter a value")
	}
	else if (document.getElementById(ClassName)!=null)
	{
		alert("This Ticket Class already exists");

	}
}


/********************************************************************************
Description:	validate for forms for null value in real time
Revision:	
*********************************************************************************/
function ValidateClassForm(oForm)
{
	if (oForm.value == null || oForm.value == "")
	{
		oForm.focus();
		alert("Please enter a value")
		oForm.value="";
		return;
	}
	else 
	{
		if (document.getElementById(oForm.value)!=null)
		{
			oForm.focus();
			alert("This Ticket Class already exists");
			oForm.value="";
		}
		
	}
}


/********************************************************************************
Description:	use this to submit a form for manage tickets page and before that, check all form fields to see if any are null
Revision:		11/03/04 Fritz Dacanay: added date validation for Available Ship Date, Ticket Sales Begin Date, Ticket Sales End Date
*********************************************************************************/
function SubmitManageTicketForm(oForm)
{

	var iIndex, ichecked, iTicketClass, sAvailableDate, sSalesBeginDate, sSalesEndDate, sMonth, sDay, bDisable;
	ichecked = 0;
	bDisable = false;
	iTicketClass = 0;	
	iClassCount = document.UpdateTicket.SeatingClassCount.value;
	
	/* Start Dates validation */
	sMonth = oForm.TicketAvailableDateMonth.value;
/*	for(var i =0;i<iClassCount;i++){
		sTotalQuantity = eval("document.UpdateTicket.txtTotalQuantity" + i + ".value");
		sLowQuantity = eval("document.UpdateTicket.txtLowStockWarningQuantity" + i + ".value");
		sSoldOut = eval("document.UpdateTicket.txtSoldOutQuantity" + i + ".value");
		//alert ("total qty " + sTotalQuantity + " " + "low Stock qty " + sLowQuantity + " " + "sold out qty " + sSoldOut);
		//checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut);
		
		if(!checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut)){
			eval("document.UpdateTicket.txtTotalQuantity" + i + ".focus()");
			return;
		}
	}*/
	if (sMonth.length == 1)
	{
		sMonth = "0" + sMonth;
	}
	sDay = oForm.TicketAvailableDateDay.value;
	if (sDay.length == 1)
	{
		sDay = "0" + sDay;
	}
	if (!CheckDate(sMonth + "/" + sDay + "/" + oForm.TicketAvailableDateYear.value))
	{
		alert ("Ticket Available for Shipping Date is not a valid date.");
		return;
	}
	
	sMonth = oForm.TicketSalesStartDateMonth.value;
	if (sMonth.length == 1)
	{
		sMonth = "0" + sMonth;
	}
	sDay = oForm.TicketSalesStartDateDay.value;
	if (sDay.length == 1)
	{
		sDay = "0" + sDay;
	}
	if (!CheckDate(sMonth + "/" + sDay + "/" + oForm.TicketSalesStartDateYear.value))
	{
		alert ("The Ticket Sales Begin Date is not a valid date.");
		return;
	}
	else
	{
		if (oForm.TicketSalesStartDateYear.value < "2004")
		{
			alert ("The Ticket Sales Begin Date is not a valid date.");
			return;
		}
	}
	
	sMonth = oForm.TicketSalesEndDateMonth.value;
	if (sMonth.length == 1)
	{
		sMonth = "0" + sMonth;
	}
	sDay = oForm.TicketSalesEndDateDay.value;
	if (sDay.length == 1)
	{
		sDay = "0" + sDay;
	}
	if (!CheckDate(sMonth + "/" + sDay + "/" + oForm.TicketSalesEndDateYear.value))
	{
		alert ("The Ticket Sales End Date is not a valid date.");
		return;
	}
	else
	{
		if (oForm.TicketSalesEndDateYear.value < "2004")
		{
			alert ("The Ticket Sales End Date is not a valid date.");
			return;
		}
	}
	/* End Dates validation */
	
	for (iIndex=0;iIndex<oForm.length;iIndex++ )
	{
		// Check checkboxes
		if (oForm.elements[iIndex].type=="checkbox")
		{
			if (oForm.elements[iIndex].checked)
			{
				ichecked ++;
				if(oForm.elements[iIndex].isDisable == 1)
				{
					bDisable = true;
				}
			}
		}

		//check text inputs
		if (oForm.elements[iIndex].name!="MemberPriceInsert" && oForm.elements[iIndex].name!="GuestPriceInsert" && oForm.elements[iIndex].name!="TicketQuantityInsert" && oForm.elements[iIndex].name!="LowStockInsert" && oForm.elements[iIndex].name!="SoldOutInsert" && oForm.elements[iIndex].type=="text" && oForm.elements[iIndex].name != "")
		{

			if (oForm.elements[iIndex].value == "")
			{
				alert("Please complete all required form fields")
				return;
			}

			if (isMoney(stringReplace(oForm.elements[iIndex].value, ",", "")) == false&& (oForm.elements[iIndex].name.indexOf("txtGuestPrice")>=0 || oForm.elements[iIndex].name.indexOf("txtMemberPrice")>=0))
			{
				alert("All quantity values must be greater than zero (0)")
				return;
			}
			if (isNumber(oForm.elements[iIndex].value) == false&& (oForm.elements[iIndex].name.indexOf("txtTotalQuantity")>=0 || oForm.elements[iIndex].name.indexOf("txtLowStockWarningQuantity")>=0 || oForm.elements[iIndex].name.indexOf('txtSoldOutQuantity')>=0 ))
			{
				alert("Please type in a number greater than zero (0) in the quantity fields")
				return;
			}
						
			if (oForm.elements[iIndex].name=="TicketAvailableDateMonth") sAvailableDate = oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketAvailableDateDay") sAvailableDate = sAvailableDate + '/' + oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketAvailableDateYear") sAvailableDate = sAvailableDate + '/' + oForm.elements[iIndex].value;

			if (oForm.elements[iIndex].name=="TicketSalesStartDateMonth") sSalesBeginDate = oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketSalesStartDateDay") sSalesBeginDate = sSalesBeginDate + '/' + oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketSalesStartDateYear") sSalesBeginDate = sSalesBeginDate + '/' + oForm.elements[iIndex].value;
			
			if (oForm.elements[iIndex].name=="TicketSalesEndDateMonth") sSalesEndDate = oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketSalesEndDateDay") sSalesEndDate = sSalesEndDate + '/' + oForm.elements[iIndex].value;
			if (oForm.elements[iIndex].name=="TicketSalesEndDateYear") sSalesEndDate = sSalesEndDate + '/' + oForm.elements[iIndex].value;
		}
		
		
		
		//Check seating classes
		if ((oForm.elements[iIndex].type=="hidden") && (oForm.elements[iIndex].name.indexOf("txtTicketClass")>=0))
			iTicketClass++;
	}

	// Validate Date submissions
	var dAvailableDate, dSalesBeginDate, dSalesEndDate, dEventStartDate;
	
	dEventStartDate = new Date(oForm.EventStartDate.value);
	dAvailableDate = new Date(sAvailableDate);
	dSalesBeginDate = new Date(sSalesBeginDate);
	dSalesEndDate = new Date(sSalesEndDate);
	
	if (dAvailableDate < dSalesBeginDate) {
		alert ("The Available Shipping Date for the Event Tickets must be after the Sales Begin Date.");
		return;
	} else if (dSalesBeginDate > dSalesEndDate) {
		alert ("The Ticket Sales Begin Date must occur before the Ticket Sales End Date.");
		return;
	} else if (dSalesBeginDate > dEventStartDate) {
		alert ("The Ticket Sales Begin Date must occur before the Event Start Date.");
		return;
	} else if (dSalesEndDate > dEventStartDate) {
		alert ("The Ticket Event End Date must occur before the Event Start Date.");
		return;
	}

	//Check if a shipping method has been selected
	if (ichecked == 0) {
		alert("Please select at least one shipping method.")
		return;
	}

	if (ichecked == 1) {
		if(bDisable)
		{
			alert("Be selected one and only shipping method can not be disabled.")
			return;
		}
	}
	
	//Check if a seating class has been specified
	if (iTicketClass == 0) {
		alert("Please add at least one Ticket Class before you Save Changes.")
		return;
	}
	
	//Submit form		
	oForm.submit()
}

/********************************************************************************
Description:	Checks if parameter passed is a valid date
Revision:	
*********************************************************************************/
function CheckDate(strDate) {
var strDatestyle = "US"; //United States date style
//var strDatestyle = "EU";  //European date style
var strDate;
var strDateArray;
var strDay;
var strMonth;
var strYear;
var intday;
var intMonth;
var intYear;
var booFound = false;
var strSeparatorArray = new Array("-"," ","/",".");
var intElementNr;
var err = 0;
var strMonthArray = new Array(12);
	strMonthArray[0] = "01";
	strMonthArray[1] = "02";
	strMonthArray[2] = "03";
	strMonthArray[3] = "04";
	strMonthArray[4] = "05";
	strMonthArray[5] = "06";
	strMonthArray[6] = "07";
	strMonthArray[7] = "08";
	strMonthArray[8] = "09";
	strMonthArray[9] = "10";
	strMonthArray[10] = "11";
	strMonthArray[11] = "12";
	if (strDate.length < 1) {
		return true;
	}
	//if (strDate.length < 8) {
	//	return false;
	//}
	for (intElementNr = 0; intElementNr < strSeparatorArray.length; intElementNr++) {
		if (strDate.indexOf(strSeparatorArray[intElementNr]) != -1) {
			strDateArray = strDate.split(strSeparatorArray[intElementNr]);
			if (strDateArray.length != 3) {
				err = 1;
				return false;
			}
			else {
				strDay = strDateArray[0];
				strMonth = strDateArray[1];
				strYear = strDateArray[2];
			}
			booFound = true;
	   }
	}
	if (strYear != null)
		if (strYear.length == 1)
			//strYear = '0' + strYear;
			return false;
	if (booFound == false) {
		if (strDate.length>5) {
			strDay = strDate.substr(0, 2);
			strMonth = strDate.substr(2, 2);
			strYear = strDate.substr(4);
			//strYear = strYear.substr(2,2);
	   }
	}
	//if (strYear.length == 2) {
	//	strYear = '20' + strYear;
	//}
	if (strDate.length >= 8) {
		if ((strYear.length != 2) && (strYear.length != 4)) {
			err = 11;
			return false;
		}
	}
	
	// US style
	if (strDatestyle == "US") {
		strTemp = strDay;
		strDay = strMonth;
		strMonth = strTemp;
	}
	
	intday = parseInt(strDay, 10);
	if (strDay != intday)
		return false;
	if (isNaN(intday)) {
		err = 2;
		return false;
	}
	intMonth = parseInt(strMonth, 10);
	if (strMonth != intMonth)
		return false;
	if (isNaN(intMonth)) {
		for (i = 0;i<12;i++) {
			if (strMonth.toUpperCase() == strMonthArray[i].toUpperCase()) {
				intMonth = i+1;
				strMonth = strMonthArray[i];
				i = 12;
		   }
		}
		if (isNaN(intMonth)) {
			err = 3;
			return false;
	   }
	}
	intYear = parseInt(strYear, 10);
	if (strYear != intYear)
		return false;
	if (isNaN(intYear)) {
		err = 4;
		return false;
	}
	if (intMonth>12 || intMonth<1) {
		err = 5;
		return false;
	}
	if ((intMonth == 1 || intMonth == 3 || intMonth == 5 || intMonth == 7 || intMonth == 8 || intMonth == 10 || intMonth == 12) && (intday > 31 || intday < 1)) {
		err = 6;
		return false;
	}
	if ((intMonth == 4 || intMonth == 6 || intMonth == 9 || intMonth == 11) && (intday > 30 || intday < 1)) {
		err = 7;
		return false;
	}
	if (intMonth == 2) {
		if (intday < 1) {
			err = 8;
			return false;
		}
		if (LeapYear(intYear) == true) {
			if (intday > 29) {
				err = 9;
				return false;
		}
		}
		else {
			if (intday > 28) {
				err = 10;
				return false;
			}
		}
	}
	if (strDatestyle == "US") {
		if (strDay.length == 1)
			strDay = "0" + strDay;
		if (strYear.length > 2) {
			if (strYear.length == 3)
				strYear = strYear.substr(1,2);
			else
				strYear = strYear.substr(2,2);
		}
		//datefield.value = strMonthArray[intMonth-1] + "/" + strDay + "/" + strYear;
	}
	/*else {
		datefield.value = intday + " " + strMonthArray[intMonth-1] + " " + strYear;
	}*/
	return true;
}

/********************************************************************************
Description:	checks if parameter entered is a valid year
Revision:		
*********************************************************************************/
function LeapYear(intYear) {
	if (intYear % 100 == 0) {
		if (intYear % 400 == 0)
			return true;
		else 
			if ((intYear % 4) == 0)
				return true;
	}
	return false;
}


/********************************************************************************
Description:	use this to submit a form for ticket setting page and before that, check all form fields to see if any are null
Revision:	
*********************************************************************************/
function SubmitTicketSettingForm(oForm,sUpdateName,sTableName)
{
	var iIndex,nameString;
	nameString="**";
	for (iIndex=0;iIndex<oForm.length;iIndex++ )
	{
		if (oForm.elements[iIndex].type=="text" && oForm.elements[iIndex].name != ""&&oForm.elements[iIndex].name!="txtShippingMethodName" && oForm.elements[iIndex].name!="txtShippingPrice" && oForm.elements[iIndex].name!="txtDaysBeforeDisable" && oForm.elements[iIndex].name!="txtSeatingClassName" && oForm.elements[iIndex].type=="text" )
		{
			if (oForm.elements[iIndex].value == "")
			{
				alert("Please fill out all the required form fields");
				return;
			}
			if (!isNumber(oForm.elements[iIndex].value) && (oForm.elements[iIndex].name =='txtInsertDisableDays' ))
			{
				alert("Please type in a value greater than zero (0) for the Shipping Method Days Before Disable fields");
				return;
			}
			if (oForm.elements[iIndex].name =='txtInsertShippingPrice') 
			{
				oForm.elements[iIndex].value = stringReplace(oForm.elements[iIndex].value, ",", "");
				if (!isMoney(oForm.elements[iIndex].value))
				{
					alert("Please type in a dollar value greater than zero (0) for the shipping price");
					return;
				}
			}
			if (oForm.elements[iIndex].name =='txtHandlingFee') 
			{
				oForm.elements[iIndex].value = stringReplace(oForm.elements[iIndex].value, ",", "");
				if (!isMoney(oForm.elements[iIndex].value))
				{
					alert("The value entered as the Handling Fee does not translate to a numeric value");
					return;
				}
			}
			
			if (oForm.elements[iIndex].name=='txtShippingMethodNameInsert' || oForm.elements[iIndex].name=='txtInsertTicketClassName')
			{
				if (nameString.indexOf("**" + oForm.elements[iIndex].value + "**")>=0)
				{
					alert(oForm.elements[iIndex].value + ":  This shipping method already exists");
					return;
				}
				nameString=nameString+oForm.elements[iIndex].value+"**"
			}
			
		}
		
	}
	

	var newrow =document.getElementById(sTableName).insertRow(document.getElementById(sTableName).rows.length-1);
	var newcell = newrow.insertCell();
	newcell.innerHTML="<input type='hidden' name='sUpdateType' value='" + sUpdateName + "'/>";
	oForm.submit();
}


/********************************************************************************
Description:	use to check if a string is an integer
Logic:			loop throught an array of strings to see if they match the requirement string
Revision:	
*********************************************************************************/
function isNumber (str) {
	var valid = 1;
	var GoodChars = "0123456789";
	var i = 0;

	for (i=0; i <= str.length -1; i++) {
		if (GoodChars.indexOf(str.charAt(i)) == -1) {
			valid = 0;
			break;
		} 
	}
	
	if (valid == 0) {
		return false;
	}
	else
		return true;
}

function isMoney (str) {
	var valid = 1;
	var GoodChars = "0123456789";
	var i = 0;
	var dot=0;
	var dotcount=0;
	
	for (i=0; i <= str.length -1; i++) 
	{
		if (GoodChars.indexOf(str.charAt(i)) == -1) 
		{
			if (str.charAt(i)!='$' && str.charAt(i)!='.' && i==0)
			{
				valid = 0;
				break;
			}
			if (str.length == 1)
			{
				valid = 0;
				break;
			}
			if (str.charAt(i)=='.' && i==(str.length-1))
			{
				valid = 0;
				break;
			}
			if (str.charAt(i)=='.')
			{
				if ( dotcount>0 )
				{
					valid = 0;
					break;
				}
				else
				{
				dotcount ++;
				}
			}
			if (str.charAt(i)=='.' && i!=(str.length-1))
			{
				dot=1;
				continue;
			}
			if (str.charAt(i)==' ')
			{
				valid = 0;
				break;
			}
			if (i!=0)
			{
				valid = 0;
				break;
			}
		} 
		if (dot>0)
		{
			dot++;
		}
		if (dot>3)
		{
			valid=0;
			break;
		}
	}

	if (valid == 0) {
		return false;
	}
	else
		return true;
}

function stringReplace(origStr, findText, replaceText) {
	var pos = 0
	var len = findText.length
	var preString
	var postString
	
	pos = origStr.indexOf(findText);
	while (pos != -1) {
		preString = origStr.substring(0, pos);
		postString = origStr.substring(pos+len, origStr.length);
		origStr = preString + replaceText + postString;
		pos = origStr.indexOf(findText);
	}
	return origStr;
}

/********************************************************************************
Description:	use this to to check the total ticket qty , low stock qty, and sold out qty to verify that the conditions are correct.
Revision:		
*********************************************************************************/
function checkTotalTicketQty(sTotalQuantity, sLowQuantity, sSoldOut){
	if (parseInt(sTotalQuantity) < parseInt(sLowQuantity))
	{
		alert("Can not add ticket class.  Please change the Total Ticket Qty to be higher than the Low Stock Qty.");
		return false;
	}
	if (parseInt(sTotalQuantity) == parseInt(sSoldOut)) //|| sTotalQuantity == sSoldOut )
	{
		alert("Can not add ticket class.  Please change the Ticket Qty to be greater than the Sold Out Qty.");
		return false;
	}
	if (parseInt(sLowQuantity) < parseInt(sSoldOut)) //|| sTotalQuantity == sSoldOut )
	{
		alert("Can not add ticket class.  Please change the Low Stock Qty to be equal or greater than the Sold Out Qty.");
		return false;
	}
	else{
	return true;
	}
}

/********************************************************************************
Description:	use this to to check the total ticket qty , low stock qty, and sold out qty to verify that the conditions are correct.
Revision:		
*********************************************************************************/
function ValidTicketClassName(sWord)
// check the Word
{
	var sRegular = /^([a-zA-Z])+([a-zA-Z0-9])*/;
	if(!sRegular.test(sWord)){
		alert("Please enter in a valid ticket class name.");
		return false;
	}
	else {
	return true;
	}
}

/*********************************************************************************
Description: Use this function to work around the ActiveX control issue because of the MS Sp2 update.
Revision: 
**********************************************************************************/
function CreateControl(DivID, CLSID, ObjectID, TYPE, CODEBASE, SRC, MOVIE, ALLOWSCRIPTACCESS, MENU, QUALITY, WMMODE, BGCOLOR, WIDTH, HEIGHT, ALIGN, URL, EMBEDTYPE, PLUGINSPAGE, SRC, FLASHVARS, AUTOSTART)
{
	var sObjectTag =  '<object id="' + ObjectID + '" classid="' + CLSID + '" type="' + TYPE + '" codebase="' + CODEBASE + '" width="' + WIDTH + '" height="' + HEIGHT + '" align="' + ALIGN +'">';
	sObjectTag +='<param name="movie" value="' + MOVIE + '" />';
	sObjectTag +='<param name="filename" value="' + URL + '" />';
	sObjectTag +='<param name="src" value="' + SRC + '" />';
	sObjectTag +='<param name="allowScriptAccess" value="' + ALLOWSCRIPTACCESS + '" />';
	sObjectTag +='<param name="menu" value="' + MENU + '" />';
	sObjectTag +='<param name="quality" value="' + QUALITY + '" />';
	sObjectTag +='<param name="wmmode" value="' + WMMODE + '" />';
	sObjectTag +='<param name="bgcolor" value="' + BGCOLOR + '" />';
	sObjectTag +='<param name="flashvars" value="' + FLASHVARS + '" />';
	sObjectTag +='<embed src="' + SRC + '" menu="'+MENU+'" quality="'+QUALITY+'" wmode="'+WMMODE+'" bgcolor="'+BGCOLOR+'" width="'+WIDTH+'" height="'+HEIGHT+'" align="'+ALIGN+'" type="'+EMBEDTYPE+'" pluginspage="'+PLUGINSPAGE+'" flashvars="'+FLASHVARS+'"></embed>';
	sObjectTag +='<param name="autoStart" value="' + AUTOSTART + '" />';
	sObjectTag +='</object>';

	var d = document.getElementById(DivID);
	d.innerHTML = sObjectTag;
    
}

/*********************************************************************************
Description: Use this function to work around the ActiveX control issue because of the MS Sp2 update.
Revision: 
**********************************************************************************/
function docwrite(sVars)
{
	document.write("'" + sVars + "'");
	
}