﻿function btv(){
var kwds = document.getElementById("kwds").value;
kwds = kwds.replace(/^\s*|\s*$/g,"");
if (kwds == ""){
document.getElementById("kwds").value = "";
document.getElementById("kwds").focus();
return (false);} 
return (true);
}
function loading() {return "<div style='display:block; text-align:center; background-color:white;'><img src='/images/site/tl_wait.gif' /></div>"; }

function gotix(d,eventid,sortby,sorttype) {
 $("#"+d).html("<div id=\"loading_box\" style=\"width:548px;text-align:center;\"><img src=\"/images/site/tl_wait.gif\" /><br />loading...</div>")
.load("/tix/ajax.aspx?at=tix&evtid="+eventid+"&sortby=" + sortby + "&sorttype=" + sorttype,function(data) {
if(data=="") {  $("#"+d).html("<div style='border: 1px solid #1d5188;padding:10px 5px 10px 5px;width:555px;'>We don't have any tickets for this event now.</div>")  }
});}

function goevs(d,data) {
 $("#"+d).html("<div id=\"loading_box\" style=\"width:548px;text-align:center;\"><img src=\"/images/site/tl_wait.gif\" /><br />loading...</div>")
.load("/tix/ajax.aspx?at=ev&"+data);}

function goalert(fname,email,zip,cid) {
document.getElementById('tlalmsg').innerHTML=loading();
var f =document.getElementById(fname).value;
var e = document.getElementById(email).value;
var z = document.getElementById(zip).value;
var c = document.getElementById(cid)[document.getElementById(cid).selectedIndex].value;
var cn = document.getElementById(cid).options[document.getElementById(cid).selectedIndex].text;

   $.ajax({
      type:"POST",
      url:"/tix/ajax.aspx",
      data: "at=tlal&fname="+f+"&email="+e+"&zip="+z+"&cid="+c+"&ctry="+cn,
      dataType:"html",
      success:function(data){
      $("div#tlalmsg").html(data);
      if(data.toString().indexOf("Thanks")>-1) {
      
      document.getElementById(fname).value="";
      document.getElementById(email).value="";
      document.getElementById(zip).value="";
       $("div#tlalmsg").css({padding:"5px"});
      $("div#TL_Alert_Wrapper").slideUp("slow").hide();
      }},
      error:function(xhr,err,e){ alert( "Error: " + err ); }
    });     
}

 

function gonoentity(firstname,email,location,which,eventname,eventid) {
document.getElementById('noenmsg').innerHTML=loading();
var loc;
if(location!=""){
loc = document.getElementById(location)[document.getElementById(location).selectedIndex].innerHTML+"|"+document.getElementById(location)[document.getElementById(location).selectedIndex].value;
}
var fname=document.getElementById(firstname).value;
var em =document.getElementById(email).value;
if(fname==null || fname=="" || fname=="First name"){document.getElementById(firstname).value="Anonymous";}

   $.ajax({
      type:"POST",
      url:"/tix/ajax.aspx",
      data: "at=noen"+which+"&fname="+fname+"&email="+em+"&location="+loc+"&eventname="+eventname+"&eventid="+eventid,
      dataType:"html",
      success:function(data){ 
     $("div#noenmsg").html(data);
        if(data.toString().indexOf("success")>-1) {
      document.getElementById(firstname).value="First name";
      document.getElementById(email).value="Email address";
      if(location!=""){document.getElementById(location).selectedIndex=0;}  
      }
      },
      error:function(xhr,err,e){document.getElementById('noenmsg').innerHTML=err;}
    });     
}

