//----------------------------------------------------------------------------------------------------------
// Browser testen, erzeugt stBrowser (gleich wie CF Browsererkennung)
// stBrowser.bMac 		-> true, false (boolean) 
// stBrowser.sVersion	-> Versionsnummer (float)
// stBrowser.sBrowser	-> "NS", "IE", "SAFARI", "OPERA" (string)
// stBrowser.sType		-> "DOM", "IELAYER", "NSLAYER" (string)


function oBrowser(f_bMac,f_sVersion,f_sBrowser,f_sType) 
{
	this.bMac = f_bMac;
	this.sVersion = f_sVersion;
	this.sBrowser = f_sBrowser;
	this.sType = f_sType;
}

var bMac = false;
var sVersion = 3.0;
var sBrowser = "IE";
var sType = "IELAYER";
var http_user_agent = navigator.userAgent.toLowerCase(); 	

if (http_user_agent.indexOf("mac") != -1)
{
	bMac = true;
}

if (http_user_agent.indexOf("opera") != -1) 
{
	sBrowser = "OPERA";
	if (http_user_agent.indexOf("opera 7") != -1)		sVersion = "7";
	else if (http_user_agent.indexOf("opera 6") != -1)	sVersion = "6";
	else if (http_user_agent.indexOf("opera 5") != -1)	sVersion = "5";
	else if (http_user_agent.indexOf("opera 4") != -1)	sVersion = "4";
	else if (http_user_agent.indexOf("opera 3") != -1)	sVersion = "3";
	else sVersion = "2";	
		
}	
else if (http_user_agent.indexOf("msie") != -1 && http_user_agent.indexOf("compatible") != -1)
{
	sBrowser = "IE";
	if (http_user_agent.indexOf("msie 5.5") != -1)			sVersion = "5.5";
	else if (http_user_agent.indexOf("msie 5.2") != -1)		sVersion = "5.2";
	else if (http_user_agent.indexOf("msie 5") != -1)		sVersion = "5";
	else if (http_user_agent.indexOf("msie 6") != -1)		sVersion = "6";
	else sVersion = "4";
}
else if (http_user_agent.indexOf("applewebkit") != -1 && http_user_agent.indexOf("safari") != -1)
{
	sBrowser = "SAFARI";
	sVersion = "1";
}	
else if (http_user_agent.indexOf("mozilla") != -1)
{
	sBrowser = "NS";
	if (http_user_agent.indexOf("mozilla/5") != -1)			sVersion = "5";
	else if (http_user_agent.indexOf("mozilla/4") != -1)	sVersion = "4";
	else if (http_user_agent.indexOf("mozilla/3") != -1)	sVersion = "3";
}	

if ((sBrowser == "IE" && sVersion >= 5 && !bMac) ||
	(sBrowser == "IE" && sVersion >= 5.2 && bMac) ||
	(sBrowser == "NS" && sVersion >= 5) || 
	(sBrowser == "OPERA" && sVersion >= 7) || 
	(sBrowser == "SAFARI" && sVersion >= 1))
{
	sType = "DOM";
}
else if (sBrowser == "NS" && sVersion == 4)
{
	sType = "NSLAYER";
}
else if ((sBrowser == "IE" && sVersion == 4) || (bMac && sBrowser == "IE" && sVersion <= 5))
{
	sType = "IELAYER";
}
else
{
	sType = "OLD";
}	

stBrowser = new oBrowser(bMac,sVersion,sBrowser,sType);

//--------------------------------------------------
function getObject(f_sObject)
{
	if (stBrowser.sType == "DOM")
	{
		return document.getElementById(f_sObject);
	}
	else
	{
		return eval("document.all." + f_sObject);
	}
}

function noCache()
{
	return "uNC=" + parseInt(Math.random()*10000000);

}

/* win_open(where,x,y)*/
function winOpen(f_sWhere)
{
	if (arguments.length > 1)
	{
		sWin = arguments[1];
	}
	else
	{
		sWin = 1;
	}
	
	if (arguments.length <= 2)
	{
		iX = 700;
		iY = 550;
	}
	else
	{
		iX = arguments[2];
		iY = arguments[3];
	}
	
	win = window.open(f_sWhere,"Object"+sWin,"resizable=yes,status=0,scrollbars=1,width="+iX+",height="+iY);
	win.focus();
}

