

function showPostingPriview(h3, number) {
	var preview = document.getElementById('postingPreview_' + number);
	if(preview) {
		if(preview.style.display == 'block') {
			preview.style.display = 'none';
			h3.className = '';
		} else {
			preview.style.display = 'block';
			h3.className = 'selected';
		}
	}
}

function preparePostingPreviews(count) {
	if(count > 0) {
		for(var i = 0; i < count; i++) {
			var preview = document.getElementById('postingPreview_' + i);
			if(preview) {
				preview.style.display = 'none';
			}
		}
	}
}

function hideBlogNotificationSuccess() {
	var blogNotificationSuccess = document.getElementById("blogNotificationSuccess");
	if (blogNotificationSuccess) {
		var inputs = blogNotificationSuccess.getElementsByTagName("input");
		if (inputs.length > 0) {
			for (var i=0; i < inputs.length; i++) {
				var input = inputs[i];
				if (input.type == 'checkbox') {
					if (input.checked) {
						blogNotificationSuccess.style.display = "none";
						break;
					}
				}
			}
		}
	}
}

var newwin;

function showFilterBody(element) {
	var display = document.getElementById('filterBody').style.display;
	
	if(display == 'none') {
		document.getElementById('filterBody').style.display = 'block';
		element.innerHTML = 'ausblenden';
	} else {
		document.getElementById('filterBody').style.display = 'none';
		element.innerHTML = 'anzeigen';
	}
}

function open_multi_chat_by_room(room, show_chat_ads) {
	var c = document.cookie;
	var p1 = c.indexOf("PHPSESSID=") + 10;
	var p2 = c.indexOf(";", p1);
	var sid = "";

	if(p2 < 0) {
		sid = c.substr(p1);
	} else {
		sid = c.substr(p1, p2 - p1);
	}
	
	open_multi_chat('/index.php?main=comcentre&view=multichat&room=' + room + '&PHPSESSID=' + sid + '&show_chat_ads=' + show_chat_ads, show_chat_ads);
}

function open_multi_chat(url, show_chat_ads) {
	/*
	newwin = window.open(url,
						 'MULTICHAT',
						 'width=705,height=600,statusbar=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no');
	window.setTimeout('newwin.focus();', 200);
	*/

	// Oeffne Chat mit Ads oder ohne. Wenn mit, muss das Fenster groesser:
	if (show_chat_ads == 'true') {
		var pop_up_height = 677; 	
	} else {
		var pop_up_height = 600;
	}

	newwin = popUp2(url, 'MULTICHAT', 'width=705,height='+pop_up_height+',statusbar=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no', 'MULTICHAT');
}

function open_single_chat(url, title) {
	/*
	newwin = window.open(url, title, 'width=595,height=447,statusbar=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no');
	*/
	
	newwin = popUp2(url, title, 'width=595,height=447,statusbar=no,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no', 'SINGLECHAT');
	
	if(newwin) {
		return true;
	} else {
		return false;
	}	
}

