
/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/jquery.json-2.2.min.js */

(function($){$.toJSON=function(o)
{if(typeof(JSON)=='object'&&JSON.stringify)
return JSON.stringify(o);var type=typeof(o);if(o===null)
return"null";if(type=="undefined")
return undefined;if(type=="number"||type=="boolean")
return o+"";if(type=="string")
return $.quoteString(o);if(type=='object')
{if(typeof o.toJSON=="function")
return $.toJSON(o.toJSON());if(o.constructor===Date)
{var month=o.getUTCMonth()+1;if(month<10)month='0'+month;var day=o.getUTCDate();if(day<10)day='0'+day;var year=o.getUTCFullYear();var hours=o.getUTCHours();if(hours<10)hours='0'+hours;var minutes=o.getUTCMinutes();if(minutes<10)minutes='0'+minutes;var seconds=o.getUTCSeconds();if(seconds<10)seconds='0'+seconds;var milli=o.getUTCMilliseconds();if(milli<100)milli='0'+milli;if(milli<10)milli='0'+milli;return'"'+year+'-'+month+'-'+day+'T'+
hours+':'+minutes+':'+seconds+'.'+milli+'Z"';}
if(o.constructor===Array)
{var ret=[];for(var i=0;i<o.length;i++)
ret.push($.toJSON(o[i])||"null");return"["+ret.join(",")+"]";}
var pairs=[];for(var k in o){var name;var type=typeof k;if(type=="number")
name='"'+k+'"';else if(type=="string")
name=$.quoteString(k);else
continue;if(typeof o[k]=="function")
continue;var val=$.toJSON(o[k]);pairs.push(name+":"+val);}
return"{"+pairs.join(", ")+"}";}};$.evalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);return eval("("+src+")");};$.secureEvalJSON=function(src)
{if(typeof(JSON)=='object'&&JSON.parse)
return JSON.parse(src);var filtered=src;filtered=filtered.replace(/\\["\\\/bfnrtu]/g,'@');filtered=filtered.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']');filtered=filtered.replace(/(?:^|:|,)(?:\s*\[)+/g,'');if(/^[\],:{}\s]*$/.test(filtered))
return eval("("+src+")");else
throw new SyntaxError("Error parsing JSON, source is not valid.");};$.quoteString=function(string)
{if(string.match(_escapeable))
{return'"'+string.replace(_escapeable,function(a)
{var c=_meta[a];if(typeof c==='string')return c;c=a.charCodeAt();return'\\u00'+Math.floor(c/16).toString(16)+(c%16).toString(16);})+'"';}
return'"'+string+'"';};var _escapeable=/["\\\x00-\x1f\x7f-\x9f]/g;var _meta={'\b':'\\b','\t':'\\t','\n':'\\n','\f':'\\f','\r':'\\r','"':'\\"','\\':'\\\\'};})(jQuery);

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/glossary.js */
/**
 * This javascript is called by database generated JQuery configuration
 * options to apply glossary terms defined in the database as fancy rollover
 * tool tips.
 *
 * Based on:
 *  simpleTooltip jQuery plugin, by Marius ILIE
 *  visit http://dev.mariusilie.net for details
 *
 * @package sfPropelGlossaryToolTipPlugin
 * @author Robert Powell
 */
(function($){ $.fn.sfGlossaryToolTip = function()
{
	return this.each(function() {
		var title = $(this).attr("title");
		$(this).attr("title", "");
		$(this).attr("class", "glossaryTerm");

		if(title != undefined) {
			$(this).hover(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				$(this).attr("title", "");
				$("body").append("<div id='glossaryToolTip' class='markup' style='position: absolute; z-index: 100; display: none;'>" + title + "</div>");
				if($.browser.msie) var tipWidth = $("#glossaryToolTip").outerWidth(true)
				else var tipWidth = $("#glossaryToolTip").width()
				$("#glossaryToolTip").width(tipWidth);
				$("#glossaryToolTip").css("left", tipX).css("top", tipY).fadeIn("medium");
			}, function(){
				$("#glossaryToolTip").remove();
				$(this).attr("title", title);
			});
			$(this).mousemove(function(e){
				var tipX = e.pageX + 12;
				var tipY = e.pageY + 12;
				var tipWidth = $("#glossaryToolTip").outerWidth(true);
				var tipHeight = $("#glossaryToolTip").outerHeight(true);
				if(tipX + tipWidth > $(window).scrollLeft() + $(window).width()) tipX = e.pageX - tipWidth;
				if($(window).height()+$(window).scrollTop() < tipY + tipHeight) tipY = e.pageY - tipHeight;
				$("#glossaryToolTip").css("left", tipX).css("top", tipY).fadeIn("medium");
			});
		}
	});
}})(jQuery);

/**
 * Removes tool tips from elements which are configured
 * not to have tooltips in the admin tool.
 */
(function($){ $.fn.sfGlossaryToolTipRemove = function(){
	return this.each(function() {
    $(this).before($(this)[0].innerHTML).remove();
	});
}})(jQuery);

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/jquery_combined_plugins.js */
/* Copyright (c) 2009 Alexandre Plennevaux (alexandre AT pixeline DOT be || http://www.pixeline.be)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* 
* See http://www.pixeline.be/experiments/simplyTabs/
*/

/**
Creates a tabbed interface out of a link of in-page anchors. 
If the anchor's target element does not exist, the tab is not created.

In order to achive the "tabbification", the plugin simply uses css classes. The css styling takes care of showing/ hiding. So that the designers can do most (if not all) of the tweaking inside the CSS stylesheet.

Designed for minimal fuzz.

Look 'n feel: A basic CSS is provided but you can customize the look completely.

* @example jQuery('#tabbedContainer').simplyTabs();
* @name simplyTabs
* @version r1 _ 01.03.2009
* @type jQuery
* @param Object	settings	hash with options, described below.
*		tabsNavMenuSelector - class of the menu to be used for the tabs detection & navigation (default : 'ul.tabsNavMenu' )
*       tabsNavMenuClass - class given to the tabs navigation menu (default: 'tab-menu')
*       tabsPanelClass - class given to the tab panels (default: 'tab-panel')
*       tabsNavMenuItemClass - class given to the menu items anchor elements (default: 'tab-menu-item')
*       visibleTabClass - class given to the active tab (default: 'tab-visible')
*       invisibleTabClass - class given to the inactive tabs ( default: 'tab-hidden')
*       selectedTab - tab selected on launch - 0-based, according to the anchor order in the html markup. (default: 0 (first tab))
*       selectedTabClass - class given to the active tab (default: 'tab-menu-item-selected')
*       onShow - callback function triggered after a tab is displayed (default: null)
*
* @return jQuery
* @cat Plugins/simplyTabs
* @author Alexandre Plennevaux (alexandre AT pixeline DOT be || http://www.pixeline.be)
* 
* @modified by John C. Scott
* @modified 9/8/2009
*/
(function($)
{
    $.fn.simplyTabs = function(options)
    {
        // build main options before element iteration
        var opts = $.extend({}, $.fn.simplyTabs.defaults, options);
        // iterate and reformat each matched element
        return this.each(function()
        {

            var $tabContainer = $(this).addClass('tabs');
            // build element specific options
            var o = $.meta ? $.extend({}, opts, $tabContainer.data()) : opts;

            if ($(o.tabsNavMenuSelector, $tabContainer).length > 0)
            {
                var $menu = $(o.tabsNavMenuSelector);
                $menu.addClass(o.tabsNavMenuClass);
                $('a', $menu).addClass(o.tabsNavMenuItemClass).each(function(index)
                {
                    var $thisMenuItem = $(this);
                    // check if this anchor targets an existing identifier
                    var panelSelector = this.hash;
                    var $panel = $(panelSelector);
                    if ($panel.length)
                    {
                        // if so, turn the element into a tab panel
                        $panel.addClass(o.tabsPanelClass);
                        // ... the link into a tab activator
                        $thisMenuItem.addClass(o.tabsNavMenuItemClass);
                        if (index == o.selectedTab)
                        {
                            $panel.addClass(o.visibleTabClass);
                            $thisMenuItem.addClass(o.selectedTabClass);
                        } else
                        {
                            $panel.addClass(o.invisibleTabClass);
                        }
                    }
                });
                // then assign tab (des)activation behavior to anchors
                $('a.' + o.tabsNavMenuItemClass).bind('click.tabs', function(e)
                {
                    e.preventDefault();
                    var $this = $(this);
                    // switch panel
                    var selectedPanel = this.hash;

                    var $tabContainer = $(this).parents('.' + o.tabsWrapper);
                    $('.' + o.tabsPanelClass, $tabContainer).removeClass(o.visibleTabClass).addClass(o.invisibleTabClass);
                    $(selectedPanel).addClass(o.visibleTabClass);
                    // update menu
                    $('a.' + o.tabsNavMenuItemClass, $tabContainer).removeClass(o.selectedTabClass);
                    $this.addClass(o.selectedTabClass);

                    if (jQuery.isFunction(o.onShow))
                    {
                        o.onShow.apply(this);
                    }
                });
            }
        });
    };

    //
    // plugin defaults
    //
    $.fn.simplyTabs.defaults = {
        tabsNavMenuSelector: 'ul.tabsNavMenu',
        tabsWrapper: 'tabs-wrapper',
        tabsNavMenuClass: 'tab-menu', 
        tabsPanelClass: 'tab-panel', 
        tabsNavMenuItemClass: 'tab-menu-item', 
        visibleTabClass: 'tab-visible', 
        invisibleTabClass: 'tab-hidden', 
        selectedTab: 0, 
        selectedTabClass: 'tab-menu-item-selected', 
        onShow: null
    };
    //
    // end of closure
    //
})(jQuery);

/**
 * Supersleight jQuery Plugin for Transparent PNGs in IE6
 * 
 * http://allinthehead.com/retro/338/supersleight-jquery-plugin
 * author: Drew McLellan
 * 
 * 12 March 2009
 * 
 * You apply it to a section of the page like this:
 * 
 * $('#content').supersleight();
 * 
 * Of course, if you wanted to fix PNGs for the entire page, you can just 
 * apply it to the body element. For all sorts of reasons, it’s better to be 
 * specific if you can.
 * 
 * $('body').supersleight();
 * 
 * This can be safely reapplied after importing a chunk of HTML via an Ajax request 
 * (something I end up doing a lot), and it uses jQuery’s browser detection to only 
 * apply it to the appropriate versions of IE, so it’s safe to deploy for everything, 
 * or to include inside some Conditional Comments as you prefer.
 * 
 * As always, the script requires the path to a transparent GIF shim image. By default, 
 * and almost by tradition with this script, that’s x.gif, but you can specify any 
 * image you like:
 * 
 * $('body').supersleight({shim: '/img/transparent.gif'});
 * 
 * Other possible configuration values are imgs and backgrounds (both boolean, 
 * default true) to tell the script which PNGs to fix up, and apply_positioning (boolean, 
 * default true) to tell the script not to try and fix up some of the bugs around 
 * unclickable links. (See the 24ways article (http://24ways.org/2007/supersleight-transparent-png-in-ie6) 
 * for more info on that).
 */
(function($){
	jQuery.fn.supersleight = function(settings) {
		settings = jQuery.extend({
			imgs: true,
			backgrounds: true,
			shim: '/images/spacer.gif',
			apply_positioning: true
		}, settings);
		
		return this.each(function(){
			if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
				jQuery(this).find('*').andSelf().each(function(i,obj) {
					var self = jQuery(obj);
					// background pngs
					if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
						var bg = self.css('background-image');
						var src = bg.substring(5,bg.length-2);
						var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
						var styles = {
							'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
							'background-image': 'url('+settings.shim+')'
						};
						self.css(styles);
					};
					// image elements
					if (settings.imgs && self.is('img[src$=png]')){
						var styles = {
							'width': self.width() + 'px',
							'height': self.height() + 'px',
							'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
						};
						self.css(styles).attr('src', settings.shim);
					};
					// apply position to 'active' elements
					if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')){
						self.css('position', 'relative');
					};
				});
			};
		});
	};
})(jQuery);