function getCheckedValue(f_objRadio)
{

	for (i = 0; i < f_objRadio.length; i++) 
	{
		if (f_objRadio[i].checked == true) 
		{
			return f_objRadio[i].value
		}
	}	

	return -1;
}


function showLayer(f_sObject)
{

	obj = getObject(f_sObject);
	if (obj.style.visibility == "hidden")
	{
		obj.style.visibility = "visible";
	}
	else
	{
		obj.style.visibility = "hidden";
	}
}

function minusSize()
{
	for(i=0; i < 2; i++)
	{
		if(stBrowser.sBrowser == "IE")
		{
			oCSS = document.styleSheets[i].rules;
		}
		else
		{
			oCSS = document.styleSheets[i].cssRules;
		}
		
		for(j=0; j < oCSS.length; j++)
		{
			if (oCSS[j].style.fontSize != "")
			{
				oCSS[j].style.fontSize = parseInt(oCSS[j].style.fontSize) - 2;		
			}
		}
	}	
}

function plusSize()
{
	for(i=0; i < 2; i++)
	{
		if(stBrowser.sBrowser == "IE")
		{
			oCSS = document.styleSheets[i].rules;
		}
		else
		{
			oCSS = document.styleSheets[i].cssRules;
		}
		
		for(j=0; j < oCSS.length; j++)
		{
			if (oCSS[j].style.fontSize != "")
			{
				oCSS[j].style.fontSize = parseInt(oCSS[j].style.fontSize) + 2;		
			}
		}
	}
}
/*
function sendlink(iNewsID,iLangID)
{
	winOpen(rootWWW + "_global/sendlink.cfm?uNewsID="+ iNewsID + "&uLangID=" + iLangID,"sendlink",560,550);
}
*/
function sendLink(f_sTitle,f_sUrl)
{
	winOpen(rootWWW + "_global/sendlink.cfm?uTitle="+f_sTitle+"&uUrl="+escape(f_sUrl),"sendlink",360,500);
}

iTimer = null;
function setLangMenu()
{
	var iWidth = 0;
	var iOffset = 0;
	
	if (arguments.length > 1)
	{
		iOffset = arguments[1];
	}
	
	obj = getObject("lang-menu");
	
	if (stBrowser.sType == "DOM")
	{
		if (stBrowser.sBrowser == "IE" && sVersion >= 5)
		{
			iWidth = document.body.clientWidth;
		}
		else
		{
			iWidth = window.innerWidth;
		}
		
		if (iWidth < 680)
		{
			obj.style.left = 0;
		}
		else
		{
			if (stBrowser.sBrowser == "NS" && stBrowser.sVersion == "5")
			{
				obj.style.left = Math.round((iWidth - 670)/2)+170-10;
			}
			else
			{
				obj.style.left = Math.round((iWidth - 670)/2)+170;
				//alert(getObject("lang-menu2").style.top);
				//getObject("lang-menu2").style.top = 14;
				getObject("lang-menu2").style.top = iOffset + 14;
			}
				
		}
		
		
	}
	iTimer = setTimeout("setLangMenu("+iOffset+")",100);
}


//--------------------------------------------------
/**
 * Application : image library
 * File        : _js/imageLibrary.js
 * @version    : 0.1
 * @author     : acn <acn@getunik.com>
 * @copyright  : copyright 05.07.2006 by http://www.getunik.com
 * 
 * Long desc:
 * Object oriented javascript function library to build a image library.
 * Take notice of the example created by acn@getunik.com.
 * 
 * Version-History:
 * 05.07.2006.getunik.acn : initial release
 * 25.08.2006.getunik.mvr : - checks now if description and caption elements are defined in html page
 * 							- if an element called 'imageLibrary#iIdx#Tooltip' exists it will be filled with description and caption
 */
 