function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight) == 'number') {
		windowHeight = window.innerHeight;
	} else {
		if (document.documentElement && document.documentElement.clientHeight) {
			windowHeight = document.documentElement.clientHeight;
		} else {
			if (document.body && document.body.clientHeight) {
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}

function cc_toggleSubmenu(id) {
	var li = document.getElementById(id);
	if(li) {
		var ul = li.getElementsByTagName('ul')[0];
		if(ul.style.display == 'block' || ul.style.display == '') {
			ul.style.display = 'none';
		} else {
			ul.style.display = 'block';
		}
	}
	return false;
}

function selectAllHearts() {
	var heartsViewList = document.getElementById('heartsViewList');
	if(heartsViewList) {
		var inputs = heartsViewList.getElementsByTagName('input');
		if(inputs.length > 0) {
			for(var i = 0; i < inputs.length; i++) {
				var input = inputs[i];
				if(input.type == 'checkbox') {
					if(input.checked) {
						input.checked = false;
					} else {
						input.checked = true;
					}
				}
			}
		}
	}
}
 function showMessageForm(type, user_id) {
 	// return true; // Non-JS Method seems to be better, really !
    var messageDiv = null;
    var subjectInput = null;
 	if(user_id) {
 		if(type == 0) {
	 		var messageDiv = document.getElementById('bubbleMessage_' + user_id);
 			var subjectInput  = document.getElementById('subjectMessage');
 		} else if(type == 1) {
 			var messageDiv = document.getElementById('bubbleHeart_' + user_id);
	 		var subjectInput = document.getElementById('subjectHeart');
 		}
 		if(typeof(subjectInput) != 'undefined' && subjectInput != null && subjectInput.className == '') {
 			// Nach dem ersten Abschicken wird die Klasse auf '' gesetzt. Deswegen wird hier dann 'text' gesetzt.
 			subjectInput.className = 'text';
 		}
 		if(messageDiv) {
 			messageDiv.style.display = "block"; 	
 			var formObject = messageDiv.getElementsByTagName('form')[0];
 			if(formObject) {
	 			formObject.reset();
	 			
	 			if(subjectInput) {
		 			subjectInput.focus();
	 			}
	 			
	 			var inputs = messageDiv.getElementsByTagName('input');
	 			if(inputs.length > 0) {
	 				for(var i = 0; i < inputs.length; i++) {
	 					var inputObject = inputs[i];
	 					if(inputObject.name == 'user_id') {
	 						inputObject.value = user_id;
	 					}
	 				}
	 			}
 			}
 			return false; // Do not follow link to non-js method.
 		} else {
 			return true
 		}
 	} else {
	 	return true; // Use non-js method of sending message
 	}
 }

 function hideMessageForm(type, user_id) {
 	var messageDiv = null;
 	if(type == 0) {
 		messageDiv = document.getElementById('bubbleMessage_' + user_id);
	} else if(type == 1) {
		messageDiv = document.getElementById('bubbleHeart_' + user_id);
	}
	if(messageDiv) {
		messageDiv.style.display = "none";
		return true;
	}
	return false;
 }
 
 function scaleMessagesOverflow(id, puffer) {
	var overflowElement = document.getElementById(id);
	if(overflowElement) {
		// Hoehe setzen
		var sichtbareHoehe = document.documentElement.clientHeight;
		overflowElement.style.height = (sichtbareHoehe - puffer) + "px";
	}
}

function submitHeartsForm() {
	var heartsViewList = document.getElementById('heartsViewList');
	var heartForm = document.getElementById('heartForm');
	if(heartsViewList && heartForm) {
		heartForm.style.display = 'none';
		var inputs = heartsViewList.getElementsByTagName('input');
		if(inputs.length > 0) {
			for(var i = 0; i < inputs.length; i++) {
				var input = inputs[i];
				if(input.name == 'rowSel_messages[]' && input.checked && input.name == 'rowSel_messages[]') {
					/*
					var inputTemp = document.createElement('input');
					inputTemp.setAttribute('type', 'text');
					inputTemp.setAttribute('name', 'rowSel_messages[]');
					inputTemp.setAttribute('value', input.value);
					*/

					heartForm.appendChild(input);
					
				}
			}
			
			// Workaround for IE
			var tempInputs = heartForm.getElementsByTagName('input');
			if(tempInputs.length > 0) {
				for(var i = 0; i < tempInputs.length; i++) {
					var tempInput = tempInputs[i];
					tempInput.checked = true;
				}
			}
			
			heartForm.submit();
		}
	}
}

function showSuccessMessage(elID) {
	window.setTimeout("show('" + elID + "')", 1500);
}

function validateFormFields(formname, fields, fields_length) {
	var form = document.forms[formname];
	if(fields.length > 0) {
		var flag = true;
		for(var i = 0; i < fields.length; i++) {
			var field = fields[i];
			
			if(typeof(form) != 'undefined') {
				var inputValue = form.elements[field].value;
				var fieldElement = form.elements[field];
			} else {
				var fieldElement = document.getElementById(field);
				var inputValue = document.getElementById(field).value;
			}
			
			if(inputValue.length < fields_length[field] ) {	
				fieldElement.setAttribute('oldClassName', fieldElement.className);
				fieldElement.className = 'errorField';
				flag = false;
				try {
					var errorElement = document.getElementById(field+"error");
					errorElement.style.display = "block";
				} catch (e) {}
				break
			} else {
				fieldElement.className = fieldElement.getAttribute('oldClassName');
				try {
					var errorElement = document.getElementById(field+"error");
					errorElement.style.display = "none";
				} catch (e) {}
			}
		}
		return flag;
	}
	return false;
}

function showLoader() {
	show('waitingBlock');
	window.setTimeout("hide('waitingBlock')", 7000);
}


// Live message 

function toggleLiveMessenger() {
	alert('button');
	var display = document.getElementById('liveEventContainer').style.display;
	
	if(display == 'none') {
		document.getElementById('liveEventContainer').style.display = 'block';
		document.getElementById('live_button_up').style.display = 'none';
		document.getElementById('live_button_down').style.display = 'block';
		element.innerHTML = 'ausblenden';
	} else {
		document.getElementById('liveEventContainer').style.display = 'none';
		document.getElementById('live_button_up').style.display = 'block';
		document.getElementById('live_button_down').style.display = 'none';
		element.innerHTML = 'anzeigen';
	}
	
}


var __MessageQueue = new Array();
var __CheckInterval = 2000;
var __CurrentMessage;

function addQueue(messageInfo) {
	// Backwards compatibility, with only private chats there was no need for a type
	if(messageInfo.type == undefined) {
		messageInfo.type = 'PRIVATECHAT';
	}

	// Save which DIV element to use in the message
	switch(messageInfo.type) {
		case 'ANONYMOUSCALL':
			messageInfo.element = '__ajax_target';
			if(__CurrentMessage != null && __CurrentMessage.type == messageInfo.type && __CurrentMessage.callid == messageInfo.callid) {
				return;
			}
		break;
		case 'PRIVATECHAT':
			messageInfo.element = 'singleChatNotificationWrap';
			if(__CurrentMessage != null && __CurrentMessage.type == messageInfo.type && __CurrentMessage.userid == messageInfo.userid) {
				return;
			}
		break;
	}
	
	// Messages are unique by type and userid, reject any duplicates for current or stored messages
	if(__CurrentMessage != null && __CurrentMessage.userid == messageInfo.userid && __CurrentMessage.type == messageInfo.type) {
	//	return;
	}

	for(i=0;i<__MessageQueue.length;i++) {
		if(__MessageQueue[i].userid == messageInfo.userid && __MessageQueue[i].type == messageInfo.type) {
			return;
		}
	}
	
	// Add message to queue and call the processing function
	__MessageQueue.push(messageInfo);
	processQueue();
}

function processQueue() {
	window.setTimeout("processQueue()", __CheckInterval);
	if(__MessageQueue.length <= 0) {
		return;
	}

	// Already displaying a message
	if(__CurrentMessage != undefined && document.getElementById(__CurrentMessage.element).style.display == 'block') {
		return;
	}
	// Remove message from queue and show it
	__CurrentMessage = __MessageQueue.shift();
	showQueryWindow(__CurrentMessage);
	window.focus();
}

function removeQueue(userid, type) {
	// Go throught the queue and remove the first message you encounter of the same type and userid
	for(i=0;i<__MessageQueue.length;i++) {
		if(__MessageQueue[i].userid == userid && __MessageQueue[i].type == type) {
			__MessageQueue.splice(i, 1);
			break;
		}
	}
	
	// If we are already displaying a message of that type and userid, hide it
	if(__CurrentMessage != null && __CurrentMessage.userid == userid && __CurrentMessage.type == type) {
		hideQueryWindow();
	}
}

function showQueryWindow(message) {
	// anonymous call
	if (message.type == 'ANONYMOUSCALL') {
		var params = new Object();
		params['view'] = 'accept_deny_invitation';
		params['anonymouscalls_id'] = message.callid;
		moduleRequestPerAjax('phoneservice', params, '__ajax_target', 'Anonym telefonieren');		
  		return;
	}

	// The element that is shown can differ for each message
	var el = document.getElementById(message.element);
	if(el) {
		// Text setzen
		var spans = el.getElementsByTagName('span');
		for(var i = 0; i < spans.length; i++) {
			var span = spans[i];
			if(span.className == 'text') {
				setIntoSpan(span, message.text);
			} else if(span.className == 'user_name') {
				setIntoSpan(span, message.from);
			} else if(span.className == 'gender') {
				setIntoSpan(span, message.gender);
			} else if(span.className == 'age') {
				setIntoSpan(span, message.age);
			} else if(span.className == 'zip') {
				setIntoSpan(span, message.zip);
			} else if(span.className == 'distance') {
				setIntoSpan(span, message.distance);
			} else if(span.className == 'city') {
				setIntoSpan(span, message.city);
			} else if(span.className == 'group') {
				setIntoSpan(span, message.group);
			} else if(span.className == 'country') {
				if(message.country == 'de') {
					message.country = 'Deutschland';
				} else if(message.country == 'at') {
					message.country = '&Ouml;sterreich';
				} else if(message.country == 'ch') {
					message.country = 'Schweiz';
				}
				setIntoSpan(span, message.country);
			}
		}
		
		// Bilder setzten
		var images = el.getElementsByTagName('img');
		for(var i = 0; i < images.length; i++) {
			if (images[i].className=='photo') {
				images[i].src = message.imageurl;
			} else if(images[i].className=='gender') {
				if(message.gender == 'Mann') {
					images[i].src = '/modules/userprofile/images/male.gif';
				} else {
					images[i].src = '/modules/userprofile/images/female.gif';
				}
			}
		}	
		
		// Links setzten
		var links = el.getElementsByTagName('a');
		for(var i = 0; i < links.length; i++) {
			switch(links[i].className) {
				case 'profile_link' : 
					links[i].setAttribute('user_id', message.userid);
					break;
				case 'accept_link':
				case 'cancel_link':
					links[i].setAttribute('user_id', message.userid);
					break;
			}
		}

		// Blockelement setzten
		var divs = el.getElementsByTagName('div');
		for(var i = 0; i < divs.length; i++) {
			switch(divs[i].className) {
				case 'notificationButtons' : 
					divs[i].style.display = "block";
					break;
				case 'closeTop' : 
				case 'closewindow':
					divs[i].style.display = "none";
					break;
				case 'accept_link':
				case 'cancel_link':
					links[i].setAttribute('user_id', message.userid);
					break;
				case 'waitATimeMessage':
				case 'startSingleChat':
					divs[i].style.display = "none";
					break;
			}
		}
	
		// Message shown on the webpage
		if(message.fromMessenger && message.type == 'PRIVATECHAT') {  
			setBackgroundIFrame(true, message.element, message.element + '_Frame');

			if(el) {
				el.style.display = "block";
			}
			
			//__CurrentMessage = null;
		} else {
			showBubble(message.element);
		}
	}
}

// NOTE: This is only for private chat
function progressQueryWindow(url, title) {
	// Something unforseen happened, the messenger client got the Chat Request but it wasn't added to the Queue or it wasn't displayed properly, but the user accepted the chat via the messenger client.
	if(!__CurrentMessage) {
		open_single_chat(url, title);
	} else {
		var startSingleChat = document.getElementById('startSingleChat');
		if(startSingleChat) {
			// Hide Notification buttons, they can be present if the user accepted via the messenger
			var notificationButtons = document.getElementById('notificationButtons');
			if(notificationButtons) {
				notificationButtons.style.display = "none";
			}
		
			// Hide Wait-Message
			var waitATimeMessage = document.getElementById('waitATimeMessage');
			if(waitATimeMessage) {
				waitATimeMessage.style.display = "none";
			}

			startSingleChat.style.display = "block";
					
			var buttonStartSingleChat = document.getElementById('buttonStartSingleChat');
			if(buttonStartSingleChat) {
				buttonStartSingleChat.href = url;
				buttonStartSingleChat.className = title;
				
				var owner = this;
				buttonStartSingleChat.onclick = function() {
					owner.hideQueryWindow();
					return !owner.open_single_chat(this.href, this.className);
				};
			}
			
			// Adjust top position of bubble (if in multichat), because it gets pushed down when we display the START button
			if(!__CurrentMessage.fromMessenger) {
				showBubble(__CurrentMessage.element);
			}
		}
	}
}

function hideQueryWindow() {
	var elID = __CurrentMessage.element;

	setBackgroundIFrame(false, elID, elID + '_Frame');
	
	var el = document.getElementById(elID);
	if(el) {
		el.style.display = "none";
	}
	
	__CurrentMessage = null;
}

// NOTE: This function places the bubble into the bottom right corner above the multichat flash client and is only intended for use with multichat
function showBubble(elID) {
	var el = document.getElementById(elID);
	if(el) {
		el.style.display = "block";
	}
	
	var flashContainer = document.getElementById('FlashContainer');
	if(flashContainer) {
		var flashContainerHeight = flashContainer.offsetHeight;
		var elHeight = el.offsetHeight;
		el.style.top = (flashContainerHeight - elHeight - 90) + "px"; 
	}
}

function setIntoSpan(span, content) {
	span.innerHTML = content;
}

function anonymousCallNotificationDeny(username, callid) {
	var params = new Object();
	params['view'] = 'deny_invitation';
	params['anonymouscalls_id'] = callid;
	params['rejected'] = 1;
	window.frames['contentIFrame'].moduleRequestPerAjax('phoneservice', params, '__ajax_target', 'Flirty Nachrichtenbox');		
  	return;
}

function anonymousCallNotificationAccept(username,callid,number,valid_until) {
	var params = new Object();
	params['view'] = 'invitation_accepted';
	params['anonymouscalls_id'] = callid;
	window.frames['contentIFrame'].moduleRequestPerAjax('phoneservice', params, '__ajax_target', 'Flirty Nachrichtenbox');		
  	return;
}
function anonymousCallNotificationError(reason) {
}

function setRating(rating, wrapID, inputfieldID, imagepath) {
	var wrap = document.getElementById(wrapID);
	var inputfield = document.getElementById(inputfieldID);
	if(rating && wrap && inputfield) {
		var imgs = wrap.getElementsByTagName('img');
		if(imgs.length > 0) {
			for(var i=0; i<imgs.length; i++) {
				var img = imgs[i];
				if(i < rating) {
					img.src = imagepath.split("?")[0] + 'icon_star_big_active.gif' + "?" + imagepath.split("?")[1];
				} else {
					img.src = imagepath.split("?")[0] + 'icon_star_big_inactive.gif' + "?" + imagepath.split("?")[1];
				}						
			}
			
			inputfield.value = rating;
		}
		
	}
}

function showErrorForm(errorBlockName) {
    var errorDiv = null;

	if(!errorBlockName) {
		errorBlockName = 'sendError';
	}

	errorDiv = document.getElementById(errorBlockName);

	if(errorDiv) {
	    errorDiv.style.display = "block";
	    return false;
	}
    return true;
}

function hideErrorForm(errorBlockName) {
    var errorDiv = null;

	if(!errorBlockName) {
		errorBlockName = 'sendError';
	}

	errorDiv = document.getElementById(errorBlockName);

    errorDiv.style.display = "none";

    return false;
}


function checkThisRadioButton(el, tabelle) {
	var divs = document.getElementsByTagName('div');
	var anchor = document.getElementById('submitButtonBottom');
	goToAnchor('submitButtonBottom');
	if(divs) {
		for(var i = 0; i < divs.length; i++) {
			var div = divs[i];
			if(div.className == 'tarifWrapTop' || div.className == 'tarifWrapTopOver') {
				var thisTopDiv = div;
				var bottomDivs = div.getElementsByTagName('div');
				if(bottomDivs) {
					for(var k = 0; k < bottomDivs.length; k++) {
						var bottomDiv = bottomDivs[k];
						if(bottomDiv.className == 'tarifWrapBottom' || bottomDiv.className == 'tarifWrapBottomOver') {
							var thisBottomDiv = bottomDiv;
						}
					}
				}
				var inputs = div.getElementsByTagName('input');
				if(inputs.length > 0) {				
					for(var j = 0; j < inputs.length; j++) {
						var input = inputs[j];
						if(input.type == 'radio' && input.id == el) {
							input.checked = true;
							thisBottomDiv.className = "tarifWrapBottomOver";
							thisTopDiv.className = "tarifWrapTopOver";
							thisTopDiv.id = "selectedAbo";
						} else {
							thisBottomDiv.className = "tarifWrapBottom";
							thisTopDiv.className = "tarifWrapTop";
							thisTopDiv.id = "";
						}	
					}
				}
			}
		}	
	}
}

function hoverThisElement(el, hover) {
	var outerDiv = el;
	var innerDivs = el.getElementsByTagName('div');
	if(innerDivs) {
		for(var i = 0; i < innerDivs.length; i++) {
			var innerDiv = innerDivs[i];
			if(hover) {
				if(innerDiv.className == 'tarifWrapBottom') {
					innerDiv.className = "tarifWrapBottomOver";
					outerDiv.className = "tarifWrapTopOver";
				}
			} else {
				var inputs = innerDiv.getElementsByTagName('input');
				if(inputs.length > 0) {
					for(var j = 0; j < inputs.length; j++) {
						var input = inputs[j];
						if((input.type == 'radio' && input.checked == false) || input.type == 'image') {
							if(innerDiv.className == 'tarifWrapBottomOver') {
								innerDiv.className = "tarifWrapBottom";
								outerDiv.className = "tarifWrapTop";
							}
						}
					}
				} 
			}
		}
	}
}

function thisHover(el, hover, hoverClass) {
	if(hover) {
		el.className = hoverClass;
	} else {
		var inputs = el.getElementsByTagName('input');
		if(inputs.length > 0) {				
			for(var j = 0; j < inputs.length; j++) {
				var input = inputs[j];
				if(input.type == 'radio' && input.checked == false) {
					el.className ='';
				}
			}
		}
	}
}

function thisSelected(el, hoverClass, bereich, ueberschrift) {
	var div = document.getElementById(bereich);
	var divCoins = document.getElementById('coinList');
	var divPhone = document.getElementById('phoneList');
	var creditCard = document.getElementById('paymentTypeCreditcard');
	var bankeinzug = document.getElementById('paymentTypeBankeinzug');
	if(div) {
		var lis = div.getElementsByTagName('li');
		if (lis){
			for(var j = 0; j < lis.length; j++) {
				var li = lis[j];
				if(li == el) {
					li.className = hoverClass;
					var inputs = li.getElementsByTagName('input');
					if(inputs) {
						for(var k = 0; k < inputs.length; k++) {
							var input = inputs[k];
							input.checked = true;
							if(divCoins && divPhone) {
								if(input.id == 'paymenttype_phone') {
									divPhone.style.display = 'block';
									divCoins.style.display = 'none';
								} else {
									divPhone.style.display = 'none';
									divCoins.style.display = 'block';
								}
							}
							if(creditCard && bankeinzug) {
								if(input.id == 'paymenttype_directdebit') {
									bankeinzug.style.display = 'inline';
									creditCard.style.display = 'none';
								} else {
									bankeinzug.style.display = 'none';
									creditCard.style.display = 'inline';
								}
							}
						}
					}
				} else {
					li.className = "";
				}
			}
		}
	}
}

function setInnerHTML(el, text) {
	el.innerHTML = text;
}


function easyHover(el, hoverId) {
	if(el) {
		el.id = hoverId;
	}
}

function goToAnchor(el) {
	var anchor = document.getElementById(el);
	if(anchor) {
		anchor.style.display = 'block';
		location.hash = el;
	}
}

function openPaymentLayer(payUrl) {
	if(payUrl) {
		var urlParser = new URLParser();
		urlParser.parse(payUrl);
		urlParser.setQueryParam('page', 'become_premium_framed');
		urlParser.setQueryParam('scrollheight', '655');
		urlParser.setQueryParam('frame_width', '954');
		urlParser.setQueryParam('parent_view', 'profile');

		newUrl = urlParser.getURL();
		getFlirtyTopFrame().requestPerAjax(newUrl, 'reserveContainerOuter', 'Payment');
	}
}


/*
function loadUserGallery(el, url, width, height) {
	var div = document.getElementById(el);
	if(div) {		
		if(! browser.isIE) {
			var flashObject = document.createElement('object');
			flashObject.setAttribute("width", width);
			flashObject.setAttribute("height", height);
			flashObject.setAttribute("type", "application/x-shockwave-flash");
			flashObject.setAttribute("data", url);
			flashObject.setAttribute("wmode", "transparent");

			div.innerHTML = '';
			div.appendChild(flashObject);
			
		} else {
			CreateControl(el,
                "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
                "EXAMPLE_OBJECT_ID",
                width,
                height,
                url);
		}
    }
}

function hideFotoNotificationSuccess() {
	var fotoNotificationSuccess = document.getElementById("fotoNotificationSuccess");
	if (fotoNotificationSuccess) {
		var inputs = fotoNotificationSuccess.getElementsByTagName("input");
		if (inputs.length > 0) {
			for (var i=0; i < inputs.length; i++) {
				var input = inputs[i];
				if (input.type == 'checkbox') {
					if (input.checked) {
						fotoNotificationSuccess.style.display = "none";
						break;
					}
				}
			}
		}
	}
}

*/

	function linear_distance(x1, y1, x2, y2) {
	    return Math.round(Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2))*10)/10;
	}
	
	
	function PLZFieldUpdateInfo(elem, form, target) {
	    window.status = elem.value;
	    if (elem.value.length>3) {	       
	    	var url = '/index.php?main=geodata&page=plzinfo&postleitzahl='+urlencode(form.postleitzahl.value)+"&country_code="+urlencode(form.country_code.value);
	        ajax_submit_to(url, target, 'innerHTML');
	
	    }
	}
		
		
	var PLZRemoteCheck_form = false;


	function PLZRemoteCheck(elem,target_id,required_field) {
		var url = '/index.php?main=geodata&fetchview=plzdata&view=ajax_result';
		
		if(PLZRemoteCheck.arguments[3] != null && (typeof PLZRemoteCheck.arguments[3] == 'function')) {
			url += "&limit=-1";
		}
		
		var ajaxArgs = new Object();
		var plzElem = false;
		var countryElem = false;	
		
		PLZRemoteCheck_form = elem.form;
		
		if (PLZRemoteCheck_form.plz) {
			plzElem = PLZRemoteCheck_form.plz;
		} else if (PLZRemoteCheck_form.postleitzahl) {
			plzElem = PLZRemoteCheck_form.postleitzahl;		
		} else if (PLZRemoteCheck_form.location_postleitzahl) {				
			plzElem = PLZRemoteCheck_form.location_postleitzahl;
		} else if (PLZRemoteCheck_form.location_plz) {		
			plzElem = PLZRemoteCheck_form.plzlocation_plz;
		} else if (PLZRemoteCheck_form.agency_zip) {		
			plzElem = PLZRemoteCheck_form.agency_zip;		
		}
		
		if (PLZRemoteCheck_form.country_code) {
			countryElem = PLZRemoteCheck_form.country_code;
		} else if (PLZRemoteCheck_form.location_country_code) {
			countryElem = PLZRemoteCheck_form.location_country_code;		
		} else if (PLZRemoteCheck_form.agency_country_code) {
			countryElem = PLZRemoteCheck_form.agency_country_code;		
		}
		
		if (plzElem && countryElem ) {
			plzElem.className = 'rpcFieldLoading';		
			ajaxArgs.postleitzahl = plzElem.value;
			ajaxArgs.country_code = countryElem.value;
			
			if (typeof(target_id) != 'undefined') {
				var target = document.getElementById(target_id);
				if (target) {
					ajaxArgs.target_id = target_id;
				}
			}
			if (typeof(required_field) != 'undefined') {
				if (required_field) {
					ajaxArgs.required_field = true;
				}
			}
			
			var callback = on_PLZRemoteCheck;
			
			if(PLZRemoteCheck.arguments[3] != null && (typeof PLZRemoteCheck.arguments[3] == 'function')) {				
				var proxy = PLZRemoteCheck.arguments[3]; 				
				proxy.source = elem;
				proxy.dataField = document.getElementById('ort');
				proxy.target = document.getElementById(target_id);								
				callback = function(responseText, responseXML) {					
					eval("var response="+responseText+";");					
					proxy.data = response;					
					proxy.call();
				};
			}
			
			ajax_submit(url, callback, ajaxArgs);				
		}
	
	}
	
	function on_PLZRemoteCheckExtended() {
		var data = on_PLZRemoteCheckExtended.data;
		var target = on_PLZRemoteCheckExtended.target;
		var source = on_PLZRemoteCheckExtended.source;
		var dataField = on_PLZRemoteCheckExtended.dataField;
		
		if(data.view.found) {
			dataField.value = data.view.results[0].city;
			
			if(data.view.results.length == 1) {				
				if(target.nodeName.toLowerCase() != 'span') {
					var oneCity = document.createElement("span");
					oneCity.setAttribute("id", target.id);
					
					oneCity.innerHTML = data.view.results[0].city;
					
					var targetParent = target.parentNode;
					targetParent.removeChild(target);
					targetParent.appendChild(multipleCities);
					
				} else {					
					target.innerHTML = data.view.results[0].city;	
					
				}				
				
			} else {
				if(target.nodeName.toLowerCase() != 'select') {					
					var multipleCities = document.createElement("select");
					multipleCities.setAttribute("name", "cities");
					multipleCities.setAttribute("id", target.id);
					multipleCities.onchange = function() {
						dataField.value = multipleCities.options[multipleCities.selectedIndex].value;
					};								
					for(var i = 0; i < data.view.results.length; i++) {					
						var temp = document.createElement("option");
						var tempCity = data.view.results[i].city;
						temp.setAttribute("value", tempCity);
						temp.innerHTML = tempCity;
						multipleCities.appendChild(temp);					
					}					
					var targetParent = target.parentNode;
					targetParent.removeChild(target);
					targetParent.appendChild(multipleCities);
					
				} else {					
					target.options = null;
					for(var i = 0; i < data.view.results.length; i++) {					
						var temp = document.createElement("option");
						var tempCity = data.view.results[i].city;
						temp.setAttribute("value", tempCity);
						temp.innerHTML = tempCity;
						target.appendChild(temp);
						target.onchange = function() {
							dataField.value = target.options[target.selectedIndex].value;
						};
					}					
				}
			}
			
		} else {
			dataField.value = "";
			if(target.nodeName.toLowerCase() != 'span') {
				var message = document.createElement("span");
				message.setAttribute("id", target.id);
				
				message.innerHTML = "--";
				
				var targetParent = target.parentNode;
				targetParent.removeChild(target);
				targetParent.appendChild(message);
			} else {
				target.innerHTML = "--";
			}
		}
		
		//Loader ausblenden
		source.className = 'text';
		return true;
	}
	
	
	function on_PLZRemoteCheck(responseText, responseXML) {
		var plzElem = false;
		var countryElem = false;
		var ortElem = false;	
		if (PLZRemoteCheck_form != false) {
			
			if (PLZRemoteCheck_form.plz) {
				plzElem = PLZRemoteCheck_form.plz;
			} else if (PLZRemoteCheck_form.postleitzahl) {
				plzElem = PLZRemoteCheck_form.postleitzahl;		
			} else if (PLZRemoteCheck_form.location_postleitzahl) {				
				plzElem = PLZRemoteCheck_form.location_postleitzahl;
			} else if (PLZRemoteCheck_form.location_plz) {		
				plzElem = PLZRemoteCheck_form.plzlocation_plz;	
			}		
			
			if (PLZRemoteCheck_form.country_code) {
				countryElem = PLZRemoteCheck_form.country_code;
			} else if (PLZRemoteCheck_form.location_country_code) {
				countryElem = PLZRemoteCheck_form.location_country_code;		
			}		
			
			if (PLZRemoteCheck_form.ort) {
				ortElem = PLZRemoteCheck_form.ort;
			} else if (PLZRemoteCheck_form.location_ort) {
				ortElem = PLZRemoteCheck_form.location_ort;		
			}			
			
			eval("var response="+responseText+";");
			
			var target = false; 
			if (typeof(response.sentdata.target_id) != 'undefined') {
				var target = document.getElementById(response.sentdata.target_id);
			}			
			
			var required_field = false;
			if (typeof(response.sentdata.required_field) != 'undefined') {
				if (response.sentdata.required_field) { 
					required_field = true;
				}
			}			
			
			if (plzElem && countryElem && (ortElem || target) ) {
				plzElem.className = 'text';
				if (response.view.ort) {
					if (target) {
						target.innerHTML = response.view.ort;
					} else {
						ortElem.value = response.view.ort;
					}
				} else {				
					plzElem.className = (required_field == true) ? 'error' : 'text';
					if (target) {
						target.innerHTML = 'Postleitzahl nicht vorhanden';
					} else {
						ortElem.value = '';
					}
				}
			}
	
			PLZRemoteCheck_form = false;
		}
	}
	
	
	
	function createCookie(name,value,days)
	{
		if (days)
		{
			var date = new Date();
			date.setTime(date.getTime()+(days*24*60*60*1000));
			var expires = "; expires="+date.toGMTString();
		}
		else var expires = "";
		document.cookie = name+"="+value+expires+"; path=/";
	}
	
	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;
	}
	
	function eraseCookie(name)
	{
		createCookie(name,"",-1);
	}
	
	
	var no_origin = -12345678;
	var origin_x = no_origin;
	var origin_y = no_origin;
	
	function ensure_geo_origin() {
	    if (origin_x==no_origin) {
	        var ox = readCookie("geo_origin_lin_x");
	        if (ox) {
	            origin_x = ox;
	        }
	    }
	    if (origin_y==no_origin) {
	        var oy = readCookie("geo_origin_lin_y");
	        if (oy) {
	            origin_y = oy;
	        }
	    }
	}
	
	function set_geo_origin(linear_x, linear_y) {
	    createCookie("geo_origin_lin_x", linear_x, 365);
	    createCookie("geo_origin_lin_y", linear_y, 365);
	    set_tmp_geo_origin;
	}
	
	function set_tmp_geo_origin(linear_x, linear_y) {
	    origin_x = linear_x;
	    origin_y = linear_y;
	}
	
	function have_origin() {
	    return ((origin_x!=no_origin) && (origin_y!=no_origin));
	}
	
	function origin_distance(linear_x, linear_y) {
	    ensure_geo_origin();
	    if (have_origin()) {
	        return linear_distance(origin_x, origin_y, linear_x, linear_y);
	    }
	}
	
	function write_distance(text_before, linear_x, linear_y, text_after, alternate_text) {
	    ensure_geo_origin();
	    if (!have_origin()) {
	        document.write(alternate_text);
	        return;
	    }
	    if (!text_after) {
	        text_after = '';
	    }
	    if (!text_before) {
	        text_before = '';
	    }
	    var distance = origin_distance(linear_x, linear_y);
	    document.write(text_before+distance+text_after);
	}

function handleFotoReminder(allProgress) {
	hide("noFotoId");
	if(allProgress < 75) {
		show("profileIncompleteBoxId");
	}
}