/*
 * jqModal - Minimalist Modaling with jQuery
 *   (http://dev.iceburg.net/jquery/jqModal/)
 *
 * Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 * 
 * $Version: 03/01/2009 +r14
 */
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};

$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])L('bind');A.push(s);}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=F;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
 if(A[0]){A.pop();if(!A[0])L('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
 if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);


/*
 * jQuery Form Plugin
 * version: 2.28 (10-MAY-2009)
 * @requires jQuery v1.2.2 or later
 *
 * Examples and documentation at: http://malsup.com/jquery/form/
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
;(function($) {

/*
    Usage Note:
    -----------
    Do not use both ajaxSubmit and ajaxForm on the same form.  These
    functions are intended to be exclusive.  Use ajaxSubmit if you want
    to bind your own submit handler to the form.  For example,

    $(document).ready(function() {
        $('#myForm').bind('submit', function() {
            $(this).ajaxSubmit({
                target: '#output'
            });
            return false; // <-- important!
        });
    });

    Use ajaxForm when you want the plugin to manage all the event binding
    for you.  For example,

    $(document).ready(function() {
        $('#myForm').ajaxForm({
            target: '#output'
        });
    });

    When using ajaxForm, the ajaxSubmit function will be invoked for you
    at the appropriate time.
*/

/**
 * ajaxSubmit() provides a mechanism for immediately submitting
 * an HTML form using AJAX.
 */
$.fn.ajaxSubmit = function(options) {
    // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
    if (!this.length) {
        log('ajaxSubmit: skipping submit process - no element selected');
        return this;
    }

    if (typeof options == 'function')
        options = { success: options };

    var url = $.trim(this.attr('action'));
    if (url) {
	    // clean url (don't include hash vaue)
	    url = (url.match(/^([^#]+)/)||[])[1];
   	}
   	url = url || window.location.href || ''

    options = $.extend({
        url:  url,
        type: this.attr('method') || 'GET'
    }, options || {});

    // hook for manipulating the form data before it is extracted;
    // convenient for use with rich editors like tinyMCE or FCKEditor
    var veto = {};
    this.trigger('form-pre-serialize', [this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
        return this;
    }

    // provide opportunity to alter form data before it is serialized
    if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSerialize callback');
        return this;
    }

    var a = this.formToArray(options.semantic);
    if (options.data) {
        options.extraData = options.data;
        for (var n in options.data) {
          if(options.data[n] instanceof Array) {
            for (var k in options.data[n])
              a.push( { name: n, value: options.data[n][k] } );
          }
          else
             a.push( { name: n, value: options.data[n] } );
        }
    }

    // give pre-submit callback an opportunity to abort the submit
    if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
        log('ajaxSubmit: submit aborted via beforeSubmit callback');
        return this;
    }

    // fire vetoable 'validate' event
    this.trigger('form-submit-validate', [a, this, options, veto]);
    if (veto.veto) {
        log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
        return this;
    }

    var q = $.param(a);

    if (options.type.toUpperCase() == 'GET') {
        options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
        options.data = null;  // data is null for 'get'
    }
    else
        options.data = q; // data is the query string for 'post'

    var $form = this, callbacks = [];
    if (options.resetForm) callbacks.push(function() { $form.resetForm(); });
    if (options.clearForm) callbacks.push(function() { $form.clearForm(); });

    // perform a load on the target only if dataType is not provided
    if (!options.dataType && options.target) {
        var oldSuccess = options.success || function(){};
        callbacks.push(function(data) {
            $(options.target).html(data).each(oldSuccess, arguments);
        });
    }
    else if (options.success)
        callbacks.push(options.success);

    options.success = function(data, status) {
        for (var i=0, max=callbacks.length; i < max; i++)
            callbacks[i].apply(options, [data, status, $form]);
    };

    // are there files to upload?
    var files = $('input:file', this).fieldValue();
    var found = false;
    for (var j=0; j < files.length; j++)
        if (files[j])
            found = true;

	var multipart = false;
//	var mp = 'multipart/form-data';
//	multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);

    // options.iframe allows user to force iframe mode
   if (options.iframe || found || multipart) {
       // hack to fix Safari hang (thanks to Tim Molendijk for this)
       // see:  http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
       if (options.closeKeepAlive)
           $.get(options.closeKeepAlive, fileUpload);
       else
           fileUpload();
       }
   else
       $.ajax(options);

    // fire 'notify' event
    this.trigger('form-submit-notify', [this, options]);
    return this;


    // private function for handling file uploads (hat tip to YAHOO!)
    function fileUpload() {
        var form = $form[0];

        if ($(':input[name=submit]', form).length) {
            alert('Error: Form elements must not be named "submit".');
            return;
        }

        var opts = $.extend({}, $.ajaxSettings, options);
		var s = $.extend(true, {}, $.extend(true, {}, $.ajaxSettings), opts);

        var id = 'jqFormIO' + (new Date().getTime());
        var $io = $('<iframe id="' + id + '" name="' + id + '" src="about:blank" />');
        var io = $io[0];

        $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });

        var xhr = { // mock object
            aborted: 0,
            responseText: null,
            responseXML: null,
            status: 0,
            statusText: 'n/a',
            getAllResponseHeaders: function() {},
            getResponseHeader: function() {},
            setRequestHeader: function() {},
            abort: function() {
                this.aborted = 1;
                $io.attr('src','about:blank'); // abort op in progress
            }
        };

        var g = opts.global;
        // trigger ajax global events so that activity/block indicators work like normal
        if (g && ! $.active++) $.event.trigger("ajaxStart");
        if (g) $.event.trigger("ajaxSend", [xhr, opts]);

		if (s.beforeSend && s.beforeSend(xhr, s) === false) {
			s.global && $.active--;
			return;
        }
        if (xhr.aborted)
            return;

        var cbInvoked = 0;
        var timedOut = 0;

        // add submitting element to data if we know it
        var sub = form.clk;
        if (sub) {
            var n = sub.name;
            if (n && !sub.disabled) {
                options.extraData = options.extraData || {};
                options.extraData[n] = sub.value;
                if (sub.type == "image") {
                    options.extraData[name+'.x'] = form.clk_x;
                    options.extraData[name+'.y'] = form.clk_y;
                }
            }
        }

        // take a breath so that pending repaints get some cpu time before the upload starts
        setTimeout(function() {
            // make sure form attrs are set
            var t = $form.attr('target'), a = $form.attr('action');

			// update form attrs in IE friendly way
			form.setAttribute('target',id);
			if (form.getAttribute('method') != 'POST')
				form.setAttribute('method', 'POST');
			if (form.getAttribute('action') != opts.url)
				form.setAttribute('action', opts.url);

            // ie borks in some cases when setting encoding
            if (! options.skipEncodingOverride) {
                $form.attr({
                    encoding: 'multipart/form-data',
                    enctype:  'multipart/form-data'
                });
            }

            // support timout
            if (opts.timeout)
                setTimeout(function() { timedOut = true; cb(); }, opts.timeout);

            // add "extra" data to form if provided in options
            var extraInputs = [];
            try {
                if (options.extraData)
                    for (var n in options.extraData)
                        extraInputs.push(
                            $('<input type="hidden" name="'+n+'" value="'+options.extraData[n]+'" />')
                                .appendTo(form)[0]);

                // add iframe to doc and submit the form
                $io.appendTo('body');
                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
                form.submit();
            }
            finally {
                // reset attrs and remove "extra" input elements
				form.setAttribute('action',a);
                t ? form.setAttribute('target', t) : $form.removeAttr('target');
                $(extraInputs).remove();
            }
        }, 10);

        var nullCheckFlag = 0;

        function cb() {
            if (cbInvoked++) return;

            io.detachEvent ? io.detachEvent('onload', cb) : io.removeEventListener('load', cb, false);

            var ok = true;
            try {
                if (timedOut) throw 'timeout';
                // extract the server response from the iframe
                var data, doc;

                doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;

                if ((doc.body == null || doc.body.innerHTML == '') && !nullCheckFlag) {
                    // in some browsers (cough, Opera 9.2.x) the iframe DOM is not always traversable when
                    // the onload callback fires, so we give them a 2nd chance
                    nullCheckFlag = 1;
                    cbInvoked--;
                    setTimeout(cb, 100);
                    return;
                }

                xhr.responseText = doc.body ? doc.body.innerHTML : null;
                xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
                xhr.getResponseHeader = function(header){
                    var headers = {'content-type': opts.dataType};
                    return headers[header];
                };

                if (opts.dataType == 'json' || opts.dataType == 'script') {
                    var ta = doc.getElementsByTagName('textarea')[0];
                    xhr.responseText = ta ? ta.value : xhr.responseText;
                }
                else if (opts.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
                    xhr.responseXML = toXml(xhr.responseText);
                }
                data = $.httpData(xhr, opts.dataType);
            }
            catch(e){
                ok = false;
                $.handleError(opts, xhr, 'error', e);
            }

            // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
            if (ok) {
                opts.success(data, 'success');
                if (g) $.event.trigger("ajaxSuccess", [xhr, opts]);
            }
            if (g) $.event.trigger("ajaxComplete", [xhr, opts]);
            if (g && ! --$.active) $.event.trigger("ajaxStop");
            if (opts.complete) opts.complete(xhr, ok ? 'success' : 'error');

            // clean up
            setTimeout(function() {
                $io.remove();
                xhr.responseXML = null;
            }, 100);
        };

        function toXml(s, doc) {
            if (window.ActiveXObject) {
                doc = new ActiveXObject('Microsoft.XMLDOM');
                doc.async = 'false';
                doc.loadXML(s);
            }
            else
                doc = (new DOMParser()).parseFromString(s, 'text/xml');
            return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
        };
    };
};

/**
 * ajaxForm() provides a mechanism for fully automating form submission.
 *
 * The advantages of using this method instead of ajaxSubmit() are:
 *
 * 1: This method will include coordinates for <input type="image" /> elements (if the element
 *    is used to submit the form).
 * 2. This method will include the submit element's name/value data (for the element that was
 *    used to submit the form).
 * 3. This method binds the submit() method to the form for you.
 *
 * The options argument for ajaxForm works exactly as it does for ajaxSubmit.  ajaxForm merely
 * passes the options argument along after properly binding events for submit elements and
 * the form itself.
 */
$.fn.ajaxForm = function(options) {
    return this.ajaxFormUnbind().bind('submit.form-plugin',function() {
        $(this).ajaxSubmit(options);
        return false;
    }).each(function() {
        // store options in hash
        $(":submit,input:image", this).bind('click.form-plugin',function(e) {
            var form = this.form;
            form.clk = this;
            if (this.type == 'image') {
                if (e.offsetX != undefined) {
                    form.clk_x = e.offsetX;
                    form.clk_y = e.offsetY;
                } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
                    var offset = $(this).offset();
                    form.clk_x = e.pageX - offset.left;
                    form.clk_y = e.pageY - offset.top;
                } else {
                    form.clk_x = e.pageX - this.offsetLeft;
                    form.clk_y = e.pageY - this.offsetTop;
                }
            }
            // clear form vars
            setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 10);
        });
    });
};

// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
$.fn.ajaxFormUnbind = function() {
    this.unbind('submit.form-plugin');
    return this.each(function() {
        $(":submit,input:image", this).unbind('click.form-plugin');
    });

};

/**
 * formToArray() gathers form element data into an array of objects that can
 * be passed to any of the following ajax functions: $.get, $.post, or load.
 * Each object in the array has both a 'name' and 'value' property.  An example of
 * an array for a simple login form might be:
 *
 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
 *
 * It is this array that is passed to pre-submit callback functions provided to the
 * ajaxSubmit() and ajaxForm() methods.
 */
$.fn.formToArray = function(semantic) {
    var a = [];
    if (this.length == 0) return a;

    var form = this[0];
    var els = semantic ? form.getElementsByTagName('*') : form.elements;
    if (!els) return a;
    for(var i=0, max=els.length; i < max; i++) {
        var el = els[i];
        var n = el.name;
        if (!n) continue;

        if (semantic && form.clk && el.type == "image") {
            // handle image inputs on the fly when semantic == true
            if(!el.disabled && form.clk == el) {
            	a.push({name: n, value: $(el).val()});
                a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
            }
            continue;
        }

        var v = $.fieldValue(el, true);
        if (v && v.constructor == Array) {
            for(var j=0, jmax=v.length; j < jmax; j++)
                a.push({name: n, value: v[j]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: n, value: v});
    }

    if (!semantic && form.clk) {
        // input type=='image' are not found in elements array! handle it here
        var $input = $(form.clk), input = $input[0], n = input.name;
        if (n && !input.disabled && input.type == 'image') {
        	a.push({name: n, value: $input.val()});
            a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
        }
    }
    return a;
};

/**
 * Serializes form data into a 'submittable' string. This method will return a string
 * in the format: name1=value1&amp;name2=value2
 */
$.fn.formSerialize = function(semantic) {
    //hand off to jQuery.param for proper encoding
    return $.param(this.formToArray(semantic));
};

/**
 * Serializes all field elements in the jQuery object into a query string.
 * This method will return a string in the format: name1=value1&amp;name2=value2
 */
$.fn.fieldSerialize = function(successful) {
    var a = [];
    this.each(function() {
        var n = this.name;
        if (!n) return;
        var v = $.fieldValue(this, successful);
        if (v && v.constructor == Array) {
            for (var i=0,max=v.length; i < max; i++)
                a.push({name: n, value: v[i]});
        }
        else if (v !== null && typeof v != 'undefined')
            a.push({name: this.name, value: v});
    });
    //hand off to jQuery.param for proper encoding
    return $.param(a);
};

/**
 * Returns the value(s) of the element in the matched set.  For example, consider the following form:
 *
 *  <form><fieldset>
 *      <input name="A" type="text" />
 *      <input name="A" type="text" />
 *      <input name="B" type="checkbox" value="B1" />
 *      <input name="B" type="checkbox" value="B2"/>
 *      <input name="C" type="radio" value="C1" />
 *      <input name="C" type="radio" value="C2" />
 *  </fieldset></form>
 *
 *  var v = $(':text').fieldValue();
 *  // if no values are entered into the text inputs
 *  v == ['','']
 *  // if values entered into the text inputs are 'foo' and 'bar'
 *  v == ['foo','bar']
 *
 *  var v = $(':checkbox').fieldValue();
 *  // if neither checkbox is checked
 *  v === undefined
 *  // if both checkboxes are checked
 *  v == ['B1', 'B2']
 *
 *  var v = $(':radio').fieldValue();
 *  // if neither radio is checked
 *  v === undefined
 *  // if first radio is checked
 *  v == ['C1']
 *
 * The successful argument controls whether or not the field element must be 'successful'
 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
 * The default value of the successful argument is true.  If this value is false the value(s)
 * for each element is returned.
 *
 * Note: This method *always* returns an array.  If no valid value can be determined the
 *       array will be empty, otherwise it will contain one or more values.
 */
$.fn.fieldValue = function(successful) {
    for (var val=[], i=0, max=this.length; i < max; i++) {
        var el = this[i];
        var v = $.fieldValue(el, successful);
        if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length))
            continue;
        v.constructor == Array ? $.merge(val, v) : val.push(v);
    }
    return val;
};

