﻿var host = document.location.host;
var prot = (("https:" == document.location.protocol) ? "https://" : "http://");
var isLocalHost = (document.location.hostname.toLowerCase() == 'localhost');

$(document).ready(

		function() {

            /*Attaches Watermarks*/
            $.ris2Watermark.attachAll();

		    /*initialize scrollable*/
		    $("div.scrollable").scrollable({
		        size: 1,
		        items: '#thumbs',
		        hoverClass: 'hover',
		        loop: 'true',
		        easing: 'swing'
		        }).autoscroll(5000);
		    }
		);

		function pageLoad() {
            //$.ris2Watermark.attachAll();
		}

		function CallPageMethod(methodName, onSuccess, onFail) {
            
            if (isLocalHost) {
                host = host + "/blacktie.org";
            }

			var args = '';
			var l = arguments.length;
			if (l > 3) {
			    for (var i = 3; i < l - 1; i += 2) {
			        if (args.length != 0) args += ',';
			        args += '"' + arguments[i] + '":"' + arguments[i + 1] + '"';
			    }
			}

			$.ajax({
				type: "POST",
				url: prot + host + "/WebMethods.aspx/" + methodName,
				data: "{" + args + "}",
				contentType: "application/json; charset=utf-8",
				dataType: "json",
				cache: false,
				success: onSuccess,
				fail: onFail
			});
		}