﻿function pageLoad() 
{
    Events.GetEventTitle($.query.get('e'), getEventTitleSuccess, getEventFail);
    Events.GetEventDetails($.query.get('e'), getEventDetailsSuccess, getEventFail);
    Events.GetEventImage($.query.get('e'), getEventImageSuccess, getEventFail);
}

function getEventTitleSuccess(result) {
    $get("divTitlesTop").innerHTML = result;
    sIFR.replace(georgia, {
    selector: '#divTitlesTop h1'
    ,wmode: 'transparent'
    ,thickness: -100
    ,css: [
      '.sIFR-root { color: #ffffff; leading: -2; letter-spacing: -1; font-size: 32px;}'
      ,'a { text-decoration: none; }'
      ,'.clsOrange { color: #FF7A00; }'
      ,'.clsYellow { color: #FFC300; }'
      ,'.clsGreen { color: #59C001; }'
      ,'.clsBlueLight { color: #5AC3FF; }'
      ,'.clsRed { color: #BB1E53; }'
      ,'.clsYellowLight { color: #8B8B00; }'
      ,'.clsPurple { color: #8225A3; }'
      ,'.clsBlue { color: #8290CE; }'
      ,'.clsGrape { color: #FF7AFF; }'
      ,'a:hover { text-decoration: underline; color:none; }'
    ]
  });
}
function getEventDetailsSuccess(result) {
    $get("divEventsContentLeft").innerHTML = result;
}
function getEventImageSuccess(result) {
    $get("divEventsContentRight").innerHTML = result;
    sIFR.replace(georgia, {
    selector: '#divEventsContentRight h2'
    ,wmode: 'transparent'
    ,thickness: -100
    ,css: [
      '.sIFR-root { color: #ffffff; leading: -2; letter-spacing: -1; font-size: 18px;}'
      ,'a { text-decoration: none; }'
      ,'.clsOrange { color: #FF7A00; }'
      ,'.clsYellow { color: #FFC300; }'
      ,'.clsGreen { color: #59C001; }'
      ,'.clsBlueLight { color: #5AC3FF; }'
      ,'.clsRed { color: #BB1E53; }'
      ,'.clsYellowLight { color: #8B8B00; }'
      ,'.clsPurple { color: #8225A3; }'
      ,'.clsBlue { color: #8290CE; }'
      ,'.clsGrape { color: #FF7AFF; }'
      ,'a:hover { text-decoration: underline; color:none; }'
    ]
  });

}


function submitBuyTickets (intEventID, intPrice, intPriceConcession, strClientCode, intContactID, intSendEmailID) {

    $get("ancContinue").href = 'purchase_tickets-process.asp?e=' + intEventID + '&tp=' + intPrice + '&qty=' + $get("txtQuantity").value + '&tpc=' + intPriceConcession + '&qtyc=' + $get("txtQuantityConcession").value + '&dm=' + $("input[@type=radio][@checked]").val() + '&cc=' + strClientCode + '&cid=' + intContactID + '&seid=' + intSendEmailID;
 
    if ($get("txtQuantity").value < 1 && $get("txtQuantityConcession").value < 1) {
        alert("You must request at least 1 ticket.");
        $get("txtQuantity").focus();
    } else {
        $('#ancContinue').nyroModalManual({
            from: $get("ancContinue"),
            modal: false,
            width: 780,
            height: 600

            
        });
    }
    
    return false;
}



function getEventFail(error)
{
    alert(error.get_message());
}

// Register for updates.
function subscribe()
{
    $get("imgAjaxLoaderRegister").style.display = 'inline';
    	//Build Checkbox string
	var txt="";
	txt = txt + "'";	if($("#cbCabaret").attr("checked")==true){
 		txt=txt + "Cabaret | ";
	}
	if($("#cbCircus").attr("checked")==true){
 		txt=txt + "Circus | ";
	}
	if($("#cbComedy").attr("checked")==true){
 		txt=txt + "Comedy | ";
	}
	if($("#cbFilm").attr("checked")==true){
 		txt=txt + "Film | ";
	}
	if($("#cbLiterature").attr("checked")==true){
 		txt=txt + "Literature | ";
	}
	if($("#cbLiveart").attr("checked")==true){
 		txt=txt + "Live Art | ";
	}
	if($("#cbLivemusic").attr("checked")==true){
 		txt=txt + "Live Music | ";
	}
	if($("#cbOther").attr("checked")==true){
 		txt=txt + "Other | ";
	}
	if($("#cbTheatre").attr("checked")==true){
 		txt=txt + "Theatre | ";
	}
	if($("#cbVisualart").attr("checked")==true){
 		txt=txt + "Visual Art | ";
	}
	
	//Remove Trailing comma
	var outstr = ((txt.charAt(txt.length-2,1) == "|") ? txt.substring(0,txt.length-2) : txt);
	outstr = outstr + "'";
	
    Events.Subscribe($get("txtFirstName").value, $get("txtLastName").value, $get("txtEmail").value, outstr, subscribeSuccess, subscribeFail);
}