function gosuggests(cat,loc) {
var c = document.getElementById(cat)[document.getElementById(cat).selectedIndex];
var l = document.getElementById(loc)[document.getElementById(loc).selectedIndex];
if(c.value=="0" && l.value=="0") {document.getElementById("tlsmsg").innerHTML="<table id='frmE' style='width:130px; margin-left:10px;'><tr><td class='f'>&nbsp;</td><td class='s' align='left'>Please select a category and location.</td></tr></table>"; return;}
else if(c.value=="0" && l.value!="0") {document.getElementById("tlsmsg").innerHTML="<table id='frmE' style='width:130px; margin-left:10px;'><tr><td class='f'>&nbsp;</td><td class='s' align='left'>Please select a category.</td></tr></table>"; return;}
else if(c.value!="0" && l.value=="0") {document.getElementById("tlsmsg").innerHTML="<table id='frmE' style='width:130px; margin-left:10px;'><tr><td class='f'>&nbsp;</td><td class='s' align='left'>Please select a location.</td></tr></table>"; return;}
else{
document.getElementById("tlsmsg").innerHTML="";
var url="/resultsgeneral.aspx?kwds=&pcatid="+c.value+"&city="+l.innerHTML+"&ICID=tlsuggests";
window.location=url;   
}
}

function addToFavorites() { 
var pageUrl = location.href;
if (pageUrl.indexOf('?')!=-1){
if (pageUrl.indexOf('utm_source')<0){
pageUrl+="&utm_source=bookmark&utm_nooveride=1";
}}
else{
pageUrl+="?utm_source=bookmark&utm_nooveride=1";
}						
if (document.all) {
window.external.AddFavorite(pageUrl,document.title);
}
else if (window.sidebar) {
window.sidebar.addPanel(document.title, pageUrl, "");
}
 
}
//new
function mailpage(){
var url = location.href+"%26utm_source=email%26utm_medium=emailThis";
mail_str = "mailto:?subject=Check out these " + document.title;
mail_str += "&body=I thought you might be interested in these " + document.title;
mail_str += ". You can view them at: " + url; 
location.href = mail_str;}
function mailDefaultPage()
{
mail_str = "mailto:?subject=Check out " + document.title.replace(/&nbsp;/g," ");
mail_str += "&body=I thought you might be interested in this page from TicketLiquidator";
mail_str += ". You can view it at: " + location.href; 
location.href = mail_str;
}

 function GetValueFromQuerystring(name){
var tmp = ( location.search.substring(1) );
var i   = tmp.toUpperCase().indexOf(name.toUpperCase()+"=");
if ( i >= 0 ){
tmp = tmp.substring( name.length+i+1 );
i = tmp.indexOf("&");
return unescape( tmp = tmp.substring( 0, (i>=0) ? i : tmp.length ));
}
return("");
}

function makeGuid(){
var chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz';
var guid_length = 5;
var guid = '';
for (var i=0; i<guid_length; i++) {
var rnum = Math.floor(Math.random() * chars.length);
guid += chars.substring(rnum, rnum+1);
}        
return guid;
}	
	
function b(es,q,sid) {return "https://secure.ticketliquidator.com/Checkout.aspx?e="+es+"&treq="+q +"&SessionID="+sid;}
	
function buyTickets (tgIndex,buyQty,tgQty) {
window.location= b(ssc.tgArray[tgIndex].tgTps,buyQty,makeGuid());	
}

    function AppendToPurchaseUrl(inUrl)
    {
	    var outUrl = inUrl;
	    return outUrl;
    }
     function SubmitPurchaseLinkForGiftCard(idNum, qstring)
    {
        var guidToAdd = makeGuid();
        var QSSession = GetValueFromQuerystring("SessionId");
        if (QSSession != "") { guidToAdd = QSSession; }
	    var purchaseUrl = b(qstring,"1",guidToAdd);
	    location.href = purchaseUrl;
    }
    function buy(idNum, qstring)
    {
        var guidToAdd = makeGuid();
        var QSSession = GetValueFromQuerystring("SessionId");
        if (QSSession != "") { guidToAdd = QSSession; }    
	    var requestSelect = document.getElementById(idNum);
	    var ticketsRequested = requestSelect.options[requestSelect.selectedIndex].innerHTML;
	    var purchaseUrl = b(qstring,ticketsRequested,guidToAdd);
	    location.href = purchaseUrl;
    }
 

function ToShowToHide(show,hide){
document.getElementById(show).style.display='block';
document.getElementById(hide).style.display='none';
window.scrollTo(0,0);    
}