/**
* main function to initiate a new image library object
*   - open a own data storage container, containig all informations for the image library
*
* @param  string  sImageLibraryName  the name of the image library. used to differ different image libraries od the same page.
* @param  array   aImageLibraryData  the data of the image library. format is not checked, must correspond to the example!
*/
function imageLibrary(sImageLibraryName, aImageLibraryData)
{
	if(typeof(sImageLibraryName) == 'string' && typeof(aImageLibraryData) == 'object' && sImageLibraryName != '' && aImageLibraryData.length > 0)
	{
		// save object specific data within the scope of 'this' object
		this.sImageLibraryName   = sImageLibraryName;
		this.aImageLibraryData   = aImageLibraryData;
		this.iActPos             = 0;
		this.iImageLibraryLength = aImageLibraryData.length
		this.aPrevImgs           = new Array();
		// generate preview image objects
		for(i in this.aImageLibraryData)
		{
			if(!isNaN(i))
			{
				if(this.aImageLibraryData[i]['previmgsrc'])
				{
					this.aPrevImgs[i]     = new Image();
					this.aPrevImgs[i].src = this.aImageLibraryData[i]['previmgsrc'];
				}
			}
		}
	}
	else
	{
		alert('imageLibrary.js\nError within imageLibrary():\nSubmitted data are corrupt!');
	}
}


/**
* set the visibility of the navigation buttons
*
* @param  string  sElementName  the id name of the object
* @param  array   sVisibility   the type of the new visibility status [visible|hidden]
*/
imageLibrary.prototype.setNavVisibility = function(sElementName, sVisibility)
{
	if(typeof(sElementName) == 'string' &&  typeof(sVisibility) == 'string')
	{
		if(document.getElementById(sElementName))
		{
			switch(sVisibility)
			{
				case "visible":
					document.getElementById(sElementName).style.visibility = "visible";
					break;
				case "hidden":
					document.getElementById(sElementName).style.visibility = "hidden";
					break;
				default:
					alert('imageLibrary.js\nError within setNavVisibility():\nVisibility value is wrong: \'' + sVisibility + '\'!');
					break;
			}
		}
		else
		{
			alert('imageLibrary.js\nError within setNavVisibility():\nElement id doesn\'t exist: \'' + sElementName + '\'!');
		}
	}
	else
	{
		alert('imageLibrary.js\nError within setNavVisibility():\nSubmitted data are corrupt!');	
	}
}


/**
* function to load the first object; use this as 'onload' statement
* within your html body tag, a.e.:
* <body onload="oMyImageLibrary.loadFirstObject();">
*/
imageLibrary.prototype.loadFirstObject = function()
{
	// load first image
	sImgName = this.sImageLibraryName + 'Image';
	if(document.getElementById(sImgName))
	{
		document.getElementById(sImgName).src    = this.aPrevImgs[this.iActPos].src;
		document.getElementById(sImgName).width  = this.aImageLibraryData[this.iActPos]['width'];
		document.getElementById(sImgName).height = this.aImageLibraryData[this.iActPos]['height'];
	}

	// load first description
	sDescriptionName = this.sImageLibraryName + 'Description';
	if(document.getElementById(sDescriptionName) && this.aImageLibraryData[this.iActPos]['description'] != "")
	{
		document.getElementById(sDescriptionName).firstChild.data = this.aImageLibraryData[this.iActPos]['description'];
	}
	
	// load first caption
	sCaptionName = this.sImageLibraryName + 'Caption';
	if(document.getElementById(sCaptionName) && this.aImageLibraryData[this.iActPos]['caption'] != "")
	{
		document.getElementById(sCaptionName).firstChild.data = this.aImageLibraryData[this.iActPos]['caption'];
	}
	
	// load first tooltip
	sTooltipName = this.sImageLibraryName + 'Tooltip';
	if(document.getElementById(sTooltipName))
	{
		document.getElementById(sTooltipName).firstChild.data = this.aImageLibraryData[this.iActPos]['description'] + '<br>' + this.aImageLibraryData[this.iActPos]['caption'];
	}
	
	// load e-card link text
	sLinkName = this.sImageLibraryName + 'ECard';
	if(document.getElementById(sLinkName) && this.aImageLibraryData['config']['bEcard'])
	{
		document.getElementById(sLinkName).firstChild.data = this.aImageLibraryData['config']['sEcardLinkText'];
	}
	
	// if only one (1) image is defined for the image library,
	// hide informations and navigation buttons
	if(this.iImageLibraryLength <= 1)
	{
		// hide actual position
		sActPos = this.sImageLibraryName + 'ActPos';
		this.setNavVisibility(sActPos, 'hidden');
		// just to ensure; hide the previous button
		sPrevious = this.sImageLibraryName + 'Previous';
		this.setNavVisibility(sPrevious, 'hidden');
		// just to esure; hide the next button
		sNext = this.sImageLibraryName + 'Next';
		this.setNavVisibility(sNext, 'hidden');
	}
	else
	{
		// display actual position
		sActPos = this.sImageLibraryName + 'ActPos';
		this.setNavVisibility(sActPos, 'visible');	
		sImagePos = this.sImageLibraryName + 'ImagePos';
		if(document.getElementById(sImagePos))
		{
			document.getElementById(sImagePos).firstChild.data = this.getActPosition();
		}
		// just to ensure; hide the previous button
		sPrevious = this.sImageLibraryName + 'Previous';
		this.setNavVisibility(sPrevious, 'hidden');
		// just to ensure; hide the next button
		sNext = this.sImageLibraryName + 'Next';
		this.setNavVisibility(sNext, 'visible');
	}
}


