﻿$(document).ready(function () {
	//var ss_Protocol = (("https:" == document.location.protocol) ? "https://" : "http://");
	var ss_Protocol = "http://";
	var ss_src = $('script[src$="embed.js"]').attr("src");
	var ss_src_start = ss_src.indexOf("://", 0) + 3;
	var ss_src_end = ss_src.indexOf("/", ss_src_start);
	var ss_Host = ss_src.substring(ss_src_start, ss_src_end);

	// ColorBox Style
	var ss_ColorBoxStyle = document.createElement('link');
	ss_ColorBoxStyle.href = ss_Protocol + ss_Host + "/Content/ColorBox/Square-White/colorbox.css";
	ss_ColorBoxStyle.type = "text/css";
	ss_ColorBoxStyle.rel = "stylesheet";
	ss_ColorBoxStyle.id = "ColorBoxStyle";

	// Add elements to the document head
	var ss_Head = document.getElementsByTagName("head").item(0);
	ss_Head.appendChild(ss_ColorBoxStyle);

	// Load other scripts and proceed
	$.getScript(ss_Protocol + ss_Host + "/Scripts/jquery.jqURL.js", function () {
		$.getScript(ss_Protocol + ss_Host + "/Content/ColorBox/jquery.colorbox-min.js", function () {
			$("a.sore-score").each(function () {
				var $a = $(this);
				$(this).colorbox({
					iframe: true,
					href: ss_Protocol + ss_Host + "/SoreScore/Locations",
					initialWidth: 100,
					initialHeight: 100,
					innerWidth: "850",
					innerHeight: "551",
					scrolling: false,
					opacity: 0.5,
					overlayClose: true
				});
			});

			if ($.jqURL.get('autostart') != undefined) {
				$("a.sore-score:first").click();
			}
		});
	});
});

