document.write('<scr' + 'ipt language="javascript" src="' + resume_domain + '/js/media_player_detection.js" type="text/javascript"\>' + '</scr' + 'ipt\>');
document.write('<scr' + 'ipt language="javascript" src="' + resume_domain + '/js/base64.js" type="text/javascript"\>' + '</scr' + 'ipt\>');

var customLogo = "";
var customLogoText = "";
var clientName = "";
var customLogoText_html = "";

window.onload = function() {
	if (typeof defaultPhoto != "undefined") {
		resume.displayPhoto(defaultPhoto, 'thumb');
	} else {
		resume.displayPhoto(null, 'thumb');
	}
	
	quicktimeVersion = getQuicktimeVersion();
	
	// Major version of Flash required
	var requiredMajorVersion = 8;
	// Minor version of Flash required
	var requiredMinorVersion = 0;
	// Minor version of Flash required
	var requiredRevision = 0;
	
	flashInstalled = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	customLogo = document.getElementById("clientLogo");
	customLogoText = document.getElementById("clientLogoText");
	clientName = document.getElementById("clientName");
	customLogoText_html = customLogoText.innerHTML;
	resume.setCustomLogo();
	
}

var resume = new Object;

resume.setCustomLogo = function() {
	customLogoText.innerHTML = customLogoText_html;
	
	for (var i in template.branding) {
		clientName.style[i] = template.branding[i];
	}
	
	for (var i in template.logo) {
		customLogo.style[i] = template.logo[i];
	}
	
	for (var i in template.logoText) {
		customLogoText.style[i] = template.logoText[i];
	}
	
	if (template.customLogo != null) {
		customLogoText.innerHTML = "<img src=\"" + resume_domain + template.customLogo + "\" id=\"customLogo_image\" />";
	}
	
	for (var i in template.customLogoStyle) {
		document.getElementById("customLogo_image").style[i] = template.customLogoStyle[i];
	}
}

resume.print = function() {
	window.print();
}

resume.openTab = function(tab) {
	var photoList = new Object;
		photoList["element_id"] = document.getElementById("photoList");
		photoList["tab_id"] = document.getElementById("photo");
		photoList["off"] = function() {
			photoList.element_id.style.display = "none";
			photoList.tab_id.className = "tabNav";
		}
		photoList["on"] = function() {
			photoList.element_id.style.display = "inline";
			photoList.tab_id.className = "tabNav up";
		}
		
	var vidList = new Object;
		vidList["element_id"] = document.getElementById("vidList");
		vidList["tab_id"] = document.getElementById("vid");
		vidList["off"] = function() {
			vidList.element_id.style.display = "none";
			vidList.tab_id.className = "tabNav";
		}
		vidList["on"] = function() {
			vidList.element_id.style.display = "inline";
			vidList.tab_id.className = "tabNav up";
		}
		
	if (tab == 'photo') {
		vidList.off();
		photoList.on();
		resume.displayPhoto(null, 'thumb');
	} else if (tab == 'vid') {
		photoList.off();
		vidList.on();
	}
}

var lastPhotoID = null;
resume.displayPhoto = function(id, type) {
	thumb = document.getElementById("actorPhoto");
	if (document.getElementById("actorMediaPreview_photo")) {
		document.getElementById("actorMediaPreview_photo").style.display = "inline";
		
		if (id == null) {
			id = lastPhotoID;
		}
		
		if (id != null) {
			thumb.src = Base64.decode(photos[id].thumb);
			
			if (photos[id].print != null) {
				thumb.onclick = function() {resume.displayPhoto(null,'print')};
				thumb.style.cursor = "pointer";
			} else {
				thumb.style.cursor = "default";
			}
			
			if(type == 'print' && photos[id].print != null) {
				window.open(Base64.decode(photos[id].print), "printPhoto_" + id, "status=0,toolbar=0,location=0,menubar=1,height=720,width=520,scrollbars=no");
			}
			
			lastPhotoID = id;
		}
	}
}

var videoPopupUrl = "/video_popup.html";

resume.playVideo = function(id) {
	launchVideo = false;	
	if (videos[id].type == "Quicktime") {
		
		if (quicktimeVersion > 0) {
			//playSpace.innerHTML = QT_NewOBJECT(Base64.decode(videos[id].src), "320", "256", "","autoplay","true");
			//document.getElementById("actorMediaPreview_photo").style.display = "none"
			//playSpace.style.display = "inline";
			launchVideo = true;
		} else {
			alert("In order to play this video you must have the latest version of Apple QuickTime installed.");
			window.open("http://www.apple.com/quicktime/download/", "getQuicktime", "status=1,toolbar=1,location=1,menubar=1,height=600,width=760,scrollbars=yes");
		}
	} else if (videos[id].type == "FlashPlayer" ) {
		
		if (flashInstalled) {
			//playSpace.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="320" height="255" id="rabs" align="middle"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="/gui/vaplayer.swf" /><param name="quality" value="high" /><param name="allowFullScreen" value="true" /><param name="FLASHVARS" value="video=' + Base64.decode(videos[id].src) + '" /><param name="bgcolor" value="#ffffff" /><embed src="/gui/vaplayer.swf" quality="high" bgcolor="#000000" width="320" height="255" name="rabs" allowFullScreen="true" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" FLASHVARS="video=' + Base64.decode(videos[id].src) + '" /></object>';
			//document.getElementById("actorMediaPreview_photo").style.display = "none"
			//playSpace.style.display = "inline";
			launchVideo = true;
		} else {
			alert("In order to play this video you must have the latest version of Adobe Flash installed.");
			window.open("http://get.adobe.com/flashplayer/", "getFlashPlayer", "status=1,toolbar=1,location=1,menubar=1,height=600,width=760,scrollbars=yes");
		}
	}
	
	if (launchVideo) {
		window.open(videoPopupUrl + '?id=' + id, "video_popup_" + id, "status=0,toolbar=0,location=0,menubar=0,height=300,width=350,scrollbars=no");
	}
}


