//----------------------------------------------------------------------------------------------------------
// 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);

//--------------------------------------------------
/*
	ClusterMarker Version 1.3.0
	
	A marker manager for the Google Maps API
	http://googlemapsapi.martinpearman.co.uk/clustermarker
	
	Copyright Martin Pearman 2008
	Last updated 5th March 2008

	This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

	This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

	You should have received a copy of the GNU General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
	
*/

function ClusterMarker($map, $options){
    this._map=$map;
    this._mapMarkers=[];
    this._iconBounds=[];
    this._clusterMarkers=[];
    this._eventListeners=[];
    if(typeof($options)==='undefined'){
	$options={};
    }
    this.borderPadding=($options.borderPadding)?$options.borderPadding:256;
    this.clusteringEnabled=($options.clusteringEnabled===false)?false:true;
    if($options.clusterMarkerClick){
	this.clusterMarkerClick=$options.clusterMarkerClick;
    }
    if($options.clusterMarkerIcon){
	this.clusterMarkerIcon=$options.clusterMarkerIcon;
    }else{
	this.clusterMarkerIcon=new GIcon();
	this.clusterMarkerIcon.image='http://maps.google.com/mapfiles/arrow.png';
	this.clusterMarkerIcon.iconSize=new GSize(39, 34);
	this.clusterMarkerIcon.iconAnchor=new GPoint(9, 31);
	this.clusterMarkerIcon.infoWindowAnchor=new GPoint(9, 31);
	this.clusterMarkerIcon.shadow='http://www.google.com/intl/en_us/mapfiles/arrowshadow.png';
	this.clusterMarkerIcon.shadowSize=new GSize(39, 34);
    }
    this.clusterMarkerTitle=($options.clusterMarkerTitle)?$options.clusterMarkerTitle:'Click to zoom in and see %count stores';
    if($options.fitMapMaxZoom){
	this.fitMapMaxZoom=$options.fitMapMaxZoom;
    }
    this.intersectPadding=($options.intersectPadding)?$options.intersectPadding:0;
    if($options.markers){
	this.addMarkers($options.markers);
    }
    GEvent.bind(this._map, 'moveend', this, this._moveEnd);
    GEvent.bind(this._map, 'zoomend', this, this._zoomEnd);
    GEvent.bind(this._map, 'maptypechanged', this, this._mapTypeChanged);
}

ClusterMarker.prototype.addMarkers=function($markers){
    var i;
    if(!$markers[0]){
	//	assume $markers is an associative array and convert to a numerically indexed array
	var $numArray=[];
	for(i in $markers){
	    $numArray.push($markers[i]);
	}
	$markers=$numArray;
    }
    for(i=$markers.length-1; i>=0; i--){
	$markers[i]._isVisible=false;
	$markers[i]._isActive=false;
	$markers[i]._makeVisible=false;
    }
    this._mapMarkers=this._mapMarkers.concat($markers);
};

ClusterMarker.prototype._clusterMarker=function($clusterGroupIndexes){
    function $newClusterMarker($location, $icon, $title){
	return new GMarker($location, {
	    icon:$icon,
	    title:$title
	});
    }
    var $clusterGroupBounds=new GLatLngBounds(), i, $clusterMarker, $clusteredMarkers=[], $marker, $this=this;
    for(i=$clusterGroupIndexes.length-1; i>=0; i--){
	$marker=this._mapMarkers[$clusterGroupIndexes[i]];
	$marker.index=$clusterGroupIndexes[i];
	$clusterGroupBounds.extend($marker.getLatLng());
	$clusteredMarkers.push($marker);
    }
    $clusterMarker=$newClusterMarker($clusterGroupBounds.getCenter(), this.clusterMarkerIcon, this.clusterMarkerTitle.replace(/%count/gi, $clusterGroupIndexes.length));
    $clusterMarker.clusterGroupBounds=$clusterGroupBounds;	//	only req'd for default cluster marker click action
    this._eventListeners.push(GEvent.addListener($clusterMarker, 'click', function(){
	$this.clusterMarkerClick({
	    clusterMarker:$clusterMarker,
	    clusteredMarkers:$clusteredMarkers
	});
    }));
    return $clusterMarker;
};

ClusterMarker.prototype.clusterMarkerClick=function($args){
    this._map.setCenter($args.clusterMarker.getLatLng(), this._map.getBoundsZoomLevel($args.clusterMarker.clusterGroupBounds));
};

ClusterMarker.prototype._filterActiveMapMarkers=function(){
    var $borderPadding=this.borderPadding, $mapZoomLevel=this._map.getZoom(), $mapProjection=this._map.getCurrentMapType().getProjection(), $mapPointSw, $activeAreaPointSw, $activeAreaLatLngSw, $mapPointNe, $activeAreaPointNe, $activeAreaLatLngNe, $activeAreaBounds=this._map.getBounds(), i, $marker, $uncachedIconBoundsIndexes=[], $oldState;
    if($borderPadding){
	$mapPointSw=$mapProjection.fromLatLngToPixel($activeAreaBounds.getSouthWest(), $mapZoomLevel);
	$activeAreaPointSw=new GPoint($mapPointSw.x-$borderPadding, $mapPointSw.y+$borderPadding);
	$activeAreaLatLngSw=$mapProjection.fromPixelToLatLng($activeAreaPointSw, $mapZoomLevel);
	$mapPointNe=$mapProjection.fromLatLngToPixel($activeAreaBounds.getNorthEast(), $mapZoomLevel);
	$activeAreaPointNe=new GPoint($mapPointNe.x+$borderPadding, $mapPointNe.y-$borderPadding);
	$activeAreaLatLngNe=$mapProjection.fromPixelToLatLng($activeAreaPointNe, $mapZoomLevel);
	$activeAreaBounds.extend($activeAreaLatLngSw);
	$activeAreaBounds.extend($activeAreaLatLngNe);
    }
    this._activeMarkersChanged=false;
    if(typeof(this._iconBounds[$mapZoomLevel])==='undefined'){
	//	no iconBounds cached for this zoom level
	//	no need to check for existence of individual iconBounds elements
	this._iconBounds[$mapZoomLevel]=[];
	this._activeMarkersChanged=true;	//	force refresh(true) as zoomed to uncached zoom level
	for(i=this._mapMarkers.length-1; i>=0; i--){
	    $marker=this._mapMarkers[i];
	    $marker._isActive=$activeAreaBounds.containsLatLng($marker.getLatLng())?true:false;
	    $marker._makeVisible=$marker._isActive;
	    if($marker._isActive){
		$uncachedIconBoundsIndexes.push(i);
	    }
	}
    }else{
	//	icondBounds array exists for this zoom level
	//	check for existence of individual iconBounds elements
	for(i=this._mapMarkers.length-1; i>=0; i--){
	    $marker=this._mapMarkers[i];
	    $oldState=$marker._isActive;
	    $marker._isActive=$activeAreaBounds.containsLatLng($marker.getLatLng())?true:false;
	    $marker._makeVisible=$marker._isActive;
	    if(!this._activeMarkersChanged && $oldState!==$marker._isActive){
		this._activeMarkersChanged=true;
	    }
	    if($marker._isActive && typeof(this._iconBounds[$mapZoomLevel][i])==='undefined'){
		$uncachedIconBoundsIndexes.push(i);
	    }
	}
    }
    return $uncachedIconBoundsIndexes;
};

ClusterMarker.prototype._filterIntersectingMapMarkers=function(){
    var $clusterGroup, i, j, $mapZoomLevel=this._map.getZoom();
    for(i=this._mapMarkers.length-1; i>0; i--)
    {
	if(this._mapMarkers[i]._makeVisible){
	    $clusterGroup=[];
	    for(j=i-1; j>=0; j--){
		if(this._mapMarkers[j]._makeVisible && this._iconBounds[$mapZoomLevel][i].intersects(this._iconBounds[$mapZoomLevel][j])){
		    $clusterGroup.push(j);
		}
	    }
	    if($clusterGroup.length!==0){
		$clusterGroup.push(i);
		for(j=$clusterGroup.length-1; j>=0; j--){
		    this._mapMarkers[$clusterGroup[j]]._makeVisible=false;
		}
		this._clusterMarkers.push(this._clusterMarker($clusterGroup));
	    }
	}
    }
};

ClusterMarker.prototype.fitMapToMarkers=function(){
    var $markers=this._mapMarkers, $markersBounds=new GLatLngBounds(), i;
    for(i=$markers.length-1; i>=0; i--){
	$markersBounds.extend($markers[i].getLatLng());
    }

    var $fitMapToMarkersZoom=this._map.getBoundsZoomLevel($markersBounds);
		
    if(this.fitMapMaxZoom && $fitMapToMarkersZoom>this.fitMapMaxZoom){
	$fitMapToMarkersZoom=this.fitMapMaxZoom;
    }

    this._map.setCenter($markersBounds.getCenter(), $fitMapToMarkersZoom);
    this.refresh();

    var point = this._map.fromDivPixelToLatLng(new GPoint(-370,-160)) ;
    $markersBounds.extend(point);

    $fitMapToMarkersZoom=this._map.getBoundsZoomLevel($markersBounds);

    if(this.fitMapMaxZoom && $fitMapToMarkersZoom>this.fitMapMaxZoom){
	$fitMapToMarkersZoom=this.fitMapMaxZoom;
    }

    this._map.setCenter($markersBounds.getCenter(), $fitMapToMarkersZoom);
    this.refresh();
};

ClusterMarker.prototype._mapTypeChanged=function(){
    this.refresh(true);
};

ClusterMarker.prototype._moveEnd=function(){
    if(!this._cancelMoveEnd){
	this.refresh();
    }else{
	this._cancelMoveEnd=false;
    }
};

ClusterMarker.prototype._preCacheIconBounds=function($indexes){
    var $mapProjection=this._map.getCurrentMapType().getProjection(), $mapZoomLevel=this._map.getZoom(), i, $marker, $iconSize, $iconAnchorPoint, $iconAnchorPointOffset, $iconBoundsPointSw, $iconBoundsPointNe, $iconBoundsLatLngSw, $iconBoundsLatLngNe, $intersectPadding=this.intersectPadding;
    for(i=$indexes.length-1; i>=0; i--){
	$marker=this._mapMarkers[$indexes[i]];
	$iconSize=$marker.getIcon().iconSize;
	$iconAnchorPoint=$mapProjection.fromLatLngToPixel($marker.getLatLng(), $mapZoomLevel);
	$iconAnchorPointOffset=$marker.getIcon().iconAnchor;
	$iconBoundsPointSw=new GPoint($iconAnchorPoint.x-$iconAnchorPointOffset.x-$intersectPadding, $iconAnchorPoint.y-$iconAnchorPointOffset.y+$iconSize.height+$intersectPadding);
	$iconBoundsPointNe=new GPoint($iconAnchorPoint.x-$iconAnchorPointOffset.x+$iconSize.width+$intersectPadding, $iconAnchorPoint.y-$iconAnchorPointOffset.y-$intersectPadding);
	$iconBoundsLatLngSw=$mapProjection.fromPixelToLatLng($iconBoundsPointSw, $mapZoomLevel);
	$iconBoundsLatLngNe=$mapProjection.fromPixelToLatLng($iconBoundsPointNe, $mapZoomLevel);
	this._iconBounds[$mapZoomLevel][$indexes[i]]=new GLatLngBounds($iconBoundsLatLngSw, $iconBoundsLatLngNe);
    }
};

ClusterMarker.prototype.refresh=function($forceFullRefresh){
    var i,$marker, $uncachedIconBoundsIndexes=this._filterActiveMapMarkers();
    if(this._activeMarkersChanged || $forceFullRefresh){
	this._removeClusterMarkers();
	if(this.clusteringEnabled && this._map.getZoom()<this._map.getCurrentMapType().getMaximumResolution()){
	    if($uncachedIconBoundsIndexes.length>0){
		this._preCacheIconBounds($uncachedIconBoundsIndexes);
	    }
	    this._filterIntersectingMapMarkers();
	}
	for(i=this._clusterMarkers.length-1; i>=0; i--){
	    this._map.addOverlay(this._clusterMarkers[i]);
	}
	for(i=this._mapMarkers.length-1; i>=0; i--){
	    $marker=this._mapMarkers[i];
	    if(!$marker._isVisible && $marker._makeVisible){
		this._map.addOverlay($marker);
		$marker._isVisible=true;
	    }
	    if($marker._isVisible && !$marker._makeVisible){
		this._map.removeOverlay($marker);
		$marker._isVisible=false;
	    }
	}
    }
};

ClusterMarker.prototype._removeClusterMarkers=function(){
    for(var i=this._clusterMarkers.length-1; i>=0; i--){
	this._map.removeOverlay(this._clusterMarkers[i]);
    }
    for(i=this._eventListeners.length-1; i>=0; i--){
	GEvent.removeListener(this._eventListeners[i]);
    }
    this._clusterMarkers=[];
    this._eventListeners=[];
};

ClusterMarker.prototype.removeMarkers=function(){
    for(var i=this._mapMarkers.length-1; i>=0; i--){
	if(this._mapMarkers[i]. _isVisible){
	    this._map.removeOverlay(this._mapMarkers[i]);
	}
	delete this._mapMarkers[i]._isVisible;
	delete this._mapMarkers[i]._isActive;
	delete this._mapMarkers[i]._makeVisible;
    }
    this._removeClusterMarkers();
    this._mapMarkers=[];
    this._iconBounds=[];
};


ClusterMarker.prototype.triggerClick=function($index){
    var $marker=this._mapMarkers[$index];
    if($marker._isVisible){
	//	$marker is visible
	GEvent.trigger($marker, 'click');
    }
    else if($marker._isActive){
	//	$marker is clustered
	this._map.setCenter($marker.getLatLng());
	this._map.zoomIn();
	this.triggerClick($index);
    }else{
	// $marker is not within active area (map bounds + border padding)
	this._map.setCenter($marker.getLatLng());
	this.triggerClick($index);
    }
};

ClusterMarker.prototype._zoomEnd=function(){
    this._cancelMoveEnd=true;
    this.refresh(true);
};

//--------------------------------------------------
/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only thing you need to change in this file is the following
variables: checkboxHeight, radioHeight and selectWidth.

Replace the first two numbers with the height of the checkbox and
radio button. The actual height of both the checkbox and radio
images should be 4 times the height of these two variables. The
selectWidth value should be the width of your select list image.

You may need to adjust your images a bit if there is a slight
vertical movement during the different stages of the button
activation.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "220";

/* No need to change anything after this */

