﻿//frtLib - Java Script Library for First Run Theatre
//Version 2.0
//11-13-2007


function formMailAdd()
{
//Use this functionto inplace of the email recipient tag in an email form.
//This will prevent the email address from being collected by spam trawler software.

var userName="info";
var mailServ="firstruntheatre.com";
document.write('<input type=hidden name="recipeint" value="'+userName+'@'+mailServ+'">');
}


function graphAdd()
{
//Use this function to place graphic of email address wtih link.
//This will prevent email address from being collected by spam trawler software.

var userName="info";
var mailServ="firstruntheatre.com";
document.write('<a href="mailto:'+userName+'@'+mailServ+'">');
document.write('<img src="images/frt-email.gif" border=0 align=middle>');
document.write('</a>');
}

function PPticket()
{
//This functionn will build the PayPal ticket ordering form

for(k=0;k<nPlays;k++){
	document.write('<tr bgcolor="#CCCCCC" valign="top">');
	document.write('<td colspan="2" bgcolor="salmon">');
	document.write('<div align="center">');
	document.write('<span class="playtitle">'+PlayTitle[k][0]+'</span></div></td></tr>');
	TicWrite(PlayTitle[k][1]);
	}
}

function TicWrite(Tcode)
{
// This functio writes the ticket forms for each day of a performance

var performCnt=0

for(i=0;i<nPerform;i++){
	if(Perform[i][0]==Tcode){
		performCnt++
		document.write('<tr bgcolor="#CCCCCC" valign="top">');
		document.write('<td colspan="2" bgcolor="#666666"><font size="3" color="#FFFFFF"><b>'+Perform[i][1]+', '+Perform[i][2]+' - '+Perform[i][3]+'</b></font></td></tr>');
		typeWrite(Perform[i][0],Perform[i][2],performCnt);
		}
	}
return
}

function typeWrite(Tcode,Pdate,cnt){
//This function writes administions buttons for each type of admission

var AdmType=new Array(4);
for(j=0;j<6;j++)AdmType[j]=new Array(6);
AdmType[0]=["General Admission","10.00","General","G"];
AdmType[1]=["Senior","8.00","SeniorStudent","Sr"];
AdmType[2]=["Student","8.00","SeniorStudent","St"];
AdmType[3]=["Groups of 10 or more General Admissions","8.00","Group Gen","GR"];
AdmType[4]=["Groups of 10 or more Seniors","5.00","Group Sr","GSr"];
AdmType[5]=["Groups of 10 or more Students","5.00","Group St","GSt"];

for(j=0;j<6;j++){
	document.write('<tr bgcolor="#CCCCCC" valign="top">');
	document.write('<td><b>'+AdmType[j][0]+': $'+AdmType[j][1]+'</b></td>');
	document.write('<td><div align="center">');
	document.write('<form action="https://www.paypal.com/cgi-bin/webscr" method="post">');
	document.write('<input type="hidden" name="cmd" value="_xclick">');
	document.write('<input type="hidden" name="business" value="info@firstruntheatre.com">');
	document.write('<input type="hidden" name="item_name" value="'+Pdate+' '+AdmType[j][2]+'">');
	document.write('<input type="hidden" name="item_number" value="'+Tcode+cnt+AdmType[j][3]+'">');
	document.write('<input type="hidden" name="amount" value="'+AdmType[j][1]+'">');
	document.write('<input type="hidden" name="undefined_quantity" value="1">');
	document.write('<input type="hidden" name="no_note" value="1">');
	document.write('<input type="hidden" name="currency_code" value="USD">');
	document.write('<input type="hidden" name="lc" value="US">');
	document.write('<input type="image" src="https://www.paypal.com/images/x-click-but23.gif" border="0" name="submit10" alt="Make payments with PayPal - it is fast, free and secure!">');
	document.write('</form></div></td></tr>');
	}
return
}

function WSreg(){
//This functionn will build the PayPal Workshop Registration form

for(k=0;k<nWs;k++){
	document.write('<tr bgcolor="#CCCCCC" valign="top">');
	document.write('<td colspan="2" bgcolor="salmon">');
	document.write('<div align="center">');
	document.write('<span class="playtitle">Workshop - '+WorkShop[k][0]+' '+WorkShop[k][1]+'</span></div></td></tr>');
	RegWrite(WorkShop[k][0],WorkShop[k][2]);
	}
}

function RegWrite(Wname,Wcode){
// This functio writes the ticket forms for each day of a performance

var wsCnt=0

for(i=0;i<nwsDate;i++){
	if(Session[i][0]==Wcode){
		wsCnt++
		document.write('<tr bgcolor="#CCCCCC" valign="top">');
		document.write('<td colspan="2" bgcolor="#666666"><font size="3" color="#FFFFFF"><b>'+Session[i][2]+'</b></font></td></tr>');
		
		document.write('<tr bgcolor="#CCCCCC" valign="top">');
		document.write('<td><b>'+Wname+' '+Session[i][1]+' '+Session[i][3]+': $'+Session[i][4]+'</b></td>');
		document.write('<td><div align="center">');
		document.write('<form action="https://www.paypal.com/cgi-bin/webscr" method="post">');
		document.write('<input type="hidden" name="cmd" value="_xclick">');
		document.write('<input type="hidden" name="business" value="info@firstruntheatre.com">');
		document.write('<input type="hidden" name="item_name" value="'+Session[i][2]+'">');
		document.write('<input type="hidden" name="item_number" value="'+Wcode+wsCnt+'">');
		document.write('<input type="hidden" name="amount" value="'+Session[i][4]+'">');
		document.write('<input type="hidden" name="undefined_quantity" value="1">');
		document.write('<input type="hidden" name="no_note" value="1">');
		document.write('<input type="hidden" name="currency_code" value="USD">');
		document.write('<input type="hidden" name="lc" value="US">');
		document.write('<input type="image" src="https://www.paypal.com/images/x-click-but23.gif" border="0" name="submit10" alt="Make payments with PayPal - it is fast, free and secure!">');
		document.write('</form></div></td></tr>');
		}
	}
return
}