/**
 * Returns the value of the field element.
 */
$.fieldValue = function(el, successful) {
    var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
    if (typeof successful == 'undefined') successful = true;

    if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
        (t == 'checkbox' || t == 'radio') && !el.checked ||
        (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
        tag == 'select' && el.selectedIndex == -1))
            return null;

    if (tag == 'select') {
        var index = el.selectedIndex;
        if (index < 0) return null;
        var a = [], ops = el.options;
        var one = (t == 'select-one');
        var max = (one ? index+1 : ops.length);
        for(var i=(one ? index : 0); i < max; i++) {
            var op = ops[i];
            if (op.selected) {
				var v = op.value;
				if (!v) // extra pain for IE...
                	v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
                if (one) return v;
                a.push(v);
            }
        }
        return a;
    }
    return el.value;
};

/**
 * Clears the form data.  Takes the following actions on the form's input fields:
 *  - input text fields will have their 'value' property set to the empty string
 *  - select elements will have their 'selectedIndex' property set to -1
 *  - checkbox and radio inputs will have their 'checked' property set to false
 *  - inputs of type submit, button, reset, and hidden will *not* be effected
 *  - button elements will *not* be effected
 */
$.fn.clearForm = function() {
    return this.each(function() {
        $('input,select,textarea', this).clearFields();
    });
};

