﻿function compareTickets() {
    var x = document.getElementsByName("compareBox");
    for(i=0;i<x.length;i++) {
        if (x[i].checked == false) {
            var id = x[i].id
            id = id.substring(3)
            $get("t" + id).style.display = "none";
            
            var _ct = document.getElementById("ts" + id);
            if(_ct != null) $get("ts" + id).style.display = "none";
        }
    }
}

function compareReset() {
    var x = document.getElementsByName("compareBox");
    for(i=0;i<x.length;i++) {
        var id = x[i].id
        id = id.substring(3)
        $get("t" + id).style.display = "block";
        
        var _ct = document.getElementById("ts" + id);
        if(_ct != null) $get("ts" + id).style.display = "block";
    }
}

function CheckRange(b, a) {
    var bv = $get(b).value;
    var av = $get(a).value;
 

    if (parseInt(bv) >= parseInt(av) && parseInt(av) != 0) {
        alert("Invalid Price Range.")
        return false;
    }
    
    doAJAXLoad();
}

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 buyNow(id, gid, price) {
    var spsource = getCookie("sp-source");
    //var spaff = document.getElementById("affid").value;
    
    var adsource = "";
    if (spsource != null) adsource = "&SPSourceID=" + spsource
    //if (spaff != null) affsource = "&SPAffiliateID=" + spaff;
     
    var split = document.getElementById("tsp" + id).value;
    var oURL = "https://secure.stubpass.com/checkout/checkout.aspx?brokerid=3214&sitenumber=0&tgid=" + gid + "&treq=" + split + "&evtID=" + evtID + "&price=" + price + "&SessionId=" + makeGuid() + adsource;
    window.location.href = oURL;
    return false;
}

function disableScroll(v) {
    
    var scroller = document.getElementById("evtTickets");
    if(v.value == "Disable Scroll") {
        v.value = "Enable Scroll";
        scroller.style.overflowY = "auto";
        scroller.style.height = "auto";
    }else{
        v.value = "Disable Scroll";
        scroller.style.overflowY = "scroll";
        scroller.style.height = "470px";
    }
}


function ShowDiv(id, type, remove) {

    if(type == 0 && remove != null) {
        for(i=0;i<remove.length;i++) {
            document.getElementById(remove[i]).style.display = "none";
        }
    }

    var el = document.getElementById(id);
    if(type == 0) el.style.display = "block";
    else el.style.display = "none";
    return false;   
}