function subscribeSuccess(result)
{
    $get("imgAjaxLoaderRegister").style.display = 'none';
    $get("spnAjaxRegisterMessage").innerHTML = result;
}

function subscribeFail(error)
{
    alert(error.get_message());
}


function updateSubTotalQuantity (intNumberOfTickets) {
    //$get("spnTicketQuantity").innerHTML = intNumberOfTickets;
}

jQuery(function( $ ){

    // Register for updates text
    $(":text").placehold()
       
    // Vertical panel
	$('#divVerticalScrollingContainer').serialScroll({
		items: 'div.divVerticalScrollingItem',
		prev: '#btnArrowUp',
		next: '#btnArrowDown',
		axis: 'y',
		offset: 0, //when scrolling to photo, stop 230 before reaching it (from the left)
		start: 0, //as we are centering it, start at the 2nd
		duration: 300,
		force: true,
		stop: true,
		lazy: true,
		lock: false,
		step: 4,
		exclude: 7,
		//navigation:'#divTitlesTop a',
		cycle: false, //don't pull back once you reach the end
		easing: 'swing', //use this easing equation for a funny effect
		jump: true, //click on the images to scroll to them
		onBefore:function( e, elem, $pane, $items, pos ){
					/**
					 * 'this' is the triggered element 
					 * e is the event object
					 * elem is the element we'll be scrolling to
					 * $pane is the element being scrolled
					 * $items is the items collection at this moment
					 * pos is the position of elem in the collection
					 * if it returns false, the event will be ignored
					 */
					 //those arguments with a $ are jqueryfied, elem isn't.
					e.preventDefault();
					if( this.blur )
						this.blur();
				},
				onAfter:function( elem ){
					//'this' is the element being scrolled ($pane) not jqueryfied
				}

	});
	   
	// Sildeshow
	$('#divHorizontalScrollingContainer').serialScroll({
		items: 'li',
		prev: '#divContentRightPanelHeader a.btnArrowLeft',
		next: '#divContentRightPanelHeader a.btnArrowRight',
		axis: 'x',
		offset: 0, //when scrolling to photo, stop 230 before reaching it (from the left)
		start: 0, //as we are centering it, start at the 2nd
		duration: 300,
		force: true,
		stop: true,
		lazy: true,
		lock: false,
		cycle: false, //don't pull back once you reach the end
		easing: 'swing', //use this easing equation for a funny effect
		jump: true //click on the images to scroll to them

	});
	
	

});


//<[CDATA[



  var georgia = {
    src: 'siteFiles/js/fonts/georgia_min.swf'
    ,ratios: [7,1.32,8,1.31,12,1.27,19,1.23,28,1.19,30,1.17,31,1.18,45,1.17,61,1.16,62,1.15,67,1.16,116,1.15,117,1.14,123,1.15,124,1.14,1.15]
  };
  
  var arial = {
    src: 'siteFiles/js/fonts/arial_min.swf'
    ,ratios: [8,1.3,12,1.27,16,1.21,19,1.17,24,1.18,26,1.16,27,1.17,35,1.16,44,1.15,63,1.14,64,1.13,67,1.14,68,1.13,70,1.14,76,1.13,77,1.14,1.13]
  };

  // sIFR.domains = ['novemberborn.net'] // Don't check for domains in this demo
    
  sIFR.useStyleCheck = true;
  sIFR.forceWidth = true;
  sIFR.activate(georgia, arial);

  
   
    sIFR.replace(georgia, {
    selector: '#divTitlesBottom p'
    ,wmode: 'transparent'
    ,thickness: -100
    ,css: [
      '.sIFR-root { color: #ffffff; font-size: 17px; leading: -2;  }'
      ,'a { text-decoration: none; color: #ffffff; }'
      ,'a:hover { text-decoration: underline; color:none; }'
     ]
  });
  
  sIFR.replace(georgia, {
    selector: 'h1, #divContentRight h2, #divFooter h2'
    ,wmode: 'transparent'
    ,thickness: -100
    ,css: [
      '.sIFR-root { color: #ffffff; leading: -2; letter-spacing: -1; font-size: 18px;}'
     ]
  });
  
  sIFR.replace(georgia, {
    selector: 'li.clsMainMenuLevel1 span.clsLevel1'
    ,wmode: 'transparent'
    ,thickness: -100
    ,css: [
      '.sIFR-root { font-size: 18px; leading: 0; }'
      ,'a { text-decoration: none; color: #888888; }'
      ,'.clsSelected { color: #ffffff; }'
      ,'a:hover { color: #ffffff; }'
     ]
  });
  
  
  sIFR.replace(arial, {
    selector: 'ul.clsAboutMenu li.clsMainMenuLevel2 span.clsLevel2'
    ,wmode: 'transparent'
    ,css: [
      '.sIFR-root { font-size: 10px; leading: 0; }'
      ,'a { text-decoration: none; color: #888888; }'
      ,'.clsSelected { color: #ffffff; }'
      ,'a:hover { color: #ffffff; }'
     ]
  });


  
 
  
  //]]>
  
  /**
 * jQuery.query - Query String Modification and Creation for jQuery
 * Written in 2007 by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 2008/02/08
 *
 * @author Blair Mitchelmore
 * @version 1.2.3
 *
 **/