document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(var a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				span[a].onmousedown = Custom.pushed;
				span[a].onmouseup = Custom.check;
				document.onmouseup = Custom.clear;
			}
		}
		inputs = document.getElementsByTagName("select");
		/*	for(var a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.choose; 
			}
		}
		*/
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(var a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(var d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;
//--------------------------------------------------

function imageZoom(file,x,y)
{
	var address = rootWWW + "_global/imagezoom.cfm?img=";
	var sizeX = 850;
	var sizeY = 600;

	if(typeof x != "undefined")
		sizeX = x;
	if(typeof y != "undefined")
		sizeY = y;

	if(typeof file != "undefined" && file.length)
	{
		ImageZoomPopup = window.open(address + file, "ImageZoomWindow", "width=" + sizeX + ",height=" + sizeY + ",left=20,top=20,scrollbars=yes,resizable=yes");
		ImageZoomPopup.focus();
	}
}
//--------------------------------------------------
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,f_iLangID)
{
	winOpen(rootWWW + "_global/sendlink.cfm?uTitle="+f_sTitle+"&uUrl="+escape(f_sUrl) + "&uLangID=" + f_iLangID,"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);
}


//--------------------------------------------------
/*
 * jQuery history plugin
 *
 * Copyright (c) 2006 Taku Sano (Mikage Sawatari)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization
 * for msie when no initial hash supplied.
 */


jQuery.extend({
	historyCurrentHash: undefined,
	
	historyCleanHash: function (hash){
		var regex = new RegExp("^.*#");
		var regex2 = new RegExp("^"+rootwwwhttp);
		var regex3 = new RegExp("^"+rootWWW);
		var regex4 = new RegExp("^"+sLangShort+'/');

		hash = hash.replace(regex , '');
		hash = hash.replace(regex2 , '');
		hash = hash.replace(regex3 , '');
		hash = hash.replace(regex4 , '');		
		return hash;
	},
	
	historyCallback: undefined,
	
	historyInit: function(callback){
		jQuery.historyCallback = callback;
		
		/*
		 * Added for the IE6:  +location.search; 
		 */
		
		var current_hash = jQuery.historyCleanHash(location.hash + location.search);

		/* alert('init: '+current_hash);*/
		jQuery.historyCurrentHash = current_hash;
		if(jQuery.browser.msie) {
			// To stop the callback firing twice during initilization if no hash present
			if (jQuery.historyCurrentHash == '') {
			jQuery.historyCurrentHash = '#';
		}
		
			// add hidden iframe for IE
			$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			new_hash = current_hash.replace('?','QUERYSTRING');
			iframe.location.hash = new_hash;
		}
		else if ($.browser.safari) {
			// etablish back/forward stacks
			jQuery.historyBackStack = [];
			jQuery.historyBackStack.length = history.length;
			jQuery.historyForwardStack = [];
			
			jQuery.isFirst = true;
		}
		if(current_hash.length){
			jQuery.historyCallback(current_hash.replace(/^#/, ''));
		}
		setInterval(jQuery.historyCheck, 100);
	},
	
	historyAddHistory: function(hash) {
		// This makes the looping function do something
		jQuery.historyBackStack.push(hash);
		
		jQuery.historyForwardStack.length = 0; // clear forwardStack (true click occured)
		this.isFirst = true;
	},
	
	historyCheck: function(){

		if(jQuery.browser.msie) {
			// On IE, check for location.hash of iframe
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentDocument || ihistory.contentWindow.document;
			var current_hash = jQuery.historyCleanHash(iframe.location.hash);

			current_hash = current_hash.replace('QUERYSTRING', '?');
			jQuery.historyCurrentHash = jQuery.historyCleanHash(jQuery.historyCurrentHash)
			
			if(current_hash != jQuery.historyCurrentHash) {
/*			alert('IE: ' + current_hash + ' '+ jQuery.historyCurrentHash); */ 
				
				location.hash = current_hash;
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
				
			}
		} else if ($.browser.safari) {
			if (!jQuery.dontCheck) {
				var historyDelta = history.length - jQuery.historyBackStack.length;
				
				if (historyDelta) { // back or forward button has been pushed
					jQuery.isFirst = false;
					if (historyDelta < 0) { // back button has been pushed
						// move items to forward stack
						for (var i = 0; i < Math.abs(historyDelta); i++) jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
					} else { // forward button has been pushed
						// move items to back stack
						for (var i = 0; i < historyDelta; i++) jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
					}
					var cachedHash = jQuery.historyBackStack[jQuery.historyBackStack.length - 1];
					if (cachedHash != undefined) {
						jQuery.historyCurrentHash = jQuery.historyCleanHash(location.hash);
						jQuery.historyCallback(cachedHash);
					}
				} else if (jQuery.historyBackStack[jQuery.historyBackStack.length - 1] == undefined && !jQuery.isFirst) {
					// back button has been pushed to beginning and URL already pointed to hash (e.g. a bookmark)
					// document.URL doesn't change in Safari
					if (document.URL.indexOf('#') >= 0) {
						jQuery.historyCallback(document.URL.split('#')[1]);
					} else {
						var current_hash = location.hash;
						jQuery.historyCallback('');
					}
					jQuery.isFirst = true;
				}
			}
		} else {
			// otherwise, check for location.hash
			var current_hash = jQuery.historyCleanHash(location.hash);
			jQuery.historyCurrentHash = jQuery.historyCleanHash(jQuery.historyCurrentHash);
			
			if(current_hash != jQuery.historyCurrentHash) {
			/*	alert(current_hash +' <>  '+ jQuery.historyCurrentHash); */
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
			}
		}
	},
	historyLoad: function(hash , options){
		hash = jQuery.historyCleanHash(hash);
		
		var newhash = new String;
		
		if (jQuery.browser.safari) {
			newhash = hash;
		}
		else {
			newhash = '#' + hash;
			location.hash = newhash;
		}
		jQuery.historyCurrentHash = newhash;
		
		if(jQuery.browser.msie) {
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			newhash = newhash.replace('?','QUERYSTRING');
			iframe.location.hash = newhash;
/*			alert('Setze: ' + jQuery.historyCurrentHash );
			alert('Setze: ' + newhash);
			alert('Gesetzt: ' + iframe.location.hash );  */
			jQuery.historyCallback(hash, options);
		}
		else if (jQuery.browser.safari) {
			jQuery.dontCheck = true;
			// Manually keep track of the history values for Safari
			this.historyAddHistory(hash);
			
			// Wait a while before allowing checking so that Safari has time to update the "history" object
			// correctly (otherwise the check loop would detect a false change in hash).
			var fn = function() {jQuery.dontCheck = false;};
			window.setTimeout(fn, 200);
			jQuery.historyCallback(hash , options);
			// N.B. "location.hash=" must be the last line of code for Safari as execution stops afterwards.
			//      By explicitly using the "location.hash" command (instead of using a variable set to "location.hash") the
			//      URL in the browser and the "history" object are both updated correctly.
			location.hash = newhash;
		}
		else {
		  jQuery.historyCallback(hash , options);
		}
	}
});



//--------------------------------------------------
//Page init scripts

function ProductPage(){
var that = this;
    this.elem = $('.product-detail');
    this.initToolTips();
    this.initTabs();
	this.elem.find('.color-image').mouseover(function(){
		that.elem.find('.details-box .image img').attr('src',$(this).attr('rel'));
	});
	/**
	* resizeProductImageIfExists()ist eine globale funktion, 
	* da der resize nur einmal registriert werden darf 
	* und die funktion erst nach max-height check aufgerufen werden darf
	* definiert in odlo.functions.js
	**/
	resizeProductImageIfExists();
	//this.initProductpageGallery();
	this.closingBehaviour();
}

ProductPage.prototype.closingBehaviour = function(){
	var noCloseClass = "no-close-product-page";
	var close = this.elem.find('.close');
	close.click(function(){
		hideODLOContentLightBox();
		return false;
	});
	$('body').click(function(){
		setTimeout(function(){
			if(!close.hasClass(noCloseClass)){
			close.click();
			};
			close.removeClass(noCloseClass);
		},250);
	});
	$('.detail-hold > .detail').click(function(){
		close.addClass(noCloseClass);
	});
}

ProductPage.prototype.initProductpageGallery = function(){
	var that = this;
	this.elem.find("#tab3 li > a").lightBox({
		imageLoading:			rootWWW+'img/lightbox/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
		imageBtnPrev:			rootWWW+'img/lightbox/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
		imageBtnNext:			rootWWW+'img/lightbox/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
		imageBtnClose:			rootWWW+'img/lightbox/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
		imageBlank:				rootWWW+'img/lightbox/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
		fixedNavigation:		true,
		maxHeight: 				$(window).height(),
		maxWidth: 				$(window).width()
	}); 
	this.elem.find(".image img").click(function(){
		var img = $(this);
		that.elem.find('#tab3 li > a[rel="'+img.attr('src')+'"]').click();
	});
	
}


			
ProductPage.prototype.initToolTips = function(){
    this.elem.find('.popup').each(function(){
        jQuery(this).css({
            left: -jQuery(this).find('.l').outerWidth(true)/2 + 25
        })
    });
    this.elem.find('.detail .tab-row .product li, .detail div.tab .logos li').toolTipsNV();
};


//Tab init
ProductPage.prototype.initTabs = function(){
    this.elem.find('ul.tabset').each(function(){
        var _list = jQuery(this);
        var _links = _list.find('a.tab');
        _links.each(function() {
            var _link = jQuery(this);
            var _href = _link.attr('href').substr(_link.attr('href').lastIndexOf('#'));
            var _tab = jQuery(_href);

            if(_link.hasClass('active')) _tab.show();
            else _tab.hide();

            _link.click(function(){
                _links.filter('.active').each(function(){
                    jQuery(this).removeClass('active')
                    jQuery(jQuery(this).attr('href').substr(jQuery(this).attr('href').lastIndexOf('#'))).hide();
                });
                _link.addClass('active');
                _tab.show();
                return false;
            });
        });
    });
}



function InspirationPage(){
    this.elem = $('#collection_inspiration');
    this.initOverviewGallery();
    this.initFrameSlideShow();
}

InspirationPage.prototype.initOverviewGallery =function(){
    this.elem.find('div.gallery').gallery({
        duration: 1500,
        autoRotation: 20000,
        clone: true,
        direction: false,
        listOfSlides: '.slide-frame > ul > li',
        switcher: '.swicher li'
    });  
}


//Init main gallery
InspirationPage.prototype.initFrameSlideShow = function(){
    var swichTime = 2000;
    this.elem.find('.inspiration-gallery').each(function(){
        var set = jQuery(this);
        var navPanel = jQuery('.gallery-nav', set);
        var pageItem = jQuery('>ul>li >a', navPanel);
        var btnPrev = jQuery('.prev', navPanel);
        var btnNext = jQuery('.next', navPanel);
		var btnAllNav= jQuery('a', navPanel);
        var galleryHold = jQuery('.gallery-hold', set);
        var slider = jQuery('.slide > ul', galleryHold);
        var slides = slider.children();
        var maxH = 0, leftPos = 0, activeSlide = 0, summW = 0;
        var animateSpeed = 1500;
        var timer;
		
		btnAllNav.click(function(){
			swichTime = 0;
			if(timer) clearInterval(timer);
		})
		
        slides.css({
            position: 'absolute', 
            top: 0, 
            left: leftPos
        });
        slides.each(function(){
            if(maxH < jQuery(this).outerHeight(true)) maxH = jQuery(this).outerHeight(true);
            jQuery(this).css({
                left: leftPos
            });
            leftPos += jQuery(this).outerWidth(true);
            summW += jQuery(this).outerWidth(true);
        });
/*        slider.css({
            width: '100%', 
            height: maxH, 
            left: -1*slides.eq(activeSlide).position().left + (jQuery(window).width()/2 - slides.eq(activeSlide).outerWidth(true)/2)
        }); */
		slider.css({
            width: '100%', 
            height: maxH, 
            left: 0
        });
		
        checkNavBtn();
		
		
        pageItem.bind('click', function(){
            if(!jQuery(this).hasClass('active')){
                pageItem.removeClass('active');
                jQuery(this).addClass('active')
                var hrefAttr = jQuery(this).attr('href');
                activeSlide = jQuery(hrefAttr).index();
                animationSlider();
				checkNavBtn();
            };
            return false;
        });
		
		function checkNavBtn(){
            if(activeSlide == 0){
				btnPrev.addClass('disableBtn')
			} else {
				btnPrev.removeClass('disableBtn')
			}
            if(activeSlide == slides.length-1) {
				btnNext.addClass('disableBtn');		
			}else {
				btnNext.removeClass('disableBtn');		
			}
		}
		
        function prevSlide(){
            btnPrev.removeClass('disableBtn');
            btnNext.removeClass('disableBtn');
            if(activeSlide > 0 ) activeSlide--
            else {
            // activeSlide = slides.length-1;
            };
			checkNavBtn();
            animationSlider();
        };
        if(btnPrev.length){
            btnPrev.bind('click', function(){
                prevSlide();
                return false;
            });
        };
        function nextSlide(){
            btnPrev.removeClass('disableBtn');
            btnNext.removeClass('disableBtn');
			
            if(activeSlide < slides.length-1 ) activeSlide++
            else {
            // activeSlide = 0;
            }
            checkNavBtn();
            animationSlider();
        }
        if(btnNext.length){
            btnNext.bind('click', function(){
                nextSlide();
                return false;
            });
        };
        function animationSlider(){
            slider.animate({
                left: -1*slides.eq(activeSlide).position().left + (jQuery(window).width()/2 - slides.eq(activeSlide).outerWidth(true)/2)
            }, {
                queue: false, 
                duration: animateSpeed
            });
        };
        set.bind('mouseenter', function(){
            if(timer) clearInterval(timer);
        }).bind('mouseleave', function(){
            if(swichTime > 0) autoRotationFunc();
        });
        function autoRotationFunc(){
            timer = setInterval(function(){
                nextSlide();
            }, swichTime);
        };
        if(swichTime > 0) autoRotationFunc();
        jQuery(window).bind('resize', function(){
            animationSlider();
        });
    });
};



//gallery plugin
(function($) {
    $.fn.gallery = function(options) {
        var args = Array.prototype.slice.call(arguments);
        args.shift();
        this.each(function(){
            if(this.galControl && typeof options === 'string') {
                if(typeof this.galControl[options] === 'function') {
                    this.galControl[options].apply(this.galControl, args);
                }
            } else {
                this.galControl = new Gallery(this, options);
            }
        });
        return this;
    };
    function Gallery(context, options) {
        this.init(context, options);
    };
    Gallery.prototype = {
        options:{},
        init: function (context, options){
            this.options = $.extend({
                duration: 700,
                slideElement:1,
                autoRotation: false,
                effect: false,
                listOfSlides: '.list > li',
                switcher: false,
                autoSwitcher: false,
                disableBtn: false,
                nextBtn: 'a.link-next, a.btn-next, a.next',
                prevBtn: 'a.link-prev, a.btn-prev, a.prev',
                circle: true,
                clone: false,
                direction: false,
                event: 'click'
            }, options || {});
            var self = this;
            this.context = $(context);
            this.els = this.context.find(this.options.listOfSlides);
            this.list = this.els.parent();
            this.count = this.els.length;
            this.autoRotation = this.options.autoRotation;
            this.direction = this.options.direction;
            this.duration = this.options.duration;
            if (this.options.clone) {
                this.list.append(this.els.clone(true));
                this.list.prepend(this.els.clone(true));
                this.els = this.context.find(this.options.listOfSlides);
            }
            this.wrap = this.list.parent();
            if (this.options.nextBtn) this.nextBtn = this.context.find(this.options.nextBtn);
            if (this.options.prevBtn) this.prevBtn = this.context.find(this.options.prevBtn);

            this.calcParams(this);
			
            if (this.options.autoSwitcher) {
                this.switcherHolder = this.context.find(this.options.switcher).empty();
                this.switchPattern = $('<ul class="'+ (this.options.autoSwitcher == true ? '' : this.options.autoSwitcher) +'"></ul>');
                for (var i=0;i<this.max+1;i++){
                    $('<li><a href="#">'+i+'</a></li>').appendTo(this.switchPattern);
                }
                this.switchPattern.appendTo(this.switcherHolder);
                this.switcher = this.context.find(this.options.switcher).find('li');
                this.active = 0;
            } else {
                if (this.options.switcher) {
                    this.switcher = this.context.find(this.options.switcher);
                    this.active = this.switcher.index(this.switcher.filter('.active:eq(0)'));
                }
                else this.active = this.els.index(this.els.filter('.active:eq(0)'));
            }
            if (this.active < 0) this.active = 0;
            this.last = this.active;
            if (this.options.switcher) this.switcher.removeClass('active').eq(this.active).addClass('active');
            if (this.options.clone) this.active += this.count;
			
            if (this.options.effect) this.els.css({
                opacity: 0
            }).removeClass('active').eq(this.active).addClass('active').css({
                opacity: 1
            }).css('opacity', 'auto');
            else {
                if (this.direction) this.list.css({
                    marginTop: -(this.mas[this.active])
                });
                else this.list.css({
                    marginLeft: -(this.mas[this.active])
                });
            }
			
			
            if (this.options.nextBtn) this.initEvent(this, this.nextBtn,true);
            if (this.options.prevBtn) this.initEvent(this, this.prevBtn,false);
			
            this.initWindow(this,$(window));
			
            if (this.autoRotation) this.runTimer(this);
			
            if (this.options.switcher) this.initEventSwitcher(this, this.switcher);
            if (this.options.disableBtn && !this.options.circle && !this.options.clone) this.disableControls();
        },
        calcParams: function(self){
            this.mas = [];
            this.sum = 0;
            this.max = this.count-1;
            this.width = 0;
            if (!this.options.effect) {
                this.els.each(function(){
                    self.mas.push(self.width);
                    self.width += self.direction?$(this).outerHeight(true):$(this).outerWidth(true);
                    self.sum+=self.direction?$(this).outerHeight(true):$(this).outerWidth(true);
                });
                this.finish = this.direction?this.sum-this.wrap.outerHeight():this.sum-this.wrap.outerWidth();
                for (var i=0;i<this.count;i++){
                    if (this.mas[i]>=this.finish) {
                        this.max = i;
                        break;
                    }
                }
            }
        },
        changeSettings: function(set,val){
            this[set] = val;
        },
        fadeElement: function(){
            this.els.eq(this.last).animate({
                opacity:0
            }, {
                queue:false, 
                duration: this.duration
            });
            this.els.removeClass('active').eq(this.active).addClass('active').animate({
                opacity:1
            }, {
                queue:false, 
                duration: this.duration, 
                complete: function(){
                    $(this).css('opacity','auto');
                }
            });
            if (this.options.switcher) this.switcher.removeClass('active').eq(this.active).addClass('active');
            this.last = this.active;
        },
        scrollElement: function(f){
            if (this.direction) this.list.animate({
                marginTop: f ? -this.finish : -(this.mas[this.active])
            }, {
                queue:false, 
                duration: this.duration
            });
            else this.list.animate({
                marginLeft: f ? -this.finish : -(this.mas[this.active])
            }, {
                queue:false, 
                duration: this.duration
            });
            if (this.options.switcher) this.switcher.removeClass('active').eq(this.options.clone ? this.active < this.count ? this.active/this.options.slideElement : this.active >= this.count*2 ? (this.active - this.count*2)/this.options.slideElement : (this.active - this.count)/this.options.slideElement : this.active/this.options.slideElement).addClass('active');
        },
        runTimer: function($this){
            if($this._t) clearTimeout($this._t);
            $this._t = setInterval(function(){
                $this.nextStep();
            }, this.autoRotation);
        },
        initEventSwitcher: function($this, el){
            el.bind($this.options.event, function(){
                if (!$(this).hasClass('active')){
                    $this.active = $this.switcher.index($(this)) * $this.options.slideElement;
                    if ($this.options.clone) $this.active += $this.count;
                    $this.initMove();
                }
                return false;
            });
        },
        initEvent: function($this, addEventEl, dir){
            addEventEl.bind($this.options.event, function(){
                if (dir) $this.nextStep();
                else $this.prevStep();
                if($this._t) clearTimeout($this._t);
                if ($this.autoRotation) $this.runTimer($this);
                return false;
            });
        },
        disableControls: function(){
            this.prevBtn.removeClass(this.options.disableBtn);
            this.nextBtn.removeClass(this.options.disableBtn);
            if (this.active>=this.max) this.nextBtn.addClass(this.options.disableBtn);
            if (this.active<=0) this.prevBtn.addClass(this.options.disableBtn);
        },
        initMove: function(){
            var f = false;
            if (this.active >= this.max && !this.options.clone) {
                f = true;
                this.active = this.max;
            }
            if(this._t) clearTimeout(this._t);
            if (!this.options.effect) this.scrollElement(f);
            else this.fadeElement();
            if (this.autoRotation) this.runTimer(this);
            if (this.options.disableBtn && !this.options.circle && !this.options.clone) this.disableControls();
        },
        nextStep:function(){
            var f = false;
            this.active = this.active + this.options.slideElement;
            if (this.options.disableBtn && !this.options.circle && !this.options.clone) this.disableControls();
            if (this.options.clone){
                if (this.active > this.count*2) {
                    if (this.direction) this.list.css({
                        marginTop:-this.mas[this.count]
                    });
                    else this.list.css({
                        marginLeft:-this.mas[this.count]
                    });
                    this.active = this.count+this.options.slideElement;
                }
            } else {
                if (this.active >= this.max) {
                    if (this.options.circle) {
                        if (this.active > this.max) this.active = 0;
                        else {
                            this.active = this.max;
                            f = true
                        }
                    }
                    else {
                        this.active = this.max;
                        f = true;
                    }
                }
            }
            if (!this.options.effect) this.scrollElement(f);
            else this.fadeElement();
        },
        prevStep: function(){
            var f = false;
            this.active = this.active - this.options.slideElement;
            if (this.options.disableBtn && !this.options.circle && !this.options.clone) this.disableControls();
            if (this.options.clone){
                if (this.active < 0) {
                    if (this.direction) this.list.css({
                        marginTop:-this.mas[this.count]
                    });
                    else this.list.css({
                        marginLeft:-this.mas[this.count]
                    });
                    this.active = this.count-1;
                }
            } else {
                if (this.active < 0) {
                    if (this.options.circle) {
                        this.active = this.max;
                        f = true;
                    }
                    else this.active = 0;
                }
            }
            if (!this.options.effect) this.scrollElement(f);
            else this.fadeElement();
        },
        initWindow: function($this,$window){
            $window.focus($.proxy(this.play,this));
            $window.blur($.proxy(this.stop,this));
        },
        stop: function(){
            if (this._t) clearTimeout(this._t);
        },
        play: function(){
            if (this._t) clearTimeout(this._t);
            if (this.autoRotation) this.runTimer(this);
        }
    }
}(jQuery));




//ToolTips


$.fn.toolTipsNV = function(_options){
    var _options = jQuery.extend({
        hideOnBodyClick : false,
        viewClass: 'active-tooltip'
    },_options);

    return this.each(function(){
        var set = jQuery(this);
        var hideOnBodyClick = _options.hideOnBodyClick;
        var viewClass = _options.viewClass;
        if(!set.length) return;
        set.bind('mouseover', function(){
            jQuery('body').find('*').filter('[class*=' + viewClass + ']').each(function(){
                if(jQuery(this).hasClass(viewClass)){
                    jQuery(this).removeClass(viewClass);
                }
            });
            set.addClass(viewClass);
            return false;
        });
        jQuery('body').bind('click', function(e){
            if(set.hasClass(viewClass)){
                if(!jQuery(e.target).parents().is(set)){
                    set.removeClass(viewClass);
                };
            }
        });
    });
}
//--------------------------------------------------
/**
 * jQuery lightBox plugin
 * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
 * and adapted to me for use like a plugin from jQuery.
 * @name jquery-lightbox-0.5.js
 * @author Leandro Vieira Pinho - http://leandrovieira.com
 * @version 0.5
 * @date April 11, 2008
 * @category jQuery plugin
 * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
 * @license CCAttribution-ShareAlike 2.5 Brazil - http://creativecommons.org/licenses/by-sa/2.5/br/deed.en_US
 * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
 */

// Offering a Custom Alias suport - More info: http://docs.jquery.com/Plugins/Authoring#Custom_Alias
	jQuery.fn.lightBox = function(settings) {
		// Settings to configure the jQuery lightBox plugin how you like
		settings = jQuery.extend({
			// Configuration related to overlay
			overlayBgColor: 		'#000',		// (string) Background color to overlay; inform a hexadecimal value like: #RRGGBB. Where RR, GG, and BB are the hexadecimal values for the red, green, and blue values of the color.
			overlayOpacity:			0.8,		// (integer) Opacity value to overlay; inform: 0.X. Where X are number from 0 to 9
			// Configuration related to navigation
			fixedNavigation:		false,		// (boolean) Boolean that informs if the navigation (next and prev button) will be fixed or not in the interface.
			// Configuration related to images
			imageLoading:			'images/lightbox-ico-loading.gif',		// (string) Path and the name of the loading icon
			imageBtnPrev:			'images/lightbox-btn-prev.gif',			// (string) Path and the name of the prev button image
			imageBtnNext:			'images/lightbox-btn-next.gif',			// (string) Path and the name of the next button image
			imageBtnClose:			'images/lightbox-btn-close.gif',		// (string) Path and the name of the close btn
			imageBlank:				'images/lightbox-blank.gif',			// (string) Path and the name of a blank image (one pixel)
			// Configuration related to container image box
			containerBorderSize:	10,			// (integer) If you adjust the padding in the CSS for the container, #lightbox-container-image-box, you will need to update this value
			containerResizeSpeed:	400,		// (integer) Specify the resize duration of container image. These number are miliseconds. 400 is default.
			// Configuration related to texts in caption. For example: Image 2 of 8. You can alter either "Image" and "of" texts.
			txtImage:				'Image',	// (string) Specify text "Image"
			txtOf:					'of',		// (string) Specify text "of"
			// Configuration related to keyboard navigation
			keyToClose:				'c',		// (string) (c = close) Letter to close the jQuery lightBox interface. Beyond this letter, the letter X and the SCAPE key is used to.
			keyToPrev:				'p',		// (string) (p = previous) Letter to show the previous image
			keyToNext:				'n',		// (string) (n = next) Letter to show the next image.
			// Donīt alter these variables in any way
			imageArray:				[],
			activeImage:			0
		},settings);
		// Caching the jQuery object with all elements matched
		var jQueryMatchedObj = this; // This, in this context, refer to jQuery object
		/**
		 * Initializing the plugin calling the start function
		 *
		 * @return boolean false
		 */
		function _initialize() {
			_start(this,jQueryMatchedObj); // This, in this context, refer to object (link) which the user have clicked
			return false; // Avoid the browser following the link
		}
		/**
		 * Start the jQuery lightBox plugin
		 *
		 * @param object objClicked The object (link) whick the user have clicked
		 * @param object jQueryMatchedObj The jQuery object with all elements matched
		 */
		function _start(objClicked,jQueryMatchedObj) {
			// Hime some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').css({ 'visibility' : 'hidden' });
			// Call the function to create the markup structure; style some elements; assign events in some elements.
			_set_interface();
			// Unset total images in imageArray
			settings.imageArray.length = 0;
			// Unset image active information
			settings.activeImage = 0;
			// We have an image set? Or just an image? Letīs see it.
			if ( jQueryMatchedObj.length == 1 ) {
				settings.imageArray.push(new Array(objClicked.getAttribute('href'),objClicked.getAttribute('title')));
			} else {
				// Add an Array (as many as we have), with href and title atributes, inside the Array that storage the images references		
				for ( var i = 0; i < jQueryMatchedObj.length; i++ ) {
					settings.imageArray.push(new Array(jQueryMatchedObj[i].getAttribute('href'),jQueryMatchedObj[i].getAttribute('title')));
				}
			}
			while ( settings.imageArray[settings.activeImage][0] != objClicked.getAttribute('href') ) {
				settings.activeImage++;
			}
			// Call the function that prepares image exibition
			_set_image_to_view();
		}
		/**
		 * Create the jQuery lightBox plugin interface
		 *
		 * The HTML markup will be like that:
			<div id="jquery-overlay"></div>
			<div id="jquery-lightbox">
				<div id="lightbox-container-image-box">
					<div id="lightbox-container-image">
						<img src="../fotos/XX.jpg" id="lightbox-image">
						<div id="lightbox-nav">
							<a href="#" id="lightbox-nav-btnPrev"></a>
							<a href="#" id="lightbox-nav-btnNext"></a>
						</div>
						<div id="lightbox-loading">
							<a href="#" id="lightbox-loading-link">
								<img src="../images/lightbox-ico-loading.gif">
							</a>
						</div>
					</div>
				</div>
				<div id="lightbox-container-image-data-box">
					<div id="lightbox-container-image-data">
						<div id="lightbox-image-details">
							<span id="lightbox-image-details-caption"></span>
							<span id="lightbox-image-details-currentNumber"></span>
						</div>
						<div id="lightbox-secNav">
							<a href="#" id="lightbox-secNav-btnClose">
								<img src="../images/lightbox-btn-close.gif">
							</a>
						</div>
					</div>
				</div>
			</div>
		 *
		 */
		function _set_interface() {
			// Apply the HTML markup into body tag
			$('body').append('<div id="jquery-overlay"></div><div id="jquery-lightbox"><div id="lightbox-container-image-box"><div id="lightbox-container-image"><img id="lightbox-image"><div style="" id="lightbox-nav"><a href="#" id="lightbox-nav-btnPrev"></a><a href="#" id="lightbox-nav-btnNext"></a></div><div id="lightbox-loading"><a href="#" id="lightbox-loading-link"><img src="' + settings.imageLoading + '"></a></div></div></div><div id="lightbox-container-image-data-box"><div id="lightbox-container-image-data"><div id="lightbox-image-details"><span id="lightbox-image-details-caption"></span><span id="lightbox-image-details-currentNumber"></span></div><div id="lightbox-secNav"><a href="#" id="lightbox-secNav-btnClose"><img src="' + settings.imageBtnClose + '"></a></div></div></div></div>');	
			// Get page sizes
			var arrPageSizes = ___getPageSize();
			// Style overlay and show it
			$('#jquery-overlay').css({
				backgroundColor:	settings.overlayBgColor,
				opacity:			settings.overlayOpacity,
				width:				arrPageSizes[0],
				height:				arrPageSizes[1]
			}).fadeIn();
			// Get page scroll
			var arrPageScroll = ___getPageScroll();
			// Calculate top and left offset for the jquery-lightbox div object and show it
			$('#jquery-lightbox').css({
				top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
				left:	arrPageScroll[0]
			}).show();
			// Assigning click events in elements to close overlay
			$('#jquery-overlay,#jquery-lightbox').click(function() {
				_finish();									
			});
			// Assign the _finish function to lightbox-loading-link and lightbox-secNav-btnClose objects
			$('#lightbox-loading-link,#lightbox-secNav-btnClose').click(function() {
				_finish();
				return false;
			});
			// If window was resized, calculate the new overlay dimensions
			$(window).resize(function() {
				// Get page sizes
				var arrPageSizes = ___getPageSize();
				// Style overlay and show it
				$('#jquery-overlay').css({
					width:		arrPageSizes[0],
					height:		arrPageSizes[1]
				});
				// Get page scroll
				var arrPageScroll = ___getPageScroll();
				// Calculate top and left offset for the jquery-lightbox div object and show it
				$('#jquery-lightbox').css({
					top:	arrPageScroll[1] + (arrPageSizes[3] / 10),
					left:	arrPageScroll[0]
				});
				$('#jquery-lightbox').css({
					top:	0,
					left:	0
				});				
			});
		}
		/**
		 * Prepares image exibition; doing a imageīs preloader to calculate itīs size
		 *
		 */
		function _set_image_to_view() { // show the loading
			// Show the loading
			if(settings.activeImage >= settings.imageArray.length) {
				settings.activeImage = 0;
			}
			$('#lightbox-loading').show();
			if ( settings.fixedNavigation ) {
				$('#lightbox-image,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
			} else {
				// Hide some elements
				$('#lightbox-image,#lightbox-nav,#lightbox-nav-btnPrev,#lightbox-nav-btnNext,#lightbox-container-image-data-box,#lightbox-image-details-currentNumber').hide();
			}
			// Image preload process
			var objImagePreloader = new Image();
			objImagePreloader.onload = function() {
				$('#lightbox-image').attr('src',settings.imageArray[settings.activeImage][0]);
				// Perfomance an effect in the image container resizing it
				_resize_container_image_box(objImagePreloader.width,objImagePreloader.height);
				//	clear onLoad, IE behaves irratically with animated gifs otherwise
				objImagePreloader.onload=function(){};
			};
			objImagePreloader.src = settings.imageArray[settings.activeImage][0];
		};
		/**
		 * Perfomance an effect in the image container resizing it
		 *
		 * @param integer intImageWidth The imageīs width that will be showed
		 * @param integer intImageHeight The imageīs height that will be showed
		 */
		
		/**
		Getunik 
		http://geekswithblogs.net/wojan/archive/2009/06/17/jquerylightbox.aspx
		**/
		function _resize_container_image_box(intImageWidth,intImageHeight) {
			if((settings.maxWidth != null && settings.maxHeight != null) && (intImageWidth > settings.maxWidth || intImageHeight > settings.maxHeight)){
				var isWider = intImageWidth > intImageHeight;//is the image wide or tall?
				var scale = isWider ?  settings.maxWidth/intImageWidth : settings.maxHeight/intImageHeight;
				intImageWidth = intImageWidth * scale;
				intImageHeight = intImageHeight * scale;
				if(intImageWidth > settings.maxHeight){
					 scale = settings.maxHeight/intImageHeight;
					intImageWidth = intImageWidth * scale;
					intImageHeight = intImageHeight * scale;
				}
				
			 }
			 $('#lightbox-image').height(intImageHeight); 
			 $('#lightbox-image').width(intImageWidth);  
			// Get current width and height
			var intCurrentWidth = $('#lightbox-container-image-box').width();
			var intCurrentHeight = $('#lightbox-container-image-box').height();
			// Get the width and height of the selected image plus the padding
			var intWidth = (intImageWidth + (settings.containerBorderSize * 2)); // Plus the imageīs width and the left and right padding value
			var intHeight = (intImageHeight + (settings.containerBorderSize * 2)); // Plus the imageīs height and the left and right padding value
			// Diferences
			var intDiffW = intCurrentWidth - intWidth;
			var intDiffH = intCurrentHeight - intHeight;
			// Perfomance the effect
			$('#lightbox-container-image-box').animate({ width: intWidth, height: intHeight },settings.containerResizeSpeed,function() { _show_image(); });
			if ( ( intDiffW == 0 ) && ( intDiffH == 0 ) ) {
				if ( $.browser.msie ) {
					___pause(250);
				} else {
					___pause(100);	
				}
			} 
			$('#lightbox-container-image-data-box').css({ width: intImageWidth });
			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ height: intImageHeight + (settings.containerBorderSize * 2) });
		};
		/**
		 * Show the prepared image
		 *
		 */
		function _show_image() {
			$('#lightbox-loading').hide();
			$('#lightbox-image').fadeIn(function() {
				_show_image_data();
				_set_navigation();
			});
			_preload_neighbor_images();
		};
		/**
		 * Show the image information
		 *
		 */
		function _show_image_data() {
			$('#lightbox-container-image-data-box').slideDown('fast');
			$('#lightbox-image-details-caption').hide();
			if ( settings.imageArray[settings.activeImage][1] ) {
				$('#lightbox-image-details-caption').html(settings.imageArray[settings.activeImage][1]).show();
			}
			// If we have a image set, display 'Image X of X'
			if ( settings.imageArray.length > 1 ) {
				$('#lightbox-image-details-currentNumber').html(settings.txtImage + ' ' + ( settings.activeImage + 1 ) + ' ' + settings.txtOf + ' ' + settings.imageArray.length).show();
			}		
		}
		/**
		 * Display the button navigations
		 *
		 */
		function _set_navigation() {
			$('#lightbox-nav').show();

			// Instead to define this configuration in CSS file, we define here. And itīs need to IE. Just.
			$('#lightbox-nav-btnPrev,#lightbox-nav-btnNext').css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
			
			// Show the prev button, if not the first image in set
			if ( settings.activeImage != 0 ) {
				if ( settings.fixedNavigation ) {
					$('#lightbox-nav-btnPrev').css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' })
						.unbind()
						.bind('click',function() {
							settings.activeImage = settings.activeImage - 1;
							_set_image_to_view();
							return false;
						});
				} else {
					// Show the images button for Next buttons
					$('#lightbox-nav-btnPrev').unbind().hover(function() {
						$(this).css({ 'background' : 'url(' + settings.imageBtnPrev + ') left 15% no-repeat' });
					},function() {
						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
					}).show().bind('click',function() {
						settings.activeImage = settings.activeImage - 1;
						_set_image_to_view();
						return false;
					});
				}
			}
			
			// Show the next button, if not the last image in set
			if ( settings.activeImage != ( settings.imageArray.length -1 ) ) {
				if ( settings.fixedNavigation ) {
					$('#lightbox-nav-btnNext').css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' })
						.unbind()
						.bind('click',function() {
							settings.activeImage = settings.activeImage + 1;
							_set_image_to_view();
							return false;
						});
				} else {
					// Show the images button for Next buttons
					$('#lightbox-nav-btnNext').unbind().hover(function() {
						$(this).css({ 'background' : 'url(' + settings.imageBtnNext + ') right 15% no-repeat' });
					},function() {
						$(this).css({ 'background' : 'transparent url(' + settings.imageBlank + ') no-repeat' });
					}).show().bind('click',function() {
						settings.activeImage = settings.activeImage + 1;
						_set_image_to_view();
						return false;
					});
				}
			}
			// Enable keyboard navigation
			_enable_keyboard_navigation();
		}
		/**
		 * Enable a support to keyboard navigation
		 *
		 */
		function _enable_keyboard_navigation() {
			$(document).keydown(function(objEvent) {
				_keyboard_action(objEvent);
			});
		}
		/**
		 * Disable the support to keyboard navigation
		 *
		 */
		function _disable_keyboard_navigation() {
			$(document).unbind();
		}
		/**
		 * Perform the keyboard actions
		 *
		 */
		function _keyboard_action(objEvent) {
			// To ie
			if ( objEvent == null ) {
				keycode = event.keyCode;
				escapeKey = 27;
			// To Mozilla
			} else {
				keycode = objEvent.keyCode;
				escapeKey = objEvent.DOM_VK_ESCAPE;
			}
			// Get the key in lower case form
			key = String.fromCharCode(keycode).toLowerCase();
			// Verify the keys to close the ligthBox
			if ( ( key == settings.keyToClose ) || ( key == 'x' ) || ( keycode == escapeKey ) ) {
				_finish();
			}
			// Verify the key to show the previous image
			if ( ( key == settings.keyToPrev ) || ( keycode == 37 ) ) {
				// If weīre not showing the first image, call the previous
				if ( settings.activeImage != 0 ) {
					settings.activeImage = settings.activeImage - 1;
					_set_image_to_view();
					_disable_keyboard_navigation();
				}
			}
			// Verify the key to show the next image
			if ( ( key == settings.keyToNext ) || ( keycode == 39 ) ) {
				// If weīre not showing the last image, call the next
				if ( settings.activeImage != ( settings.imageArray.length - 1 ) ) {
					settings.activeImage = settings.activeImage + 1;
					_set_image_to_view();
					_disable_keyboard_navigation();
				}
			}
		}
		/**
		 * Preload prev and next images being showed
		 *
		 */
		function _preload_neighbor_images() {
			if ( (settings.imageArray.length -1) > settings.activeImage ) {
				objNext = new Image();
				objNext.src = settings.imageArray[settings.activeImage + 1][0];
			}
			if ( settings.activeImage > 0 ) {
				objPrev = new Image();
				objPrev.src = settings.imageArray[settings.activeImage -1][0];
			}
		}
		/**
		 * Remove jQuery lightBox plugin HTML markup
		 *
		 */
		function _finish() {
			$('#jquery-lightbox').remove();
			$('#jquery-overlay').fadeOut(function() { $('#jquery-overlay').remove(); });
			// Show some elements to avoid conflict with overlay in IE. These elements appear above the overlay.
			$('embed, object, select').css({ 'visibility' : 'visible' });
		}
		/**
		 / THIRD FUNCTION
		 * getPageSize() by quirksmode.com
		 *
		 * @return Array Return an array with page width, height and window width, height
		 */
		function ___getPageSize() {
			var xScroll, yScroll;
			if (window.innerHeight && window.scrollMaxY) {	
				xScroll = window.innerWidth + window.scrollMaxX;
				yScroll = window.innerHeight + window.scrollMaxY;
			} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
				xScroll = document.body.scrollWidth;
				yScroll = document.body.scrollHeight;
			} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
				xScroll = document.body.offsetWidth;
				yScroll = document.body.offsetHeight;
			}
			var windowWidth, windowHeight;
			if (self.innerHeight) {	// all except Explorer
				if(document.documentElement.clientWidth){
					windowWidth = document.documentElement.clientWidth; 
				} else {
					windowWidth = self.innerWidth;
				}
				windowHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
				windowWidth = document.documentElement.clientWidth;
				windowHeight = document.documentElement.clientHeight;
			} else if (document.body) { // other Explorers
				windowWidth = document.body.clientWidth;
				windowHeight = document.body.clientHeight;
			}	
			// for small pages with total height less then height of the viewport
			if(yScroll < windowHeight){
				pageHeight = windowHeight;
			} else { 
				pageHeight = yScroll;
			}
			// for small pages with total width less then width of the viewport
			if(xScroll < windowWidth){	
				pageWidth = xScroll;		
			} else {
				pageWidth = windowWidth;
			}
			arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
			return arrayPageSize;
		};
		/**
		 / THIRD FUNCTION
		 * getPageScroll() by quirksmode.com
		 *
		 * @return Array Return an array with x,y page scroll values.
		 */
		function ___getPageScroll() {
			var xScroll, yScroll;
			if (self.pageYOffset) {
				yScroll = self.pageYOffset;
				xScroll = self.pageXOffset;
			} else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
				yScroll = document.documentElement.scrollTop;
				xScroll = document.documentElement.scrollLeft;
			} else if (document.body) {// all other Explorers
				yScroll = document.body.scrollTop;
				xScroll = document.body.scrollLeft;	
			}
			arrayPageScroll = new Array(xScroll,yScroll);
			return arrayPageScroll;
		};
		 /**
		  * Stop the code execution from a escified time in milisecond
		  *
		  */
		 function ___pause(ms) {
			var date = new Date(); 
			curDate = null;
			do { var curDate = new Date(); }
			while ( curDate - date < ms);
		 };
		// Return the jQuery object for chaining. The unbind method is used to avoid click conflict when the plugin is called more than once
		return this.unbind('click').click(_initialize);
	};
