﻿var characterSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";

function pageLoad() {
	$('.CanHover').hover(
		function () {
			$(this).addClass('Hover');
		},
		function () {
			$(this).removeClass('Hover');
		});

	$('.StandardText.HoverText, p.HoverText').hover(
		function () {
			$(this).stop().animate({ color: 'White' }, 300);
		},
		function () {
			$(this).stop().animate({ color: '#ccc' }, 300);
		});
	$('.DimText.HoverText').hover(
		function () {
			$(this).stop().animate({ color: 'White' }, 300);
		},
		function () {
			$(this).stop().animate({ color: '#787878' }, 300);
		});
}

function fadeIn(elementId, duration) {
	$('#' + elementId).stop().fadeTo(duration, 1);
}

function fadeOut(elementId, duration) {
	$('#' + elementId).stop().fadeTo(duration, 0)
}

function addPageLoadCallback(callback, forceInit) {
	if (!forceInit && typeof page_isPreloading != 'undefined' && page_isPreloading) {
		page_preloadCallbacks[page_preloadCallbacks.length] = callback;
	}
	else Sys.Application.add_init(callback);
}

(function ($) {
	$.fn.customFadeIn = function (speed, callback) {
		$(this).fadeIn(speed, function () {
			if (!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if (callback != undefined)
				callback();
		});
	};
	$.fn.customFadeOut = function (speed, callback) {
		$(this).fadeOut(speed, function () {
			if (!$.support.opacity)
				$(this).get(0).style.removeAttribute('filter');
			if (callback != undefined)
				callback();
		});
	};
	$.fn.customFadeTo = function (speed, to, callback) {
		return this.animate({ opacity: to }, speed, function () {
			if (to == 1 && jQuery.browser.msie)
				this.style.removeAttribute('filter');
			if (jQuery.isFunction(callback))
				callback();
		});
	};
})(jQuery);

function setCharAt(str,index,chr) {
	if(index > str.length-1) return str;
	return str.substr(0,index) + chr + str.substr(index+1);
}