/**
* function to return the image position, a.e. '4 | 9'
*/
imageLibrary.prototype.getActPosition = function()
{
	iActPos = (this.iActPos <= 0) ? 1 : this.iActPos + 1;
	iActPos = (this.iActPos >= this.iImageLibraryLength) ? this.iImageLibraryLength : this.iActPos + 1;
	sPositionInformation = String(iActPos) + this.aImageLibraryData['config']['sActPosDelimiter'] + this.iImageLibraryLength;
	return sPositionInformation;
}


/**
* function to load the full view image of the actual object
* important notice: it use the function 'openPopUp' which is defined a.e. within 'openPopUp.js'!
*/
imageLibrary.prototype.getFullviewObject = function()
{
	if(this.aImageLibraryData[this.iActPos]['origimgsrc'] != "")
	{
		openPopUp(this.aImageLibraryData[this.iActPos]['origimgsrc'], this.aImageLibraryData['config']['PopUpWidth'], this.aImageLibraryData['config']['PopUpHeight'], this.aImageLibraryData['config']['PopUpToolbar'], this.aImageLibraryData['config']['PopUpScrollbars'], this.aImageLibraryData['config']['PopUpResizable']);
	}
}


/**
* function to turn the image library to the next object
*/
imageLibrary.prototype.getNextObject = function()
{
	if(this.iActPos < this.iImageLibraryLength - 1)
	{
		// eval the next pos
		this.iActPos = this.iActPos + 1;
		// load image
		sImgName = this.sImageLibraryName + 'Image';
		document.getElementById(sImgName).src    = this.aPrevImgs[this.iActPos].src;
		document.getElementById(sImgName).width  = this.aImageLibraryData[this.iActPos]['width'];
		document.getElementById(sImgName).height = this.aImageLibraryData[this.iActPos]['height'];
		// load description
		sDescriptionName = this.sImageLibraryName + 'Description';
		if(document.getElementById(sDescriptionName))
		{
			document.getElementById(sDescriptionName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['description']);
		}
		// load caption
		sCaptionName = this.sImageLibraryName + 'Caption';
		if(document.getElementById(sCaptionName))
		{
			document.getElementById(sCaptionName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['caption']);
		}
		// load tooltip
		sTooltipName = this.sImageLibraryName + 'Tooltip';
		if(document.getElementById(sTooltipName))
		{
			document.getElementById(sTooltipName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['description']) + '<br>' + this.removeHtml(this.aImageLibraryData[this.iActPos]['caption']);
		}
		// display actual position
		sImagePos = this.sImageLibraryName + 'ImagePos';
		document.getElementById(sImagePos).firstChild.data = this.getActPosition();
		// manage visibility
		sNext     = this.sImageLibraryName + 'Next';
		sPrevious = this.sImageLibraryName + 'Previous';
		if(this.iActPos + 1 == this.iImageLibraryLength)
		{
			this.setNavVisibility(sNext, 'hidden');
			this.setNavVisibility(sPrevious, 'visible');
		}
		else
		{
			this.setNavVisibility(sNext, 'visible');
			this.setNavVisibility(sPrevious, 'visible');
		}
	}
}