/**
 * Clears the selected form elements.
 */
$.fn.clearFields = $.fn.clearInputs = function() {
    return this.each(function() {
        var t = this.type, tag = this.tagName.toLowerCase();
        if (t == 'text' || t == 'password' || tag == 'textarea')
            this.value = '';
        else if (t == 'checkbox' || t == 'radio')
            this.checked = false;
        else if (tag == 'select')
            this.selectedIndex = -1;
    });
};

/**
 * Resets the form data.  Causes all form elements to be reset to their original value.
 */
$.fn.resetForm = function() {
    return this.each(function() {
        // guard against an input with the name of 'reset'
        // note that IE reports the reset function as an 'object'
        if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType))
            this.reset();
    });
};

/**
 * Enables or disables any matching elements.
 */
$.fn.enable = function(b) {
    if (b == undefined) b = true;
    return this.each(function() {
        this.disabled = !b;
    });
};

/**
 * Checks/unchecks any matching checkboxes or radio buttons and
 * selects/deselects and matching option elements.
 */
$.fn.selected = function(select) {
    if (select == undefined) select = true;
    return this.each(function() {
        var t = this.type;
        if (t == 'checkbox' || t == 'radio')
            this.checked = select;
        else if (this.tagName.toLowerCase() == 'option') {
            var $sel = $(this).parent('select');
            if (select && $sel[0] && $sel[0].type == 'select-one') {
                // deselect all other options
                $sel.find('option').selected(false);
            }
            this.selected = select;
        }
    });
};

// helper fn for console logging
// set $.fn.ajaxSubmit.debug to true to enable debug logging
function log() {
    if ($.fn.ajaxSubmit.debug && window.console && window.console.log)
        window.console.log('[jquery.form] ' + Array.prototype.join.call(arguments,''));
};

})(jQuery);

/*
 * jQuery Vertical Align Plugin
 * usage: $('#example p').vAlign();
 */
(function($){
	$.fn.vAlign = function(){
		return this.each(function(i){
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = (ph - ah) / 2;
			// We don't want a negative number!
			var mh = (mh < 0) ? (mh * -1) : mh;
			$(this).css('margin-top', mh);
		});
	};
})(jQuery);

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/sitewide_methods.js */
/*
 * This script instantiates sitewide jQuery methods.
 * These methods could bind events to elements, for example.
 */

// Turns on CSS background image caching in IE. May even work in FF.
//try{ document.execCommand("BackgroundImageCache", false, true); } catch(e){}; //breaks in IE6, hmm.

// Pre-load selected images. Adds images to DOM, so the cache should persist.
// Most of the nav bar images are CSS backgrounds, so this will have little effect on FF3.
// FF3 "cleans-up" images that aren't added to the DOM, btw. Don't know what IE does.
var images = [
	'/images/backgrounds/bkgd-search-area.png', 
	'/images/backgrounds/bkgd-top-search.png', 
	'/images/sprites/sprite_nav-utility-icons.png', 
	'/images/sprites/sprite_horiz_bg.png', 
	'/images/sprites/sprite_main_nav_divider.png', 
	'/images/spacer.gif', 
	'/images/header/nav-rollover-bg.png', 
	'/images/sprites/sprite_horiz_bg.png',
	'/images/minicart/bkgd-minicart-closed.png', 
	'/images/minicart/bkgd-minicart-opened.png', 
	'/images/minicart/bkgd-minicart-bottom-opened.png', 
	'/images/minicart/bkgd-minicart-fill-opened.png', 
	'/images/header/nav-account.gif', 
	'/images/header/nav-community.gif', 
	'/images/header/nav-learn.gif', 
	'/images/header/nav-shop.gif', 
	'/images/header/nav-support.gif', 
	'/images/buttons/btn-orange-sm-l.png', 
	'/images/buttons/btn-orange-sm-r.png', 
	'/images/buttons/btn-orange-sm-l-o.png', 
	'/images/buttons/btn-orange-sm-r-o.png', 
	'/images/buttons/btn-orange-med-l.png', 
	'/images/buttons/btn-orange-med-r.png', 
	'/images/buttons/btn-orange-med-l-o.png', 
	'/images/buttons/btn-orange-med-r-o.png' 
];
 
jQuery.each(images, function(i) {
  images[i] = new Image();
  images[i].src = this;
});

