﻿// JavaScript Document

function HandleUnload() {}

$(function() {
	
	
	
	$(".outertitle").each(function() {
								   
		var outerText = $(this).parent().find("strong").text()
		this.title =  outerText + " - " + $(this).text()
								   
								   
	})
	
	
	$(".logclick").click(function(event) {
		
	
		
		event.preventDefault()
		
		var data = new Object()
		data.activity_title = this.title ? this.title : $(this).text()
		data.activity_type = $(this).is(".external") ? "external_link" : "download"
		if($(this).is(".locked")) {data.activity_type+="_locked"}
		
		data.request_path = this.href
		data.activity_info = location.href
		
		var aTag = this
		if(aTag.target=="_blank") {
			var newWin = window.open()
		}
		
		
		var callback = function (data, textStatus) {
			
			if(aTag.target=="_blank") {
				
				newWin.location.href=aTag.href	
				newWin.focus()
			}
			
			else {location.href=aTag.href}
			
		}
		
		$.post("/services/log_activity.shtml",data,callback)
								  
								  
	})


	

	$(".survey-launcher").css("cursor","pointer").click(function(event) {
		
		
		event.preventDefault()
		
		launchSurvey()
		
		
	})
	
		   
})


function launchSurvey() {
	
	
	var hasProductInstall = DetectFlashVer(6, 0, 65);

	// Version check based upon the values defined in globals
	var hasRequestedVersion = DetectFlashVer(9, 0, 0);
	
	
	if(hasProductInstall) {
		tb_show(null,"/flex/survey.html?TB_iframe=true&height=483&width=630&modal=true")
	}
	
	else {
		if(confirm("Flash Player 9 is required to run this survey. Would you like to download this now?")) {
			
			var win = window.open("http://www.adobe.com/go/getflash/")
			
		}
	}	
	
	
}