/**
* function to turn the image library to the previous object
*/
imageLibrary.prototype.getPreviousObject = function()
{
	if(this.iActPos <= this.iImageLibraryLength - 1)
	{
		// eval the next pos
		this.iActPos = this.iActPos - 1;
		if(this.iActPos < 0)
		{
			this.iActPos = 0;
		}
		// load image
		sImgName = this.sImageLibraryName + 'Image';
		document.getElementById(sImgName).src    = this.aPrevImgs[this.iActPos].src;
		document.getElementById(sImgName).width  = this.aImageLibraryData[this.iActPos]['width'];
		document.getElementById(sImgName).height = this.aImageLibraryData[this.iActPos]['height'];
		// load description
		sDescriptionName = this.sImageLibraryName + 'Description';
		if(document.getElementById(sDescriptionName))
		{
			document.getElementById(sDescriptionName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['description']);
		}
		// load caption
		sCaptionName = this.sImageLibraryName + 'Caption';
		if(document.getElementById(sCaptionName))
		{
			document.getElementById(sCaptionName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['caption']);
		}
		// load tooltip
		sTooltipName = this.sImageLibraryName + 'Tooltip';
		if(document.getElementById(sTooltipName))
		{
			document.getElementById(sTooltipName).firstChild.data = this.removeHtml(this.aImageLibraryData[this.iActPos]['description']) + '<br>' + this.removeHtml(this.aImageLibraryData[this.iActPos]['caption']);
		}
		// display actual position
		sImagePos = this.sImageLibraryName + 'ImagePos';
		document.getElementById(sImagePos).firstChild.data = this.getActPosition();
		// manage visibility
		sNext     = this.sImageLibraryName + 'Next';
		sPrevious = this.sImageLibraryName + 'Previous';
		if(this.iActPos <= 0)
		{
			this.setNavVisibility(sNext, 'visible');
			this.setNavVisibility(sPrevious, 'hidden');
		}
		else
		{
			this.setNavVisibility(sNext, 'visible');
			this.setNavVisibility(sPrevious, 'visible');
		}
	}
}



/**
 * function to call the ecard template with the corresponding image id (ximg.ximg_id)
 */
imageLibrary.prototype.getECard = function(iFormIdx)
{
	var sOrigUrl = top.location.href;
	var sFormAction = sOrigUrl;
	if(window.location.search != "")
	{
		sFormAction += "&";
	}
	else
	{
		sFormAction += "?";
	}
	sFormAction += "uECardId=" + this.aImageLibraryData['config']['iEcardId'];
	sFormAction += "&uMode=set";
	sFormAction += "&uImgId=" + this.aImageLibraryData[this.iActPos]['img_id'];
	sFormId = 'imageLibrary' + iFormIdx;
	document.getElementById(sFormId).fImageLibraryOrigUrl.value = sOrigUrl;
	document.getElementById(sFormId).action = sFormAction;
	document.getElementById(sFormId).submit();
}


/**
 * removes html tags from a string
 * attention: it removes also "<this>" but "< this >" not!
 */
imageLibrary.prototype.removeHtml = function(sString)
{
	sString = sString.replace(/<[a-z]+>/gi, "");
	sString = sString.replace(/\<\/[a-z]+>/gi, "");
	return sString;
}


//--------------------------------------------------
function arrayToList(aArrayList)
{
	return aArrayList.join(",");
}

function listToArray(lListArray)
{
	return lListArray.split(",");
}