$(function(){
	/* PNG 24 fun */
	
	// Fixes transparent PNG bug just for IE6 or less.
	// Don't apply to all elements, as other non-transparent images may break.
	// Here we're appling the hack to all dynamic buttons and button elements.
	$('.btn, button, .item-compare').supersleight();

	// Here we're appling the hack to all "PNG24" images.
	$('.PNG24').supersleight({backgrounds: false});

	// Here we're appling the hack to all "tabs".
	$("ul.tabsNavMenu a span, ul.tabsNavMenu a em").supersleight();

	// Converts all support links to toggles
	$('.support-faq-question-link').click(function() { this.parentNode.onclick(); return false; });


	/* New "target" window for XHTML */
	
	//js alternative to target="_blank"
	$('a.new-win').click(function(){window.open(this.href); return false;});


	// Remove default value from input.
	$('.clear-this').focus(function(){
		$(this).val('');
	});
	
	// Let's not submit the search form if nothing's been entered
	var input_def_value = $('#search-for').val();
	$('#search-site').submit(function(){
		var input_value = $('#search-for').val();
		if (input_value == input_def_value || input_value == "") return false;
		// Add iframe for search results
		//$('#content-inner, #bodycontent').empty().append('<iframe name="search-results" id="search-results" frameborder="0" border="0" marginwidth="0" marginheight="0"></iframe>');
		
		// We need to adjust the height of the iframe to accomodate its content
		/*$('iframe').load(function(){
			// reset height, or else
			$(this).height(0);
			var iframeRef = document.getElementById('"'+this.id+'"');
			var frameHeight = $(iframeRef).find('html').outerHeight(true);
			$(this).height(frameHeight);
		});*/

		// We need to set a width of 960px if the col-wrapper element is at 100%.
		//if($('#col-wrapper').width() > 960) $('#search-results').addClass('set-width');
		return true;
	});

});

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/popup.js */
$(function() { 
	//Create a lightbox content container
	//Target the lightbox-container-content div to hold your content.
	$('body').append('<div id="lightbox-container" class="jqmDialog">' +
		'<div class="jqDrag popup-drag-outer">' +
			'<div class="popup-drag-inner">' +
				'<a href="#" class="jqmClose popup-closer">close</a>' +
			'</div>' + 
		'</div>' +
		'<div id="lightbox-container-content" class="clearfix popup-content"></div>' +
		'<div class="popup-bottom-outer">' +
			'<div class="popup-bottom-inner">&nbsp;</div>' +
		'</div>' +
	'</div>');
	$('#lightbox-container').jqm({
		modal: true,
		onShow: function(hash) {
			//PNG-24 for IE6  supersleight required for buttons in popup. 
			//Does not cascade into popup without this.
			$('.btn, button', hash.w).supersleight();
			$('.PNG24', hash.w).supersleight({backgrounds: false});
			hash.w.show();
		},
		onHide: function(hash) {
			hash.w.hide(1, function(){
				hash.c.trigger = null;
				hash.c.ajax = null;
				hash.c.target = null;
				
				var classes = $(hash.w).attr('class');
				var resetclasses = '';
				var classesarray = classes.split(' ');
				$.each(classesarray,
					function( idx, val ) {
						if (val.indexOf('jqm') == 0) {
							var sp = '';
							if (idx > 0) {sp = ' ' + val;}
							else {sp = val;}
							resetclasses += sp;
						}
					}
				);
				$(hash.w).attr( {'class' : resetclasses} );
				
				hash.o.remove();
			
			});
		}
	}).draggable({ handle: '.jqDrag', opacity: 0.5 });
	
	//css class for default popup implementation
	//will use the anchor's href to popup content
	$('a.lightbox-enable').click(
		function(event) {
			event.preventDefault();
			var url = this.href;
			$.get(
				url,
				function(data) {
					$('#lightbox-container-content').html(data);
					$('#lightbox-container').jqmShow();
				}
			);
		}
	);


	$('a.international-text-popup').click(
		function(event) {
			event.preventDefault();
			var url = this.href;
			$.get(
				url,
				function(data) {
					$('#lightbox-container-content').html(data);
					$('#lightbox-container').addClass('popup-international-text-countries');					
					$('#lightbox-container').jqmShow();
				}
			);
		}
	);
	
	$('a.minute-packages-popup').click(
			function(event) {
				event.preventDefault();
				var url = this.href;
				$.get(
					url,
					function(data) {
						$('#lightbox-container-content').html(data);
						$('#lightbox-container').addClass('popup-minute-packages');					
						$('#lightbox-container').jqmShow();
					}
				);
			}
		);


	$('a.policy-popup').click(
		function(event) {
			event.preventDefault();
			var url = this.href;
			$.get(
				url,
				function(data) {
					$('#lightbox-container-content').html(data);
					$('#lightbox-container').addClass('policy-popup');					
					$('#lightbox-container').jqmShow();
				}
			);
		}
	);		
	
	$('a.sample-popup').click(
			function(event) {
				event.preventDefault();
				var url = this.href;
				$.get(
					url,
					function(data) {
						$('#lightbox-container-content').html(data);
						$('#lightbox-container').addClass('sample-popup');					
						$('#lightbox-container').jqmShow();
					}
				);
			}
		);	
	
});

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/cart.js */
var cartajaxspinner = '<img class="ajax-spinner" src="/images/ajaxspinners/circleball.gif" />';
var ajaxBlockedTmp = null;
var addLOSLastSubmitted = null;
var cartdata = null;
var reloadCartData = false;

var docreff = (''+document.referrer);
//reload cartdata if referrer is not www.mycricket.com
if (docreff.indexOf('://www.mycricket.com/') == -1 && docreff.indexOf('://test.mycricket.com/') == -1) {
	reloadCartData = true;
}

$(function() {
	
	if ($.cookie('data')) {
		//The data cookie exists, but there is no cart. This can
		//happen if the cart cookie was deleted from myaccount pages.
		//so expire all cart related cookies.
		eval ('tcartdata = ' + $.cookie('data'));
		
		if (reloadCartData || (tcartdata.items > 0 && !$.cookie('MyCricketCartID')) 
	  		|| ($.cookie('LocationInfo') && (tcartdata.lochash != $.cookie('LocationInfo')))
	  		|| (!$.cookie('LocationInfo') && (tcartdata.lochash != ''))) 
		{
	  		reloadCartData = true;
		} else {
			cartdata = tcartdata;
			reloadCartData = false;
	  	}
	} else if ($.cookie('MyCricketCartID')) {
		reloadCartData = true;
	} else {
		reloadCartData = true;
	}
	
	if (reloadCartData && cartDataService != "") {
		$.ajax(
			{
				type: 'POST',
				url: cartDataService,
				dataType: 'json',
				success: function (jsonobj) {
					cartdata = jsonobj;
					displayMiniCart(cartdata);
					if (typeof(displayLocation) != 'undefined') displayLocation(cartdata);
					if (typeof(initLivePersonVars) != 'undefined') initLivePersonVars(cartdata);
				}
			}
		);
	} else if (cartdata != null) {
		displayMiniCart(cartdata);
		if (typeof(displayLocation) != 'undefined') displayLocation(cartdata);
		if (typeof(initLivePersonVars) != 'undefined') initLivePersonVars(cartdata);
	} else {
		if (typeof(initLivePersonVars) != 'undefined') initLivePersonVars(null);
	}
	
	//Attach zipcode check ajax validation.
	$('a.ajax-shop').click(
			function(event) {
				var elem = this;

				event.preventDefault();

				$.ajax(
				{
					type: 'POST',
					url: locationCheckService,
					dataType: 'json',
					success: function (data) {
						var formButton = null;
						if (!data.islocationset) {
						    popupZipForm(data.message, elem.href);
					   } else {
						   document.location = elem.href;
					   }
					},
					error: function(request, status, errorThrown) {
						alert(status + ' ' + locationCheckService);
					}
				});
	});

	$('.addtocart-submit').click(
			function( event ) {
				event.preventDefault();
				submitAddToCart(this, $(this).parents('form'));
			}
	);

	$('.inline-zip-form').ajaxForm(
			{
				dataType: 'json',
				beforeSubmit: function(formData, jqForm, options) {
					if (ajaxBlocked($(jqForm).find('button'))) return false;
				},
				success: function(data) {
					if (data.islocationset || data.doRedirect) {
					  if(data.redirect) {
					    document.location = data.redirect;
					  } else {
						  document.location = document.location;
					  }
					} else {
						ajaxUnblock();

						$('#lightbox-container-content').html(
								'<h3 class="question-title">We\'re sorry.</h3>'+data.message
						);
						$('#lightbox-container').addClass( 'popup-zipcode' );
						$('#lightbox-container-content p').addClass('copy');
						$('#lightbox-container-content h4').remove();

						hbxFailedZip(this.data, 'zipsearch_community_failed');

						$('#lightbox-container').jqmShow();
					}
				}

			}
	);

//	$('#minicart-wrapper').load( minicartService, function() {
//		// Assemble the cast
//		var minicart = $('#minicart');
//		var minicart_inner_wrapper = minicart.find('#minicart-inner-wrapper');
//		var minicart_toggles = minicart.find('.minicart-toggle').find('a');
//		var minicart_toggle_top = minicart.find('#minicart-toggle-top').find('a');
//		var minicart_package_toggles = minicart_inner_wrapper.find('.minicart-package-toggle').find('a');
//		var minicart_packages = minicart_inner_wrapper.find('.minicart-package');
//
//		// Toggle open/closed minicart
//		minicart_toggles.click(function(){
//			if (minicart.hasClass('minicart-opened')) {
//				// For a smooth transition, slideUp first on close...
//				minicart_inner_wrapper.slideUp('slow', function(){
//					minicart
//						.removeClass('minicart-opened')
//						.addClass('minicart-closed');
//					minicart_toggle_top.text("[+] show cart summary");
//				});
//			} else {
//				// ... and slideDown last on open.
//				minicart
//					.removeClass('minicart-closed')
//					.addClass('minicart-opened');
//				minicart_toggle_top.text("[-] hide cart summary");
//				minicart_inner_wrapper.slideDown('slow');
//			}
//
//			return false;
//		});
//
//		// Toggle open/closed minicart-packages
//		minicart_package_toggles.click(function(){
//			// First, close all packages.
//			minicart_packages.slideUp();
//			minicart_package_toggles.find('span').text('+');
//
//			// Then, toggle this package.
//			var my_package = $(this).parent().next('.minicart-package');
//			var state = $(this).find('span');
//
//			if(my_package.css('display') === 'none') {
//				my_package.slideDown();
//				state.text('-');
//			} else {
//				my_package.slideUp();
//				state.text('+');
//			}
//
//			return false;
//		});
//	});
});