function showNotificationControlls(h3, divID) {
	var content = document.getElementById(divID);
	if(content) {
		if(content.style.display == 'block') {
			content.style.display = 'none';
			h3.className = '';
		} else {
			content.style.display = 'block';
			h3.className = 'selected';
		}
	}
}

/**
 * @author Martin Regner <m.regner@librics.de>
 * @copyright 2006 librics GmbH & CoKG
 * @version svn: $Id: ajax.js 8219 2007-05-16 11:03:12Z kuebing $
 * 
 */
	
	
	function setNotificationEvent(checkbox,eventname,user_id,sendas,times) {
		if (checkbox) {
			if (!checkbox.checked) {
				unregisterNotification(eventname,user_id);
			} else {
				registerNotification(eventname, checkbox.value, times, user_id);
			}
		}
	}
	
	function unregisterNotification(eventname,user_id) {
		if(typeof(unregisterNotificationAction) == 'undefined') {
			alert ("You have to define the action url for the unregisterNotification function in 'unregisterNotificationAction' somewhere in your template!");
			return;
		}		

		var wait_div_name = "wait_div_" + eventname;
		var wait_div = document.getElementById(wait_div_name);
		if(wait_div) {
			wait_div.style.display = 'block';
		}
		
		var ajaxArgs = new Object();
		ajaxArgs['eventName'] = eventname;
		ajaxArgs['user_id'] = user_id;
		
		ajax_submit(unregisterNotificationAction, on_notification_registered, ajaxArgs);		
		
	}
	
	function registerNotification(eventname, sendas, times, user_id) {
		if(typeof(registerNotificationAction) == 'undefined') {
			alert ("You have to define the action url for the registerNotification function in 'registerNotificationAction' somewhere in your template!");
			return;
		}

		var wait_div_name = "wait_div_" + eventname;
		show(wait_div_name);
		
		var ajaxArgs = new Object();
		ajaxArgs['eventName'] = eventname;
		ajaxArgs['sendAs[]'] = sendas;
		ajaxArgs['times'] = times;
		ajaxArgs['user_id'] = user_id;
		
		ajax_submit(registerNotificationAction, on_notification_registered, ajaxArgs);
	}
	
	function on_notification_registered(responseText, responseXML) {
		try {
			eval("var response="+responseText+";");
			var eventname = response['sentdata']['eventName'];
			var wait_div_name = "wait_div_" + eventname;
			hide(wait_div_name);
			
		} catch (exception) {
			var errorArea = document.getElementById('error_area');
			if(errorArea) {
				errorArea.innerHTML = responseText;
				errorArea.style.display = 'inline';
			} else {
				alert(responseText);
			}
		}
	}

if(typeof(window.NAMEDFIFO_DEFINED) == 'undefined') {
	window.NAMEDFIFO_DEFINED = true;

	NamedFIFO = function() {}
	
	NamedFIFO.push = function (name, element) {
		this.getQueue(name).push(element);
	}
	
	NamedFIFO.pop = function (name) {
		return this.getQueue(name).shift();
	}
	
	NamedFIFO.getQueue = function(name) {
		if(!this.namedQueues) {
			this.namedQueues = new Object();
		}
		if(!this.namedQueues[name]) {
			this.namedQueues[name] = new Array();
		}
		return this.namedQueues[name];
	}
	
	NamedFIFO.prototype.push = NamedFIFO.push;
	NamedFIFO.prototype.pop = NamedFIFO.pop;
	NamedFIFO.prototype.getQueue = NamedFIFO.getQueue;
}

/**
*	Init() for various crossbrowser-optimize functions
*/

var on_page_load = '';

var fixedFooterBarInterval = null;
var advertisementsInterval = null;

function init() {
	initLocal();	
	enableTooltips();
	setPageTitle();
	resizeShadowLayer();
	resizeShadowLayer('overlay_wrap');

	// Intervall zum positionieren der fixed Footer Bar
	fixedFooterBarInterval = window.setInterval('repositioningFixedFooterBar()', 100);

	// Init Intervall fuer den Anzeigen Ticker
	if(typeof(switchAdvertisements) == 'function') {  
		switchAdvertisements();
	}
			
	if (on_page_load) {
		eval(on_page_load);
	}
	if(typeof(flashCookieInit) != 'undefined') {
		flashCookieInit();
	} else {
		flashCookieProxyInit();
	}

	if(typeof(initSinglesOfTheDay) != 'undefined') {
		initSinglesOfTheDay();	
	}

	/*
	initMessengerDisplay();	
	if(! browser.isIE){
		initMessengerListsSortable();
	}	
	*/
	 
	/**
	* 	IE-Fix for Sub-Navigation-Rollover
	*/
	/*
	if(browser.isIE) {
		var subnavi = document.getElementById('subnavi');
		if(subnavi) {
			var lis = subnavi.getElementsByTagName('li');
			for(var i = 0; i < lis.length; i++) {
				var li = lis[i];
				li.onmouseover = function() {
				
					};
				li.onmouseout = function() {
						
					};
			}
		}
	}
	*/
}

/**
 * Diese Funktion postiert die fixed footer bar am unteren Fensterrand des 
 * gegenwärtigen Viewports. Wuerde auch mit CSS (position: fixed) gehen. Wird 
 * aber nicht in allen Browsern unterstuetzt.
 */
function repositioningFixedFooterBar() {
	var fixed_footer_bar = document.getElementById('fixedFooterBar');
	var cookies = document.cookie;
	var hide_fixed_footer_bar = cookies.indexOf('hideFixedFooterBar=true');
	
	// Sonderfall wenn keine cookies, alles clearen 
	if(cookies == '' && fixed_footer_bar != null) {
		hide('fixedFooterBar');
		window.clearInterval(advertisementsInterval);
		window.clearInterval(fixedFooterBarInterval);
		
		return false;
	}
	
	// fixedFooterBar am unteren Rand des Viewports positionieren
	if (fixed_footer_bar != null && hide_fixed_footer_bar == -1) {
		if (typeof(window.innerHeight) != 'undefined') {
			var viewport_height = window.innerHeight;
			var new_position = pageYOffset+viewport_height-fixed_footer_bar.offsetHeight;
		} else if (typeof(document.documentElement) != 'undefined' && typeof(document.documentElement.clientWidth) != 'undefined' && document.documentElement.clientWidth != 0) {
			var viewport_height = document.documentElement.clientHeight;
			var new_position = document.documentElement.scrollTop+viewport_height-fixed_footer_bar.offsetHeight;
		}

		fixed_footer_bar.style.top = new_position+'px';
		if (fixed_footer_bar.style.display != 'block') fixed_footer_bar.style.display = 'block'; 
	}
}

function popupJSLink(viewLink, title, popWidth, popHeight, popLeft, popTop, popScrollbars) {
	var browser = navigator.appName;
	if (browser == "Microsoft Internet Explorer" || browser == "msie") {
		IEAddedWidth = 0;
		IEAddedHeight = 0;
		
	} else {
		IEAddedWidth = 0;
		IEAddedHeight = 0;
	}
	var layer = getFlirtyTopFrame().document.getElementById('layer_wrap');
	if(layer) {
		layer.style.display = "none";
	}
//	if(window.opener && document.title == title) {
//		document.location.href=viewLink;
//	} else {
		return window.open(viewLink, title, "width="+(popWidth+IEAddedWidth)+", height="+(popHeight+IEAddedHeight)+", left="+popLeft+", top="+popTop+", scrollbars="+popScrollbars+"");
//	}	
}

function add_on_page_load(code) {
	on_page_load += code + "\n";
}

/**
*	Shold be overwritten by various Modules, Plug-Ins
*	etc. Helpfull for function requiring an already loaded
*	HTML-Sructure.
*/
function initLocal() {
	return true;
}

function openNewMessageNotifier() {
	show("newMessageBlock");
}

/**
*	Shold be overwritten by the Formclass.
*/
function enableTooltips() {
	return true;
}

function resizeShadowLayer(id) {
	if(typeof(id) != 'undefined') {
		layerDiv = document.getElementById(id);
	} else {
		layerDiv = document.getElementById('layer_wrap');
	}

	if(layerDiv) {
		divs = layerDiv.getElementsByTagName('div');
		for ( var i = 0; i < divs.length; i++) {
			var currentDiv = divs[i];
			if(currentDiv.className == 'shadow') {
				var the_height = 0;			
				if (browser.isIE == true) {
					the_height = document.body.scrollHeight;
				} else {
					the_height = document.body.offsetHeight;
				}
				currentDiv.style.height = the_height + "px"; 
			}
		}
	}
}

/**
* 	Controlls displaying Messenger-Lists
*/

/*
function initMessengerDisplay() {
	var nameListPrefix = "messengerListWrap_";	
	var messenger = document.getElementById('messenger');
	if(messenger) {
		var h3s = messenger.getElementsByTagName('h3');
		if(h3s.length > 0) {
			for(var i = 0; i < h3s.length; i++) {
				var h3 = h3s[i];
				var h3Id = h3.id;
				var h3Number = h3Id.substring(h3Id.length - 1, h3Id.length);
				
				var listId = '' + nameListPrefix + h3Number;				
				list = document.getElementById(listId);
				list.style.display = 'none';
				
				if(inCookie('flirty_messanger_' + listId + '_display', 'block')) {
					list.style.display = 'block';
					toggleBackgroundImage(h3, '/images/meta/icons/messenger_plus.gif', '/images/meta/icons/messenger_minus.gif');						
				}
								
				h3.onclick = function() {
						// Toggle Background-Image ('+' or '-')
						toggleBackgroundImage(this, '/images/meta/icons/messenger_plus.gif', '/images/meta/icons/messenger_minus.gif');						
						
						// Slide-Effect
						var thisId = this.id;
						var thisNumber = thisId.substring(thisId.length - 1, thisId.length);
						var list = document.getElementById('' + nameListPrefix + thisNumber);					
						new Effect.toggle(list, 'Slide');
						
						// Store the display-Status in a cookie
						var display = list.style.display;
						if(display == 'none') {
							display = 'block';
						} else {
							display = 'none';
						}
						var id = list.id;
						var cookieString = 'flirty_messanger_' + id + '_display=' + display + '; path=/';
						document.cookie = cookieString;
					};
			}
		}
	}	
}
*/

/**
* 	Initialize sorting Messenger-Lists
*/
/*
function initMessengerListsSortable() { 
	Sortable.create("messengerList_1",
		{dropOnEmpty:true,containment:["messengerList_1","messengerList_2","messengerList_3","messengerList_4"], constraint:false});
	Sortable.create("messengerList_2",
		{dropOnEmpty:true,containment:["messengerList_1","messengerList_2","messengerList_3","messengerList_4"],constraint:false});
	Sortable.create("messengerList_3",
		{dropOnEmpty:true,containment:["messengerList_1","messengerList_2","messengerList_3","messengerList_4"], constraint:false});
	Sortable.create("messengerList_4",
		{dropOnEmpty:true,containment:["messengerList_1","messengerList_2","messengerList_3","messengerList_4"],constraint:false});
}
*/

/**
* 	Toggles Background-Images for element
*/
function toggleBackgroundImage(el) {
	if(el.style.backgroundImage != 'url(' + arguments[2] + ')') {
		el.style.backgroundImage = 'url(' + arguments[2] + ')';
	} else {
		el.style.backgroundImage = 'url(' + arguments[1] + ')';
	}
}

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

function show(id,timeout_delay,type) {
	var default_delay=1500;
	var element = document.getElementById(id);
	if(element) {
		if(typeof(type) != 'undefined') {
			element.style.display = type;
		} else {
			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);
			}			
		}
	}
}

var profileBubbleTimeoutId;

function setProfileBubbleTimeout() {
	profileBubbleTimeoutId = window.setTimeout("hide('profileBubble')", 7000);
}

function clearProfileBubbleTimeout() {
	window.clearTimeout(profileBubbleTimeoutId);
}

function showProfileBubble(userName, relativeElement) {
	var eProfileBubble = document.getElementById('profileBubble');
	var eRelativeElement = document.getElementById(relativeElement);
	
	if(eProfileBubble) {
		var eProfileBubbleUserName = document.getElementById('profileBubbleUserName');
		var eTextRegister = document.getElementById('profileBubbleTextRegister');
		var eTextAlternative = document.getElementById('profileBubbleTextAlternative');
		
		if(eProfileBubbleUserName) {
			eProfileBubbleUserName.innerHTML = userName;
		}
		
		if(eTextRegister && eTextAlternative) {			
			if(document.location.href.indexOf('main') < 0 || document.location.href.indexOf('main=registration') >= 0 || document.location.href.indexOf('main=homepage') >= 0) {
				eTextRegister.style.display = 'block';
				eTextAlternative.style.display = 'none';
			} else {
				eTextRegister.style.display = 'none';
				eTextAlternative.style.display = 'block';
			}
		}
		
		eProfileBubble.style.display = 'block';
		eProfileBubble.style.left = absLeft(eRelativeElement) + 'px';
		eProfileBubble.style.top = absTop(eRelativeElement) + 'px';
		
		clearProfileBubbleTimeout();
		setProfileBubbleTimeout();
	}
}


// Browserunabhängig ein Element holen
function get(id) {
  if (document.all) {
  	return document.all[id];
  } else if (document.getElementById) {
  	return document.getElementById(id);
  } 
  return false;
}

/**
*	
*/
function inCookie(key, value) {
	var c = document.cookie;
	if(key && value) {
		var pattern = key + "=" + value;
		if(c.indexOf(pattern) != -1) {
			return true;
		} else {
			return false;
		}
	} else {
		return false;
	}
}

function resetField(field) {
	if(field) {
		field.value = "";
	}
}

/**
* 	Workaround for Mac IE,
*	doesn't support Array.push()
*/
if(typeof Array.prototype.push=='undefined')
  Array.prototype.push=function(){
    var i=0;
    b=this.length,a=arguments;
    for(i;i<a.length;i++)this[b+i]=a[i];
    return this.length
  };
   
 // These functions get inserted via a Smarty postfilter if DEBUG and DEBUG_HTML have been set to true
 function html_debug(element, event, templateName, moduleName) {
        event.cancelBubble = true;
        event.cancel = true;
        event.returnValue = false;
        var elementInfo = element.tagName;
        if (element.id) {
            elementInfo += " ID="+element.id;
        }
        if (element.name) {
            elementInfo += " NAME="+element.name;
        }
        if (element.className) {
            elementInfo += " CLASS="+element.className;
        }
        if (element.src) {
            elementInfo += " SRC="+element.src;
        }
        if (element.target) {
            elementInfo += " TARGET="+element.target;
        }
        var stat =  templateName+'  '+elementInfo;
        window.status = stat;
        setTimeout('window.status = "'+stat+'";', 200);
 }
 
  function html_undebug(element, event) {
    event.cancelBubble = true;
    event.cancel = true;
    event.returnValue = false;
    window.status = '';
 }
 
 // Pop-Up
function popUp(seite, fenstername, scrolling, breite, hoehe, tb) {
	var actToolbar = 0;
	if(tb) {
		actToolbar = tb;
	}
	
	return popUp2(seite, fenstername, 'toolbar=' + tb + ',location=0, directories=0,status=0,menubar=0,scrollbars=' + scrolling + ',resizable=0,width=' + breite + ',height=' + hoehe);
}

var popup;
function popUp2(url, title, params, type) {
	popup = window.open(url, title, params);
	var infoContainer = document.getElementById('popupChecker');
	if(!popup) {
		if(!type || type == undefined) {
			if(infoContainer) {
				infoContainer.style.display = "block";
			}
		} else {
			if(infoContainer) {
				infoContainer.style.display = "block";
			}
		}
	} else {
		window.setTimeout('popup.focus();', 50);
	}
	
	return popup;
}

var globalPopUpBlocker = false;

var popupCheckDone = false;
function checkPopupBlocker(warningDiv, saveAsConfigParam, recheck) {
    if (!recheck && popupCheckDone) {
        return globalPopUpBlocker;
    }
    popupCheckDone = true;
	var newPopup = window.open('', 'blockerTest', 'left=5000,top=5000,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1');
	window.focus();
	if(! newPopup) {
        globalPopUpBlocker = true;
        if (warningDiv) {
		    var div = document.getElementById(warningDiv);
		    if(div) {
			    div.style.display = "block";
		    }
        }
		if(saveAsConfigParam) {
			getFlirtyTopFrame().frames['actionIFrame'].location.href = "/index.php?action-userprofile=setUserConfigParam&main=userprofile&page=main&param=popupBlockerDeactivated&value=0";
		}
		return true;			
	} else {
        globalPopUpBlocker = false;
		newPopup.close();
        if (warningDiv) {
            var div = document.getElementById(warningDiv);
            if(div) {
			    div.style.display = "none";
		    }
        }
		if(saveAsConfigParam) {
			getFlirtyTopFrame().frames['actionIFrame'].location.href = "/index.php?action-userprofile=setUserConfigParam&main=userprofile&page=main&param=popupBlockerDeactivated&value=1";
		}
		return false;
	}
}				

function setPageTitle() {
	var content = document.getElementById('content');
	if(content) {
		var h1s = content.getElementsByTagName('h1');
		if(h1s.length > 0) {
			for(var i = 0; i < h1s.length; i++) {
				var h1 = h1s[i];
				if(h1.className == '') {
					var trimInnerHtml = (h1.innerHTML).replace(/^\s*|\s*$/g,'');
					h1.innerHTML = trimInnerHtml;
					if(h1.firstChild.data == undefined && h1.firstChild.nodeName == 'IMG') {
						var title = h1.firstChild.title;
					} else if(h1.firstChild.data) {
						//var title = h1.firstChild.data.replace(/\s/, '');
						var title = h1.firstChild.data;
					}
					if(title) {
						document.title += ' - ' + title;
					}
					break;
				}
			}
		}
	}
}