function ToDisplayBlock(x) {
for(var i=0; i<arguments.length; i++) {
document.getElementById(arguments[i]).style.display="block";
}}

function ToDisplayNone(x) {
for(var i=0; i<arguments.length; i++) {
document.getElementById(arguments[i]).style.display="none";
}}

function ShowHelpTopic(divID){$('#'+divID).toggle();}
function toggle(id){$(id).toggle();}

 var comments = new Array("<p><img src='/images/site/openquote.gif' />&nbsp;The tickets arrived exactly when they were supposed to and I really appreciated the extra info (weather, restaurants, directions). I will definitely be buying tickets from you guys in the future and recommending your services to others!!!&nbsp;<img src='/images/site/endquote.gif' /><br />-Brigitte Z.</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;What a pleasure to order from your site. From being secure to user-friendly, this made for easy ordering. My compliments to you!&nbsp;<img src='/images/site/endquote.gif' /><br />- Lynn</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I just wanted to take the time to extend my sincerest forms of gratitude to your company for the exemplar service your have provided me. This is the first time I have purchased tickets from TicketLiquidator and the experience has been nothing but excellent.&nbsp;<img src='/images/site/endquote.gif' /><br />- Amy M.</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I thank you very much for a great experience and the helpful info you sent a few days before the game, and I am looking forward to doing business with your company in the future.&nbsp;<img src='/images/site/endquote.gif' /><br />- Eric G.</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I was hesitant to purchase from you, but you have all gone the extra mile to make this experience quick and pleasant. Our tickets arrived quickly and the follow-up email with directions and dining suggestions and the weather was a very nice touch. I will recommend you to everyone looking for tickets. Thanks.&nbsp;<img src='/images/site/endquote.gif' /><br />- Wanda</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;Delivery was extremely quick. And follow-up was very nice! I'd recommend this site to any one looking for great deals on any event!&nbsp;<img src='/images/site/endquote.gif' /><br />- Anonymous</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I can't tell you how pleased I am with Ticketliquator ! I have used your site three times and each time, received super fast, professional service. Seats have always been exactly as advertised on the site. I will continue to use Ticketliquidator as my first choice for premium tickets and recommend it highly!&nbsp;<img src='/images/site/endquote.gif' /><br />- Christina M.</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I just received an e-mail from Molly Duncan detailing directions, weather forecast, and restaurant options associated with our tickets to the Fiesta Bowl. What a nice touch!&nbsp;<img src='/images/site/endquote.gif' /><br />- Richard</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;Very accurate and good quality service. Thank you very much.&nbsp;<img src='/images/site/endquote.gif' /><br />- Anonymous</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;Thank you so much for great tickets for a really great game. I enjoyed it soooo much.&nbsp;<img src='/images/site/endquote.gif' /><br />- Jennifer</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;The tickets arrived in ample time for the game and were exactly as stated and the seats were great. It was my first time at a home Redskins game and the experience was exceptional. I will continue to use and recommend ticket liquidator to my friends. Thanks again.&nbsp;<img src='/images/site/endquote.gif' /><br />- Reilly</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;I just used Ticket Liquidator for the first time and will definitely be using it again. I'll also recommend it to my friends. The process was easy and the tickets arrived quickly. I liked the extra touches afterwards - the maps and dining tips, etc. Thanks for the great service!!!&nbsp;<img src='/images/site/endquote.gif' /><br />- Karen L.</p>",
  "<p><img src='/images/site/openquote.gif' />&nbsp;Thanks for the most amazing night of my life. My tickets were cheaper than anyone else's and they came quickly to me. The added bonus of the extra tickets made me look like the coolest guy there as I took all of my friends with me. Thanks again!!!&nbsp;<img src='/images/site/endquote.gif' /><br />- Brian H.</p>");
  
  
var newwindow;
function poptastic(url,h,w){newwindow=window.open(url,'name','height='+h+',width='+w);}

// mbox test
/*
case 1 = old design
case 2 = new design
case 3 = new design + dropdown
case 4 = new design + dropdown + geo
*/

