// JavaScript Document
jQuery.noConflict();


/*$(document).ready(
	function(){
		$("#navi .fl").mouseover(function(){
			$("ul li:eq(0)", this).show("fast", function(){
				$(this).next().show("fast", arguments.callee);				
			});				
		});
	});
*/


var cookie_id  = 'xspfplayer';

var XSPF_Player =
{
	init: function(cookie_id)
	{
		this.cookie_id  		= cookie_id;
		this.flash_cookie_ready = false;
		this.flash_cookie_able  = false;
		this.flash_cookie  		= null;
		this.flash_alert  		= false;
		
		this.flash_is_ready();
		
		config = getSsipCrumbs();

		this.flash_cookie.f_playTrackJS(config[0],config[1],config[2],config[3]);
		
	},

	flash_is_ready: function()
	{
		if(!document.getElementById || !document.getElementById(this.cookie_id)) return;
		if(!this.get_movie(this.cookie_id)) return;

		this.flash_cookie_ready = true;
	},

	get: function()
	{
		var ret = this.flash_cookie.f_getPlayTime();
		document.cookie="playerconfig="+ret+"; path=/new/;";
		//return ((ret == 'null') ? '' : ret);
	},

	get_movie: function()
	{
    	if (navigator.appName.indexOf("Microsoft") != -1)
    	{
    		this.flash_cookie = window[this.cookie_id];
    	}
    	else
    	{
    		this.flash_cookie =  document[this.cookie_id];
    	}

    	return ((this.flash_cookie) ? true : false);
	}

};


function flash_ready()
{
	XSPF_Player.init(cookie_id);
}


/* cookie stuff*/
var cookiedomain= "www.dropin-shop.ch";
var cookiepath  = "/new/";
	
document.cookie = "domain="+cookiedomain+";";
document.cookie = "path="+cookiepath+";";

	function getSsipCrumbs(){

		ssipConfig = false;
		cookieArray = document.cookie.split(";");
		
		for(c=0;c<cookieArray.length;c++){
			cookiePair     = cookieArray[c].split("=");
			cookiePair[0]  = cookiePair[0].replace(/\s/g,"");
			if(cookiePair[0]=="playerconfig"){
				ssipConfig =  cookiePair[1];
			}
 		}

		if(ssipConfig){
			ssipCrumbsArray = ssipConfig.split(",");
			/*ssipCrumbs      = new Array();
			for(c=0;c<ssipCrumbsArray.length-1;c++){
				ssipConfigPair = ssipCrumbsArray[c].split(":");
				ssipCrumbs[c] = new Object();
				ssipCrumbs[c]["name"]=ssipConfigPair[0];
				ssipCrumbs[c]["value"]=ssipConfigPair[1];
			}
			*/
			return ssipCrumbsArray;
		}else{
			return false;	
		}
		
	}


jQuery(window).unload (
	function(){
		XSPF_Player.get();
	}
);