function hbxFailedZip(data, type) {
	var result = data.split(/zip=([\d]{5})/i);
	if(result) {
		var ev1 = new _hbEvent('search');
		ev1.keywords = result[1] ? result[1] : '';
		ev1.results = 0;
		ev1.attt1 = 0;
		ev1.attr2 = type;
		ev1.attr3 = 0;
		_hbSend();
	}

}


function nextStep(clicked) {
	$.ajax(
			{
				type: 'POST',
				url: nextStepService,
				dataType: 'json',
				beforeSend: function(request) {
					if (ajaxBlocked(clicked)) return false;
				},
				success: function (jsonobj) {
					document.location = jsonobj.nextURL;
				}
			}
		);
}

function addLOSItem(clicked) {
	submitAddToCart(clicked,  $(clicked).parents('form'));
	return false;
}

function submitAddToCart(clicked, jqForm) {
	jqForm.ajaxSubmit({
		dataType: 'json',
		beforeSubmit: function(formData, jqForm, options) {
			if (ajaxBlocked(clicked)) return false;
			addLOSLastSubmitted = jqForm;
		},
		success: function(data) {
			if (data.success) {
				if (data.cartitem && (typeof(data.cartitem) == 'object') && (typeof('lpAddVars') != 'undefined')) {
					if (data.cartitem.itemType == 'phone') {
						lpAddVars('page', 'lpPhoneType', data.cartitem.itemName);
					} else if (data.cartitem.itemType == 'plan') {
						lpAddVars('page', 'lpPlanType', data.cartitem.itemName);
					}
				} 
				document.location = data.nextstep;
			} else {
				ajaxUnblock();
				$('.addtocart-submit').click(
						function( event ) {
							event.preventDefault();
							submitAddToCart(this, $(this).parents('form'));
						}
				);
				$('#lightbox-container-content').html(data.message);
				$('#lightbox-container').addClass( 'popup-package-conflict' );
				$('#lightbox-container').jqmShow();
			}
		}
	});
}


function popupZipForm(zipformcontent, successurl) {
	$('#lightbox-container-content').html(zipformcontent);
	$('#lightbox-container').addClass( 'popup-zipcode' );

	$('#form-zipentry').ajaxForm(
			{
				dataType: 'json',
				beforeSubmit: function(formData, jqForm, options) {
					if (ajaxBlocked($(jqForm).find('button'))) return false;
				},
				success: function(data) {
					if (data.islocationset) {
						if (successurl != '') {
							document.location = successurl;
						} else {
							//Success url is empty. So refresh the
							document.location = document.location;
						}
					} else {
						ajaxUnblock();
						$('#zipformerror').fadeOut('normal', function() {
							$('#form-zipentry').addClass( 'popup-zipcode-error' );
							$('#zipformerror').html(data.message);
							$('#zipformerror').fadeIn();
						});

						hbxFailedZip(this.data, 'zipsearch_shop_failed');
					}
				}

			}
		);

  $('#lightbox-container').jqmShow();
}

function replaceLOSItem(clicked, packageid) {
	$(addLOSLastSubmitted[0]['addmode']).attr({value : packageid});
	submitAddToCart(clicked, addLOSLastSubmitted);
}

function newLOSItem(clicked, packagetype) {
	$(addLOSLastSubmitted[0]['packagetype']).attr({value : packagetype});
	$(addLOSLastSubmitted[0]['addmode']).attr({value : 'append'});
	submitAddToCart(clicked, addLOSLastSubmitted);
}

function setIntention(clicked, packagetype) {
	$(addLOSLastSubmitted[0]['packagetype']).attr({value : packagetype});
	appendConfirmStack(addLOSLastSubmitted, 'confirmintention');
	submitAddToCart(clicked, addLOSLastSubmitted);
}

function confirmFringeAddToCart(clicked) {
	appendConfirmStack(addLOSLastSubmitted, 'fringezip');
	submitAddToCart(clicked, addLOSLastSubmitted);
}

function appendConfirmStack(jqForm, confirmAction) {
	var confirmstack = $(jqForm[0]['confirmstack']).attr('value');
	confirmstack += (confirmAction + ',');
	$(jqForm[0]['confirmstack']).attr({value : confirmstack});
}

function ajaxBlocked(ajaxButton) {
	if ($('.ajax-spinner').length > 0) return true;
	ajaxBlockedTmp = $(ajaxButton).replaceWith(cartajaxspinner);
}

function ajaxUnblock() {
	$.each(ajaxBlockedTmp, function(intIndex, objValue) {
		$('.ajax-spinner').replaceWith(objValue);
	});
}

function expireCart() {
	var rdi_cart_date = new Date();
	rdi_cart_date.setTime(rdi_cart_date.getTime()+(-7*24*60*60*1000));
	var rdi_cart_expires = "; expires="+rdi_cart_date.toGMTString();
	document.cookie = "MyCricketCartID="+rdi_cart_expires+"; path=/; domain=.mycricket.com";
	document.cookie = "data="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopPhonesNav="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopPlansNav="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopBroadbandNav="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopBroadbandPlansNav="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopFamilyPlansNav="+rdi_cart_expires+"; path=/";
	document.cookie = "ShopAccessoriesNav="+rdi_cart_expires+"; path=/";
}





