
flashvars.xmlPath = 'xml/';
flashvars.imgPath = 'pix/';
flashvars.flvPath = 'flv/';
flashvars.cssPath = 'css/';
flashvars.swfPath = 'swf/';
flashvars.waEnv = '';
flashvars.waRS = '';
flashvars.waOrg1 = '';
flashvars.waPagename = '';

var flashMovie = function() {
	var params = {
		scale: "noscale",
		allowFullScreen: "true",
		menu: "false",
		wmode: "opaque"
	};
	var attributes = {id: "intel_sot_movie"};
	swfobject.embedSWF("swf/intel_sot_main.swf", "flashContent", "100%", "100%", "9", null, flashvars, params, attributes);
	swffit.fit("intel_sot_movie", 960, 608);
}

var showTermsYOT = function() {
	window.open("terms_yot.html","terms","status=0,toolbar=0,menubar=0,width=600,height=600,scrollbars=1");
}

var overlay_timeout = 0;

var smOver = function() {
	clearTimeout(overlay_timeout);
}

var smOut = function() {
	overlay_timeout = setTimeout(function() { showSocialMedia(null, "hide"); }, 100);
}

// showAddThis() is a proxy function for showSocialMedia() - kept in to prevent the need to change calls from flash
var currentShareLink = baseUrl;

var showAddThis = function(link, background, action) {
	if(background == true) {
		document.getElementById('social-media-bg').style.display = 'block';
	} else {
		document.getElementById('social-media-bg').style.display = 'none';
	}
	if(shareLinkFunctionality != 'standard') return false;
	if(!link) link = '';
	if(!action) action = 'show';
	
	showSocialMedia(link, action);
}

var clickAddThis = function() {
	if(shareLinkFunctionality != 'email') return false;
	document.getElementById('intel_sot_movie').trackShareLink("email");
	emailFriend('en_US');
}

var showSocialMedia = function(link, action) {
	if(action == 'show') {
	
		if(!link) {
			link = baseUrl;
		} else {
			if(shareLinks[link]) {
				link = shareLinks[link];
			} else {
				link = baseUrl;
			}
		}
	
	} else {
		link = currentShareLink;
	}
	currentShareLink = link;

	if(!action) action = 'show';
	var overlay = document.getElementById("social-media");
	overlay.style.display = (action == "hide" || overlay.style.display == "block" ? "none" : "block");
	clearTimeout(overlay_timeout);
}

var share_link = function(service) {
	var url = currentShareLink;
	
	var title = document.title;
	switch (service) {
		case "email":
			document.getElementById('intel_sot_movie').trackShareLink("email");
			emailFriend('en_US');
			break;
		case "digg":
			document.getElementById('intel_sot_movie').trackShareLink("digg");
			window.open("http://digg.com/submit?phase=2&amp;url=" + url + "&amp;title=" + title, "digg");
			break;
		case "delicious":
			document.getElementById('intel_sot_movie').trackShareLink("delicious");
			window.open("http://delicious.com/post?url=" + url + "&amp;title=" + title, "delicious");
			break;
		case "stumbleupon":
			document.getElementById('intel_sot_movie').trackShareLink("stumbleupon");
			window.open("http://www.stumbleupon.com/submit?url=" + url + "&amp;title=" + title, "stumbleupon");
			break;
	}
	return false;
}

var toggle_bandwidth = function (section, bandwidth)
{
	if (bandwidth == 1)
	{
		section = section + '_lo';
	}
	window.location = shareLinks[section];
}

var trace = function(msg) { try{ console.log(msg); console.log(typeof msg) } catch(e) {} }

