function getFlirtyTopFrame() {
	var flirtyFrameNames = new Array('contentIFrame', 'actionIFrame', 'messengerIFrame');
	do {
		var checkname = flirtyFrameNames.shift();
		if (window.name == checkname) {
			return parent;
		}
	} while(checkname);
	
	return window;
}

function refreshTopFrameNavigation() {
	var topframe = getFlirtyTopFrame();
	//The function is defined in navigation_bar.tpl in the navigation module.
	if(self.name == 'contentIFrame') {
		if(typeof(topframe.refreshNavigationFromUrl) == 'function') {
			topframe.refreshNavigationFromUrl(document.location.href);
		}
	}
}

function frame_check() {
	topFrame = getFlirtyTopFrame();
	
	if(topFrame == self) {		
        var loc = new String(self.location.href);
		var nloc = loc;
		nloc = nloc.replace(/&border=0/, '&border=1');
		nloc = nloc.replace(/\?border=0/, '?border=1');
		if(nloc==loc) {
			if(nloc.search(/\?/) != -1) {
				nloc += "&border=1";
			} else {
				nloc += "?border=1";				
			}			
		} 
		nloc = nloc.replace(/action-([a-zA-Z0-9]+)\=([^&]*)/, '');
		nloc = nloc.replace(/#([^&?]+)(.*)/, "$2#$1");
			
		topFrame.location.replace(nloc);
	}
}

function init() {
	refreshTopFrameNavigation();
	registrationDivShadowStretcher();
	startScrollingRegistration();
	showProfileRegistration();
	flashCookieInit();
}
//Funktion wird in der profile_static_part ueberschrieben  
function showProfileRegistration() {return true;}

function registrationDivShadowStretcher() {
	var shadowDiv = document.getElementById('shade');
	var autologinDiv = document.getElementById('autologinShade');
	var newHeight = document.body.scrollHeight;
	if(shadowDiv && newHeight) {
		shadowDiv.style.height = newHeight+"px"; 
	}
	if(autologinDiv && newHeight) {
		autologinDiv.style.height = newHeight+"px";
	}
	
}

function registrationDivShadowStrecherNolayer() {
	var shadowDiv = document.getElementById('Step1Shade');
	var newHeight = 837;
	var newWidth = document.body.scrollWidth;
	if(shadowDiv && newHeight) {
		shadowDiv.style.height = newHeight+"px"; 
		shadowDiv.style.width = newWidth+"px"; 
	}
}

function startScrollingRegistration() {
	var regDiv = document.getElementById('twoStepRegistrationCenter');
	if(regDiv) {
		 setInterval("scrollTwoStepRegistration()", 300);
	}
}

function scrollTwoStepRegistration() {
	var regDiv = document.getElementById('twoStepRegistrationCenter');
	var scrollHeight;
	if (browser.isIE) {
		var htmlWrap = document.getElementsByTagName('html')[0];
		if(htmlWrap) {
			scrollHeight = htmlWrap.scrollTop;
		}
	} else {
		scrollHeight = window.pageYOffset;
	}
	if(scrollHeight > 100) {
		regDiv.style.top = scrollHeight + 50 + "px"; 
	} else {
		regDiv.style.top = "50px";
	}
}


function resize_iframe() {
	var iframe = getFlirtyTopFrame().document.getElementById('contentIFrame');

	if(iframe) {
		//iframe.contentWindow.document.body.style.margin = '0px';
		//iframe.contentWindow.document.body.style.padding = '0px';
		
		var the_height = iframe.contentWindow.document.body.scrollHeight;
		iframe.height = the_height;

	  	//var the_width = iframe.contentWindow.document.body.scrollWidth;
	  	//iframe.width = the_width;
	}
}

function absTop(el) {
	return (el.offsetParent)? 
	el.offsetTop+absTop(el.offsetParent) : el.offsetTop;
}

function showFormArrow(inputfield, bubble, infotext) {
	var bubbleDiv = document.getElementById(bubble);
	var activatetParent = inputfield.parentNode; 
	var activatetParentParentParent = inputfield.parentNode.parentNode.parentNode;
	
	if(inputfield && bubbleDiv) {
		if(browser.isIE) {
			var ifDistTop = absTop(inputfield);
		} else {
			var ifDistTop = inputfield.offsetTop;
		}
		bubbleDiv.style.top = ifDistTop - 23 + "px";
		if(infotext) {
			var ps = bubbleDiv.getElementsByTagName("p")
			for(var i=0; i<ps.length; i++) {
				var para = ps[i];
				if(para.className == 'infoArrowText'){
					para.innerHTML = infotext;
				}
			}
		}
		
		var regDiv = document.getElementById('registration');
		if(regDiv) {
			var fieldsets = regDiv.getElementsByTagName('fieldset');
			if(fieldsets) {
				for(var j=0; j<fieldsets.length; j++) {
					var fs = fieldsets[j];
					if(fs.className == "box2d" && activatetParent == fs) {
						fs.id = "box2dActivated";
						fs.className = "box2d";
					} else if(fs.className == "box2d" && activatetParentParentParent == fs) {
						fs.id = "box2dActivated";
						fs.className = "box2d";
					} else if(fs.className == "box2d") {
						fs.id = "";
						fs.className = "box2d";
					}
				}
			}
		}
	}
}

function setSenderOverlayer() {
	var layer = document.getElementById('overlayer');
	var completeHeight = document.body.offsetHeight;
	var infoBox = document.getElementById('betaInfo');
	
	if(layer && completeHeight) {
		infoBox.style.display = "inline";
		layer.style.height = completeHeight + "px";
		layer.style.display = "inline";
	}
}

function hide(id) {
	var element = document.getElementById(id);
	if(element) {
		element.style.display = "none";
	}
}

function show(id,timeout_delay) {
	var default_delay=1500;
	var element = document.getElementById(id);
	if(element) {
		element.style.display = "block";
		if (typeof(timeout_delay) != 'undefined') {
			if (timeout_delay == true) {
				timeout_delay = default_delay;
			} else if (timeout_delay == false) {
				timeout_delay = 0
			} else if (timeout_delay <= 0) {
				timeout_delay = 0
			}
			
			if (timeout_delay > 0) {
				setTimeout("hide('"+id+"')",timeout_delay);
			}			
		}
	}
}

function switchRegButtons() {
	var loaderDiv = document.getElementById('registerLoadingBox');
	if (loaderDiv) {
		hide('registerSubmitButton');
		loaderDiv.style.visibility = 'visible';
		loaderDiv.style.position = 'static';
	} 
}

function frame_escape() {
    topFrame = getFlirtyTopFrame();
    
	if(topFrame != self) {
		var loc = new String(self.location.href);
		var nloc = loc;
		nloc = nloc.replace(/action-([a-zA-Z0-9]+)\=([^&]*)/, '');
		nloc = nloc.replace(/#([^&?]+)(.*)/, "$2#$1");
		topFrame.location.replace(nloc);
	}
}

/**
 * SWFObject v1.5: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

// Browser Detect  v2.1.6
function BrowserDetect() {
   var ua = navigator.userAgent.toLowerCase(); 

   // browser engine name
   this.isGecko       = (ua.indexOf('gecko') != -1 && ua.indexOf('safari') == -1);
   this.isAppleWebKit = (ua.indexOf('applewebkit') != -1);

   // browser name
   this.isKonqueror   = (ua.indexOf('konqueror') != -1); 
   this.isSafari      = (ua.indexOf('safari') != - 1);
   this.isOmniweb     = (ua.indexOf('omniweb') != - 1);
   this.isOpera       = (ua.indexOf('opera') != -1); 
   this.isIcab        = (ua.indexOf('icab') != -1); 
   this.isAol         = (ua.indexOf('aol') != -1); 
   this.isIE          = (ua.indexOf('msie') != -1 && !this.isOpera && (ua.indexOf('webtv') == -1) ); 
   this.isMozilla     = (this.isGecko && ua.indexOf('gecko/') + 14 == ua.length);
   this.isFirebird    = (ua.indexOf('firebird/') != -1);
   this.isFirefox    = (ua.indexOf('firefox/') != -1);
   this.isNS          = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && !this.isOpera && !this.isSafari && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
   
   // spoofing and compatible browsers
   this.isIECompatible = ( (ua.indexOf('msie') != -1) && !this.isIE);
   this.isNSCompatible = ( (ua.indexOf('mozilla') != -1) && !this.isNS && !this.isMozilla);
   
   // rendering engine versions
   this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
   this.equivalentMozilla = ( (this.isGecko) ? parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) ) : -1 );
   this.appleWebKitVersion = ( (this.isAppleWebKit) ? parseFloat( ua.substring( ua.indexOf('applewebkit/') + 12) ) : -1 );
   
   // browser version
   this.versionMinor = parseFloat(navigator.appVersion); 
   
   // correct version number
   if (this.isGecko && !this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('/', ua.indexOf('gecko/') + 6) + 1 ) );
   }
   else if (this.isMozilla) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('rv:') + 3 ) );
   }
   else if (this.isIE && this.versionMinor >= 4) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
   }
   else if (this.isKonqueror) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
   }
   else if (this.isSafari) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('safari/') + 7 ) );
   }
   else if (this.isOmniweb) {
      this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('omniweb/') + 8 ) );
   }
   else if (this.isOpera) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera') + 6 ) );
   }
   else if (this.isIcab) {
      this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab') + 5 ) );
   }
   
   this.versionMajor = parseInt(this.versionMinor); 
   
   // dom support
   this.isDOM1 = (document.getElementById);
   this.isDOM2Event = (document.addEventListener && document.removeEventListener);
   
   // css compatibility mode
   this.mode = document.compatMode ? document.compatMode : 'BackCompat';

   // platform
   this.isWin    = (ua.indexOf('win') != -1);
   this.isWin32  = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1 || ua.indexOf('xp') != -1) );
   this.isMac    = (ua.indexOf('mac') != -1);
   this.isUnix   = (ua.indexOf('unix') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
   this.isLinux  = (ua.indexOf('linux') != -1);
   
   // specific browser shortcuts
   this.isNS4x = (this.isNS && this.versionMajor == 4);
   this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
   this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
   this.isNS4up = (this.isNS && this.versionMinor >= 4);
   this.isNS6x = (this.isNS && this.versionMajor == 6);
   this.isNS6up = (this.isNS && this.versionMajor >= 6);
   this.isNS7x = (this.isNS && this.versionMajor == 7);
   this.isNS7up = (this.isNS && this.versionMajor >= 7);
   
   this.isIE4x = (this.isIE && this.versionMajor == 4);
   this.isIE4up = (this.isIE && this.versionMajor >= 4);
   this.isIE5x = (this.isIE && this.versionMajor == 5);
   this.isIE55 = (this.isIE && this.versionMinor == 5.5);
   this.isIE5up = (this.isIE && this.versionMajor >= 5);
   this.isIE6x = (this.isIE && this.versionMajor == 6);
   this.isIE6up = (this.isIE && this.versionMajor >= 6);
   
   this.isIE4xMac = (this.isIE4x && this.isMac);
}
var browser = new BrowserDetect();

var AnimatedImagesObjects = new Array();


function videolinkOver(link,unique_id,width,height,frameSpeed) {
	var img_preview_id = 'videoPreviewPic_'+unique_id;
	var anim_container_id = 'videoPreviewAnim_'+unique_id;
	
	var anim_container = document.getElementById(anim_container_id);
	if (anim_container) {
		var animationdata = anim_container.getAttribute('animationdata');
		if (animationdata) {
			var animationidx = link.getAttribute('animationidx');
			var animObjUrls = animationdata.split(','); 
			if (!animationidx) {
				if (AnimatedImagesObjects.length == 0) { AnimatedImagesObjects[0] = -999; }
				animationidx = AnimatedImagesObjects.length;
				link.setAttribute('animationidx',animationidx);
				AnimatedImagesObjects[animationidx] = new AnimatedImagesObject(img_preview_id,anim_container_id,animObjUrls,width,height,frameSpeed,0,true);
				AnimatedImagesObjects[animationidx].animationIndex = animationidx;
				AnimatedImagesObjects[animationidx].prepare();
			} else {
				animationidx = parseInt(animationidx);
			}	
		}
		
		if ( typeof(AnimatedImagesObjects[animationidx]) == 'object' ) { 
			AnimatedImagesObjects[animationidx].startAnimation();
		}	
	}
}

function videolinkOut(link,unique_id) {
	/*
	var fnName = 'videolinkOut_' + unique_id;
	eval('fnExists = (typeof('+fnName+') != "undefined") ? true : false  ;');
	if (fnExists) {
		eval('var fn = '+fnName+' ;');
		fn(link);
	}
	*/
	var animationidx = link.getAttribute('animationidx');
	if (animationidx) {
		animationidx = parseInt(animationidx);
		if ( typeof(AnimatedImagesObjects[animationidx]) == 'object' ) { 
			AnimatedImagesObjects[animationidx].stopAnimation();
		}
	}		
}

function setObjectOpacity (object,value) {
	if (typeof(value) == 'undefined') { var value = 100; } else { value = parseInt(value); }
	value = (value > 100) ? 100 : value; value = (value < 0) ? 0 : value;
	if (typeof(object) == 'string') {	var object = document.getElementById(object).style; }
	if (object) {
		if (typeof(object.opacity) != null )  		{object.opacity = (value / 101); }
		if (typeof(object.MozOpacity) != null) 		{object.MozOpacity = (value / 101); }
		if (typeof(object.KhtmlOpacity) != null)  	{object.KhtmlOpacity = (value / 100); }
		if (typeof(object.filter) != null)  		{object.filter = "alpha(opacity=" + value + ")"; } 
	}
};

var AnimatedImagesObject = function(source_id,target_id,imageUrls,width,height,frameSpeed,startDelay,hideSource) {
	this.timer = false;
	this.source_id = source_id;
	this.target_id = target_id;
	this.imageUrls = imageUrls;
	this.width = width;
	this.height = height;
	this.frameSpeed = frameSpeed; 	
	this.startDelay = startDelay;
	this.hideSource = false;
	this.initialized = false;
	this.framesCount = 0;
	this.animationIndex = -1;
	this.imagesLoaded = false;
	this.lastFrame = -1;
	this.hidden=true;
	this.fadeEnabled = false; // ACHTUNG FADING NOCH NICHT FERTIG !!
	
	if (typeof(hideSource) != 'undefined') { this.hideSource = hideSource; }
	
	this.sourceObj = document.getElementById(source_id);
	this.targetObj = document.getElementById(target_id);
	
	var _this = this;
	
	this.addEvent = function ( obj, type, fn )
	{
	   if (obj.addEventListener) {
	      obj.addEventListener( type, fn, false );
	   } else 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] );
	   }
	}
	
	
	this.setOpacity = function (object,value) {
		if (typeof(value) == 'undefined') { var value = 100; } else { value = parseInt(value); }
		value = (value > 100) ? 100 : value; value = (value < 0) ? 0 : value;
		if (typeof(object) == 'string') {	var object = document.getElementById(object).style; }
		if (object) {
			if (typeof(object.opacity) != null )  		{object.opacity = (value / 101); }
			if (typeof(object.MozOpacity) != null) 		{object.MozOpacity = (value / 101); }
			if (typeof(object.KhtmlOpacity) != null)  	{object.KhtmlOpacity = (value / 100); }
			if (typeof(object.filter) != null)  		{object.filter = "alpha(opacity=" + value + ")"; } 
		}
	};
	
	this.fadeIn = function (image,duration,maxOpacity) {
		if (typeof(maxOpacity) == 'undefined') { var maxOpacity = 100; } else { maxOpacity = parseInt(maxOpacity); }
		if (typeof(duration) == 'undefined') { var duration = 1000; } else { duration = parseInt(duration); }
		var minOpacity = 0;
	    var speed = Math.round(duration / 100);
	    var timer = 0;

		
		setObjectOpacity(image,0);
		image.style.display = 'inline';

		for (var opacity=minOpacity; opacity <= maxOpacity ; opacity++) {
			setTimeout("setObjectOpacity('"+image.getAttribute('id')+"',"+opacity+")",(timer*speed));
			timer++;
		} 	    		
	};

	this.fadeOut = function (image,duration,minOpacity) {
		if (typeof(minOpacity) == 'undefined') { var minOpacity = 0; } else { minOpacity = parseInt(minOpacity); }
		if (typeof(duration) == 'undefined') { var duration = 1000; } else { duration = parseInt(duration); }
		var maxOpacity = 0;
	    var speed = Math.round(duration / 100);
	    var timer = 0;		
		
		for (var opacity=maxOpacity; opacity >= minOpacity ; opacity--) {
			setTimeout("setObjectOpacity('"+image.getAttribute('id')+"',"+opacity+")",(timer*speed));
			timer++;
		}	
		
	};

	this.blendImages = function (imgIn,imgOut,duration) {
		
	};
	
	this.prepare = function() {
		/* console.info("preparing #"+_this.animationIndex); */
		if (_this.targetObj && !_this.initialized ) {
			var frameCount = -1;
			for (var i=0; i < _this.imageUrls.length; i++) {
				var imgUrl = _this.imageUrls[i];
				if (imgUrl.indexOf('no_image') < 0) {
					frameCount++;
					var imgEl = document.createElement('img');
					var imgEl_id = 'animobjframe_'+_this.animationIndex+'_'+frameCount;

					imgEl.setAttribute('id',imgEl_id);
					imgEl.setAttribute('rel',_this.animationIndex+','+frameCount);


					imgUrl = imgUrl.replace("'","");
					imgUrl = imgUrl.replace("'","");
					 
					imgEl.src = imgUrl
					imgEl.setAttribute('image_loaded',false);
					imgEl.setAttribute('onload_done',false);
					imgEl.className='videoPreviewAnimPic';
					imgEl.setAttribute('class','videoPreviewAnimPic');
					imgEl.id = imgEl_id;
					
					imgEl.onload = function() {
						imgEl.setAttribute('image_loaded',true);
						imgEl.setAttribute('onload_done',true);
					};
				 					
					
					imgEl.setAttribute('width',_this.width);
					imgEl.setAttribute('height',_this.height);
					
					imgEl.style.display='none';
					if (_this.fadeEnabled) {
						_this.setOpacity(imgEl,0);
					}
					
					_this.targetObj.appendChild(imgEl);
					
					_this.framesCount++;
				}
			}	
	
			_this.initialized = true;
		}
	}
	
	this.startAnimation = function() {
		var previewAnimPics =  _this.targetObj.getElementsByTagName('IMG')
		if (previewAnimPics.length > 0) {
			_this.timer =  setInterval(_this.runAnimation,_this.frameSpeed);
		}
		
	}
	
	this.runAnimation = function() {
		// check if all images are loaded
		var previewAnimPics =  _this.targetObj.getElementsByTagName('IMG')
		var firstLoaded = -1;
		var loadedImages = 0; 
		if (!_this.imagesLoaded) {
			for (var i=0; i < previewAnimPics.length; i++) {
				var img = previewAnimPics[i];
				var image_loaded = img.getAttribute('image_loaded');				
				var image_IEloaded = (typeof(img.complete) != undefined) ? img.complete : false;				
				
				if (image_loaded == true || image_loaded == 'true' || image_IEloaded) {
					img.setAttribute('image_loaded',true);
					loadedImages++;
					if (firstLoaded < 0) {firstLoaded=i;}
				} 
			}
			if (loadedImages == previewAnimPics.length) {
				_this.imagesLoaded = true;
			}
		} else {
			loadedImages = previewAnimPics.length;
		}
			
		if (loadedImages >= 0) {
			if (_this.hidden) {
				_this.show();
			}
			
			var framePos = -1;
			if (loadedImages < previewAnimPics.length) { 
				framePos = (firstLoaded > 0) ? firstLoaded : 0; 
			} else {
				for( var k=0; k < previewAnimPics.length; k++) {
					var img = previewAnimPics[k];
					if (img.style.display != 'none') {
						if (_this.fadeEnabled ) {
							img.style.display='none';
							_this.targetObj.style.backgroundImage='url('+img.src+')';
							_this.targetObj.style.backgroundPosition='left top';
							_this.targetObj.style.backgroundRepeat='no-repeat';
							_this.targetObj.style.width=img.width;
							_this.targetObj.style.height=img.height;
							
						} else {
							img.style.display='none';
						}
						framePos = k;
						break;
					}
				}
				framePos++;
				if (framePos > previewAnimPics.length-1) {	framePos=0; }
			}
			if (_this.fadeEnabled ) {
				_this.fadeIn(previewAnimPics[framePos],500,100);
			} else {
				previewAnimPics[framePos].style.display='inline';
			} 
		}
		_this.lastFrame = framePos;
	}
	
	this.stopAnimation = function() {
		clearInterval(_this.timer); 
		_this.hide();
	}
	
	this.show = function() {
		if (_this.targetObj) { _this.targetObj.style.display='inline'; }
		if (_this.sourceObj && _this.hideSource) {_this.sourceObj.style.display='none';	}
		this.hidden = false;		
	}
	
	this.hide = function() {
		if (_this.targetObj) { _this.targetObj.style.display='none'; }
		if (_this.sourceObj && _this.hideSource) { _this.sourceObj.style.display='inline'; }	
		this.hidden = true;	
	}
}

function clearfield(form_name, field_name, default_value) {
	try {
		var field = document.forms[form_name].elements[field_name];
		if(field.value == default_value) {
			field.value = "";
		}
	} catch (e) {}
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}