function controlSkyscraper () {
	var x;
	if (self.innerHeight) {
		x = self.innerWidth;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		x = document.documentElement.clientWidth;
	} else if (document.body) {
		x = document.body.clientWidth;
	}
	
	var skyscraper = document.getElementById('skyscraper');
	if(x < 1120) {
		skyscraper.style.display = "none";
	} else {
		skyscraper.style.display = "block";
	}
}

function absLeft(el) {
	return (el.offsetParent)? 
	el.offsetLeft+absLeft(el.offsetParent) : el.offsetLeft;
}

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

function moveAndShowTip(e, tipID, countdown) {
	if(browser.isIE) {
		x = window.event.x + document.documentElement.scrollLeft;
		y = window.event.y + document.documentElement.scrollTop;
	} else {
		x = e.pageX;
		y = e.pageY;
	}
		
	tip = document.getElementById(tipID);
	if(tip) {
		
		showAndHideAfterCountdown(tipID, countdown);
		tip.style.left = (x-20) + "px";
		tip.style.top = (y - tip.offsetHeight)  + "px";
		
	}
}

function showAndHideAfterCountdown(elementID, timeout) {
	if(elementID) {
		show(elementID);
	}
	
	// Hide after Countdown
	hideAfterCountdown(elementID, timeout);
}

function hideAfterCountdown(elementID, timeout) {
	if(timeout > 0) {		
		var element = document.getElementById(elementID);
		if(element) {
			var spans = element.getElementsByTagName('span');
			for(var i=0; i < spans.length; i++ ) {				
				var span = spans[i];
				if(span.className == 'countdown') {
					span.innerHTML = timeout;
				}
			}
		}
		timeout--;
		setTimeout("hideAfterCountdown('" + elementID+ "', " + timeout + " )", 1000);
	} else {
		hide(elementID);
	}
}