function listGetAt(lList,iPos)
{
	var sDelimiter = ",";
	if (arguments.length > 2)
	{
		sDelimiter = arguments[2];
	}
	var aList = lList.split(sDelimiter);

	if (iPos > 0 && iPos < aList.length+1)
	{
		return aList[iPos - 1];
	}
	else
	{
		return 0;
	}
}

function listSetAt(lList,iPos,sValue)
{
	var aList = lList.split(",");

	if (iPos > 0 && iPos < aList.length+1)
	{
		aList[iPos - 1] = sValue;
		return aList.join(",");
	}
	else
	{
		return lList;
	}	
}

function listDeleteAt(lList,iPos)
{
	var aList = lList.split(",");

	if(aList.length > 1)
	{ 
		if (iPos > 0 && iPos < aList.length+1)
		{
	
			if (sBrowser == "IE" && sVersion < "5.5")
			{
				if (aList.length > iPos)
				{
					for (i = iPos-1; i < aList.length-1; i++)
					{
						aList[i] = aList[i + 1];
					}
					
					aList.length --;
				}
				else
				{
					aList.length --;
				}	
			}
			else
			{
				aList.splice(iPos-1, 1);
			}	
			
			return aList.join(",");
		
		}
		else
		{
			return lList;
		}
	}
	else
	{
		return "";
	}		
}

function listFind(lList,sValue)
{
	var aList = lList.split(",");
	//alert(sValue.toLowerCase());
	
	for (i = 0; i < aList.length; i++)
	{
		if(sValue.toString().toLowerCase() == aList[i].toString().toLowerCase())
		{
			return i+1;
		}
	}
	return 0;
}

function listAppend(lList,sValue)
{

	if(lList.length > 0)
	{
		var aList = lList.split(",");
	
		/* keine doppelten hinzufügen
		for (i = 0; i < aList.length; i++)
		{
			if(sValue.toString().toLowerCase() == aList[i].toString().toLowerCase())
			{
				return i;
			}
		}
		*/
		
		if (sBrowser == "IE" && sVersion < "5.5")
		{
			aList.length ++;
			aList[aList.length-1] = sValue;
		}
		else
		{
			aList.push(sValue);
		}	
		
		
		return aList.join(",");
	}
	else
	{
		return sValue;
	}
}
//--------------------------------------------------
sOver = "a";
sNormal = "n";

function setClass(f_obj)
{
	if (stBrowser.sType == "IELAYER" || stBrowser.sType == "DOM")
	{
		
		sClassName = f_obj.className;
		sMainClassName = sClassName.substr(0,sClassName.length-1);
		sEndClassName = sClassName.substr(sMainClassName.length,sClassName.length);
	
		if (sEndClassName == sNormal)
		{
			f_obj.className = sMainClassName + sOver;
			setCursor(f_obj);
		}
		else
		{
			f_obj.className = sMainClassName + sNormal;
		}
	
	}
	
}

function setClassName(f_sObj)
{
	if (stBrowser.sType == "IELAYER" || stBrowser.sType == "DOM")
	{
		obj = getObject(f_sObj);
		sClassName = obj.className;
		sMainClassName = sClassName.substr(0,sClassName.length-1);
		sEndClassName = sClassName.substr(sMainClassName.length,sClassName.length);
		
		if (sEndClassName == sNormal)
		{
			obj.className = sMainClassName + sOver;
			setCursor(obj);
		}
		else
		{
			obj.className = sMainClassName + sNormal;
		}
	
	}
	
}

function setCursor(f_obj)
{

	if (stBrowser.sBrowser == "NS")
	{
		f_obj.style.cursor  = "pointer";
	}
	else
	{
		f_obj.style.cursor  = "hand";
	}
}

function setCursorNormal(f_obj)
{
	if (stBrowser.sBrowser == "NS")
	{
		f_obj.style.cursor  = "";
	}
	else
	{
		f_obj.style.cursor  = "";
	}
}

function setLoc(f_sLoc)
{
	document.location.href=f_sLoc;
}

function setExpColor(f_sObj,f_iSwitch)
{
	if (stBrowser.sType == "IELAYER" || stBrowser.sType == "DOM")
	{
		
		if (f_iSwitch == 0)
		{
			f_sObj.style.backgroundColor = "";
		}
		else
		{
			f_sObj.style.backgroundColor = "FDB15D";
		}
	
	}

}