/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/flashdetect.js */
// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;

// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];

			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
}

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/swfobject.js */
/**
 * SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept={};}if(typeof deconcept.util=="undefined"){deconcept.util={};}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil={};}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10]||"";},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=[];var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<!-- this comment needs to be here - IE6 div height fix --><embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<!-- this comment needs to be here - IE6 div height fix --><object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/processflow.js */
var ProcessFlow = {

  init : function(nav, callback)
  {
	var data;
    var cookieName = nav;
    var path = window.location.pathname.replace('/dev.php', '');

    // If a phone purchase is already in progress
    if(nav=='ShopPlansNav' || nav=='ShopBroadbandPlansNav')
    {
      if(path.match(/^\/broadband\/plans/gi))
      {
        data = $.cookie('ShopBroadbandNav');

        cookieName = 'ShopBroadbandNav';
      }
      else
      {
        data = $.cookie('ShopPhonesNav');

        cookieName = 'ShopPhonesNav';
      }
    }
    else if(nav=='ShopAccessoriesNav')
    {
      if(path.match(/^\/cell-phone-accessories\/datacard/gi))
      {
        data = $.cookie('ShopBroadbandNav');

        cookieName = 'ShopBroadbandNav';
      }
      else
      {
        data = $.cookie('ShopPhonesNav');

        cookieName = 'ShopPhonesNav';
      }
    }
    else
    {
      data = $.cookie(nav);
    }

		if(reloadCartData || !data)
		{
  		$.ajax(
  			{
  				type: 'POST',
  				url: envController + 'cart/getDefaultBuyFlowConfig/' + nav,
  				success: function (data) {
  				  if(data)
  				  {
    				  eval('data=' + data);
    					ProcessFlow.build(cookieName, data);
  				  } else {
  					$('#processflow').css({'min-height':'0','height':'auto'});
  				  }

        		if(callback) {
        		  callback(data);
        		}
  				},
  				error: function(request, status, errorThrown) {
  					console.debug(status + ' ' + '/cart/getDefaultBuyFlowConfig');
  				}
  			}
  		);
		}
		else
		{
		  eval('data=' + data);

		  ProcessFlow.build(cookieName, data);

  		if(callback) {
  		  callback(data);
  		}
		}
  },

  build : function(cookieName, data) {
    $('#processflow').css('width', data.width + 'px');

    var html = '<ul>';

     for(i=0; i<data.steps.length; i++)
     {
       var className = '';

       var href = 'javascript:;';

       // Step is selected
       if(ProcessFlow.isSelected(data.steps[i]))
       {
         if(i===0)
         {
           className += 'pf-left-selected';
         }
         else if(i==data.steps.length-1)
         {
           className = 'pf-right-selected';
         }

         className += ' pf-selected';
       }
       // Step is the first
       else if(i===0)
       {
         className = 'pf-left';
       }
       // Step is the last
       else if(i==data.steps.length-1)
       {
         className = ' pf-right';
       }

       if(data.steps[i]['isclickable'])
       {
         className = 'pf-link ' + className;

         href = data.steps[i]['link'];
       }

       if(data.steps[i]['checked']==true && ProcessFlow.isSelected(data.steps[i]))
       {
        className += ' pf-checked-selected';
     	 }

       if(data.steps[i]['checked']==true)
       {
         className += ' pf-checked';
       }

       if(className) {
       	className=' class="' + className + '"';
       }

       html += '<li' + className + ' id="' + data.steps[i]['id']  + '">';

       html += '<a href="' + href + '" name="&amp;lid&#61;'+(escape(data.steps[i]['title']))+'"><img src="/images/spacer.gif" title="' + data.steps[i]['title'] + '" alt="" /></a>';

       html += '<div class="pf-arrow"><img src="/images/processflow/processflow_arrow.png" class="PNG24" alt="" /></div>';

       html += '</li>';

       if(data.steps[i]['id']=='pf-accessories' && data.steps[i]['checked']=='trigger')
       {
         data.steps[i]['checked'] = true;

         data.width += 49;

         $.cookie(cookieName, $.toJSON(data), { path: '/' });
       }
     }

     html += '</ul>';

     $('#processflow').append(html);
  },

  isSelected : function(data)
  {
    var path = window.location.pathname.replace('/dev.php', '');

    if(data['id']=='pf-phone')
    {
      if(path.match(/^\/cell-phones/gi)) return true;

      return false;
    }

    if(data['id']=='pf-accessories')
    {
      if(path.match(/^\/cell-phone-accessories/gi)) return true;

      return false;
    }

    if(data['id']=='pf-plan')
    {
      if(path.match(/^\/cell-phone-plans/gi)) return true;
      if(path.match(/^\/broadband\/plans/gi)) return true;

      return false;
    }

    if(data['id']=='pf-modem')
    {
      if(path.match(/^\/broadband\/devices/gi)) return true;
      if(path.match(/^\/broadband\/datacard\//gi)) return true;

      return false;
    }

    if(data['id']=='pf-selectnumlines')
    {
      if(path.match(/^\/cell-phone-plans\/family-plans/gi)) return true;

      return false;
    }

    if(data['id']=='pf-buildfamplan')
    {
      if(path.match(/^\/family-cell-phone-plans\/build/gi)) return true;

      return false;
    }
  }
};

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/jquery/jquery.cookie.js */
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

/* COMBINED: /var/www/mycricket.com/mycricket_com/web/js/motionpoint.js */
MP = {
// mp_trans_disable_start 
    Version: '1.0.14',
    Domains: {'es':'espanol.mycricket.com'},		
	SrcLang: 'en',
// mp_trans_disable_end 
	UrlLang: 'mp_js_current_lang',
	SrcUrl: unescape('mp_js_orgin_url'),
// mp_trans_disable_start 	
	init: function() {
	   if (MP.UrlLang.length!=2) {
	       MP.UrlLang = MP.SrcLang;
	   }
	   if (MP.SrcUrl.indexOf('p_js_orgin_url')==1) {
	       MP.SrcUrl = location.href;
	   }
	},
    switchLanguage: function(lang) {
		if (lang!=MP.SrcLang) {
            var script = document.createElement('SCRIPT');
            script.src = location.protocol+'//'+MP.Domains[lang]+'/en'+lang+'/?1023749632;'+escape(MP.SrcUrl);
            document.body.appendChild(script);
        } else if (lang==MP.SrcLang) {
		    MP.switchToLang(MP.SrcUrl);		
		}
		return false;
    },
	switchToLang: function(url) {
        var mplink=document.createElement('A');
		if (mplink.click) { // using location.href will cause IE6 to not report referrer
		    mplink.href=url;
            document.body.appendChild(mplink);
            mplink.click();
		} else {
		    location.href=url; 
		}
	}
// mp_trans_disable_end
};	
function switchLanguage(lang) {
    MP.SrcUrl=unescape('mp_js_orgin_url');MP.UrlLang='mp_js_current_lang';MP.init();
	MP.switchLanguage(MP.UrlLang==lang?'en':lang);
	return false;
}


