﻿

 function initPlayer(){
	

	var player = $("#tourPlayer");
	
	var delayPanelID;
	var hideDuration=1; // in seconds
    CIDimmer.init({
        object: "tourPlayer"
    });
	
	$("#icon_wmv a").click(function(){
		CITools.track('clicks.wmv');
		//$("#flashplayer").hide();
		//$("#wmvplayer").show();
		//return false;
	});
	
	$("#icon_flash a").click(function(){
		CITools.track('clicks.flv');
		//$("#wmvplayer").hide();
		//$("#flashplayer").show();
		//return false;
	});
    
    $("#icon_fullscreen a").click(function(){
		return false;
    });
    
    $("#icon_lights a").click(function(){
		CITools.track('clicks.lights');
        CIDimmer.toggle();
        return false;
    });
	$("a","#icon_download,#icon_quicktime,#icon_mpeg").click(function(){
		var event=$(this).parent("li").attr("id").split("_")[1];
		CITools.track("clicks."+event);
		
	});
	$(".panel ul a").hover(function(){
		
		$(this).parent().addClass("over");

       
        
    }, function(){
        $(this).parent().removeClass("over");
    })
	
	
    player.hover(function(){
		clearTimeout(delayPanelID);
        $(".panel ul", this).fadeIn();
    }, function(){
		var obj= $(".panel ul", this);
		delayPanelID=setTimeout(function(){			
			obj.fadeOut();
		},hideDuration*1000);
    });
		
	/*delayPanelID=setTimeout(function(){		
		
			$(".panel ul",  player).fadeOut();
			
		},hideDuration*1000);*/
    

}
var ff={
	
	is:function(){
		return (navigator.plugins && navigator.plugins.length)?true:false;
	},
	has:function(plugin){
		var has=false;
		
		for(var idx in navigator.plugins){
			if(navigator.plugins[idx].description && navigator.plugins[idx].description==plugin){
				has=true;
				break;
			}
		}
		return has;
	}
	
};

var __TRACKING_URL__="";

/**
*  Acceptable Tracking
*	All tracking will be in dot notation where the first is the user action follow by the area,
* 	for instance clicks.fullscreen, indicates that the user clicked on the fullscreen button/action ($_POST['action'])
*	This will be passed to your tracking script also including the context which includes useragent,server url,title and other idenfiers
*	this will be found in the $_POST['context']
**/

var CITools = {
    goFullscreen: function(playerID){
        var player = document.getElementById(playerID);
        if (player) {
        
            player.jsAction("enterFullScreen");
            
            
        }
        
    },
    dontSubscribe: function(){
        return true;
    },
	track:function(action,obj){
		var params={};
		params['context[referrer]'] = document.referrer.toString();
		params['context[title]'] = document.title.toString();
		params['context[server_url]'] = document.location.toString();					
		params['context[ua]'] = navigator.userAgent;
		params['action']=action;
		//jQuery.post(__TRACKING_URL__,params);
	}
    
};