//--------------------------------------------------
/*
 * jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 JÃķrn Zaefferer
 *
 * $Id: jquery.tooltip.min.js,v 1.1 2009/03/23 10:18:10 osr Exp $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */;(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.tooltip={blocked:false,defaults:{delay:200,fade:false,showURL:true,extraClass:"",top:15,left:15,id:"tooltip"},block:function(){$.tooltip.blocked=!$.tooltip.blocked;}};$.fn.extend({tooltip:function(settings){settings=$.extend({},$.tooltip.defaults,settings);createHelper(settings);return this.each(function(){$.data(this,"tooltip",settings);this.tOpacity=helper.parent.css("opacity");this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).mouseover(save).mouseout(hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(settings){if(helper.parent)return;helper.parent=$('<div id="'+settings.id+'"><h3></h3><div class="body"></div><div class="url"></div></div>').appendTo(document.body).hide();if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function settings(element){return $.data(element,"tooltip");}function handle(event){if(settings(this).delay)tID=setTimeout(show,settings(this).delay);else
show();track=!!settings(this).track;$(document.body).bind('mousemove',update);update(event);}function save(){if($.tooltip.blocked||this==current||(!this.tooltipText&&!settings(this).bodyHandler))return;current=this;title=this.tooltipText;if(settings(this).bodyHandler){helper.title.hide();var bodyContent=settings(this).bodyHandler.call(this);if(bodyContent.nodeType||bodyContent.jquery){helper.body.empty().append(bodyContent)}else{helper.body.html(bodyContent);}helper.body.show();}else if(settings(this).showBody){var parts=title.split(settings(this).showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;(part=parts[i]);i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(settings(this).showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(settings(this).extraClass);if(settings(this).fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;if((!IE||!$.fn.bgiframe)&&settings(current).fade){if(helper.parent.is(":animated"))helper.parent.stop().show().fadeTo(settings(current).fade,current.tOpacity);else
helper.parent.is(':visible')?helper.parent.fadeTo(settings(current).fade,current.tOpacity):helper.parent.fadeIn(settings(current).fade);}else{helper.parent.show();}update();}function update(event){if($.tooltip.blocked)return;if(event&&event.target.tagName=="OPTION"){return;}if(!track&&helper.parent.is(":visible")){$(document.body).unbind('mousemove',update)}if(current==null){$(document.body).unbind('mousemove',update);return;}helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+settings(current).left;top=event.pageY+settings(current).top;var right='auto';if(settings(current).positionLeft){right=$(window).width()-left;left='auto';}helper.parent.css({left:left,right:right,top:top});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+settings(current).left;helper.parent.css({left:left+'px'}).addClass("viewport-right");}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+settings(current).top;helper.parent.css({top:top+'px'}).addClass("viewport-bottom");}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;var tsettings=settings(this);function complete(){helper.parent.removeClass(tsettings.extraClass).hide().css("opacity","");}if((!IE||!$.fn.bgiframe)&&tsettings.fade){if(helper.parent.is(':animated'))helper.parent.stop().fadeTo(tsettings.fade,0,complete);else
helper.parent.stop().fadeOut(tsettings.fade,complete);}else
complete();if(settings(this).fixPNG)helper.parent.unfixPNG();}})(jQuery);
//--------------------------------------------------
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";
		}
	
	}

}


//--------------------------------------------------
if(typeof(rootwwwhttp) != "undefined"){
/* Ajax Error */
$().ajaxError(function(event, request, settings){
    ajax_unset_cursor();
/* alert("Error by calling: " + settings.url) */
});			
/* Ajax Handler  */
var window_cache = new Object();
var window_cache_sort = new Array();
var window_history_sort = new Array();
				
var regex = new RegExp("^.*#");
var regex2 = new RegExp("^"+rootwwwhttp);
var regex3 = new RegExp("^"+rootWWW);
var regex4 = new RegExp("^"+sLangShort+'/');

function  cleanHash (hash){
    hash = hash.replace(regex , '');
    hash = hash.replace(regex2 , '');
    hash = hash.replace(regex3 , '');
    hash = hash.replace(regex4 , '');
    return hash;
}
function init_ajax_anker(selector){
    $(selector ).click(function(){
        var link = $(this);
        if(!link.attr('href_save') ){
            var href = window.location + window.location.search;
            link.attr('href','#'+ href).attr('href_save','#'+ href)
        }
    });
}		
/* WCMS Links für den Ajax Modus initialisieren */
function init_ajax_links(selector, options){
    $(selector + ' a ' ).click(function(){
        var link = $(this);
        var href_tmp = link.attr('href');
        if(!link.attr('href_save')
            &&  href_tmp != ""
            && href_tmp.substring(0,1) != "#"
            && (href_tmp.substring(0,rootwwwhttp.length) == rootwwwhttp || href_tmp.substring(0,rootWWW.length) == rootWWW )){
            /* Es ist ein Link vorhanden, aber dieser wurde noch nicht bearbeitet */
            link.attr('href_save', href_tmp).attr('href','#'+ cleanHash(href_tmp));
			$(this).removeAttr('target');
        } else if (!href_tmp || href_tmp == ""){
            /* Kein Link vorhanden -> Reload vermeiden */
            var location = new String(window.location);
            location = location.split('#');
            if (location[1]){
                link.attr('href', "#"+location[1]);
            } else {
                link.attr('href', '#');
            }
        }
        if(link.attr('href') && link.attr('href_save')){
			
			$.historyLoad(link.attr('href_save'));
			// return false;
		}
    });
}
var ajax =null;
function ajax_get_wcms_content(link , params, options ){
    /* Curosr setzen */
    ajax_set_cursor();
    window_history_sort.push(link);
    if(bAnalytics){
        pageTracker1._trackPageview(sLangShort+'/'+link);
        pageTracker2._trackPageview(sLangShort+'/'+link);
    }
    if (window_cache[link])  {
        ajax_load_wcms_content(window_cache[link]);
    }
    else {
	  if(ajax != null){
		try {
			ajax.abort();
		} catch(e){
		
		}
	  }
       ajax =  $.getJSON(link , {
            ajax : true
        },  function(data){
            $(document).ready(function(){
                ajax_load_wcms_content(data );
            })
            /* Content Cachen */
            if(bWindowCache){
                window_cache_sort.push(link);
                window_cache[link] = data ;
            }
        });
    }
}	

var fadeTime = 500;

function hideODLOContentLightBox(){
	var overlayHolder = $('#odlolightbox-holder');
	overlayHolder.stop().fadeOut(fadeTime, function(){
		overlayHolder.find('#odlolightbox').empty();
	});
}

function showODLOContentLightBox(){
	var elem = $('#odlolightbox-holder');
	elem.find('#breadcrumbs').remove();
	elem.stop().fadeIn(fadeTime);
}
function ajax_load_wcms_content(data) {

	hideODLOContentLightBox();
    /* Titelleiste*/
    if(data.sSiteTitle){
        // siehe http://bugs.adobe.com/jira/browse/FP-240
        sTitle = data.sSiteTitle;
        document.title = data.sSiteTitle;
    }
    /* Full flash content */
    if(data.bClearBody){
        $('body').html(data.htmlCode);
        return;
    }
    var contentWindow = $("#content_window");
    var overlay = $("#overlay");
    var footer = $('#footer');
    var breadcrumbs = $('#breadcrumbs');
    var old_breadcrumbs = breadcrumbs.clone();
    var background_div =  $("#background_div");
    var map_overlay = $("#map_overlay");
    var background_footer_div =  $('.background_footer_div');
    var background_fade =  $('#background_fade');
    
    if(map_overlay.css("display") != "none" ){
        map_overlay
        .css("z-Index" , -1)
        .css("display" , "none")
        .empty();
        contentWindow.css("display" , "block");
    }
    $("#mainnav_add").empty();
    if(background_div.css("display") != "none" ){
        background_div
        .css("z-Index" , -1)
        .css("display" , "none")
        .empty();
    }

    if(overlay.css("display") == "block" && !data.bOverlay){
        overlay.css("z-Index" , -1).fadeOut(250);
        contentWindow.css("display" , "block");
    }
    else {
        if(data.bOverlay && $("#overlay").css("display") == "none" ) {
            overlay.fadeIn(250);
        }
    }
    /* Navigation setzen */
    if(data.iMainNav) {
        $('#mainnav .hover').addClass('hide_nav');
        $('#mainnav .normal ').removeClass('hide_nav');

        $('#nav_main_'+data.iMainNav+'_hover').removeClass("hide_nav");
        $('#nav_main_'+data.iMainNav).addClass("hide_nav");
    }
    /* Content laden */
	if(!data.sLightBox || data.sLightBox == ''){
		$('#midcol').empty().html(data.htmlCode);
	} else {
		$('#odlolightbox').empty().html(data.htmlCode);
		showODLOContentLightBox();
		 ajax_unset_cursor();
		return;
	}
    /* Content Window Klasse*/
    
    contentWindow.attr('class', 'content-window')
    if(data.sContentWindowClass){
        contentWindow.addClass(data.sContentWindowClass);
    }
    if(data.bCWfade) {
        contentWindow.addClass('content-window-fade');
    }else{
        contentWindow.removeClass('content-window-fade');
    }

    /* sBreadcrumb */

    if(data.bBreadcrumb){
        breadcrumbs.css("display", "block");
        if(data.bchangeBreadcrumb){
            breadcrumbs.html(data.sBreadcrumb);
			
        } else {
            breadcrumbs.replaceWith(old_breadcrumbs);
            init_ajax_links('#breadcrumbs');
        }
    }else {
        breadcrumbs.empty();
    }
    /* Falshfilm*/
    if(data.bFlash){
        $('#bgFlash').fadeIn(1);
    } else $('#bgFlash').fadeOut(1);
    /* sBackgroundImage */
    if(data.bchangeBackgroundImage){
		
        var img1 = $('#background_image1');
        img1.css('display', 'none');
        if(data.bBackgroundImage){
            footer.addClass('footer_fade ');
            show_footer();
            if(data.stBackgroundImage){
                img1.attr('src', data.stBackgroundImage.sHeaderImage);
                resize_HeaderImg();
            }
            img1.css('display', 'block');
        } else {
            footer.removeClass('footer_fade ');
            background_footer_div.css('display', 'none');
			
            /* Body - Hintergrund setzen und Bild löschen */
            var img = $('.background_image');
            img.css('display', 'none');
        }
        if(data.bFadeImage){
            background_fade.css('display', 'block');

        } else  {
            background_fade.css('display', 'none');
        }
        footer.attr('class', 'clearfix');
        if(data.bFadeFooter){
            background_footer_div.css('display', 'block');
            footer.addClass('footer_fade');
        } else {
            background_footer_div.css('display', 'none');
        }
        if(data.sFooter ){
            footer.addClass(data.sFooter);
        }
    }
    ajax_unset_cursor();
}
}
			
//--------------------------------------------------
var sTitle = "";
var odloMinHeight = 750;
var odloMinWidth = 1024;
var odloMaxProductImageHeight = 630;

$().ready(function(){
    ajax_load = $('.ajax_load');
    $('body').mousemove(function(e){
        mousepos = e;
        if(typeof(ajax_load) != "undefined"){
            x = e.pageX;
            y =  e.pageY;
            ajax_load.css('left', (x + 20) + "px");
            ajax_load.css('top', (y + 20) + "px");
        }
    }) ;
    // fix for http://bugs.adobe.com/jira/browse/FP-240
    setInterval(function(){
        if(sTitle.length > 0){
            document.title = sTitle;
        }
    }, 150);

    $('body').mousemove(function(){
        if(sTitle.length > 0){
            document.title = sTitle;
        }
    })
    resize_window();
    resize_HeaderImg();
    /* IM FOOTER WIRD DAS HINTERGRUNDBILD NOCH GELADEN !!! */
    $('#content_window').centerScreen();

});

$(window).resize(function(){
    resize_window();
    var win_height = $("#wrapper").height();
    $('.background_footer')
    .css('top', parseInt(win_height-115));
    resize_HeaderImg();
	resizeProductImageIfExists();
});	


function resizeProductImageIfExists (){
	var img = $('#collection_inspiration .image img');
	var bodyHeight= $('body').height();
	// Height berechnet sich aus: body höhe abzüglich padding vom overlay, 
	// abzüglich der tabrow mit farben und related products
	// abzüglich inner padding von der productbox sowie dem padding vom bild
	var productBoxBorderAndPadding =  153 + 20 + 50 + 39
	// var productBoxBorderAndPadding =  156 + 20 + 60 + 39 wegen höhe geändert
	var imageHeight = bodyHeight - productBoxBorderAndPadding;
	if(img.size()){
	
		if(imageHeight > odloMaxProductImageHeight){
			imageHeight = odloMaxProductImageHeight;
		}
		img.height(imageHeight);
	}
	var boxHeight = imageHeight + productBoxBorderAndPadding
	var box =  $('#odlolightbox'); 
	var top = 0;
	if(bodyHeight > boxHeight){
		top = (bodyHeight - boxHeight) / 2 ;
	}
	box.css('top', top);
}







function show_footer(){
    var win_height = $("#wrapper").height();
    $('.background_footer_div').supersleight().css('display', 'block');
    ;
    $('.background_footer').css('top', parseInt(win_height-115));
}
function resize_window(){
    var win_height = $(window).height();
    var win_width =  $(window).width();
    var body = $('body');
    if (win_height <= odloMinHeight){
        body.css('height', odloMinHeight);
        win_height = odloMinHeight;
		body.removeClass('dynamicHeight');
    }else {
        body.css('height', '100%');
		body.addClass('dynamicHeight');
    }
    if (win_width <= odloMinWidth){
        body.css('width', odloMinWidth);
        win_width  = odloMinWidth;
		body.removeClass('dynamicWidth')
    }else {
        body.css('width', '100%');
		body.addClass('dynamicWidth');
    }
    $('#map_google').css('height', win_height  - 87);
    $('#map_holder').css('height', win_height  - 76);
}

function resize_HeaderImg(img){

	if(typeof(iHeaderImgHeight) == "undefined"){
		return;
	}
    var win_h = $('body').height();
    var win_w = $('body').width();
    var img_h = iHeaderImgHeight;
    var img_w = iHeaderImgWidth;
    var dim_h = (win_h/img_h);		/* Bsp: 1.5 Das Fenster ist 1.5 mal so hoch wie das Bild*/
    var dim_w = (win_w/img_w);
    if(!img) 	img = $(".background_image:not('#background_fade')");
    if(dim_w > dim_h){
        /* Bild auf die Breite einstellen und in der Höhe zentrieren */
        var new_h = parseInt(img_h*dim_w);
        var new_w = parseInt(img_w*dim_w);
        //	img.animate({ height: new_h , width: new_w , top : parseInt((new_h-win_h)/-2) , left: 0 }, 1, 'linear');
        img
        .css("height",new_h)
        .css("width",new_w)
        /* nicht nach oben skalieren, da ansonsten die köpfe abgeschnitten werden
			.css("top",parseInt((new_h-win_h)/-2))
			*/
        .css("left",0);
    } else {
        /* Bild auf die Höhe einstellen und in der Breite zentrieren */
        var new_h = parseInt(img_h*dim_h);
        var new_w = parseInt(img_w*dim_h);
        img
        .css("height",new_h)
        .css("width",new_w)
        .css("left",parseInt((new_w-win_w)/-2))
        .css("top",0);
    }
}

function window_close(){
    window.history.back();
}

function getTooltip(type, id){
    var return_val = getOdloAjaxContent('getTooltip', type, id);
    return return_val.htmlCode;
}

function getOdloAjaxContent(uMode, type, id , params, load){
    if(typeof(load) == "undefined" ){
        load = false;
    }
	
    if(!params) params = "";
    if(!type) type = "";
    if(!id) id = "";
    var return_text= new String;
	
    var link = rootCore+'odlo.ajax_operations_mode.cfm?uMode='+uMode+'&uLangID='+iLangId+'&uType='+type+'&uId='+id + params;
					
    if(typeof(window['cache_ajax']) == "undefined"){
        cache_ajax = new Object();
    }
    if(!(cache_ajax[link ]) || load){
		
        jQuery.ajax({
            url : link,
            dataType : 'json',
            cache : false,
            success: function(data, html){
                return_text = data;
            },
            async : false
        })
        cache_ajax[link ] = return_text ;
		
    } else {
        return_text = cache_ajax[link];
    }
    return return_text;
}


function ajax_set_cursor(){
    if(typeof(ajax_load) != "undefined"){
        ajax_load.css('display', 'block');
    }
/* $('body').css('cursor', 'wait'); */
}
	
function ajax_unset_cursor(){
    if(typeof(ajax_load) != "undefined"){
        ajax_load.css('display', 'none');
    }
/* $('body').css('cursor', ''); */
}			

	

//--------------------------------------------------
jQuery.fn.centerScreen = function(elem, loaded) {
    if($('#header').size() == 0){
        return;
    }
    if(!elem) elem = window;
    var header_height= 0;
    if(elem == window){
        header_height = parseInt($('#header').css("padding-top")) + parseInt($('#header').height()) + 20;
    }
    var top_pos = Math.max($(elem).height()/2-this.height()/2, header_height );
    if(typeof(top_pos) != "undefined"){
        var obj = this;
        if(!loaded) {
            obj.css('top', top_pos);
            obj.css('display', 'block');
            $(elem).resize(function()	{
                obj.centerScreen(elem, !loaded);
            });
        } else {
            obj.stop();
            obj.css('top', top_pos);
        }
    }
}

jQuery.fn.middleScreen = function(elem, loaded) {
    if(!elem) elem = window;
    var header_height= 0;
    if(elem == window){
        header_height = parseInt($('#header').css("padding-top")) + parseInt($('#header').height()) + 20;
    }
    var top_pos = Math.max($(elem).height()/2-this.height()/2, header_height );
    var obj = this;
    if(!loaded) {
        obj.css('top', top_pos);
        obj.css('left', Math.max(($(elem).width()/2-this.width()/2),0));
        obj.css('display', 'block');
        $(elem).resize(function()	{
            obj.middleScreen(elem, !loaded);
        });

    } else {
        obj.stop();
        obj.css('top', top_pos);
        obj.css('left', Math.max(($(elem).width()/2-this.width()/2),0));
    }
}

jQuery.fn.supersleight = function(settings) {
    settings = jQuery.extend({
        imgs: true,
        backgrounds: true,
        shim: rootWWW+'img/clear.gif',
        apply_positioning: true
    }, settings);
				
    return this.each(function(){
        if (jQuery.browser.msie && parseInt(jQuery.browser.version) < 7 && parseInt(jQuery.browser.version) > 4) {
            jQuery(this).find('*').each(function(i,obj) {
                var self = jQuery(obj);
                // background pngs
                if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
                    var bg = self.css('background-image');
                    var src = bg.substring(5,bg.length-2);
                    var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
                    var styles = {
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
                        'background-image': 'url('+settings.shim+')'
                    };
                    self.css(styles);
                };
                // image elements
                if (settings.imgs && self.is('img[src$=png]')){
                    var styles = {
                        'width': self.width() + 'px',
                        'height': self.height() + 'px',
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
                    };
                    self.css(styles).attr('src', settings.shim);
                };
                // apply position to 'active' elements
                if (settings.applyPositioning && self.is('a, input') && self.css('position') === ''){
                    self.css('position', 'relative');
                };
            });
        };
    });
};



//--------------------------------------------------
/*
 *  Copyright (c) 2010 trialox.org (trialox AG, Switzerland).
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 * @author osr
 */
 
function StartPage(){
    var that= this;
    this.fade = 1000;
    this.rondellTimer = 60000; // 60 sec

    this.slider = $('.startpage-teaser-slider');
	if($('.fw-wcms-backend').size() > 0){
	
		return;
	}
    this.content_window = $('.content-window');
    this.footer = $('#footer');
    this.arrowR = $('.RightArrow');
    this.arrowL = $('.LeftArrow');
    this.bgImage = $('#background_image1');
    this.startpageFader = $('#startpageFader');
    this.posSlider();
    this.id = this.createUUID();
    $(window).resize(function(){
        if(that.isSamePage){
            that.posSlider();
        }
    });

    
    $('.HomeCenterContent-Inlay ').attr('id', this.id);
    this.titles = $('.HomeCenterContent-Inlay ');

    this.titlesCount = this.titles.size();
    this.index = 1;
    this.imageloader = $('.imageloader');
    this.bgImages = new Object();
    this.titles.each(function(index, value){
        var image = $(this).find('.title-image').attr('rel');
        that.bgImages[index+1] = image;
        that.imageloader.append($('<img/>').attr('src', image));
    })

    this.arrowR.click(function(){
        that.clearInterval()
        that.nextIndex();
        return false;
    });
    this.arrowL.click(function(){
        that.clearInterval()
        that.prevIndex();
        return false;
    });
    this.interval = null;
    if(this.rondellTimer > 0){
		
        this.interval = setInterval(function(){
            if(that.isSamePage()){
                that.nextIndex();
            }else {
                that.clearInterval()
            }
        }, this.rondellTimer+(2*this.fade));
		
    }
}

StartPage.prototype.isSamePage =function(){
    return (this.id == $('.HomeCenterContent-Inlay ').attr('id'));
}

StartPage.prototype.clearInterval =function(){
    if(this.interval){
        clearInterval(this.interval);
        this.interval = null;
    }
}

StartPage.prototype.nextIndex =function(){
    if(this.index < this.titlesCount){
        this.index++;
    } else {
        this.index = 1;
    }
    this.showIndex();
}
StartPage.prototype.prevIndex =function(){
    if(this.index > 1){
        this.index--;
    } else {
        this.index = this.titlesCount;
    }
    this.showIndex();
}
StartPage.prototype.showNewTitle= function(){
    this.titles.css("position", 'absolute').css("left", '-10000px');
    this.bgImage.attr('src', this.bgImages[this.index])
    $(this.titles.get(this.index-1)).css("position", 'relative').css("left", '0px');
    this.startpageFader.fadeOut(this.fade);
}
StartPage.prototype.manageButtons= function(){
    if(this.index == 1){
        this.arrowL.css("visibility",  "hidden");
    } else {
        this.arrowL.css("visibility",  "visible");
    }
    if(this.index == this.titlesCount){
        this.arrowR.css("visibility",  "hidden");
    } else  {
        this.arrowR.css("visibility",  "visible");
    }
}
StartPage.prototype.showIndex= function(){
    var that = this;
    this.startpageFader.fadeIn(this.fade);
    setTimeout(function(){
        that.showNewTitle();
    }, this.fade+100);
}

StartPage.prototype.posSlider = function(){
    var content_window_pos = this.content_window .position();
    if(this.slider.size()  && this.content_window.size() ){
        var left = parseInt(-1*content_window_pos.left);
        var top = 28 + 200;
        var win_height = $(window).height();
		    var footerTop =10;
        var footerTop = this.footer.position().top  ;
        if(footerTop  < win_height){
            win_height = footerTop ;
        }
        if(win_height > content_window_pos.top + top + this.slider.height()){
            top = (((win_height - content_window_pos.top  - this.slider.height() - top)/2)+top);
        }
        this.slider.css({
            left: left,
            top: top
        }).show();
    }
}

StartPage.prototype.createUUID = function() {
    // http://www.ietf.org/rfc/rfc4122.txt
    var s = [];
    var hexDigits = "0123456789ABCDEF";
    for (var i = 0; i < 32; i++) {
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
    }
    s[12] = "4";  // bits 12-15 of the time_hi_and_version field to 0010
    s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1);  // bits 6-7 of the clock_seq_hi_and_reserved to 01

    var uuid = s.join("");
    return uuid;
}

//--------------------------------------------------

function protectMail(){
	$('a[domain]').each(function(){
		var elem = $(this);
		elem.text(elem.text() + '@' + elem.attr('domain'));
		elem.attr('href','mailto:' + elem.text());
	});
}

$().ready(function(){protectMail()});

//<a domain="mydomain.com">firstname.lastname</a>

//--------------------------------------------------
/*	sIFR v2.0.7
	Copyright 2004 - 2008 Mark Wubben and Mike Davidson. Prior contributions by Shaun Inman and Tomas Jogin.
	
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var hasFlash=function(){var a=6;if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1){document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');if(window.hasFlash!=null)return window.hasFlash}if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;return parseInt(b.substr(b.indexOf(".")-2,2),10)>=a}return false}();String.prototype.normalize=function(){return this.replace(/\s+/g," ")};if(Array.prototype.push==null){Array.prototype.push=function(){var i=0,a=this.length,b=arguments.length;while(i<b){this[a++]=arguments[i++]}return this.length}}if(!Function.prototype.apply){Function.prototype.apply=function(a,b){var c=[];var d,e;if(!a)a=window;if(!b)b=[];for(var i=0;i<b.length;i++){c[i]="b["+i+"]"}e="a.__applyTemp__("+c.join(",")+");";a.__applyTemp__=this;d=eval(e);a.__applyTemp__=null;return d}}function named(a){return new named.Arguments(a)}named.Arguments=function(a){this.oArgs=a};named.Arguments.prototype.constructor=named.Arguments;named.extract=function(a,b){var c,d;var i=a.length;while(i--){d=a[i];if(d!=null&&d.constructor!=null&&d.constructor==named.Arguments){c=a[i].oArgs;break}}if(c==null)return;for(e in c)if(b[e]!=null)b[e](c[e]);return};var parseSelector=function(){var a=/^([^#.>`]*)(#|\.|\>|\`)(.+)$/;function r(s,t){var u=s.split(/\s*\,\s*/);var v=[];for(var i=0;i<u.length;i++)v=v.concat(b(u[i],t));return v}function b(c,d,e){c=c.normalize().replace(" ","`");var f=c.match(a);var g,h,i,j,k,n;var l=[];if(f==null)f=[c,c];if(f[1]=="")f[1]="*";if(e==null)e="`";if(d==null)d=document;switch(f[2]){case "#":k=f[3].match(a);if(k==null)k=[null,f[3]];g=document.getElementById(k[1]);if(g==null||(f[1]!="*"&&!o(g,f[1])))return l;if(k.length==2){l.push(g);return l}return b(k[3],g,k[2]);case ".":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;k=f[3].match(a);if(k!=null){if(g.className==null||g.className.match("(\\s|^)"+k[1]+"(\\s|$)")==null)continue;j=b(k[3],g,k[2]);l=l.concat(j)}else if(g.className!=null&&g.className.match("(\\s|^)"+f[3]+"(\\s|$)")!=null)l.push(g)}return l;case ">":if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;j=b(f[3],g,">");l=l.concat(j)}return l;case "`":h=m(d,f[1]);for(i=0,n=h.length;i<n;i++){g=h[i];j=b(f[3],g,"`");l=l.concat(j)}return l;default:if(e!=">")h=m(d,f[1]);else h=d.childNodes;for(i=0,n=h.length;i<n;i++){g=h[i];if(g.nodeType!=1)continue;if(!o(g,f[1]))continue;l.push(g)}return l}}function m(d,o){if(o=="*"&&d.all!=null)return d.all;return d.getElementsByTagName(o)}function o(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}return r}();var sIFR=function(){var a="http://www.w3.org/1999/xhtml";var b=false;var c=false;var d;var ah=[];var al=document;var ak=al.documentElement;var am=window;var au=al.addEventListener;var av=am.addEventListener;var f=function(){var g=navigator.userAgent.toLowerCase();var f={a:g.indexOf("applewebkit")>-1,b:g.indexOf("safari")>-1,c:navigator.product!=null&&navigator.product.toLowerCase().indexOf("konqueror")>-1,d:g.indexOf("opera")>-1,e:al.contentType!=null&&al.contentType.indexOf("xml")>-1,f:true,g:true,h:null,i:null,j:null,k:null};f.l=f.a||f.c;f.m=!f.a&&navigator.product!=null&&navigator.product.toLowerCase()=="gecko";if(f.m&&g.match(/.*gecko\/(\d{8}).*/))f.j=new Number(g.match(/.*gecko\/(\d{8}).*/)[1]);f.n=g.indexOf("msie")>-1&&!f.d&&!f.l&&!f.m;f.o=f.n&&g.match(/.*mac.*/)!=null;if(f.d&&g.match(/.*opera(\s|\/)(\d+\.\d+)/))f.i=new Number(g.match(/.*opera(\s|\/)(\d+\.\d+)/)[2]);if(f.n||(f.d&&f.i<7.6))f.g=false;if(f.a&&g.match(/.*applewebkit\/(\d+).*/))f.k=new Number(g.match(/.*applewebkit\/(\d+).*/)[1]);if(am.hasFlash&&(!f.n||f.o)){var aj=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;f.h=parseInt(aj.substr(aj.indexOf(".")-2,2),10)}if(g.match(/.*(windows|mac).*/)==null||f.o||f.c||(f.d&&(g.match(/.*mac.*/)!=null||f.i<7.6))||(f.b&&f.h<7)||(!f.b&&f.a&&f.k<312)||(f.m&&f.j<20020523))f.f=false;if(!f.o&&!f.m&&al.createElementNS)try{al.createElementNS(a,"i").innerHTML=""}catch(e){f.e=true}f.p=f.c||(f.a&&f.k<312);return f}();function at(){return{bIsWebKit:f.a,bIsSafari:f.b,bIsKonq:f.c,bIsOpera:f.d,bIsXML:f.e,bHasTransparencySupport:f.f,bUseDOM:f.g,nFlashVersion:f.h,nOperaVersion:f.i,nGeckoBuildDate:f.j,nWebKitVersion:f.k,bIsKHTML:f.l,bIsGecko:f.m,bIsIE:f.n,bIsIEMac:f.o,bUseInnerHTMLHack:f.p}}if(am.hasFlash==false||!al.getElementsByTagName||!al.getElementById||(f.e&&(f.p||f.n)))return{UA:at()};function af(e){if((!k.bAutoInit&&(am.event||e)!=null)||!l(e))return;b=true;for(var i=0,h=ah.length;i<h;i++)j.apply(null,ah[i]);ah=[]}var k=af;function l(e){if(c==false||k.bIsDisabled==true||((f.e&&f.m||f.l)&&e==null&&b==false)||al.getElementsByTagName("body").length==0)return false;return true}function m(n){if(f.n)return n.replace(new RegExp("%\d{0}","g"),"%25");return n.replace(new RegExp("%(?!\d)","g"),"%25")}function as(p,q){return q=="*"?true:p.nodeName.toLowerCase().replace("html:", "")==q.toLowerCase()}function o(p,q,r,s,t){var u="";var v=p.firstChild;var w,x,y,z;if(s==null)s=0;if(t==null)t="";while(v){if(v.nodeType==3){z=v.nodeValue.replace("<","&lt;");switch(r){case "lower":u+=z.toLowerCase();break;case "upper":u+=z.toUpperCase();break;default:u+=z}}else if(v.nodeType==1){if(as(v,"a")&&!v.getAttribute("href")==false){if(v.getAttribute("target"))t+="&sifr_url_"+s+"_target="+v.getAttribute("target");t+="&sifr_url_"+s+"="+m(v.getAttribute("href")).replace(/&/g,"%26");u+='<a href="asfunction:_root.launchURL,'+s+'">';s++}else if(as(v,"br"))u+="<br/>";if(v.hasChildNodes()){y=o(v,null,r,s,t);u+=y.u;s=y.s;t=y.t}if(as(v,"a"))u+="</a>"}w=v;v=v.nextSibling;if(q!=null){x=w.parentNode.removeChild(w);q.appendChild(x)}}return{"u":u,"s":s,"t":t}}function A(B){if(al.createElementNS&&f.g)return al.createElementNS(a,B);return al.createElement(B)}function C(D,E,z){var p=A("param");p.setAttribute("name",E);p.setAttribute("value",z);D.appendChild(p)}function F(p,G){var H=p.className;if(H==null)H=G;else H=H.normalize()+(H==""?"":" ")+G;p.className=H}function aq(ar){var a=ak;if(k.bHideBrowserText==false)a=al.getElementsByTagName("body")[0];if((k.bHideBrowserText==false||ar)&&a)if(a.className==null||a.className.match(/\bsIFR\-hasFlash\b/)==null)F(a, "sIFR-hasFlash")}function j(I,J,K,L,M,N,O,P,Q,R,S,r,T){if(!l())return ah.push(arguments);aq();named.extract(arguments,{sSelector:function(ap){I=ap},sFlashSrc:function(ap){J=ap},sColor:function(ap){K=ap},sLinkColor:function(ap){L=ap},sHoverColor:function(ap){M=ap},sBgColor:function(ap){N=ap},nPaddingTop:function(ap){O=ap},nPaddingRight:function(ap){P=ap},nPaddingBottom:function(ap){Q=ap},nPaddingLeft:function(ap){R=ap},sFlashVars:function(ap){S=ap},sCase:function(ap){r=ap},sWmode:function(ap){T=ap}});var U=parseSelector(I);if(U.length==0)return false;if(S!=null)S="&"+S.normalize();else S="";if(K!=null)S+="&textcolor="+K;if(M!=null)S+="&hovercolor="+M;if(M!=null||L!=null)S+="&linkcolor="+(L||K);if(O==null)O=0;if(P==null)P=0;if(Q==null)Q=0;if(R==null)R=0;if(N==null)N="#FFFFFF";if(T=="transparent")if(!f.f)T="opaque";else N="transparent";if(T==null)T="";var p,V,W,X,Y,Z,aa,ab,ac;var ad=null;for(var i=0,h=U.length;i<h;i++){p=U[i];if(p.className!=null&&p.className.match(/\bsIFR\-replaced\b/)!=null)continue;V=p.offsetWidth-R-P;W=p.offsetHeight-O-Q;aa=A("span");aa.className="sIFR-alternate";ac=o(p,aa,r);Z="txt="+m(ac.u).replace(/\+/g,"%2B").replace(/&/g,"%26").replace(/\"/g, "%22").normalize() + S + "&w=" + V + "&h=" + W + ac.t;F(p,"sIFR-replaced");if(ad==null||!f.g){if(!f.g){if(!f.n)p.innerHTML=['<embed class="sIFR-flash" type="application/x-shockwave-flash" src="',J,'" quality="best" wmode="',T,'" bgcolor="',N,'" flashvars="',Z,'" width="',V,'" height="',W,'" sifr="true"></embed>'].join("");else p.innerHTML=['<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" sifr="true" width="',V,'" height="',W,'" class="sIFR-flash"><param name="movie" value="',J,'"></param><param name="flashvars" value="',Z,'"></param><param name="quality" value="best"></param><param name="wmode" value="',T,'"></param><param name="bgcolor" value="',N,'"></param> </object>'].join('')}else{if(f.d){ab=A("object");ab.setAttribute("data",J);C(ab,"quality","best");C(ab,"wmode",T);C(ab,"bgcolor",N)}else{ab=A("embed");ab.setAttribute("src",J);ab.setAttribute("quality","best");ab.setAttribute("flashvars",Z);ab.setAttribute("wmode",T);ab.setAttribute("bgcolor",N)}ab.setAttribute("sifr","true");ab.setAttribute("type","application/x-shockwave-flash");ab.className="sIFR-flash";if(!f.l||!f.e)ad=ab.cloneNode(true)}}else ab=ad.cloneNode(true);if(f.g){if(f.d)C(ab,"flashvars",Z);else ab.setAttribute("flashvars",Z);ab.setAttribute("width",V);ab.setAttribute("height",W);ab.style.width=V+"px";ab.style.height=W+"px";p.appendChild(ab)}p.appendChild(aa);if(f.p)p.innerHTML+=""}if(f.n&&k.bFixFragIdBug)setTimeout(function(){al.title=d},0)}function ai(){d=al.title}function ae(){if(k.bIsDisabled==true)return;c=true;if(k.bHideBrowserText)aq(true);if(am.attachEvent)am.attachEvent("onload",af);else if(!f.c&&(al.addEventListener||am.addEventListener)){if(f.a&&f.k>=132&&am.addEventListener)am.addEventListener("load",function(){setTimeout("sIFR({})",1)},false);else{if(al.addEventListener)al.addEventListener("load",af,false);if(am.addEventListener)am.addEventListener("load",af,false)}}else if(typeof am.onload=="function"){var ag=am.onload;am.onload=function(){ag();af()}}else am.onload=af;if(!f.n||am.location.hash=="")k.bFixFragIdBug=false;else ai()}k.UA=at();k.bAutoInit=true;k.bFixFragIdBug=true;k.replaceElement=j;k.updateDocumentTitle=ai;k.appendToClassName=F;k.setup=ae;k.debug=function(){aq(true)};k.debug.replaceNow=function(){ae();k()};k.bIsDisabled=false;k.bHideBrowserText=true;return k}();
/*
if(typeof sIFR == "function"){
    // sIFR.setup();
   // sIFR.debug();

};
*/



if(typeof sIFR == "function" && !sIFR.UA.bIsIEMac && (!sIFR.UA.bIsWebKit || sIFR.UA.nWebKitVersion >= 100)){
	sIFR.setup();

};


//--------------------------------------------------
/*
        Unobtrusive Slider Control by frequency decoder v2.4 (http://www.frequency-decoder.com/)

        Released under a creative commons Attribution-Share Alike 3.0 Unported license (http://creativecommons.org/licenses/by-sa/3.0/)

        You are free:

        * to copy, distribute, display, and perform the work
        * to make derivative works
        * to make commercial use of the work

        Under the following conditions:

                by Attribution.
                --------------
                You must attribute the work in the manner specified by the author or licensor.

                sa
                --
                Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under a license identical to this one.

        * For any reuse or distribution, you must make clear to others the license terms of this work.
        * Any of these conditions can be waived if you get permission from the copyright holder.
*/

var fdSliderController = (function() {
        var sliders           = {},
            uniqueid          = 0,
            mouseWheelEnabled = true;
                
        var removeMouseWheelSupport = function() {
                mouseWheelEnabled = false;
        };                       
        var addEvent = function(obj, type, fn) {
                if( obj.attachEvent ) {
                        obj["e"+type+fn] = fn;
                        obj[type+fn] = function(){obj["e"+type+fn]( window.event );};
                        obj.attachEvent( "on"+type, obj[type+fn] );
                } else { obj.addEventListener( type, fn, true ); }
        };
        var removeEvent = function(obj, type, fn) {
                if( obj.detachEvent ) {
                        try {
                                obj.detachEvent( "on"+type, obj[type+fn] );
                                obj[type+fn] = null;
                        } catch(err) { };
                } else { obj.removeEventListener( type, fn, true ); }
        };
        var stopEvent = function(e) {
                if(e == null) e = document.parentWindow.event;
                if(e.stopPropagation) {
                        e.stopPropagation();
                        e.preventDefault();
                };
                
                /*@cc_on@*/
                /*@if(@_win32)
                e.cancelBubble = true;
                e.returnValue = false;
                /*@end@*/
                
                return false;
        };                                           
        var joinNodeLists = function() {
                if(!arguments.length) { return []; };
                var nodeList = [];
                for (var i = 0; i < arguments.length; i++) {
                        for (var j = 0, item; item = arguments[i][j]; j++) { nodeList[nodeList.length] = item; };
                };
                return nodeList;
        };

        // Function by Artem B. with a minor change by f.d.
        var parseCallbacks = function(cbs) {
                if(cbs == null) { return {}; };
                var func,
                    type,
                    cbObj = {},
                    parts,
                    obj;
                for(var i = 0, fn; fn = cbs[i]; i++) {
                        type = fn.match(/(fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+)/i)[1];
                        fn   = fn.replace(new RegExp("^"+type), "").replace(/-/g, ".");
                        type = type.replace(/^fd_slider_cb_/i, "").replace(/_$/, "");

                        try {
                                if(fn.indexOf(".") != -1) {
                                        parts = fn.split('.');
                                        obj   = window;
                                        for (var x = 0, part; part = obj[parts[x]]; x++) {
                                                if(part instanceof Function) {
                                                        (function() {
                                                                var method = part;
                                                                func = function (data) { method.apply(obj, [data]) };
                                                        })();
                                                } else {
                                                obj = part;
                                                };
                                        };
                                } else {
                                        func = window[fn];
                                };
                            
                                if(!(func instanceof Function)) continue;
                                if(!(type in cbObj)) { cbObj[type] = []; };
                                cbObj[type][cbObj[type].length] = func;
                        } catch (err) {};
                };
                return cbObj;
        };
                
        var parseClassNames = function(cbs) {
                if(cbs == null) { return ""; };
                var cns = [];                    
                for(var i = 0, cn; cn = cbs[i]; i++) { 
                        cns[cns.length] = cn.replace(/^fd_slider_cn_/, "");                                                                 
                };                 
                return cns.join(" ");
        };
        var createSlider = function(options) {
                if(!options.inp || !options.inp.id) { return false; };
                destroySingleSlider(options.inp.id);
                sliders[options.inp.id] = new fdSlider(options);
                return true;
        };                
        var init = function( elem) {
                var ranges     = /fd_range_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/i,
                    increment  = /fd_inc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,
                    height  = /fd_height_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,
                    kIncrement = /fd_maxinc_([-]{0,1}[0-9]+(d[0-9]+){0,1}){1}/,
                    callbacks  = /((fd_slider_cb_(update|create|destroy|redraw|move|focus|blur)_)([^\s|$]+))/ig, 
                    classnames = /(fd_slider_cn_([a-zA-Z0-9_\-]+))/ig,
                    inputs     = elem && elem.tagName && elem.tagName.search(/input|select/i) != -1 ? [elem] : joinNodeLists(document.getElementsByTagName('input'), document.getElementsByTagName('select')),
                    range, 
                    tmp, 
                    options;

                for(var i = 0, inp; inp = inputs[i]; i++) {
                        if((inp.tagName.toLowerCase() == "input" && inp.type == "text" && (inp.className.search(ranges) != -1 || inp.className.search(/fd_slider/) != -1)) || (inp.tagName.toLowerCase() == "select" && inp.className.search(/fd_slider/) != -1)) {
                                // If we haven't been passed a specific id and the slider exists then continue
                                if(!elem && inp.id && document.getElementById("fd-slider-"+inp.id)) { continue; };
                                        
                                // Create an id if necessary
                                if(!inp.id) { inp.id == "sldr" + uniqueid++; };                       
                                       
 								test=          inp.className.search(height) != -1 ? inp.className.match(height)[0].replace("fd_height_", "").replace("d",".") : "19";
                                options = {
                                        inp:            inp,
                                        inc:            inp.className.search(increment)  != -1 ? inp.className.match(increment)[0].replace("fd_inc_", "").replace("d",".") : "1",
                                        maxInc:         inp.className.search(kIncrement) != -1 ? inp.className.match(kIncrement)[0].replace("fd_maxinc_", "").replace("d",".") : false,
                                        range:          [0,100],
                                        h: test,
                                        callbacks:      parseCallbacks(inp.className.match(callbacks)),
                                        classNames:     parseClassNames(inp.className.match(classnames)),
                                        tween:          inp.className.search(/fd_tween/i) != -1,
                                        vertical:       inp.className.search(/fd_vertical/i) != -1,
                                        hideInput:      inp.className.search(/fd_hide_input/i) != -1,
                                        clickJump:      inp.className.search(/fd_jump/i) != -1,
                                        fullARIA:       inp.className.search(/fd_full_aria/i) != -1,
                                        noMouseWheel:   inp.className.search(/fd_disable_mousewheel/i) != -1
                                };
                                        
                                if(inp.tagName.toLowerCase() == "select") {
                                        options.range = [0, inp.options.length - 1];                                                
                                } else if(inp.className.search(ranges) != -1) {                                                
                                        range = inp.className.match(ranges)[0].replace("fd_range_", "").replace(/d/g,".").split("_");                                                 
                                        options.range = [range[0], range[1]];                                                                                                  
                                };                                       
                                        
                                createSlider(options);                                        
                        };
                };
                return true;
        };
        var destroySingleSlider = function(id) {
                if(id in sliders) { 
                        sliders[id].destroy(); 
                        delete sliders[id]; 
                        return true;
                };
                return false;
        };
        var destroyAllsliders = function(e) {
                for(slider in sliders) { sliders[slider].destroy(); };                        
        };
        var unload = function(e) {
                destroyAllsliders();
                sliders = null;                         
                removeEvent(window, "unload", unload);
                removeEvent(window, "resize", resize);
                removeOnloadEvent();
        };                  
        var resize = function(e) {
                for(slider in sliders) { sliders[slider].onResize(); };        
        };                 
        var removeOnloadEvent = function() {
                removeEvent(window, "load", init);
                /*@cc_on@*/
                /*@if(@_win32)
                removeEvent(window, "load",   function() { setTimeout(onload, 200) });
                /*@end@*/
        };              
        function fdSlider(options) {
                var inp         = options.inp,
                    tagName     = inp.tagName.toLowerCase(),                      
                    min         = +options.range[0],
                    max         = +options.range[1], 
                    range       = Math.abs(max - min),
                    inc         = tagName == "select" ? 1 : +options.inc||1,
                    maxInc      = options.maxInc ? options.maxInc : inc * 2,
                    precision   = options.inc.search(".") != -1 ? options.inc.substr(options.inc.indexOf(".")+1, options.inc.length - 1).length : 0,
                    steps       = Math.ceil(range / inc),
                    useTween    = !!options.tween,
                    fullARIA    = !!options.fullARIA,
                    hideInput   = !!options.hideInput,                                                 
                    clickJump   = useTween ? false : !!options.clickJump,                                        
                    vertical    = !!options.vertical,
                    callbacks   = options.callbacks,
                    classNames  = options.classNames,
                    noMWheel    = !!options.noMouseWheel,                    
                    timer       = null,
                    kbEnabled   = true,                    
                    sliderH     = 0,
                    sliderW     = 0, 
                    tweenX      = 0,
                    tweenB      = 0,
                    tweenC      = 0,
                    tweenD      = 0,
                    frame       = 0,
                    x           = 0,                    
                    y           = 0, 
                    h			= options.h,                
                    maxPx       = 0,
                    handlePos   = 0,                    
                    destPos     = 0,                    
                    mousePos    = 0,
                    deltaPx     = 0, 
                    stepPx      = 0,
                    self        = this,
                    changeList  = {},
                    initVal     = null,
                    outerWrapper,
                    wrapper,
                    handle,
                    bar;                                 
                
                if(max < min) {
                        inc    = -inc;
                        maxInc = -maxInc;
                };
                 
                function destroySlider() {
                        try {                                         
                                removeEvent(outerWrapper, "mouseover", onMouseOver);
                                removeEvent(outerWrapper, "mouseout",  onMouseOut);
                                removeEvent(outerWrapper, "mousedown", onMouseDown);
                                removeEvent(handle, "focus",     onFocus);
                                removeEvent(handle, "blur",      onBlur);                        
                                if(!window.opera) {
                                        removeEvent(handle, "keydown",   onKeyDown);  
                                        removeEvent(handle, "keypress",  onKeyPress); 
                                } else {
                                        removeEvent(handle, "keypress",  onKeyDown);
                                };                                             
                                removeEvent(handle, "mousedown", onHandleMouseDown);
                                removeEvent(handle, "mouseup",   onHandleMouseUp);

                                if(mouseWheelEnabled && !noMWheel) {
                                        if (window.addEventListener && !window.devicePixelRatio) window.removeEventListener('DOMMouseScroll', trackMouseWheel, false);
                                        else {
                                                removeEvent(document, "mousewheel", trackMouseWheel);
                                                removeEvent(window,   "mousewheel", trackMouseWheel);
                                        };
                                };
                        } catch(err) {};
                        wrapper = bar = handle = outerWrapper = timer = null;
                        callback("destroy");
                        callbacks = null;
                };
                
                function redraw() {
                        locate();
                        // Internet Explorer requires the try catch
                        try {
                                var sW = outerWrapper.offsetWidth,
                                    sH = outerWrapper.offsetHeight,
                                    hW = handle.offsetWidth,
                                    hH = handle.offsetHeight,
                                    bH = bar.offsetHeight,
                                    bW = bar.offsetWidth; 
                                
                                maxPx     = vertical ? sH - hH : sW - hW;
                                stepPx    = maxPx / steps;                                                 
                                deltaPx   = maxPx / Math.ceil(range / maxInc);
                                
                                sliderW = sW;
                                sliderH = sH;
                                
                                valueToPixels();
                        } catch(err) { };
                        callback("redraw");
                };
                
                function callback(type) {
                        
                        var cbObj = {"elem":inp, "value":tagName == "select" ? inp.options[inp.selectedIndex].value : inp.value};
                        if(type in callbacks) {
                                for(var i = 0, func; func = callbacks[type][i]; i++) {
                                        func(cbObj);
                                };
                        }; 
                };

                function onFocus(e) {
                        outerWrapper.className = outerWrapper.className.replace('focused','') + ' focused';
                        if(mouseWheelEnabled && !noMWheel) {
                                addEvent(window, 'DOMMouseScroll', trackMouseWheel);
                                addEvent(document, 'mousewheel', trackMouseWheel);
                                if(!window.opera) addEvent(window,   'mousewheel', trackMouseWheel); 
                        }; 
                        callback("focus");                      
                };
                
                function onBlur(e) {
                        outerWrapper.className = outerWrapper.className.replace(/focused|fd-fc-slider-hover|fd-slider-hover/g,'');
                        if(mouseWheelEnabled && !noMWheel) {
                                removeEvent(document, 'mousewheel', trackMouseWheel);
                                removeEvent(window, 'DOMMouseScroll', trackMouseWheel);
                                if(!window.opera) removeEvent(window,   'mousewheel', trackMouseWheel);
                        };
                        callback("blur");
                };
                
                function trackMouseWheel(e) {
                        if(!kbEnabled) return;
                        e = e || window.event;
                        var delta = 0;
                            
                        if (e.wheelDelta) {
                                delta = e.wheelDelta/120;
                                if (window.opera && window.opera.version() < 9.2) delta = -delta;
                        } else if(e.detail) {
                                delta = -e.detail/3;
                        };
                        
                        if(vertical) { delta = -delta; };
                        
                        if(delta) {
                                var xtmp = vertical ? handle.offsetTop : handle.offsetLeft;
                                xtmp = (delta < 0) ? Math.ceil(xtmp + deltaPx) : Math.floor(xtmp - deltaPx);                                
                                pixelsToValue(Math.min(Math.max(xtmp, 0), maxPx));
                        }
                        return stopEvent(e);
                };                  
                
                function onKeyPress(e) {                        
                        e = e || document.parentWindow.event;                         
                        if ((e.keyCode >= 33 && e.keyCode <= 40) || !kbEnabled || e.keyCode == 45 || e.keyCode == 46) {                                 
                                return stopEvent(e);
                        };
                        return true;
                };               
                        
                function onKeyDown(e) {
                        if(!kbEnabled) return true;

                        e = e || document.parentWindow.event;
                        var kc = e.keyCode != null ? e.keyCode : e.charCode;
                        
                        if ( kc < 33 || (kc > 40 && (kc != 45 && kc != 46))) return true;

                        var value = tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex;
                        if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);    
                        
                        if( kc == 37 || kc == 40 || kc == 46 || kc == 34) {
                                // left, down, ins, page down                                                              
                                value -= (e.ctrlKey || kc == 34 ? maxInc : inc)
                        } else if( kc == 39 || kc == 38 || kc == 45 || kc == 33) {
                                // right, up, del, page up                                                                  
                                value += (e.ctrlKey || kc == 33 ? maxInc : inc)
                        } else if( kc == 35 ) {
                                // max                                
                                value = max;
                        } else if( kc == 36 ) {
                                // min                                
                                value = min;
                        };  
                        
                        valueToPixels(value);
                        callback("update");
                        
                        // Opera doesn't let us cancel key events so the up/down arrows and home/end buttons will scroll the screen - which sucks
                        return stopEvent(e);
                };                                     
                               
                function onMouseOver( e ) {
                        /*@cc_on@*/
                        /*@if(@_jscript_version <= 5.6)
                        if(this.className.search(/focused/) != -1) {
                                this.className = this.className.replace("fd-fc-slider-hover", "") +' fd-fc-slider-hover';
                                return;
                        }
                        /*@end@*/
                        this.className = this.className.replace(/fd\-slider\-hover/g,"") +' fd-slider-hover';
                };  
                              
                function onMouseOut( e ) {
                        /*@cc_on@*/
                        /*@if(@_jscript_version <= 5.6)
                        if(this.className.search(/focused/) != -1) {
                                this.className = this.className.replace("fd-fc-slider-hover", "");
                                return;
                        }
                        /*@end@*/
                        this.className = this.className.replace(/fd\-slider\-hover/g,"");
                };
                
                function onHandleMouseUp(e) {
                        e = e || window.event;
                        removeEvent(document, 'mousemove', trackMouse);
                        removeEvent(document, 'mouseup',   onHandleMouseUp);
                        
                        kbEnabled = true;

                        // Opera fires the blur event when the mouseup event occurs on a button, so we attept to force a focus
                        if(window.opera) try { setTimeout(function() { onfocus(); }, 0); } catch(err) {};
                        document.body.className = document.body.className.replace(/slider-drag-vertical|slider-drag-horizontal/g, "");
                              
                        return stopEvent(e);
                };
                
                function onHandleMouseDown(e) {
                        e = e || window.event;
                        mousePos  = vertical ? e.clientY : e.clientX;
                        handlePos = parseInt(vertical ? handle.offsetTop : handle.offsetLeft)||0;                        
                        kbEnabled = false;
                        
                        clearTimeout(timer);
                        timer = null;
                                
                        addEvent(document, 'mousemove', trackMouse);
                        addEvent(document, 'mouseup', onHandleMouseUp);
                                
                        // Force a "focus" on the button on mouse events
                        if(window.devicePixelRatio || (document.all && !window.opera)) try { setTimeout(function() { handle.focus(); }, 0); } catch(err) {};
                        
                        document.body.className += " slider-drag-" + (vertical ? "vertical" : "horizontal");
                };
                
                function onMouseUp( e ) {
                        e = e || window.event;
                        removeEvent(document, 'mouseup', onMouseUp);
                        if(!useTween) {
                                clearTimeout(timer);
                                timer = null;
                                kbEnabled = true;
                        };                        
                        return stopEvent(e);
                };
                
                function trackMouse( e ) {                                                  
                        e = e || window.event;                        
                        pixelsToValue(snapToNearestValue(handlePos + (vertical ? e.clientY - mousePos : e.clientX - mousePos)));                                          
                };
                
                function onMouseDown( e ) {
                        e = e || window.event;
                        var targ;                          
                        if (e.target) targ = e.target;
                        else if (e.srcElement) targ = e.srcElement;
                        if (targ.nodeType == 3) targ = targ.parentNode;

                        if(targ.className.search("fd-slider-handle") != -1) { return true; };
                                
                        try { setTimeout(function() { handle.focus(); }, 0); } catch(err) { };                                               
                        
                        clearTimeout(timer);
                        locate();
                        
                        timer     = null;
                        kbEnabled = false;                           
                        
                        var posx        = 0,
                            sLft        = 0,
                            sTop        = 0;

                        // Internet Explorer doctype woes
                        if (document.documentElement && document.documentElement.scrollTop) {
                                sTop = document.documentElement.scrollTop;
                                sLft = document.documentElement.scrollLeft;
                        } else if (document.body) {
                                sTop = document.body.scrollTop;
                                sLft = document.body.scrollLeft;
                        };

                        if (e.pageX)            posx = vertical ? e.pageY : e.pageX;
                        else if (e.clientX)     posx = vertical ? e.clientY + sTop : e.clientX + sLft;
                        posx -= vertical ? y + Math.round(handle.offsetHeight / 2) : x + Math.round(handle.offsetWidth / 2);                         
                        posx = snapToNearestValue(posx);                         
                        
                        if(useTween) {
                                tweenTo(posx);
                        } else if(clickJump) {
                                pixelsToValue(posx);
                        } else {
                                addEvent(document, 'mouseup', onMouseUp);
                                destPos = posx;
                                onTimer();
                        };                    
                };

                function incrementHandle(numOfSteps) { 
                        var value = tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex;
                        if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);  
                        value += inc * numOfSteps;
                        valueToPixels(value);                                               
                };
                
                function snapToNearestValue(px) {
                        var rem = px % stepPx;
                        if(rem && rem >= (stepPx / 2)) { px += (stepPx - rem); } 
                        else { px -= rem;  };                        
                        return Math.min(Math.max(parseInt(px, 10), 0), maxPx);        
                };                 
                
                function locate(){
                        var curleft = 0,
                            curtop  = 0,
                            obj     = outerWrapper;
                            
                        // Try catch for IE's benefit
                        try {
                                while (obj.offsetParent) {
                                        curleft += obj.offsetLeft;
                                        curtop  += obj.offsetTop;
                                        obj      = obj.offsetParent;
                                };
                        } catch(err) {};
                        x = curleft;
                        y = curtop;
                };
                
                function onTimer() {
                        var xtmp = vertical ? handle.offsetTop : handle.offsetLeft;
                        xtmp = Math.round((destPos < xtmp) ? Math.max(destPos, Math.floor(xtmp - deltaPx)) : Math.min(destPos, Math.ceil(xtmp + deltaPx)));                  
                        pixelsToValue(xtmp);
                        if(xtmp != destPos) timer = setTimeout(onTimer, steps > 20 ? 50 : 100);
                        else kbEnabled = true;
                };

                var tween = function(){
                        frame++;
                        var c = tweenC,
                            d = 20,
                            t = frame,
                            b = tweenB,
                            x = Math.ceil((t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b);

                        pixelsToValue(t == d ? tweenX : x);
                        callback("move");
                        if(t!=d) timer = setTimeout(tween, 20);
                        else {
                                clearTimeout(timer);
                                timer     = null;
                                kbEnabled = true;
                        };
                };

                function tweenTo(tx){
                        kbEnabled = false;
                        tweenX = parseInt(tx, 10);
                        tweenB = parseInt(vertical ? handle.style.top : handle.style.left, 10);
                        tweenC = tweenX - tweenB;
                        tweenD = 20;
                        frame  = 0;
                        if(!timer) timer = setTimeout(tween, 20);
                };
                
                function pixelsToValue(px) {                       
                        handle.style[vertical ? "top" : "left"] = px + "px";                                                                                                                              
                        var val = min + (Math.round(px / stepPx) * inc);                                                                                                                                                      
                        setInputValue((tagName == "select" || inc == 1) ? Math.round(val) : val);                         
                };
                
                function valueToPixels(val) {
                        var value = isNaN(val) ? tagName == "input" ? parseFloat(inp.value) : inp.selectedIndex : val;
                        if(isNaN(value) || value < Math.min(min,max)) value = Math.min(min,max);
                        else if(value > Math.max(min,max)) value = Math.max(min,max);                         
                        setInputValue(value);                                                                    
                        handle.style[vertical ? "top" : "left"] = Math.round(((value - min) / inc) * stepPx) + "px";                                                                                                                                 
                };

                function setInputValue(val) {                                             
                        val = isNaN(val) ? min : val; 
                        if(tagName == "select") {
                                try {                                               
                                        val = parseInt(val, 10);
                                        if(inp.selectedIndex == val) return;
                                        inp.options[val].selected = true;                                                                             
                                } catch (err) {};
                        } else {                                                                                                                                                                                                                                                                               
                                val = (min + (Math.round((val - min) / inc) * inc)).toFixed(precision);    
                                if(inp.value == val) return;
                                inp.value = val;                                 
                        };
                        updateAriaValues();                        
                        callback("update");
                };
                
                function findLabel() {
                        var label;
                        if(inp.parentNode && inp.parentNode.tagName.toLowerCase() == "label") label = inp.parentNode;
                        else {
                                var labelList = document.getElementsByTagName('label');
                                // loop through label array attempting to match each 'for' attribute to the id of the current element
                                for(var i = 0, lbl; lbl = labelList[i]; i++) {
                                        // Internet Explorer requires the htmlFor test
                                        if((lbl['htmlFor'] && lbl['htmlFor'] == inp.id) || (lbl.getAttribute('for') == inp.id)) {
                                                label = lbl;
                                                break;
                                        };
                                };
                        };
                        if(label && !label.id) { label.id = inp.id + "_label"; };
                        return label;
                };
                
                function updateAriaValues() {
                        handle.setAttribute("aria-valuenow",  tagName == "select" ? inp.options[inp.selectedIndex].value : inp.value);
                        handle.setAttribute("aria-valuetext", tagName == "select" ? inp.options[inp.selectedIndex].text  : inp.value);
                };
                
                function onChange( e ) {
                        valueToPixels();
                        callback("update"); 
                        return true;
                };                  
              
                (function() { 
                        if(hideInput) { inp.className += " fd_hide_slider_input"; }
                        else { addEvent(inp, 'change', onChange); };

                        outerWrapper              = document.createElement('div');
                        outerWrapper.className    = "fd-slider" + (vertical ? "-vertical " : " ") + classNames;
                        outerWrapper.id           = "fd-slider-" + inp.id;

                        wrapper                   = document.createElement('span');
                        wrapper.className         = "fd-slider-inner";

                        bar                       = document.createElement('span');
                        bar.className             = "fd-slider-bar";

                        if(fullARIA) {
                                handle            = document.createElement('span');
                                handle.setAttribute(!/*@cc_on!@*/false ? "tabIndex" : "tabindex", "0");
                        } else {
                                handle            = document.createElement('button');                                 
                                handle.setAttribute("type", "button");
                        };
                        
                        handle.className          = "fd-slider-handle";
						handle.style.height = h+'px'; 
                        handle.appendChild(document.createTextNode(String.fromCharCode(160)));                         
                        
                        outerWrapper.appendChild(wrapper);
                        outerWrapper.appendChild(bar);
                        outerWrapper.appendChild(handle);
                        
                        inp.parentNode.insertBefore(outerWrapper, inp);

                        /*@cc_on@*/
                        /*@if(@_win32)
                        handle.unselectable       = "on";
                        bar.unselectable          = "on";
                        wrapper.unselectable      = "on";
                        outerWrapper.unselectable = "on";
                        /*@end@*/

                        addEvent(outerWrapper, "mouseover", onMouseOver);
                        addEvent(outerWrapper, "mouseout",  onMouseOut);
                        addEvent(outerWrapper, "mousedown", onMouseDown);                        
                        if(!window.opera) {
                                addEvent(handle, "keydown",   onKeyDown);  
                                addEvent(handle, "keypress",  onKeyPress); 
                        } else {
                                addEvent(handle, "keypress",  onKeyDown);
                        };
                        addEvent(handle, "focus",     onFocus);
                        addEvent(handle, "blur",      onBlur);                       
                        addEvent(handle, "mousedown", onHandleMouseDown);
                        addEvent(handle, "mouseup",   onHandleMouseUp); 
                        
                        // Add ARIA accessibility info programmatically                         
                        handle.setAttribute("role",           "slider");
                        handle.setAttribute("aria-valuemin",  min);
                        handle.setAttribute("aria-valuemax",  max);                     
                        
                        var lbl = findLabel();
                        if(lbl) {                                 
                                handle.setAttribute("aria-labelledby", lbl.id);
                                handle.id = "fd-slider-handle-" + inp.id;
                                /*@cc_on
                                /*@if(@_win32)
                                lbl.setAttribute("htmlFor", handle.id);
                                @else @*/
                                lbl.setAttribute("for", handle.id);
                                /*@end
                                @*/
                        };
                        
                        // Are there page instructions - the creation of the instructions has been left up to you fine reader...
                        if(document.getElementById("fd_slider_describedby")) {                                  
                                handle.setAttribute("aria-describedby", "fd_slider_describedby");  // aaa:describedby
                        };
                                                       
                        updateAriaValues();                        
                        callback("create");                            
                        redraw();                                                                                  
                })();
               
                return {
                        onResize:       function(e) { if(outerWrapper.offsetHeight != sliderH || outerWrapper.offsetWidth != sliderW) { redraw(); }; },
                        destroy:        function()  { destroySlider(); },
                        reset:          function()  { valueToPixels(); },
                        increment:      function(n) { incrementHandle(n); }
                };
        }; 
           
//        addEvent(window, "load",   init);
        addEvent(window, "unload", unload);
        addEvent(window, "resize", resize);
        /*@cc_on@*/
        /*@if(@_win32)
        var onload = function(e) {
                for(slider in sliders) { sliders[slider].reset(); }
        };                   
        addEvent(window, "load", function() { setTimeout(onload, 200) });
        /*@end@*/
                
        return {                          
                        create:                 function(elem) { init(elem) },                        
                        destroyAll:             function() { destroyAllsliders(); },
                        destroySlider:          function(id) { return destroySingleSlider(id); },
                        redrawAll:              function() { resize(); },
                        increment:              function(id, numSteps) { if(!(id in sliders)) { return false; }; sliders[id].increment(numSteps); },
                        addEvent:               addEvent,
                        removeEvent:            removeEvent,
                        stopEvent:              stopEvent,
                        disableMouseWheel:      function() { removeMouseWheelSupport(); },
                        removeOnLoadEvent:      function() { removeOnloadEvent(); }                      
        }
})();             
                       
     
//--------------------------------------------------
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;
	}
}

//--------------------------------------------------

