
function checkdate(dtlive, av, active)
    {
	var buynowlink1, buyimage, buynowlink2, bnConcat
	//document.write(active)
	
	if (active == "0")
	{
	buyimage = '<img hspace="0" height="18" width="85" border="0" src="http://www.pechanga.com/Portals/0/Pechanga/prc_form_sold_out.png" alt=" Sold Out" />'
	document.write (buyimage)
	} else {
		var ch=Date.parse(dtlive);
		var currentdt = new Date();
		
		
		buynowlink1 = '<a href="https://www.pechanga.com/tickets/Online/seatSelect.asp?BOset::WSmap::seatmap::performance_ids='
		buynowlink2 = '" target="_blank">'
		buyimage = '<img hspace="0" height="18" width="85" border="0" src="http://www.pechanga.com/Portals/0/Pechanga/prc_form_buy_button.png" alt=" Buy Tickets Now" />'
		buynowlink3 = '</a>'

		bnConcat = buynowlink1 + av + buynowlink2 + buyimage + buynowlink3
		
		if(ch<Date.parse(currentdt))
			{
				document.write(bnConcat)
			}
		}
	}	

function presale(dtlive, av, active, dtexpire) {
            var buynowlink1, buyimage, buynowlink2, bnConcat
            //document.write(active)

            if (active == "0") {
                buyimage = '<img hspace="0" height="18" width="85" border="0" src="http://www.pechanga.com/Portals/0/Pechanga/prc_form_sold_out.png" alt=" Sold Out" />'
                document.write(buyimage)
            } else {
                var ch = Date.parse(dtlive);
                var exp = Date.parse(dtexpire);
                var currentdt = new Date();
              
                buynowlink1 = '<a href="https://www.pechanga.com/tickets/Online/default.asp?BOset::WSseatSearch::Query::Clause::10::value='
                buynowlink2 = '" target="_blank">'
                buyimage = '<img hspace="0" height="18" width="85" border="0" src="http://www.pechanga.com/Portals/0/Pechanga/prc_form_buy_button.png" alt=" Buy Tickets Now" />'
                buynowlink3 = '</a>'

                bnConcat = buynowlink1 + av + buynowlink2 + buyimage + buynowlink3

                if (ch < Date.parse(currentdt) && exp > Date.parse(currentdt)) {
                    document.write(bnConcat)
                }
            }
        }	