new function(settings) { 
  // Various Settings
  var $separator = settings.separator || '&';
  var $spaces = settings.spaces === false ? false : true;
  var $suffix = settings.suffix === false ? '' : '[]';
  var $hash = settings.hash === true ? true : false;
  var $prefix = settings.prefix === false ? false : true;
  
  jQuery.query = new function() {
    var queryObject = function(a) {
      var self = this;
      self.keys = {};
      
      if (a.queryObject) {
        jQuery.each(a.keys, function(key, val) {
          self.destructiveSet(key, val);
        });
      } else {
        jQuery.each(arguments, function() {
          var q = "" + this;
          q = q.replace(/^[?#]/,''); // remove any leading ? || #
          q = q.replace(/[;&]$/,''); // remove any trailing & || ;
          if ($spaces) q = q.replace(/[+]/g,' '); // replace +'s with spaces

          jQuery.each(q.split(/[&;]/), function(){
            var key = this.split('=')[0];
            var val = this.split('=')[1];
            var temp, hashKey = null, type = null; 
  
            if (!key) return;
          
            if (/^-?[0-9]+\.[0-9]+$/.test(val)) // simple float regex
              val = parseFloat(val);
            else if (/^-?[0-9]+$/.test(val)) // simple int regex
              val = parseInt(val, 10);
              
            if (/\[([^\] ]+)\]$/.test(key)) // hash syntax
              type = Object, hashkey = key.replace(/^.+\[([^\] ]+)\]$/,"$1"), key = key.replace(/\[([^\] ]+)\]$/,"");
            else if (/\[\]$/.test(key)) // array syntax
              type = Array, key = key.replace(/\[\]$/,"");
          
            val = (!val && val !== 0) ? true : val;
          
            if (!type && self.has(key)) 
              type = Array, self.destructiveSet(key, self.has(key, Array) ? self.keys[key] : [self.keys[key]]);
            
            if (val !== false && val !== true)
              val = decodeURIComponent(val);
  	  
            if (!type)
              self.destructiveSet(key, val);
            else
              if (type == Object) 
                temp = self.keys[key] || {}, temp[hashkey] = val, self.destructiveSet(key, temp);
              else if (type == Array)
                temp = self.keys[key] || [], temp.push(val), self.destructiveSet(key, temp);
          });
        });
      }
      return self;
    };
    
    queryObject.prototype = {
      queryObject: true,
      has: function(key, type) {
        var keys = this.keys;
        return !!type ? keys[key] != undefined && keys[key] !== null && keys[key].constructor == type : keys[key] != undefined && keys[key] !== null;
      },
      get: function(key) {
        var value = (key == undefined) ? this.keys : this.keys[key];
        if (!value) 
          return '';
        else if (value.constructor == Array)
          return value.slice(0);
        else if (value.constructor == Object)
          return jQuery.extend({}, value);
        else
          return value;
      },
      destructiveSet: function(key, val) {
        if (val == undefined || val === null)
          this.destructiveRemove(key);
        else
          this.keys[key] = val;
        return this;
      },
      set: function(key, val) {
        return this.copy().destructiveSet(key, val);
      },
      destructiveRemove: function(key) {
        if (typeof this.keys[key] != 'undefined') 
          delete this.keys[key];
        return this;
      },
      remove: function(key) {
        return this.copy().destructiveRemove(key);
      },
      destructiveEmpty: function() {
        var self = this;
        jQuery.each(self.keys, function(key, value) {
          delete self.keys[key];
        });
        return self;
      },
      empty: function(destructive) {
        return this.copy().destructiveEmpty();
      },
      copy: function() {
        return new queryObject(this);
      },
      toString: function() {
        var i = 0, queryString = [], self = this, addFields = function(o, key, value) {
          o.push(key);
          if (value !== true) {
            o.push("=");
            o.push(encodeURIComponent(value));
          }
        };
        jQuery.each(this.keys, function(key, value) {
          var o = [];
          if (value !== false) {
            if (i++ == 0)
              o.push($prefix ? $hash ? "#" : "?" : "");
            if (self.has(key, Object)) {
              var _o = []
              jQuery.each(value, function(_key, _value) {
                var __o = [];
                addFields(__o, key + "[" + _key + "]", _value);
                _o.push(__o.join(""));
              });
              o.push(_o.join($separator));
            } else if (self.has(key, Array)) {
              var _o = []
              jQuery.each(value, function(_key, _value) {
                var __o = [];
                addFields(__o, key + $suffix, _value);
                _o.push(__o.join(""));
              });
              o.push(_o.join($separator));
            } else {
              addFields(o,key,value);
            }
          }
          queryString.push(o.join(""));
        });
        return queryString.join($separator);
      }
    };
    
    return new queryObject(location.search, location.hash);
  };
}(jQuery.query || {}); // Pass in jQuery.query as settings object
