﻿/*
* TimeTravel Explorer xJavascript
* -------------------------------
* J Barr
* -------------------------------
* Core functionality
* rev 0.98.1
* 24.03.2010 
* -------------------------------
*/

// init
$(document).ready(function() {

});

// Call asp.net HttpHandler to process ajax requests
function ajaxRequest(service, obj, callback) {
    $.ajax({
        type: "POST",
        url: "/x." + service + ".ashx",
        cache: false,
        async: false,
        data: obj,
        dataType: "json",
        success: function(output) {
            callback(output);
        },
        error: function(xmlhr, status, err) {
            console.error(err);
            var response = eval("(" + xmlhr.responseText + ")");
            console.log(response);
        }
    });
}

function redirectinator() {
    window.location.href = docUrl;
}
        
// Window popoup
popitup = function(url, width, height) {
    newwindow=window.open(url,"name","height=" + height + ",width=" + width + ",menubar=yes,resizable=yes,scrollbars=yes");
	if (window.focus) {
	    newwindow.focus();
	}
	return false;
}

// load flv video
function loadVideo(id, video) {
   var width = $("#" + id).width(); 
   var height = $("#" + id).height(); 
   var params = {
      }; 
   var flashvars = {
      }; 
   var attributes = {
      }; 
   params.menu = "false"; 
   params.quality = "high"; 
   params.bgcolor = "#000000"; 
   params.allowFullScreen = "true"; 
   attributes.id = id; 
   attributes.name = id; 
   flashvars.movie = video; 
   
   //'movie=video.flv&fgcolor=0×006AC3&bgcolor=0×000000&volume=70′
   swfobject.embedSWF("/swf/player.swf", id, width, height, "9.0.0", false, flashvars, params, attributes); 
}

// load flv video
function loadAudio(id, video) {
   var width = $("#" + id).width(); 
   var height = $("#" + id).height(); 
   var params = {
      }; 
   var flashvars = {
      }; 
   var attributes = {
      }; 
   params.menu = "false"; 
   params.quality = "high"; 
   params.bgcolor = "#000000"; 
   params.allowFullScreen = "true"; 
   attributes.id = id; 
   attributes.name = id; 
   flashvars.movie = video; 
   
   //'movie=video.flv&fgcolor=0×006AC3&bgcolor=0×000000&volume=70′
   swfobject.embedSWF("/swf/player.swf", id, width, height, "9.0.0", false, flashvars, params, attributes); 
}
