//////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// PLACE SWF /////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

	function placeWebsite(container, swf, id, width, height, version, color) {
		var fo = new FlashObject(swf, id, "100%", "100%", version, color, true);
		fo.addParam("menu","false");
		fo.useExpressInstall('include/expressinstall.swf');
		
	
		// get language
		var i = window.location.href.indexOf("?lang=");
		var langUrl = window.location.href.substr((i+6),1);
		if(langUrl==0 || langUrl==1) { 
			fo.addVariable("lang",langUrl); 
			
			// open a specific page?
			var j = window.location.href.indexOf("&page=");
			var openPage = window.location.href.substr((j+6),1);
			if(openPage>0) { fo.addVariable("page",openPage); }
			
		} 
		else {
			// get cookie
			var langCookie = GetCookie ("LeFish");
			if(langCookie==0 || langCookie==1) { fo.addVariable("lang",langCookie); }
		}

		
		

		
		fo.write(container);
	}
	
	
	
//////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// UPDATE PAGE TITLE /////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

	function swfID_DoFSCommand(command, args) {
		// Change pagetitle
		if (command == "changeTitle") { document.title = "[[ Le Fish ]] "+args; }
		// Write cookie
		if(command == "writeCookie") { WriteCookie("LeFish",args); }
	}


//////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////// GET/SET COOKIE ////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////

	// get cookie
	function GetCookie (name) {
		var arg = name + "=";
		var alen = arg.length;
		var clen = document.cookie.length;
		var i = 0;
		while (i < clen) {
			var j = i + alen;
			if (document.cookie.substring(i, j) == arg) return getCookieVal (j);
			i = document.cookie.indexOf(" ", i) + 1;
			if (i == 0) break;
		}
		return null;
	}

	// get cookie value
	function getCookieVal (offset) {
		var endstr = document.cookie.indexOf (";", offset);
		if (endstr == -1) endstr = document.cookie.length;
		return unescape(document.cookie.substring(offset, endstr));
	}	
		
	// write cookie	
	function WriteCookie(name, value) {
		var nowDate = new Date();
		var expdate = new Date();
		expdate.setTime (expdate.getTime() + 90*(24 * 60 * 60 * 1000)); // 90 days from now
		document.cookie = name + "=" + value + "; expires=" + expdate.toGMTString();
	}

		