var concertlistTest;
var sportsTest;
var theaterTest;
var defaultTest;

function isSet(variable) {return(typeof(variable) != 'undefined');}
function defaultPageLoading(){return"<div style='min-height:400px;width:600px;text-align:center;margin-top:15px;background:url(/images/site/tl_wait.gif) no-repeat 50% 0;'></div>";}

function defaultPageTest(p,city) {
//----- start setup
var page = p.toLowerCase();
var testvar = page+"Test";
var ddSp = "city_select_inner_"+page;
var dv = page+"DefaultInfo";
if(isSet(testvar) && document.getElementById(dv)!=null){
var test = eval(testvar); 
//------end

if(test == '2' || test == '3' || test=='4')
{ 
$("#"+dv).show();
$("#"+dv+"Browse").show();

if(test == '3' || test=='4'){

var dd = 'city_select';
if(test=='4' && city!=null){
var d = document.getElementById(dd).options;for(var i=0; i<d.length; i++){if(d[i].value.toLowerCase()==city){d[i].selected=true; break;}}}
 
// if selected, get city
if(document.getElementById(dd)) {var v = document.getElementById(dd)[document.getElementById(dd).selectedIndex].value;if(v!="") {gocity(dd,p);}}

$('#'+ddSp).show();
} //end if 3|4

} //end if 2|3|4

// case 1 or fall through
else {$('#'+dv+"Old").show();}

if(document.getElementById("dp_loading")) {$("#dp_loading").hide();}

}//end isSet
}


function gocity(id,f) {
if(document.getElementById(id) && document.getElementById(f+"DefaultInfoCity")) 
{
 var v = document.getElementById(id)[document.getElementById(id).selectedIndex].value;
 if(v=="default") { 
 $("div#"+f+"DefaultInfo").show(); 
 $("div#"+f+"DefaultInfoCity").hide(); 
 return;
 }
    $.ajax({
      url:"/tix/ajax.aspx",
      data: "at=def&city="+v+"&f="+f,
      dataType:"html",
      success:function(data){ 
      $("div#"+f+"DefaultInfoCity").html( "<div style='vertical-align:top;'>"+data+"</div>" ).show();
      $("div#"+f+"DefaultInfo").hide();
      },
      error:function(xhr,err,e){ alert( "Error: " + err ); }
    });  
    }  
}

function getCookieVal (offset) 
	{
		var endstr = document.cookie.indexOf (";", offset);
		if (endstr == -1)
			endstr = document.cookie.length;

		return unescape(document.cookie.substring(offset, endstr));
	}

	function GetCookie (name) 
	{
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		
		while (i < clen) 
		{
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg)
				return getCookieVal (j);
			
			i = document.cookie.indexOf(" ", i) + 1;

			if (i == 0) break; 
		}
		
		return null;
	}
	
function CancelUpdate()
{
    var confirmed = confirm("Do you really want to cancel your updates?\r\nClick OK to cancel any unsaved changes and return to the TicketLiquidator home page.\r\nClick Cancel to continue editing your preferences.");
    if (confirmed)
    {
        window.location = "http://www.ticketliquidator.com";
    }
}
	
/*   tracking 
m=server
*/
function ga(m){
$.ajax({
        type:      'GET',
        url:       'http://www.google-analytics.com/urchin.js',
        success:   function() {
         _uacct = "UA-168406-1";
		_udn="ticketliquidator.com";
        urchinTracker();       
        __utmSetVar(m);
        },
        dataType:  'script'
      }
    );
}
function yho(){
$.ajax({
        type:      'GET',
        url:       'http://srv1.wa.marketingsolutions.yahoo.com/script/ScriptServlet?aid=11PICLH706MFUQIEVDC888U90C4',
        dataType:  'script'
      }
    );
}

function lbhide(){
document.getElementById('light').style.display='none';
document.getElementById('fade').style.display='none';
document.getElementById('lightxbtn').style.display='none';
}
function lbshow() {
document.getElementById('light').style.display='block';
document.getElementById('fade').style.display='block';
document.getElementById('lightxbtn').style.display='block';
}