function url_encode(text) {
     text = escape(text);
     text = text.replace(/\//g,"%2F");
     text = text.replace(/\?/g,"%3F");
     text = text.replace(/=/g,"%3D");
     text = text.replace(/&/g,"%26");
     text = text.replace(/@/g,"%40");
     text = text.replace(/\+/g,"%2B");
     return text;
}

function getCookieValue(key) {
	if(document.cookie.length > 0) {
		splittedCookie = document.cookie.split(";");
		for (var index in splittedCookie) {
			keyvaluePair = splittedCookie[index];
			splittedPair = keyvaluePair.split('=');
			cookieKey = splittedPair[0].replace(/^\s+/, "");
			cookieValue = splittedPair[1];
			if(cookieKey == key) {
				return cookieValue;
			}
		}
	}
	return false;
}

function writeWebmasterID() {
	var webmaster_id = getCookieValue('webmaster_id');
	if(webmaster_id) {
		var element = document.getElementById('footer_webmaster_id');
		if(element) {
			element.innerHTML = "WMID: " + webmaster_id;
		}
	}
}

function setBackgroundIFrame(state, div, iframe) {
	if(browser.isIE) {
		var DivRef = document.getElementById(div);
		var IfrRef = document.getElementById(iframe);
		
		if(!DivRef || !IfrRef)
			return;
		
		if(state) {
			DivRef.style.display = "block";
			IfrRef.style.width = DivRef.offsetWidth;
			IfrRef.style.height = DivRef.offsetHeight;
			IfrRef.style.top = DivRef.style.top;
			IfrRef.style.left = DivRef.style.left;
			IfrRef.style.zIndex = DivRef.style.zIndex - 1;
			IfrRef.style.display = "block";
		} else {
			DivRef.style.display = "none";
			IfrRef.style.display = "none";
		}
	}
}

function IEResetGender() {
	var imgs = document.getElementsByTagName("img");
	if(imgs && browser.isIE6x) {
		for(var i=0;i<imgs.length;i++) {
			var bild = imgs[i];
			if(bild.className == "genderInImage") {
				bild.style.display = "none";
				bild.style.position = "relative";
				bild.style.position = "absolute";
				bild.style.display = "block";
			}
		}
	}
}
add_on_page_load("IEResetGender()");

/// Behavious Library 

/*
   Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
   of Simon Willison (see comments by Simon below).

   Description:
       
       Uses css selectors to apply javascript behaviours to enable
       unobtrusive javascript in html documents.
       
   Usage:   
   
    var myrules = {
        'b.someclass' : function(element){
            element.onclick = function(){
                alert(this.innerHTML);
            }
        },
        '#someid u' : function(element){
            element.onmouseover = function(){
                this.innerHTML = "BLAH!";
            }
        }
    };
    
    Behaviour.register(myrules);
    
    // Call Behaviour.apply() to re-apply the rules (if you
    // update the dom, etc).

   License:
   
       This file is entirely BSD licensed.
       
   More information:
       
       http://ripcord.co.nz/behaviour/
   
*/   

var Behaviour = {
    list : new Array,
    
    register : function(sheet){
        Behaviour.list.push(sheet);
    },
    
    start : function(){
        Behaviour.addLoadEvent(function(){
            Behaviour.apply();
        });
    },
    
    apply : function(){
        for (h=0;sheet=Behaviour.list[h];h++){
            for (selector in sheet){
                list = document.getElementsBySelector(selector);
                
                if (!list){
                    continue;
                }

                for (i=0;element=list[i];i++){
                    sheet[selector](element);
                }
            }
        }
    },
    
    addLoadEvent : function(func){
        var oldonload = window.onload;
        
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
}

//Behaviour.start();

/*
   The following code is Copyright (C) Simon Willison 2004.

   document.getElementsBySelector(selector)
   - returns an array of element objects from the current document
     matching the CSS selector. Selectors can contain element names, 
     class names and ids and can be nested. For example:
     
       elements = document.getElementsBySelect('div#main p a.external')
     
     Will return an array of all 'a' elements with 'external' in their 
     class attribute that are contained inside 'p' elements that are 
     contained inside the 'div' element which has id="main"

   New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
   See http://www.w3.org/TR/css3-selectors/#attribute-selectors

   Version 0.4 - Simon Willison, March 25th 2003
   -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
   -- Opera 7 fails 
*/

function getAllChildren(e) {
  // Returns all children of element. Workaround required for IE5/Windows. Ugh.
  return e.all ? e.all : e.getElementsByTagName('*');
}

document.getElementsBySelector = function(selector) {
  // Attempt to fail gracefully in lesser browsers
  if (!document.getElementsByTagName) {
    return new Array();
  }
  // Split selector in to tokens
  var tokens = selector.split(' ');
  var currentContext = new Array(document);
  for (var i = 0; i < tokens.length; i++) {
    token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
    if (token.indexOf('#') > -1) {
      // Token is an ID selector
      var bits = token.split('#');
      var tagName = bits[0];
      var id = bits[1];
      var element = document.getElementById(id);
      if (tagName && element.nodeName.toLowerCase() != tagName) {
        // tag with that ID not found, return false
        return new Array();
      }
      // Set currentContext to contain just this element
      currentContext = new Array(element);
      continue; // Skip to next token
    }
    if (token.indexOf('.') > -1) {
      // Token contains a class selector
      var bits = token.split('.');
      var tagName = bits[0];
      var className = bits[1];
      if (!tagName) {
        tagName = '*';
      }
      // Get elements matching tag, filter them for class selector
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      continue; // Skip to next token
    }
    // Code to deal with attribute selectors
    if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
      var tagName = RegExp.$1;
      var attrName = RegExp.$2;
      var attrOperator = RegExp.$3;
      var attrValue = RegExp.$4;
      if (!tagName) {
        tagName = '*';
      }
      // Grab all of the tagName elements within current context
      var found = new Array;
      var foundCount = 0;
      for (var h = 0; h < currentContext.length; h++) {
        var elements;
        if (tagName == '*') {
            elements = getAllChildren(currentContext[h]);
        } else {
            elements = currentContext[h].getElementsByTagName(tagName);
        }
        for (var j = 0; j < elements.length; j++) {
          found[foundCount++] = elements[j];
        }
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      var checkFunction; // This function will be used to filter the elements
      switch (attrOperator) {
        case '=': // Equality
          checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
          break;
        case '~': // Match one of space seperated words 
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
          break;
        case '|': // Match start with value followed by optional hyphen
          checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
          break;
        case '^': // Match starts with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
          break;
        case '$': // Match ends with value - fails with "Warning" in Opera 7
          checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
          break;
        case '*': // Match ends with value
          checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
          break;
        default :
          // Just test for existence of attribute
          checkFunction = function(e) { return e.getAttribute(attrName); };
      }
      currentContext = new Array;
      var currentContextIndex = 0;
      for (var k = 0; k < found.length; k++) {
        if (checkFunction(found[k])) {
          currentContext[currentContextIndex++] = found[k];
        }
      }
      // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
      continue; // Skip to next token
    }
    
    if (!currentContext[0]){
        return;
    }
    
    // If we get here, token is JUST an element (not a class or ID selector)
    tagName = token;
    var found = new Array;
    var foundCount = 0;
    for (var h = 0; h < currentContext.length; h++) {
      var elements = currentContext[h].getElementsByTagName(tagName);
      for (var j = 0; j < elements.length; j++) {
        found[foundCount++] = elements[j];
      }
    }
    currentContext = found;
  }
  return currentContext;
}

/* That revolting regular expression explained 
/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
  \---/  \---/\-------------/    \-------/
    |      |         |               |
    |      |         |           The value
    |      |    ~,|,^,$,* or =
    |   Attribute 
   Tag
*/

function setSessionVar(name,value) {
	var ajaxArgs = new Object;
	
	ajaxArgs.name = name;
	ajaxArgs.value = value;
	
	ajax_submit(setSessionVarAction,on_set_session_var,ajaxArgs);
}

function switchToPaymetSkyscraper(displayType, bannerType) {
	var standardBanner = getFlirtyTopFrame().document.getElementById('standardPremiumBanner');
	if(bannerType == 'pgv4') {
		var paymentBanner = getFlirtyTopFrame().document.getElementById('paymentPremiumBannerPGV4');
	} else {
		var paymentBanner = getFlirtyTopFrame().document.getElementById('paymentPremiumBanner');
	}
	if(paymentBanner && standardBanner) {
		if(displayType == 'block') {
			if(standardBanner.style.display != 'none') {
				standardBanner.style.display = 'none';	
			}
			if(paymentBanner.style.display != 'block') {
				paymentBanner.style.display = 'block';	
			}
			
		} else if(displayType == 'none') {
			if(standardBanner.style.display != 'block') {
				standardBanner.style.display = 'block';	
			}
			if(paymentBanner.style.display != 'none') {
				paymentBanner.style.display = 'none';
			}
			var paymentBannerPgv4 = getFlirtyTopFrame().document.getElementById('paymentPremiumBannerPGV4');
			if(typeof(paymentBannerPgv4) != 'undefined' && paymentBannerPgv4.style.display != 'none') {
				paymentBannerPgv4.style.display = 'none';
			}
		}
	}
}

function switchStandardBanner(displayType) {
	var standardBanner = getFlirtyTopFrame().document.getElementById('standardPremiumBanner');
	if(standardBanner) {
		if(displayType == 'block') {
			if(standardBanner.style.display != 'block') {
				standardBanner.style.display = 'block';	
			}
			
		} else if(displayType == 'none') {
			if(standardBanner.style.display != 'none') {
				standardBanner.style.display = 'none';	
			}
		}
	}
}

function switchChamaeleonSpecialbanner(displayType) {
	var chamaeleonSpecialbanner = getFlirtyTopFrame().document.getElementById('chamaeleonSpecialbanner');
	if(chamaeleonSpecialbanner) {
		if(displayType == 'block') {
			if(chamaeleonSpecialbanner.style.display != 'block') {
				chamaeleonSpecialbanner.style.display = 'block';	
			}
			
		} else if(displayType == 'none') {
			if(chamaeleonSpecialbanner.style.display != 'none') {
				chamaeleonSpecialbanner.style.display = 'none';	
			}
		}
	}
}

function on_set_session_var(esponseText, responseXML) {
	try {
		eval("var response="+responseText+";");
		return response['status'];
	} catch (ex) {
		//do nothing
	}
}

function resizeForPayment(enlarge) {
	return true;
}

function clearfield(field,defaultvalue) {	
	try {
		var testfield = document.getElementById(field);
		if (testfield.value == defaultvalue) {
			testfield.value = "";
		}
	} catch (e) {}
}

/*	Erweiterung des LABEL-Handlings */

function LabelController()  {
	this.setLabelFor = LC_setLabelFor;
	this.setEventHandler = LC_setEventHandler;
}

function LC_setLabelFor(labelID, inputID) {
	var d = document;
	var input = d.getElementById(inputID);
	var labelelement = d.getElementById(labelID);
	if(input && labelelement && browser.isIE) {
		this.setEventHandler(labelelement, input);		
	}
}

function LC_setEventHandler(labelelement, inputelement) {
	labelelement.onclick = function() {
		var type = inputelement.type;
		if(type == 'radio' || type == 'checkbox'){
			inputelement.checked = true;
		}
	};
}

/* 
 * flowplayer.js 3.1.1. The Flowplayer API
 * 
 * Copyright 2009 Flowplayer Oy
 * 
 * This file is part of Flowplayer.
 * 
 * Flowplayer 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.
 * 
 * Flowplayer 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 Flowplayer.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * Date: 2009-02-25 16:24:29 -0500 (Wed, 25 Feb 2009)
 * Revision: 166 
 */
(function(){function g(o){console.log("$f.fireEvent",[].slice.call(o))}function k(q){if(!q||typeof q!="object"){return q}var o=new q.constructor();for(var p in q){if(q.hasOwnProperty(p)){o[p]=k(q[p])}}return o}function m(t,q){if(!t){return}var o,p=0,r=t.length;if(r===undefined){for(o in t){if(q.call(t[o],o,t[o])===false){break}}}else{for(var s=t[0];p<r&&q.call(s,p,s)!==false;s=t[++p]){}}return t}function c(o){return document.getElementById(o)}function i(q,p,o){if(typeof p!="object"){return q}if(q&&p){m(p,function(r,s){if(!o||typeof s!="function"){q[r]=s}})}return q}function n(s){var q=s.indexOf(".");if(q!=-1){var p=s.substring(0,q)||"*";var o=s.substring(q+1,s.length);var r=[];m(document.getElementsByTagName(p),function(){if(this.className&&this.className.indexOf(o)!=-1){r.push(this)}});return r}}function f(o){o=o||window.event;if(o.preventDefault){o.stopPropagation();o.preventDefault()}else{o.returnValue=false;o.cancelBubble=true}return false}function j(q,o,p){q[o]=q[o]||[];q[o].push(p)}function e(){return"_"+(""+Math.random()).substring(2,10)}var h=function(t,r,s){var q=this;var p={};var u={};q.index=r;if(typeof t=="string"){t={url:t}}i(this,t,true);m(("Begin*,Start,Pause*,Resume*,Seek*,Stop*,Finish*,LastSecond,Update,BufferFull,BufferEmpty,BufferStop").split(","),function(){var v="on"+this;if(v.indexOf("*")!=-1){v=v.substring(0,v.length-1);var w="onBefore"+v.substring(2);q[w]=function(x){j(u,w,x);return q}}q[v]=function(x){j(u,v,x);return q};if(r==-1){if(q[w]){s[w]=q[w]}if(q[v]){s[v]=q[v]}}});i(this,{onCuepoint:function(x,w){if(arguments.length==1){p.embedded=[null,x];return q}if(typeof x=="number"){x=[x]}var v=e();p[v]=[x,w];if(s.isLoaded()){s._api().fp_addCuepoints(x,r,v)}return q},update:function(w){i(q,w);if(s.isLoaded()){s._api().fp_updateClip(w,r)}var v=s.getConfig();var x=(r==-1)?v.clip:v.playlist[r];i(x,w,true)},_fireEvent:function(v,y,w,A){if(v=="onLoad"){m(p,function(B,C){if(C[0]){s._api().fp_addCuepoints(C[0],r,B)}});return false}A=A||q;if(v=="onCuepoint"){var z=p[y];if(z){return z[1].call(s,A,w)}}if(v=="onStart"||v=="onUpdate"||v=="onResume"){i(A,y);if(!A.duration){A.duration=y.metaData.duration}else{A.fullDuration=y.metaData.duration}}var x=true;m(u[v],function(){x=this.call(s,A,y,w)});return x}});if(t.onCuepoint){var o=t.onCuepoint;q.onCuepoint.apply(q,typeof o=="function"?[o]:o);delete t.onCuepoint}m(t,function(v,w){if(typeof w=="function"){j(u,v,w);delete t[v]}});if(r==-1){s.onCuepoint=this.onCuepoint}};var l=function(p,r,q,t){var s={};var o=this;var u=false;if(t){i(s,t)}m(r,function(v,w){if(typeof w=="function"){s[v]=w;delete r[v]}});i(this,{animate:function(y,z,x){if(!y){return o}if(typeof z=="function"){x=z;z=500}if(typeof y=="string"){var w=y;y={};y[w]=z;z=500}if(x){var v=e();s[v]=x}if(z===undefined){z=500}r=q._api().fp_animate(p,y,z,v);return o},css:function(w,x){if(x!==undefined){var v={};v[w]=x;w=v}r=q._api().fp_css(p,w);i(o,r);return o},show:function(){this.display="block";q._api().fp_showPlugin(p);return o},hide:function(){this.display="none";q._api().fp_hidePlugin(p);return o},toggle:function(){this.display=q._api().fp_togglePlugin(p);return o},fadeTo:function(y,x,w){if(typeof x=="function"){w=x;x=500}if(w){var v=e();s[v]=w}this.display=q._api().fp_fadeTo(p,y,x,v);this.opacity=y;return o},fadeIn:function(w,v){return o.fadeTo(1,w,v)},fadeOut:function(w,v){return o.fadeTo(0,w,v)},getName:function(){return p},getPlayer:function(){return q},_fireEvent:function(w,v,x){if(w=="onUpdate"){var y=q._api().fp_getPlugin(p);if(!y){return}i(o,y);delete o.methods;if(!u){m(y.methods,function(){var A=""+this;o[A]=function(){var B=[].slice.call(arguments);var C=q._api().fp_invoke(p,A,B);return C=="undefined"?o:C}});u=true}}var z=s[w];if(z){z.apply(o,v);if(w.substring(0,1)=="_"){delete s[w]}}}})};function b(o,t,z){var E=this,y=null,x,u,p=[],s={},B={},r,v,w,D,A,q;i(E,{id:function(){return r},isLoaded:function(){return(y!==null)},getParent:function(){return o},hide:function(F){if(F){o.style.height="0px"}if(y){y.style.height="0px"}return E},show:function(){o.style.height=q+"px";if(y){y.style.height=A+"px"}return E},isHidden:function(){return y&&parseInt(y.style.height,10)===0},load:function(F){if(!y&&E._fireEvent("onBeforeLoad")!==false){m(a,function(){this.unload()});x=o.innerHTML;if(x&&!flashembed.isSupported(t.version)){o.innerHTML=""}flashembed(o,t,{config:z});if(F){F.cached=true;j(B,"onLoad",F)}}return E},unload:function(){try{if(!y||y.fp_isFullscreen()){return E}}catch(F){return E}if(x.replace(/\s/g,"")!==""){if(E._fireEvent("onBeforeUnload")===false){return E}y.fp_close();y=null;o.innerHTML=x;E._fireEvent("onUnload")}return E},getClip:function(F){if(F===undefined){F=D}return p[F]},getCommonClip:function(){return u},getPlaylist:function(){return p},getPlugin:function(F){var H=s[F];if(!H&&E.isLoaded()){var G=E._api().fp_getPlugin(F);if(G){H=new l(F,G,E);s[F]=H}}return H},getScreen:function(){return E.getPlugin("screen")},getControls:function(){return E.getPlugin("controls")},getConfig:function(F){return F?k(z):z},getFlashParams:function(){return t},loadPlugin:function(I,H,K,J){if(typeof K=="function"){J=K;K={}}var G=J?e():"_";E._api().fp_loadPlugin(I,H,K,G);var F={};F[G]=J;var L=new l(I,null,E,F);s[I]=L;return L},getState:function(){return y?y.fp_getState():-1},play:function(G,F){function H(){if(G!==undefined){E._api().fp_play(G,F)}else{E._api().fp_play()}}if(y){H()}else{E.load(function(){H()})}return E},getVersion:function(){var G="flowplayer.js 3.1.1";if(y){var F=y.fp_getVersion();F.push(G);return F}return G},_api:function(){if(!y){throw"Flowplayer "+E.id()+" not loaded when calling an API method"}return y},setClip:function(F){E.setPlaylist([F]);return E},getIndex:function(){return w}});m(("Click*,Load*,Unload*,Keypress*,Volume*,Mute*,Unmute*,PlaylistReplace,ClipAdd,Fullscreen*,FullscreenExit,Error").split(","),function(){var F="on"+this;if(F.indexOf("*")!=-1){F=F.substring(0,F.length-1);var G="onBefore"+F.substring(2);E[G]=function(H){j(B,G,H);return E}}E[F]=function(H){j(B,F,H);return E}});m(("pause,resume,mute,unmute,stop,toggle,seek,getStatus,getVolume,setVolume,getTime,isPaused,isPlaying,startBuffering,stopBuffering,isFullscreen,toggleFullscreen,reset,close,setPlaylist,addClip").split(","),function(){var F=this;E[F]=function(H,G){if(!y){return E}var I=null;if(H!==undefined&&G!==undefined){I=y["fp_"+F](H,G)}else{I=(H===undefined)?y["fp_"+F]():y["fp_"+F](H)}return I=="undefined"?E:I}});E._fireEvent=function(O){if(typeof O=="string"){O=[O]}var P=O[0],M=O[1],K=O[2],J=O[3],I=0;if(z.debug){g(O)}if(!y&&P=="onLoad"&&M=="player"){y=y||c(v);A=y.clientHeight;m(p,function(){this._fireEvent("onLoad")});m(s,function(Q,R){R._fireEvent("onUpdate")});u._fireEvent("onLoad")}if(P=="onLoad"&&M!="player"){return}if(P=="onError"){if(typeof M=="string"||(typeof M=="number"&&typeof K=="number")){M=K;K=J}}if(P=="onContextMenu"){m(z.contextMenu[M],function(Q,R){R.call(E)});return}if(P=="onPluginEvent"){var F=M.name||M;var G=s[F];if(G){G._fireEvent("onUpdate",M);G._fireEvent(K,O.slice(3))}return}if(P=="onPlaylistReplace"){p=[];var L=0;m(M,function(){p.push(new h(this,L++,E))})}if(P=="onClipAdd"){if(M.isInStream){return}M=new h(M,K,E);p.splice(K,0,M);for(I=K+1;I<p.length;I++){p[I].index++}}var N=true;if(typeof M=="number"&&M<p.length){D=M;var H=p[M];if(H){N=H._fireEvent(P,K,J)}if(!H||N!==false){N=u._fireEvent(P,K,J,H)}}m(B[P],function(){N=this.call(E,M,K);if(this.cached){B[P].splice(I,1)}if(N===false){return false}I++});return N};function C(){if($f(o)){$f(o).getParent().innerHTML="";w=$f(o).getIndex();a[w]=E}else{a.push(E);w=a.length-1}q=parseInt(o.style.height,10)||o.clientHeight;if(typeof t=="string"){t={src:t}}r=o.id||"fp"+e();v=t.id||r+"_api";t.id=v;z.playerId=r;if(typeof z=="string"){z={clip:{url:z}}}if(typeof z.clip=="string"){z.clip={url:z.clip}}z.clip=z.clip||{};if(o.getAttribute("href",2)&&!z.clip.url){z.clip.url=o.getAttribute("href",2)}u=new h(z.clip,-1,E);z.playlist=z.playlist||[z.clip];var F=0;m(z.playlist,function(){var H=this;if(typeof H=="object"&&H.length){H={url:""+H}}m(z.clip,function(I,J){if(J!==undefined&&H[I]===undefined&&typeof J!="function"){H[I]=J}});z.playlist[F]=H;H=new h(H,F,E);p.push(H);F++});m(z,function(H,I){if(typeof I=="function"){j(B,H,I);delete z[H]}});m(z.plugins,function(H,I){if(I){s[H]=new l(H,I,E)}});if(!z.plugins||z.plugins.controls===undefined){s.controls=new l("controls",null,E)}s.canvas=new l("canvas",null,E);t.bgcolor=t.bgcolor||"#000000";t.version=t.version||[9,0];t.expressInstall="http://www.flowplayer.org/swf/expressinstall.swf";function G(H){if(!E.isLoaded()&&E._fireEvent("onBeforeClick")!==false){E.load()}return f(H)}x=o.innerHTML;if(x.replace(/\s/g,"")!==""){if(o.addEventListener){o.addEventListener("click",G,false)}else{if(o.attachEvent){o.attachEvent("onclick",G)}}}else{if(o.addEventListener){o.addEventListener("click",f,false)}E.load()}}if(typeof o=="string"){flashembed.domReady(function(){var F=c(o);if(!F){throw"Flowplayer cannot access element: "+o}else{o=F;C()}})}else{C()}}var a=[];function d(o){this.length=o.length;this.each=function(p){m(o,p)};this.size=function(){return o.length}}window.flowplayer=window.$f=function(){var p=null;var o=arguments[0];if(!arguments.length){m(a,function(){if(this.isLoaded()){p=this;return false}});return p||a[0]}if(arguments.length==1){if(typeof o=="number"){return a[o]}else{if(o=="*"){return new d(a)}m(a,function(){if(this.id()==o.id||this.id()==o||this.getParent()==o){p=this;return false}});return p}}if(arguments.length>1){var r=arguments[1];var q=(arguments.length==3)?arguments[2]:{};if(typeof o=="string"){if(o.indexOf(".")!=-1){var t=[];m(n(o),function(){t.push(new b(this,k(r),k(q)))});return new d(t)}else{var s=c(o);return new b(s!==null?s:o,r,q)}}else{if(o){return new b(o,r,q)}}}return null};i(window.$f,{fireEvent:function(){var o=[].slice.call(arguments);var q=$f(o[0]);return q?q._fireEvent(o.slice(1)):null},addPlugin:function(o,p){b.prototype[o]=p;return $f},each:m,extend:i});if(typeof jQuery=="function"){jQuery.prototype.flowplayer=function(q,p){if(!arguments.length||typeof arguments[0]=="number"){var o=[];this.each(function(){var r=$f(this);if(r){o.push(r)}});return arguments.length?o[arguments[0]]:new d(o)}return this.each(function(){$f(this,k(q),p?k(p):{})})}}})();(function(){var e=typeof jQuery=="function";function i(){if(c.done){return false}var k=document;if(k&&k.getElementsByTagName&&k.getElementById&&k.body){clearInterval(c.timer);c.timer=null;for(var j=0;j<c.ready.length;j++){c.ready[j].call()}c.ready=null;c.done=true}}var c=e?jQuery:function(j){if(c.done){return j()}if(c.timer){c.ready.push(j)}else{c.ready=[j];c.timer=setInterval(i,13)}};function f(k,j){if(j){for(key in j){if(j.hasOwnProperty(key)){k[key]=j[key]}}}return k}function g(j){switch(h(j)){case"string":j=j.replace(new RegExp('(["\\\\])',"g"),"\\$1");j=j.replace(/^\s?(\d+)%/,"$1pct");return'"'+j+'"';case"array":return"["+b(j,function(m){return g(m)}).join(",")+"]";case"function":return'"function()"';case"object":var k=[];for(var l in j){if(j.hasOwnProperty(l)){k.push('"'+l+'":'+g(j[l]))}}return"{"+k.join(",")+"}"}return String(j).replace(/\s/g," ").replace(/\'/g,'"')}function h(k){if(k===null||k===undefined){return false}var j=typeof k;return(j=="object"&&k.push)?"array":j}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){}})}function b(j,m){var l=[];for(var k in j){if(j.hasOwnProperty(k)){l[k]=m(j[k])}}return l}function a(q,s){var o=f({},q);var r=document.all;var m='<object width="'+o.width+'" height="'+o.height+'"';if(r&&!o.id){o.id="_"+(""+Math.random()).substring(9)}if(o.id){m+=' id="'+o.id+'"'}o.src+=((o.src.indexOf("?")!=-1?"&":"?")+Math.random());if(o.w3c||!r){m+=' data="'+o.src+'" type="application/x-shockwave-flash"'}else{m+=' classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'}m+=">";if(o.w3c||r){m+='<param name="movie" value="'+o.src+'" />'}o.width=o.height=o.id=o.w3c=o.src=null;for(var j in o){if(o[j]!==null){m+='<param name="'+j+'" value="'+o[j]+'" />'}}var n="";if(s){for(var l in s){if(s[l]!==null){n+=l+"="+(typeof s[l]=="object"?g(s[l]):s[l])+"&"}}n=n.substring(0,n.length-1);m+='<param name="flashvars" value=\''+n+"' />"}m+="</object>";return m}function d(l,o,k){var j=flashembed.getVersion();f(this,{getContainer:function(){return l},getConf:function(){return o},getVersion:function(){return j},getFlashvars:function(){return k},getApi:function(){return l.firstChild},getHTML:function(){return a(o,k)}});var p=o.version;var q=o.expressInstall;var n=!p||flashembed.isSupported(p);if(n){o.onFail=o.version=o.expressInstall=null;l.innerHTML=a(o,k)}else{if(p&&q&&flashembed.isSupported([6,65])){f(o,{src:q});k={MMredirectURL:location.href,MMplayerType:"PlugIn",MMdoctitle:document.title};l.innerHTML=a(o,k)}else{if(l.innerHTML.replace(/\s/g,"")!==""){}else{l.innerHTML="<h2>Flash version "+p+" or greater is required</h2><h3>"+(j[0]>0?"Your version is "+j:"You have no flash plugin installed")+"</h3>"+(l.tagName=="A"?"<p>Click here to download latest version</p>":"<p>Download latest version from <a href='http://www.adobe.com/go/getflashplayer'>here</a></p>");if(l.tagName=="A"){l.onclick=function(){location.href="http://www.adobe.com/go/getflashplayer"}}}}}if(!n&&o.onFail){var m=o.onFail.call(this);if(typeof m=="string"){l.innerHTML=m}}if(document.all){window[o.id]=document.getElementById(o.id)}}window.flashembed=function(k,l,j){if(typeof k=="string"){var m=document.getElementById(k);if(m){k=m}else{c(function(){flashembed(k,l,j)});return}}if(!k){return}var n={width:"100%",height:"100%",allowfullscreen:true,allowscriptaccess:"always",quality:"high",version:null,onFail:null,expressInstall:null,w3c:false};if(typeof l=="string"){l={src:l}}f(n,l);return new d(k,n,j)};f(window.flashembed,{getVersion:function(){var l=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var k=navigator.plugins["Shockwave Flash"].description;if(typeof k!="undefined"){k=k.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var m=parseInt(k.replace(/^(.*)\..*$/,"$1"),10);var q=/r/.test(k)?parseInt(k.replace(/^.*r(.*)$/,"$1"),10):0;l=[m,q]}}else{if(window.ActiveXObject){try{var o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")}catch(p){try{o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");l=[6,0];o.AllowScriptAccess="always"}catch(j){if(l[0]==6){return}}try{o=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(n){}}if(typeof o=="object"){k=o.GetVariable("$version");if(typeof k!="undefined"){k=k.replace(/^\S+\s+(.*)$/,"$1").split(",");l=[parseInt(k[0],10),parseInt(k[2],10)]}}}}return l},isSupported:function(j){var l=flashembed.getVersion();var k=(l[0]>j[0])||(l[0]==j[0]&&l[1]>=j[1]);return k},domReady:c,asString:g,getHTML:a});if(e){jQuery.tools=jQuery.tools||{version:{}};jQuery.tools.version.flashembed="1.0.2";jQuery.fn.flashembed=function(k,j){var l=null;this.each(function(){l=flashembed(this,k,j)});return k.api===false?this:l}}})();

if(typeof(window.REQUESTPERAJAX_DEFINED) == 'undefined') {
	window.REQUESTPERAJAX_DEFINED = true;

	var ajaxResponseTargetQueues = false;
	var ajaxRequestStorage = new Object();
	
	function getAjaxResponseTargetQueues() {
		if(!ajaxResponseTargetQueues) {
			ajaxResponseTargetQueues = new NamedFIFO()
		}
		return ajaxResponseTargetQueues;
	}
	
	function actionPerAjax(element, __target_id, title, timeout) {

		if (!element || (element.nodeName != 'A' && element.nodeName != 'FORM')){
			alert("Invalid action element. Use Form or link.");
			return;
		}
		if(element.nodeName == 'A') {
			var url = element.href;
		} else if (element.nodeName == 'FORM') {

			var url = element.action;
			var conjunction = '?'
			if(url.match(/\?/)) {
				conjunction = '&';
			}

			for(var i=0;i < element.elements.length;i++) {
				var input = element.elements[i];
				url = url + conjunction + input.name + "=" + input.value;
				conjunction = '&';
			}
		} 
		requestPerAjax(url, __target_id, title, timeout);
	}
	
	function pushToAjaxQueue(html,__target_id,title,timeout)  {
		var response = {
			'view':html,
			'sentdata':{
						'__target_id':'__ajax_target',
						'title':''
					}
			};

		if (typeof(__target_id) != 'undefined') {
			if (__target_id) {
				response['sentdata']['__target_id'] = __target_id;
			}
		}		


		if (typeof(title) != 'undefined') {
			if (title) {
				response['sentdata']['title'] = title;
			}
		}

		if (typeof(timeout) != 'undefined') {
			if (timeout) {
				response['sentdata']['timeout'] = timeout;
			}
		}
		
		
		handleResponse(response);
	}
	
	
	function requestPerAjax(url, __target_id, title, timeout, __loader_id, clear_target) {
		if(typeof(__target_id) == 'undefined') {
			return;
		}
		var urlParser = new URLParser();
		urlParser.parse(url);
	
		var storageKey = urlParser.query + "&__target_id=" + __target_id;
		storageKey = storageKey.replace(/[\?&=]/g,'');
		if(ajaxRequestStorage[storageKey] == 1) {
			var target_element = document.getElementById(__target_id);
			if(target_element && target_element.style.display != 'none' && __target_id == '__ajax_target') {
				return;
			}
		} else {
			ajaxRequestStorage[storageKey] = 1;
		}
	
		var ajaxAction = urlParser.baseurl;
		var ajaxArgs = urlParser.getQueryParams();
		
		var view = 'main';
		if(ajaxArgs['view']) {
			view = ajaxArgs['view'];
		} else if(ajaxArgs['page']) {
			view = ajaxArgs['page'];
			delete(ajaxArgs['page']);
		}
		ajaxArgs['view'] = 'ajax_result';
		ajaxArgs['fetchview'] = view;
		ajaxArgs['__target_id'] = __target_id;
		ajaxArgs['title'] = title;
		ajaxArgs['__loader_id'] = __loader_id;
		
		var target_element = document.getElementById(__target_id);
		var content_element = document.getElementById(__target_id + "_content");
		
		
		if(clear_target) {
			if(content_element) {
				content_element.innerHTML = '';
			} else if(target_element) {
				target_element.innerHTML = '';
			}
		}
		
		show(__loader_id);
		
		if(timeout) {
			ajaxArgs['timeout'] = timeout;
		}
		ajax_submit(ajaxAction, on_response, ajaxArgs);
	}

	
	function on_response(responseText, responseXML) {
		try {
			eval("var response="+responseText+";");
			if(typeof(response) == 'object') {
				handleResponse(response);
			} else {
				//Well well well what have we here...
			}
		} catch (exception) {
			alert(exception.toString());
		}
	}
	
	function handleResponse(response) {
		if(typeof(response) != 'object') return;
		try {
			var __target_id = response['sentdata']['__target_id'];
			var title = response['sentdata']['title'];
			
			hide(response['sentdata']['__loader_id']);
			
			var target_element = document.getElementById(__target_id);
			//We have a target for the response
			if(target_element) {
				//The target is free for our response
				if(target_element.style.display != 'none' && __target_id == '__ajax_target') {
					//We have to queue the response for the target
					getAjaxResponseTargetQueues().push(__target_id, response);				
				} else {
					var title_element = document.getElementById(__target_id + "_title");
					if(title_element) {
						title_element.innerHTML = title;
					}
					var content_element = document.getElementById(__target_id + "_content");
					if(content_element) {
						content_element.innerHTML = response['view'];
						if(content_element.scrollHeight > 400 && __target_id == '__ajax_target') {
							content_element.style.height = '400px';
							content_element.style.overflow = 'auto';
						}
						var timeout = response['sentdata']['timeout'];
						//target_element.style.display='inline';
						showTarget(__target_id, timeout);
					} else {
						target_element.innerHTML = response['view'];
					}
				}
			}
			//If no error occurred we can return true... the target element is
			//optional. if someone won't need it... well thats ok....
			return true;
		} catch (exception) {
			alert(exception.toString());
		}
		return false;
	}
	
	function showTarget(__target_id, timeout) {
		if(timeout > 0) {
			setTimeout("hideTarget('"+__target_id+"')", timeout);		
		}
		show(__target_id);
	}

	function hideTarget(__target_id) {
		hide(__target_id);
		checkAndHandleResponseQueue(__target_id);
	}

	function checkAndHandleResponseQueue(__target_id) {
		try {
			var response = getAjaxResponseTargetQueues().pop(__target_id);
			handleResponse(response);
		} catch (exception) {
			alert(exception.toString());
		}
	}

	function moduleRequestPerAjax(module, params, __target_id, title) {
		var ajaxAction = "http://" + window.location.host + "/index.php";
	
		params['useamps'] = false;
		
		var ajaxArgs = new Object();
		ajaxArgs['main'] = module;
		ajaxArgs['view'] = 'ajax_result';
		ajaxArgs['fetchview'] = 'ajax_url';
		ajaxArgs['urlparams'] = params;
		ajaxArgs['__target_id'] = __target_id;
		ajaxArgs['title'] = title;
		ajax_submit(ajaxAction, on_module_per_ajax_response, ajaxArgs);
	}
	
	function on_module_per_ajax_response(responseText, responseXML) {
		try {
			eval("var response="+responseText+";");
	
			var __target_id = response['sentdata']['__target_id'];
			var url = response['view'];
		    var title = response['sentdata']['title'];
	
			requestPerAjax(url, __target_id, title);
		} catch (exception) {
			alert(exception.toString());
		}
	}
	
	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 hide(id) {
		var element = document.getElementById(id);
		if(element) {
			element.style.display = "none";
		}
	}
}

/**
 * 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;

function JStype(obj){
	var type = typeof obj;
	if (type == 'object' && obj.nodeName){
		switch(obj.nodeType){
			case 1: return 'element';
			case 3: return 'textnode';
		}
	}
	if (type == 'object' || type == 'function'){
//		if (typeof(obj.constructor) != 'undefined') {
//			switch(obj.constructor){
//				case Array: return 'array';
//				case RegExp: return 'regexp';
//				case Class: return 'class';
//			}
//		}

		if (typeof obj.length == 'number'){
			if (obj.item) return 'collection';
			if (typeof(obj.callee) != 'undefined') {		
				if (obj.callee) return 'arguments';
			}
		}
	}
	return type;
};


function urlencode(text) {
     text = encodeURIComponent(text);
     text = text.replace(/\//g,"%2F");
     text = text.replace(/\?/g,"%3F");
     text = text.replace(/=/g,"%3D");
     text = text.replace(/&/g,"%26");
     text = text.replace(/@/g,"%40");
     text = text.replace(/\+/g,"%2B");
     return text;   
}


var requests = new Array();
var requestMap = new Array();
var ajaxDefaultTimeout = 1000000;

function callTimeout(id) {
    var req = requestMap[id];
    if ((req) && (req.isBusy())) {
        req.internalTimeout();
    }
    requestMap[id]=false;
}

function XMLRPC () {	

	var status = null;
	var url = null;	
	var req = null;
	var msgCount = 0;	
	var inProgress = false;
	var isComplete = false;
    var timeoutRef = false;
    var reqID = false;
    this.asynchronous = true;
		
	var oThis = this;
	
	// checks to see if we have too many messages in log
	var internalCanMsg = function(){
		msgCount++;
		return msgCount < 100;
	}
	
	// adds message to internal log
	var internalOnLog = function(msg){
		if(oThis.onLog && internalCanMsg()) {
			oThis.onLog(msg);
		}
	}
	
	// adds message to internal error handler
	var internalOnError = function(msg){
		if(oThis.onError && internalCanMsg()) {
			oThis.onError(msg);
		}
	}	
	
	// tells us whether we are busy waiting for the response to another requst
	var internalIsBusy = function(){
		return inProgress && !isComplete;
	}
    
	
	// internal callback function for the browser; it is called when a state of a request object changes
	var internalRequestComplete = function() {
				
		var STATE_COMPLETED = 4;
		var STATUS_200 = 200;

		clearTimeout(this.timeoutRef);		
		if (!internalIsBusy()) {
			internalOnError("internalRequestComplete: error - no request submitted");
		}
		internalOnLog("internalRequestComplete: readyState " + req.readyState);
		
		if (req.readyState == STATE_COMPLETED) {
			status = req.status;
			inProgress = false;
			isComplete = true;
            ajax_decrement(); 
			internalOnLog("internalRequestComplete: status " + status);
			
			if (status == STATUS_200) {
				internalOnLog("internalRequestComplete: calling callback on content with length " + req.responseText.length + " chars");			
                if(oThis.onComplete) {
                    
					oThis.onComplete(req.responseText, req.responseXML);
				}				 
				internalOnLog("internalRequestComplete: complete on " + new Date());
			} else {
				internalOnError("internalRequestComplete: error - bad status while fetching " + url);
			}
		} else {
			// we need to review other state codes for XMLRPC provider
		}
	}	
	
	// call this function to figure out version of this class
	this.getVersion = function(){
		return "1.0.0";
	}
	
	// call this function to figure out if current browser supports XML HTTP Requests
	this.isSupported = function(){
		var nonEI = window.XMLHttpRequest;
		var onIE = window.ActiveXObject;
		
		if (onIE) {	    		
			onIE = new ActiveXObject("Microsoft.XMLHTTP") != null;
		}
		
		return window.XMLHttpRequest || onIE;
	}
	
	// call this function to find out if more calls are possible and if request has been completely received 
	this.isBusy = function(){
		return internalIsBusy();
	}

    this.internalTimeout = function() {
        this.abort();
        this.onError("Request Timeout");
    }
    
    this.onStartRequestTimeout = function(url, timeout) {
        if (timeout<=0) return;
        var ts = new Date();
        var id = ts.toUTCString() + '-' + url;
        this.reqID = id;
        requestMap[id]=this;
        this.timeoutRef = setTimeout("callTimeout('"+id+"');", timeout);  
    }		

	//  call this function to submit new request
	this.get = function(_url, timeout){	
		if (internalIsBusy()) {
			internalOnError("submit: error - busy processing another request " + _url);			
		}	
		
		msgCount = 0;
		internalOnLog("submit: started on " + new Date() + " for " + _url);
		ajax_status("GET: "+_url);
        ajax_increment();		
		url = _url;	
		status = null;
		inProgress = true;
		isComplete = false;
        if (!timeout) {
            timeout = ajaxDefaultTimeout;
        }
		this.onStartRequestTimeout(_url, timeout);
		this.onStart();
	    if (window.XMLHttpRequest) {
	    
	    	// branch for native XMLHttpRequest object
			internalOnLog("submit: using XMLHttpRequest()");
	    
	        req = new XMLHttpRequest();
			if(this.asynchronous) {
				req.onreadystatechange = internalRequestComplete;
			}
	        req.open("GET", url, true);
	                
        	req.send(null);	

			if(!this.asynchronous) {
				return req.responseText;
			}
	        	    
	    } else { 
	    	    	
	    	// branch for IE/Windows ActiveX version
	    	if (window.ActiveXObject) {	    		
		        req = new ActiveXObject("Microsoft.XMLHTTP");
		        if (req) {
		        
					internalOnLog("get: using Microsoft.XMLHTTP");
		        
					if(this.asynchronous) {
						req.onreadystatechange = internalRequestComplete;
					}

		            req.open("GET", url, true);
			    	req.setrequestheader("Pragma","no-cache");
		   	    	req.setrequestheader("Cache-control","no-cache");
		           
		        	req.send();
		        		
					if(!this.asynchronous) {
						return req.responseText;
					}
		        } else {
					internalOnError("submit: error - unable to create Microsoft.XMLHTTP");
		        }
		    } else {
				internalOnError("submit: error - browser does not support XML HTTP Request");
		    }
	    }
		
		internalOnLog("submit: complete");
	}
	
	//  call this function to submit new request
	this.post = function(_url, param_obj, timeout){	
		if (internalIsBusy()) {
			internalOnError("submit: error - busy processing another request " + _url);			
		}	
		ajax_status("POST: "+_url);
        ajax_increment();
		msgCount = 0;
		internalOnLog("submit: started on " + new Date() + " for " + _url);
				
		url = _url;	
		status = null;
		inProgress = true;
		isComplete = false;
        var parameters = '';
        if (!timeout) {
            timeout = ajaxDefaultTimeout;
        }
        
		this.onStartRequestTimeout(_url, timeout);
		this.onStart();
        for (var idx in param_obj) {
        	paramValue = param_obj[idx];
			if (typeof(JStype) != 'undefined') {
				paramValueType = JStype(paramValue);				
			} else {
				paramValueType = typeof(paramValue);
			}
					
        	if(paramValueType == 'object' || paramValueType == 'array') {
        		for(valueElemIdx in paramValue) {

					if (typeof(JStype) != 'undefined') {
						valueElemIdxType = JStype(paramValue[valueElemIdx]);				
					} else {
						valueElemIdxType = typeof(paramValue[valueElemIdx]);
					}

					if (valueElemIdxType != 'function') {
	        			if(valueElemIdxType == 'string') {
		        			parameters = parameters + idx + "[" + valueElemIdx + "]=" + urlencode(paramValue[valueElemIdx]) + "&";
        				} else {
	        				parameters = parameters + idx + "[]=" + urlencode(paramValue[valueElemIdx]) + "&";
        				}
					}
        		}
        	} else {
	            parameters = parameters+idx+"="+urlencode(paramValue) + "&";
        	}
        }
	    if (window.XMLHttpRequest) {
	    	// branch for native XMLHttpRequest object
	        req = new XMLHttpRequest();
	        if (req) {
				internalOnLog("post: using XMLHttpRequest()");
			}        	    
	    } else {   	
	    	// branch for IE/Windows ActiveX version
	    	if (window.ActiveXObject) {	    		
		        req = new ActiveXObject("Microsoft.XMLHTTP");
		        if (req) {
					internalOnLog("post: using Microsoft.XMLHTTP");
		        }
		    } 
	    }
		if (req) {
			if(this.asynchronous) {
				req.onreadystatechange = internalRequestComplete;
			}

	        req.open('POST', url, this.asynchronous);
			req.setRequestHeader("Pragma","no-cache");
		   	req.setRequestHeader("Cache-control","no-cache");
			req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			req.setRequestHeader("Content-length", parameters.length);
			req.setRequestHeader("Connection", "close");
			req.send(parameters);
			
			if(!this.asynchronous) {
				return req.responseText;
			}
		} else {
			internalOnError("submit: error - browser does not support XML HTTP Request");
		}
		internalOnLog("submit: complete");
	}
	
	// call this function to abort current request
	this.abort = function(){
		internalOnLog("abort: " + url);
		
		if (!internalIsBusy()) {
			internalOnError("abort: error - no request submitted");			
		}
	
		onComplete = null;		
		req.abort();
	}	

	// call this function to find out current url
	this.getUrl = function(){
		return url;
	}
	
	// call this function to find out HTTP status code after response completes
	this.getStatus = function(){
		return status;
	}	
	
	// please can override this; this is function called when fatal error occurs
	this.onError = function(msg){
            window.status=msg;
	} 
	
	// user can override this; this function  is called when log message is created	
	this.onLog = function(msg) {
           // window.status=msg;
	}	
	
	// user can override this;  this function is called when response is received without errors
	this.onComplete = function(responseText, responseXML){
	}
	
	// user can override this; this function is called bevor the request ist submittet
	this.onStart = function() {}	
}

function get_form_data(element_id) {
    var result = '';
    var elem = document.getElementById(element_id);
    var param_obj = get_form_params(elem);
    for (var idx in param_obj) {
         result = result+idx+"="+urlencode(param_obj[idx]) + "&";
    }
    return result;
}

function get_form_params_by_id(element_id) {
    var result = '';
    var elem = document.getElementById(element_id);
    var param_obj = get_form_params(elem);
    return param_obj;
}

function get_form_params(form) {
        var arrayCounters = new Object();
        var params = new Object();    
			 //construct values
			 childList = form.getElementsByTagName('*');
				for( var e = 0; e < childList.length; e++ ) {
				 thisInput = childList[e];
					//only get form elements
					if( thisInput.nodeName.toLowerCase() == 'input' ) {
					 thisElmType = thisInput.getAttribute('type');
					 thisElmType = ( thisElmType == null ) ? 'text' : thisElmType.toLowerCase();
					}
					else if( thisInput.nodeName.toLowerCase() == 'button' ) {
					 thisElmType = 'button';
                     
					}
					else if( thisInput.nodeName.toLowerCase() == 'textarea' ) {
					 thisElmType = 'textarea';
					}
					else if( thisInput.nodeName.toLowerCase() == 'select' ) {
					 thisElmType = 'select';
					}
					else {
					 continue;
					}
					//do not handle elements with no names
					if( thisInput.name == '' || thisInput.name == 'undefined' ) {
					 continue;
					}
					/*
						Account for different element types
					*/
                    //file upload
					if( thisElmType == "file" ) {
					 userFuncVal = userFunc( null , AJForm.STATUS['FILE_UPLOAD_FAILED'] , "Unable to handle file uploads." );
					 return userFuncVal;
					}
					//checkbox | radio
					else if( thisElmType == "checkbox" || thisElmType == "radio" ) {
						if( !thisInput.checked ) {
						    continue;
						} 
					}
				
					//JMM- 11/18 fix 3 - added this clause for multiple select handling
					if (thisElmType == 'select') {
					 selectName = thisInput.name;
					 selectValue = thisInput.value
                    
                     if (!thisInput.multiple) {
					    for (var sIndex=0; sIndex<thisInput.length; sIndex++) {
							if (thisInput.options[sIndex].selected) {
							 controlName = thisInput.name;
							 controlValue = thisInput.options[sIndex].value;	 
							}
						}
                        params[controlName]=controlValue;
                        
					 } else {
                     
                        for (var sIndex=0; sIndex<thisInput.length; sIndex++) {
							if (thisInput.options[sIndex].selected) {
							 controlName = thisInput.name + "["+sIndex+"]";
							 controlValue = thisInput.options[sIndex].value;
							 params[controlName]=controlValue;
							}
						}
                        
                     }
                    } else {
						//JMM 11/18 fix 1 = switched location of this and dataStr code below
						//argument separator
					     //encode the data
					     controlName = thisInput.name;
					     controlValue = thisInput.value;
                         var reg = /[a-z0-9_]\[\]/im;
                         if (reg.test(controlName)) {
                            controlBaseName = controlName.slice(0, controlName.length-2);
                            var ac = 0;
                            if (arrayCounters[controlBaseName]) {
                                ac = arrayCounters[controlBaseName]; 
                            }
                            arrayCounters[controlBaseName] = ac+1;
                            controlName = controlBaseName + "["+ac+"]";
                            
                         }
                         params[controlName]=controlValue;
					}
                    
                    
				}
                return params;
}

function array_contains(ar, search) {
    for (i in ar) {
        if (ar[i]==search) {
            return true;
        }
    }
    return false;
}

function add_prefixed_attributes(src, prefix, target) {
    for (var name in src) {
        target[prefix + name] = src[name];
    }
    return target;
}

function get_prefixed_attributes(src, prefix) {
    var target = new Object();
    var plen = prefix.length;
    for (var name in src) {
        if (name.length<=plen) continue;
        var p = name.substring(0,plen);
        if (p!=prefix) continue;
        var sname = name.substr(plen);
        target[sname] = src[name];
    }
    return target;
}


function restore_form_params(form, params) {   
			 //construct values
			 childList = form.getElementsByTagName('*');
			 for( var e = 0; e < childList.length; e++ ) {
				 thisInput = childList[e];
					//only get form elements
					if( thisInput.nodeName.toLowerCase() == 'input' ) {
					 thisElmType = thisInput.getAttribute('type');
					 thisElmType = ( thisElmType == null ) ? 'text' : thisElmType.toLowerCase();
					}
					else if( thisInput.nodeName.toLowerCase() == 'button' ) {
					 thisElmType = 'button';
                     
					}
					else if( thisInput.nodeName.toLowerCase() == 'textarea' ) {
					 thisElmType = 'textarea';
					}
					else if( thisInput.nodeName.toLowerCase() == 'select' ) {
					 thisElmType = 'select';
					}
					else {
					 continue;
					}
					//do not handle elements with no names
					if( thisInput.name == '' || thisInput.name == 'undefined' || thisInput.name == undefined) {
					 continue;
					}
                    var controlName = thisInput.name;
                    var controlIsArray = false;
                    var reg = /[a-z0-9_]\[\]/im;
                    if (reg.test(controlName)) {
                        controlBaseName = controlName.slice(0, controlName.length-2);
                        controlIsArray = true;
                    }
                    if (controlName) {
                        var controlValue = params[controlName];
                    }
                    
					/*
						Account for different element types
					*/
					//file upload
					if( thisElmType == "file" ) {
					 userFuncVal = userFunc( null , AJForm.STATUS['FILE_UPLOAD_FAILED'] , "Unable to handle file uploads." );
					 return userFuncVal;
					} else if( thisElmType == "checkbox" || thisElmType == "radio" ) {
                            if (params[controlName]==thisInput.value) {
                             thisInput.checked = true;
						    } else {
                             thisInput.checked = false;
                            }
                            if (controlIsArray) {
                                if (array_contains(params[controlBaseName], thisInput.value)) {
                                    thisInput.checked = true;
                                } else {
                                    thisInput.checked = false;
                                }
                            }
                            continue;
                    } 
                    
                    if (thisElmType == 'select') {
                        
                        if (!thisInput.multiple) {
                                
                                for (var sIndex=0; sIndex<thisInput.length; sIndex++) {
					 		        if (controlValue) {
                                        if (thisInput.options[sIndex].value == controlValue) {
                                                thisInput.options[sIndex].selected = true;
                                        } else {
                                            thisInput.options[sIndex].selected = false; 
                                        }
                                    } else {
                                            thisInput.options[sIndex].selected = false;
                                    }
                                }              
					        
                        } else {
                                for (var sIndex=0; sIndex<thisInput.options.length; sIndex++) {
                                        thisInput.options[sIndex].selected = false;    
                                        if (controlValue && controlValue.length) {
                                            for (var kx=0;kx<controlValue.length;kx++) {
					 		                    if (controlValue[kx] == thisInput.options[sIndex].value) {
					  		 	                      thisInput.options[sIndex].selected = true;
                                                      break;
					  		                    } 
                                            }
                                        }
                                        
					 	        }                        
                        }
                    } else {
						    //JMM 11/18 fix 1 = switched location of this and dataStr code below
						    //argument separator
					     //encode the data
                           if (controlValue!=undefined) {
					            thisInput.value=controlValue;
                           }
					}
                       
				}
                return true;
}


function ajax_getDocElement(name) {
  if (document.all) {
  	return document.all[name];
  } else if (document.getElementById) {
  	return document.getElementById(name);
  } 
  return false;
}

function ajax_targeted_response(responseText, responseXML) {
    var trg = ajax_getDocElement(this.target);
	var content = '';
    if (responseText.substr(0,1) == '{') {
    	// the response is a JSON object.
	    eval('var response='+responseText+';');
	    if (typeof(response.view) != 'undefined') {
	    	content = response.view;
	    }
    } else {
		// the response is a plain text or html response
    	content = responseText;	
    }
    // replace the specified attribute of the target element with the received content
    trg[this.targetAttribute]=content;    
}

function ajax_json(responseText, responseXML) {
    eval('var targets='+responseText+';');
    for(var k in targets) {
        var elem = getDocElement(k);
        var content = targets[k];
        if (k=='execute') {
            continue;
        }
        if (elem) {
            if (elem.tagName=='div') {
                elem.innerHTML = content;
            } else if (elem.tagName=='input') {
                elem.value = content;
            } else if (elem.tagName=='span') {
                elem.innerHTML = content;
            } else if (elem.tagName=='textarea') {
                elem.value = content;
            } else {
                elem.innerHTML = content;
            }
        }
    }
    if (targets['execute']) {
        eval(targets['execute']);
    }
}

var ajax_count=0;

function ajax_status(stat) {
    var el = document.getElementById('ajax_status');
    if (el) {
        el.innerHTML = stat;
    }
}

function set_ajax_count(ct) {
    var el = document.getElementById('ajax_count');
    ajax_count = ct;
    if (el) {
        el.innerHTML = ct;
    }
}

function ajax_increment() {
    ajax_count++;
    set_ajax_count(ajax_count);
}

function ajax_decrement() {
    ajax_count--;
    if (ajax_count<0) {
        ajax_count = 0;
    }
    set_ajax_count(ajax_count);
}


// Beendet alle laufenden Requests.
function ajax_clear() {
    for (var i=0;i<requests.length;i++) {
        requests[i].abort();
    }
    requests = new Array();
}

function ajax_submit_form(form, callback, validator) {
                
    var request = new XMLRPC();
    requests[requests.length]=request;
	request.onComplete = callback;
	var params = get_form_params(form);
    if (validator) {
        validator(params);
    }
    request.params = params;
	request.post(form.action, params);
}

function ajax_submit(url, callback, params) {
	
	var request = new XMLRPC();
    requests[requests.length]=request;
    request.params = params;
	request.onComplete = callback;
    if (params) {
        request.post(url, params);
    } else {
	    request.get(url);
    }
}

function ajax_submit_synchronous(url, params) {
	
	var request = new XMLRPC();
    request.asynchronous = false;
    requests[requests.length]=request;
    request.params = params;
            
    if (params) {
        request.post(url, params);
    } else {
      request.get(url);      
    }
    
    return request.response;
}

function ajax_submit_to(url, target, targetAttribute, params) {
                var request = new XMLRPC();
                requests[requests.length]=request;
                request.params = params;
                request.target = target;
                request.targetAttribute = targetAttribute;
				request.onComplete = ajax_targeted_response;
				request.get(url);
}

function ajax_submit_form_to(form, target, targetAttribute, validator) {
                var request = new XMLRPC();
                requests[requests.length]=request;
                request.target = target;
                request.targetAttribute = targetAttribute;
				request.onComplete = ajax_targeted_response;
				var params = get_form_params(form);
                if (validator) {
                    validator(params);
                }
                request.params = params;
				request.post(form.action, params);
}

function ajax_submit_form_to_url(url, form, target, targetAttribute, validator) {
                var request = new XMLRPC();
                requests[requests.length]=request;
                request.target = target;
                request.targetAttribute = targetAttribute;
				request.onComplete = ajax_targeted_response;
				var params = get_form_params(form);
                if (validator) {
                    validator(params);
                }
                request.params = params;
                
				request.post(url, params);
}

function ajax_submit_to(url, target, targetAttribute) {
                var request = new XMLRPC();
                requests[requests.length]=request;
                request.target = target;
                request.targetAttribute = targetAttribute;
				request.onComplete = ajax_targeted_response;
				request.get(url);
}

// Browser Detect  v2.1.6
// documentation: http://www.dithered.com/javascript/browser_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)


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();

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

function getFlirtyTopFrameName() {
	var topFrameName =  getFlirtyTopFrame().name;
	if(!topFrameName) {
		topFrameName = "_top"
	}
	return topFrameName;
}

function setFlirtyTopFrameTarget(elID) {
	var el = document.getElementById(elID);
	if(el) {
		el.target = getFlirtyTopFrameName();
	}
}

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 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);
	}
}

function frame_escape_redirect() {
	if(window.name != '') {
		topFrame = getFlirtyTopFrame();
		if(topFrame != self) {
			var loc = new String(self.location.href);
			topFrame.location.replace('/index.php?main=homepage&page=main');
		}
	}
}

function resize_iframe(frame_id, wrap_id, frame_width) {
	if(frame_id) {
		var iframe = document.getElementById(frame_id);
		if (!iframe) {
			var iframe = getFlirtyTopFrame().document.getElementById(frame_id);
		}
	} else {
		var iframe = getFlirtyTopFrame().document.getElementById('contentIFrame');
	}
	
	if(wrap_id && iframe) {	
		var wrap = iframe.contentWindow.document.getElementById(wrap_id);
	} else {
		var wrap = getFlirtyTopFrame().document.getElementById('wrap');
	}
	if(iframe && wrap) {
		if (browser.isIE == true) {
			var iframeHeight = iframe.contentWindow.document.body.scrollHeight;
		} else {		
			var iframeHeight = iframe.contentWindow.document.body.offsetHeight;
		}
		
		var the_height = 0;			
		if (browser.isIE == true) {
			the_height = iframe.contentWindow.document.body.scrollHeight;
		} else {
			the_height = iframe.contentWindow.document.body.offsetHeight;
		}	
		//var the_width = iframe.contentWindow.document.body.scrollWidth;
		if (browser.isIE == true) {
			the_width = wrap.scrollWidth;
		} else {
			the_width = wrap.offsetWidth;
		}						
		
		iframe.height = the_height;
		if(!frame_width) {
			iframe.width = the_width;
		}
	}
}

// load from template via ajax
function loadTabPerAjax (url, ajaxTarget, tabListName, activeListElement) {
	// display animation awaiting the ajax response
	document.getElementById(ajaxTarget+'_content').innerHTML = '<div class="ajaxLoader"></div>'
	// change className of activeListElement to 'active'
	toggleTabs(tabListName, activeListElement);
	// request per Ajax
	requestPerAjax(url,  ajaxTarget, '', '');
}

// load from hidden div
function loadTabFromElement(elementId, ajaxTarget, tabListName, activeListElement ) {
	// change className of activeListElement to 'active'
	toggleTabs(tabListName, activeListElement);
	// insert content in target wrapper
	document.getElementById(ajaxTarget+'_content').innerHTML = document.getElementById(elementId).innerHTML;	
}

function toggleTabs(tabListName, activeListElement) {
	var tabs = document.getElementById(tabListName).childNodes;
	for (var i=0; i < tabs.length; i++) {
		if(tabs[i].tagName == 'LI')	{
			tabs[i].className = '';
		}
	}
	activeListElement.parentNode.className='active';
}


if(typeof(window.URLPARSER_DEFINED) == 'undefined') {
	window.URLPARSER_DEFINED = true;
	
	URLParser = function () {};
	
	URLParser.parse = function(url) {
		this.url = url;
		
		var result = this.url.match(this.regexp);
		
		this.protocol = result[1];
		this.host = result[2];
		this.port = result[4];
		this.path = result[5];
		this.query = result[6];
		this.baseurl = this.getBaseURL();
		this.parseQueryParams();
		return this;
	};
	
	URLParser.parseQueryParams = function() {
		if(typeof(this.query) == 'undefined' || this.query == '') {
			return false;
		}
		
		var paramPairs = this.query.split("&");
		if(paramPairs.length > 0) {
			this.queryParams = new Object();
			for(var i = 0;i < paramPairs.length;i++) {
				var paramPair = paramPairs[i].split("=");
				this.queryParams[paramPair[0]] = paramPair[1];
			}
		}
	};		
	
	URLParser.getBaseURL = function() {
		baseUrl = this.protocol + "://" + this.host;
		if(this.port) {
			baseUrl = baseUrl + ":" + this.port;
		}
		if(this.path) {
			baseUrl = baseUrl + "/" + this.path;
		}
		return baseUrl;
	};
	
	URLParser.getURL = function() {
		var newUrl = this.getBaseURL();
		var queryString = '';
		for (var key in this.queryParams) {
			if(queryString != '') queryString += '&';
			queryString += key + '=' + this.queryParams[key];
		}
		return newUrl + '?' + queryString;
	};
	
	URLParser.setQueryParam  = function(key,value) {
		this.queryParams[key] = value;
	};

	URLParser.getQueryParams = function() {
		return this.queryParams;
	};

	URLParser.prototype.parse = URLParser.parse;
	URLParser.prototype.parseQueryParams = URLParser.parseQueryParams;
	URLParser.prototype.getQueryParams = URLParser.getQueryParams;
	URLParser.prototype.setQueryParam = URLParser.setQueryParam;
	URLParser.prototype.getBaseURL = URLParser.getBaseURL;
	URLParser.prototype.getURL = URLParser.getURL;
	URLParser.prototype.regexp = /(https?):\/\/([a-zA-Z0-9_\-\.]+)(:([0-9]+))?\/?([a-zA-Z0-9_\.]+)?\??(.*)?/;
}


/*
*	TabsController
*/

function tabsController() {
	this.controller = false;
	this.contentDivs = new Array;
	
	this.setController = TC_setController;
	this.setContentDivs = TC_setContentDivs;
	this.setActiveTabIndex = TC_setActiveTabIndex;
	this.initialize = TC_initialize;
	this.showDiv = TC_showDiv;
	this.setSimpleController = TC_setSimpleController;
	this.disableBlur = TC_disableBlur;
	this.checkAnchors = TC_checkAnchors;
}


function TC_setController(controllElement) {
	this.controller = controllElement;
}

function TC_setContentDivs(divs) {
	this.contentDivs = TC_setContentDivs.arguments;
}

function TC_initialize() {
	/*
	 * Hide all Divs, except the first one
	 */
	 for(var i=0; i < this.contentDivs.length; i++) {
	 	var div = document.getElementById(this.contentDivs[i]);
	 	if(div && i > 0) {
	 		div.style.display = 'none';
	 	}
	 }
	 	 
	 /*
	  * Create the Tab-Controller
	  */
 	 var rootElement = document.getElementById(this.controller);
 	 if(rootElement) {
		var as = rootElement.getElementsByTagName('a');
		for(var j=0; j < as.length; j++) {
			var a = as[j];
			if(a.className != 'notab') {
				a.setAttribute('control', this.contentDivs[j]);
				a.setAttribute('number', j);
				
				var owner = this;
				
				a.onclick = function() {
					owner.showDiv(this.getAttribute('control'));
					owner.setActiveTabIndex(this.getAttribute('number'));
					
					// Anpassen des InnerFrames
					if(typeof(resize_iframe) == 'function') {
						resize_iframe();
					}
					
					return false;
				};
			}	
			this.disableBlur(a);
		}
 	 }
 	 
 	 this.checkAnchors();
}

function TC_showDiv(divId) {
	
	/*
	 * Hide all Divs first
	 */
	 for(var i=0; i < this.contentDivs.length; i++) {
	 	var div = document.getElementById(this.contentDivs[i]);
	 	if(div) {
	 		div.style.display = 'none';
	 	}
	 }
	
	var div = document.getElementById(divId);
	if(div) {
		div.style.display = 'block';
	}
}

function TC_setActiveTabIndex(index) {
	var controller = document.getElementById(this.controller);
	if(controller) {
 		var lis = controller.getElementsByTagName('li');
		for(var i=0; i < lis.length; i++) {
			var li = lis[i];
			if(i == index) {
				li.className = 'active';
			} else {
				li.className = '';
		 	}
		}
	}
}

function TC_setSimpleController(id, contentId, index) {
	var rootElement = document.getElementById(id);
	if(rootElement) {
		var as = rootElement.getElementsByTagName('a');
		for(var j=0; j < as.length; j++) {
			var a = as[j];
			var owner = this;
						
			a.onclick = function() {
				owner.showDiv(contentId);
				owner.setActiveTabIndex(index);
				return false;
			};
			
			this.disableBlur(a);

		}
	}
}

function TC_disableBlur(e) {
	e.onfocus = function() {
		this.blur();
	};
}

function TC_checkAnchors() {
	var anchor = window.location.hash;
	if(anchor) {
		anchor = anchor.substr(1);
		for(var i=0; i < this.contentDivs.length; i++) {
			var actDiv = this.contentDivs[i];
			if(actDiv == anchor) {				
				this.showDiv(actDiv);
				this.setActiveTabIndex(i);
				break;
			}
		}
	}
}





function switchSearchView(buttonID, formID) {
	var button = document.getElementById(buttonID);
	if(button) {
		button.disabled = true;
		button.value = 'loading...';		
	}
	var search_view = document.getElementById('search_view_select');
	if(search_view) {
		var viewValue = search_view.options[search_view.selectedIndex].value;
		
		// Write in the Hidden-Field of the Form in the right column...
		var hidden_search_view = document.getElementById('hidden_search_view');
		if(hidden_search_view) {
			hidden_search_view.value = viewValue;
		}
		
		if(!formID) {
			fromID = 'right_column_search';
		}
		// Submit
		var form = document.getElementById(formID);
		if(form) {
			form.submit();
		}
	}
}

function switchTop100View(buttonID, formID) {
	var form = document.getElementById(formID);
	var button = document.getElementById(buttonID);
	if(button) {
		button.disabled = true;
		button.value = 'loading...';
	}
	
	var search_view = form.elements['limit'];
	var limit = form.elements['limit'];
	if(search_view.value == 'detail') {
		limit.value = 5;
	} else {
		limit.value = 25;
	}
	
	if(form) {
		form.submit();
	}
}

function presetAgeTo(fromSelect, toSelectID) {
	var toSelect = document.getElementById(toSelectID);
	if(toSelect) {
		var minAge = Number(fromSelect.options[fromSelect.selectedIndex].value);
		var ageDifference = null;
		if(minAge < 20) {
			ageDifference = 8;
		} else if(minAge < 30) {
			ageDifference = 10;
		} else if(minAge < 40) {
			ageDifference = 12;
		} else if(minAge < 50) {
			ageDifference = 15;
		} else {
			ageDifference = 20;
		}

		var maxAge = ageDifference + minAge;

		for(var i=0; i < toSelect.options.length; i++) {
			if( (ageDifference + minAge) == toSelect.options[i].value ) {
				toSelect.selectedIndex = i;
			}
		}
	}	
}

function allowSearchPerDistance(plzFieldId, distanceSelectId, countrySelectId) {
	var plzField = document.getElementById(plzFieldId);
	var distanceSelect = document.getElementById(distanceSelectId);
	var countrySelect = document.getElementById(countrySelectId);
				
	if(plzField && distanceSelect && countrySelect) {
		var disableDistance = false;
		if(countrySelect.value == 'de') {
			if(plzField.value.length < 5) {
				disableDistance = true;
			}
		} else if(countrySelect.value == 'at') {
			if(plzField.value.length < 4) {
				disableDistance = true;
			}
		}
		
		if(disableDistance) {
			distanceSelect.disabled = true;
		} else {
			distanceSelect.disabled = false;
		}
	} 
}

function submitExamples(searchString) {
	var formular = document.exampleForm;
	var hiddenInput = formular.tag_query;
	if(formular && hiddenInput) {
		hiddenInput.value = searchString;
		formular.submit();
	}
}



/*	Tabs-Steuerung */
/*
function initLocal() {
	setTabsControlling(
		'controllForProfileElements',
		new Array('persoenlicheAngaben', 'details', 'hobbiesInteressen')
	);
}
*/
/*
function setTabsControlling(controller, divs) {
	//
	// Hide all Divs, except the first one
	 //
	 for(var i=0; i < divs.length; i++) {
	 	var div = document.getElementById(divs[i]);
	 	if(div && i > 0) {
	 		div.style.display = 'none';
	 	}
	 }
	 
	 //
	 // Create the Tab-Controller
	 //
 	 var controller = document.getElementById(controller);
 	 if(controller) {
		var as = controller.getElementsByTagName('a');
		for(var j=0; j < as.length; j++) {
			var a = as[j];
				a.setAttribute('control', j);
				a.onclick = function() {
					showContent(divs[this.getAttribute('control')], divs);
					switchTab(this.parentNode, controller);
				};
		}
 	 }
}

function showContent(showElement, hideElements) {
	if(hideElements.length > 0) {
		for(var i=0; i < hideElements.length; i++) {
			var div = document.getElementById(hideElements[i]);
		 	if(div) {
		 		div.style.display = 'none';
		 	}
		}
		
		var div = document.getElementById(showElement);
		if(div) {
			div.style.display = 'block';
		}
	}
}

function switchTab(activeTab, controller) {
	var lis = controller.getElementsByTagName(li);
	alert(controller);
	if(lis.length > 0) {
		for(var i=0; i < lis.length; i++) {
			var li = lis[i];
			li.className = '';
		}
	}
	activeTab.className = 'active';
}
*/

function askForPhoto(fotoanfrageURL) {
	var ajaxParams = {};
	hide('askForPhotoInner');
	show('askForPhoto_load');
	ajax_submit(fotoanfrageURL, on_askForPhoto, ajaxParams);
}

function on_askForPhoto(responseText, responseXML) {
	hide('askForPhoto_load');
	try {
		eval("var response="+responseText+";");
		if (response.status == 'ok') {
			show('askForPhoto_success');
			setTimeout("hide('askForPhoto')",1500);
		} else {
			show('askForPhotoInner');
		}
	} catch (exception) {
		alert(exception.toString());
	}
}

function clearTextfield(defaultString, textfield) {
	tfValue = textfield.value;
	if(tfValue == defaultString) {
		textfield.value = "";
	}
}

function resizeShadow(div_id) {
	if(div_id) {
		divId = div_id;
	} else {
		divId = "shadowLayer";
	}
	div = document.getElementById(divId);
	var browser = navigator.appName;
	if(div) {
		if (browser == "Microsoft Internet Explorer" || browser == "msie") {
			windowHeight = document.body.offsetHeight;
		} else {
			windowHeight = window.outerHeight;
		}
		div.style.height = windowHeight + "px"; 
	}
}

function viewBigImage(image_path, has_xxl_media_zoom_addon) {
	containerDiv = document.getElementById('imageContainer');
	if(containerDiv) {
		containerDiv.src = image_path;
	}
	show('shadowLayer');
	show('imageContainerWrap');

	var xxl_media_zoom_ad = document.getElementById('xxlMediaZoomAd');
	if(has_xxl_media_zoom_addon == '' && xxl_media_zoom_ad != null) {
		show('xxlMediaZoomAd');	
	}
}

function closeBigImage() {
	hide('shadowLayer');
	hide('imageContainerWrap');
	containerDiv = document.getElementById('imageContainer');
	if(containerDiv != null) {
		containerDiv.src = "";
	}
	
	var xxl_media_zoom_ad = document.getElementById('xxlMediaZoomAd');
	if(xxl_media_zoom_ad != null) {
		hide('xxlMediaZoomAd');
	}
}

function prepareHelp(id) {
	var rootEl = document.getElementById(id);
	if(rootEl) {
		var divs = rootEl.getElementsByTagName('div');
		if(divs.length > 0) {
			for(var i = 0; i < divs.length; i++) {
				var div = divs[i];
				if(div.className == 'help') {
					div.style.display = 'none';
				}
			}
		}
	}
}

function positionHelp(id, mode, border) {
	var help = document.getElementById(id);
	var helpCopy = help.cloneNode(true);
	var helpWrapper = document.getElementById('helpWrapper');
	if(help && helpWrapper) {
		if(mode) {
			helpWrapper.appendChild(helpCopy);
			helpCopy.style.display = "block";
		} else {
			var childs = helpWrapper.childNodes;
			for(var i = 0; i < childs.length; i++) {
				helpWrapper.removeChild(childs[i]);
			}
		}	
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////
// Enable and disable input fields [destid] with a checkbox-switch [srcid]         //
//////////////////////////////////////////////////////////////////////////////////////////////
function handleReadonly(srcid,destid) {
	var cbx = document.getElementById(srcid);
	var txtbox = document.getElementById(destid);
	
	// If the checkbutton (srcid) is checked enable the textinput (destid)
	// else disable and delete  the textinput value (destid)
	if (cbx.type == 'checkbox' || cbx.type == 'radio') {
		if (cbx.checked) {
			txtbox.disabled = false;
			txtbox.style.backgroundColor="#FFF";
		} else {
			txtbox.disabled = true;
			txtbox.value ="";
			txtbox.style.backgroundColor="#EBE3DA";
		}
	}
}

/**
 * Diese fkt ermittelt das passende Sternzeichen zum monat und tag.
 * Schreibt es danach entweder ins uebergebene target oder gibts
 * einfach nur zurueck.
 * 
 * @param day_ele string html-id-ele vom tag 1|2...|31
 * @param month_ele string  html-id-ele vom monat 1|2...|12
 * @param sign_target string html-id-ele wo das sign rein soll
 * @param hidden_field string html-id-ele wo das sign rein soll
 * 
 * @return string sign Das ermittelte Sternzeichen
 */
function getSignByBirthday(day_ele, month_ele, sign_target, hidden_field) {	
	if (day_ele && month_ele) {
		
		// die benoetigen vars
		var sign = "";
		var day = document.getElementById(day_ele).value;
		var month = document.getElementById(month_ele).value;
				
		// sternzeichen ermitteln
		if (month == 1 && day >= 21 || month == 2 && day <= 19) {
			sign = "Wassermann";
		} else if (month == 2 && day >= 20 || month == 3 && day <= 20) {
			sign = "Fische";
		} else if (month == 3 && day >= 21 || month == 4 && day <= 20) {
			sign = "Widder";
		} else if (month == 4 && day >= 21 || month == 5 && day <= 20) {
			sign = "Stier";
		} else if (month == 5 && day >= 21 || month == 6 && day <= 21) {
			sign = "Zwillinge";
		} else if (month == 6 && day >= 22 || month == 7 && day <= 22) {
			sign = "Krebs";
		} else if (month == 7 && day >= 23 || month == 8 && day <= 23) {
			sign = "Löwe";
		} else if (month == 8 && day >= 24 || month == 9 && day <= 23) {
			sign = "Jungfrau";
		} else if (month == 9 && day >= 24 || month == 10 && day <= 23) {
			sign = "Waage";
		} else if (month == 10 && day >= 24 || month == 11 && day <= 22) {
			sign = "Skorpion";
		} else if (month == 11 && day >= 23 || month == 12 && day <= 21) {
			sign = "Schütze";
		} else if (month == 12 && day >= 22 || month == 1 && day <= 20) {
			sign = "Steinbock";
		}		
		
		// in ein hiddenfield schreiben wenn vorhanden
		if (hidden_field) {			
			document.getElementById(hidden_field).value = sign;
		}
		
		// in ein element oder zureckgeben
		if (sign_target) {
			document.getElementById(sign_target).innerHTML = sign;
		}  else {
			return sign;
		}
	} else {
		return false;
	}
}

function setFormAction(element, action) {
	if(typeof(element) != 'undefined') {
		element.form.action = action;
		element.form.submit();
	}
}

function resizeFakeHeader(new_width) {
	var fake_header = getFlirtyTopFrame().document.getElementById('fake_header');
	if(fake_header) {
		fake_header.style.width = new_width + "px";
	}
}

// Flash Version Detector  v1.2.1
// documentation: http://www.dithered.com/javascript/flash_detect/index.html
// license: http://creativecommons.org/licenses/by/1.0/
// code by Chris Nott (chris[at]dithered[dot]com)
// with VBScript code from Alastair Hamilton (now somewhat modified)


function isDefined(property) {
  return (typeof property != 'undefined');
}

var flashVersion = 0;
function getFlashVersion() {
	var latestFlashVersion = 8;
   var agent = navigator.userAgent.toLowerCase(); 
	
   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1) {
      flashVersion = 0;
   }
   
	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') { 
			for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }
		
	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else {
		flashVersion = flashVersion_DONTKNOW;
	}

	return flashVersion;
}

flashVersion_DONTKNOW = -1;

var flowplayerConfig = {
	plugins: {
		controls: {
			progressColor: '#f8ee01',
			progressGradient:'low',
			bufferColor: '#e00100',
			bufferGradient: 'medium',
			buttonColor: '#df2020',
			buttonOverColor:'#a91313',
			volume:true,
			volumeSliderColor:'#e00100',
			mute:true,
			time:false,
			timeColor:'#f8ee02',
			timeBgColor: '#696969',
			scrubber:true,
			fullscreen:true,
			mute: true,
			height:25,
			autoHide: 'always',
			background:'url(/modules/video/images/flowplayer_background.png) no-repeat',
			backgroundColor: 'transparent',
			backgroundGradient: 'none',
			padding: 5,
			bottom: 12,
			right:10,
			width:'95%',
			borderRadius: '10'
		}
	}
};

function start_flowplayer_ajax(id, url, onlyShowSeconds, onFullscreenURL) {
	document.getElementById(id).href = url;
	
	var cfg = new Object();

	for(var s in flowplayerConfig) {
		cfg[s] = flowplayerConfig[s];
	}
	
	cfg['playlist'] = [{
		'url': url
	}];
	cfg['clip'] = {
		'url': url
	};
	
	if(onFullscreenURL != '') {
		cfg['onBeforeFullscreen'] = function() {
			if(window.opener) {
				window.opener.location.href = onFullscreenURL;
				window.opener.focus();
			}
			
			return false;
		}
	}
	
	if(onlyShowSeconds) {
		onlyShowSeconds = parseInt(onlyShowSeconds) * 1000;
		
		if(onlyShowSeconds > 0) {
			cfg['plugins']['controls']['scrubber'] = false;
			
			cfg['clip']['onCuepoint'] = [[onlyShowSeconds], function(clip, cuepoint) {
		        flowplayer(id).unload();
		        
		        hide(id);
		        show(id + '_premiumOverlay');
		        if(getVideoPaymentUrl()) {
		        	openInMain(getVideoPaymentUrl());
		        }
	    	}];
		}
	}
	
	flowplayer(id, '/resources/video/flash/flowplayer-3.1.1.swf', cfg).load();
}

function start_flowplayer(id, onlyShowSeconds, onFullscreenURL, queryString) {
	var url = document.getElementById(id).href;
	
	var cfg = new Object();
	
	for(var s in flowplayerConfig) {
		cfg[s] = flowplayerConfig[s];
	}
	
	cfg['playlist'] = [{
		'url': url
	}];
	cfg['clip'] = {
		'url': url
	};

	if(onFullscreenURL != '') {
		cfg['onBeforeFullscreen'] = function() {
			if(window.opener) {
				window.opener.location.href = onFullscreenURL;
				window.opener.focus();
			}
			
			return false;
		}
	}
	
	if(onlyShowSeconds) {
		onlyShowSeconds = parseInt(onlyShowSeconds) * 1000;
		
		if(onlyShowSeconds > 0) {
			cfg['plugins']['controls']['scrubber'] = false;
			
			cfg['clip']['onCuepoint'] = [[onlyShowSeconds], function(clip, cuepoint) {
		        flowplayer(id).unload();
		        
		        hide(id);
		        show(id + '_premiumOverlay');
		        if(getVideoPaymentUrl()) {
		        	openInMain(getVideoPaymentUrl());
		        }
	    	}];
		}
	}
	
	
		
	flowplayer(id, '/resources/video/flash/flowplayer-3.1.1.swf', cfg);
}

function swapQuickmatchButton(image, path) {
	var bild = image;
	bild.src = path;
} 

function newInput(inputName) {
	
	var txt= document.createElement('input');

	txt.setAttribute("class","text");
	txt.setAttribute("name",inputName);


	return txt;
}

function newTd() {
	var td = document.createElement('td');
	return td
}

				
function newParam(isDataset) {
	var table = document.getElementById('newParams');
	var tbody = document.createElement('tbody');
			
	var tr = document.createElement('tr');
					
	var index = document.getElementById('helper').value;
	document.getElementById('helper').value = parseInt(index)+1;
	
	var tdName = document.createElement('td');
	var tdValue = document.createElement('td');
					
	var inpName = newInput("newParams["+index+"][name]");
	var inpValue = newInput("newParams["+index+"][value]");
	
	
	
	tdName.appendChild(inpName);
	tdValue.appendChild(inpValue);

	tr.appendChild(tdName);
	tr.appendChild(tdValue);
	
	if(isDataset != '') {
		var tdDefValue = document.createElement('td');
		tdDefValue.setAttribute('colspan',2);
		var inpDefValue = newInput("newParams["+index+"][defValue]");
		
		tdDefValue.appendChild(inpDefValue);
		tr.appendChild(tdDefValue);
	}
	
	tbody.appendChild(tr);				
	table.appendChild(tbody);
					
					
	document.getElementById('newParams').style.display = "";
}
		
function deleteParam(param) {
	var password = window.prompt("Bitte geben Sie ihr eigenes Passwort ein:","");
			
	var form = document.getElementById('deleteParamForm');
	form.password.value = password;
	form.param.value = param;
					
	form.submit();
}

function newInput(inputName) {
	
	var txt= document.createElement('input');

	txt.setAttribute("class","text");
	txt.setAttribute("name",inputName);


	return txt;
}

function newTd() {
	var td = document.createElement('td');
	return td
}

				
function newParam(isDataset) {
	var table = document.getElementById('newParams');
	var tbody = document.createElement('tbody');
			
	var tr = document.createElement('tr');
					
	var index = document.getElementById('helper').value;
	document.getElementById('helper').value = parseInt(index)+1;
	
	var tdName = document.createElement('td');
	var tdValue = document.createElement('td');
					
	var inpName = newInput("newParams["+index+"][name]");
	var inpValue = newInput("newParams["+index+"][value]");
	
	
	
	tdName.appendChild(inpName);
	tdValue.appendChild(inpValue);

	tr.appendChild(tdName);
	tr.appendChild(tdValue);
	
	if(isDataset != '') {
		var tdDefValue = document.createElement('td');
		tdDefValue.setAttribute('colspan',2);
		var inpDefValue = newInput("newParams["+index+"][defValue]");
		
		tdDefValue.appendChild(inpDefValue);
		tr.appendChild(tdDefValue);
	}
	
	tbody.appendChild(tr);				
	table.appendChild(tbody);
					
					
	document.getElementById('newParams').style.display = "";
}
		
function deleteParam(param) {
	var password = window.prompt("Bitte geben Sie ihr eigenes Passwort ein:","");
			
	var form = document.getElementById('deleteParamForm');
	form.password.value = password;
	form.param.value = param;
					
	form.submit();
}

function checkNumberValue(field) {
	if(field.value != '') {
		var newValue = field.value.match(/[0-9]+/);
		if(newValue != null) {
			field.value = newValue;
		} else {
			field.value = '';
		}
	}
}