//--------------------------------------------------
/*	Unobtrusive Flash Objects (UFO) v3.20 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005, 2006 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}

//--------------------------------------------------
function testString(f_sString)
{
	if (f_sString.length > 0)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testStringEq(f_sString, f_iLen)
{
	if (f_sString.length == f_iLen)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testStringGt(f_sString, f_iLen)
{
	if (f_sString.length > f_iLen)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testStringLt(f_sString, f_iLen)
{
	if (f_sString.length < f_iLen)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testInt(f_iInteger)
{
	var regInt = /^[0-9]+$/;
	
	if (regInt.test(f_iInteger) == true)
	{
		return true;
	}	
	else
	{
		return false;
	}
}

function testFloat(f_flFloat)
{
	var regFloat = /^[0-9]+(\.[0-9]+)*$/;
	
	if (regFloat.test(f_flFloat) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testIntGtZero(f_iInteger)
{
	var regInt = /^[0-9]+$/;
	
	if (regInt.test(f_iInteger) == true && f_iInteger > 0)
	{
		return true;
	}	
	else
	{
		return false;
	}
}

function testMinusOne(f_iInteger)
{
	if (f_iInteger != -1)
	{
		return true;
	}	
	else
	{
		return false;
	}
}

function testTime(f_sTime)
{
	var regTime = /^([0-2]?[0-9]):[0-5][0-9](:[0-5][0-9])?$/;
	var iIndex;
	var iValue;
	var sValue = f_sTime;
	
	if (regTime.test(sValue) == true)
	{
		iIndex = sValue.indexOf(":");
		iValue = sValue.substr(0,iIndex);
		
		if (iValue <= 23 && iValue >=0)
		{
			return true;
		}
		else
		{
			return false;
		}	
	}
	else
	{
		return false;
	}
}

function testDate(f_sDate)
{
	var regDate = /^([0-3]?[0-9])\.([0-1]?[0-9])\.[1-9][0-9]{3}$/;
	var iIndex, iIndex2;
	var iMonth,iDay,iYear;
	var arrMonth = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
	var sValue = f_sDate;
	
	if (regDate.test(sValue) == true)
	{
		iIndex = sValue.indexOf(".");
		iIndex2 = sValue.indexOf(".",iIndex+1);
		
		iDay = sValue.substr(0,iIndex);
		iMonth = sValue.substring(iIndex+1,iIndex2);
		iYear = sValue.substr(iIndex2+1,sValue.length);		

		if (iMonth < 1 || iMonth > 12)
		{
			return false;		
		}
		
		if (iMonth == 2 && ( ( (iYear % 4) == 0 && (iYear % 100) != 0 ) || (iYear % 400) == 0 ) ) 
		{
			if (iDay < 1 || iDay > 29)
			{
				return false;
			}
		}
		else
		{
			if (iDay < 1 || iDay > arrMonth[iMonth-1])
			{
				return false;
			}
		}		

		return true;

	}
	else
	{
		return false;
	}
}

function testEmail(f_sEmail)
{
	var regEmail = /^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*\.([a-zA-Z]{2,4})$/;
	
	if (regEmail.test(f_sEmail) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testChPlz(f_iPLZ)
{
	var regPLZ = /^[1-9][0-9]{3}$/;
	
	if (regPLZ.test(f_iPLZ) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testCHMoney(f_flMoney)
{
	var regMoney = /(^[1-9][0-9]*|^0)(\.[0-9](0|5))?$/;
	
	if (regMoney.test(f_flMoney) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function testEmpty(f_sString)
{
	var regWhiteSpace = /[^ \f\n\r\t]/;
	
	if (regWhiteSpace.test(f_sString))
	{
		return false;
	}
	else
	{
		return true;
	}
}

function testReg(f_sString,f_regString)
{

	regString = new RegExp(f_regString,"gi");
	if (regString.test(f_sString) == true)
	{
		return true;
	}
	else
	{
		return false;
	}
}

//--------------------------------------------------
