/* xajax Javascript library :: version 0.2.4 */
Array.prototype.containsValue=function(valueToCheck){for(var i=0;i<this.length;i++){if(this[i]==valueToCheck)return true;}
return false;}
function Xajax(){this.DebugMessage=function(text){if(text.length > 1000)text=text.substr(0,1000)+"...\n[long response]\n...";try{if(this.debugWindow==undefined||this.debugWindow.closed==true){this.debugWindow=window.open('about:blank','xajax-debug','width=800,height=600,scrollbars=1,resizable,status');this.debugWindow.document.write('<html><head><title>Xajax debug output</title></head><body><h2>Xajax debug output</h2><div id="debugTag"></div></body></html>');}
text=text.replace(/&/g,"&amp;")
text=text.replace(/</g,"&lt;")
text=text.replace(/>/g,"&gt;")
debugTag=this.debugWindow.document.getElementById('debugTag');debugTag.innerHTML=('<b>'+(new Date()).toString()+'</b>: '+text+'<hr/>')+debugTag.innerHTML;}catch(e){alert("Xajax Debug:\n "+text);}
};this.workId='xajaxWork'+new Date().getTime();this.depth=0;this.responseErrorsForAlert=["400","401","402","403","404","500","501","502","503"];this.getRequestObject=function(){if(xajaxDebug)this.DebugMessage("Initializing Request Object..");var req=null;if(typeof XMLHttpRequest!="undefined")
req=new XMLHttpRequest();if(!req&&typeof ActiveXObject!="undefined"){try{req=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){try{req=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e2){try{req=new ActiveXObject("Msxml2.XMLHTTP.4.0");}
catch(e3){req=null;}
}
}
}
if(!req&&window.createRequest)
req=window.createRequest();if(!req)this.DebugMessage("Request Object Instantiation failed.");return req;}
this.$=function(sId){if(!sId){return null;}
var returnObj=document.getElementById(sId);if(!returnObj&&document.all){returnObj=document.all[sId];}
if(xajaxDebug&&!returnObj&&sId!=this.workId){this.DebugMessage("Element with the id \""+sId+"\" not found.");}
return returnObj;}
this.include=function(sFileName){var objHead=document.getElementsByTagName('head');var objScript=document.createElement('script');objScript.type='text/javascript';objScript.src=sFileName;objHead[0].appendChild(objScript);}
this.stripOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(sEventName.indexOf('on')==0){sEventName=sEventName.replace(/on/,'');}
return sEventName;}
this.addOnPrefix=function(sEventName){sEventName=sEventName.toLowerCase();if(sEventName.indexOf('on')!=0){sEventName='on'+sEventName;}
return sEventName;}
this.addHandler=function(sElementId,sEvent,sFunctionName){if(window.addEventListener){sEvent=this.stripOnPrefix(sEvent);eval("this.$('"+sElementId+"').addEventListener('"+sEvent+"',"+sFunctionName+",false);");}
else{sAltEvent=this.addOnPrefix(sEvent);eval("this.$('"+sElementId+"').attachEvent('"+sAltEvent+"',"+sFunctionName+",false);");}
}
this.removeHandler=function(sElementId,sEvent,sFunctionName){if(window.addEventListener){sEvent=this.stripOnPrefix(sEvent);eval("this.$('"+sElementId+"').removeEventListener('"+sEvent+"',"+sFunctionName+",false);");}
else{sAltEvent=this.addOnPrefix(sEvent);eval("this.$('"+sElementId+"').detachEvent('"+sAltEvent+"',"+sFunctionName+",false);");}
}
this.create=function(sParentId,sTag,sId){var objParent=this.$(sParentId);objElement=document.createElement(sTag);objElement.setAttribute('id',sId);if(objParent)
objParent.appendChild(objElement);}
this.insert=function(sBeforeId,sTag,sId){var objSibling=this.$(sBeforeId);objElement=document.createElement(sTag);objElement.setAttribute('id',sId);objSibling.parentNode.insertBefore(objElement,objSibling);}
this.insertAfter=function(sAfterId,sTag,sId){var objSibling=this.$(sAfterId);objElement=document.createElement(sTag);objElement.setAttribute('id',sId);objSibling.parentNode.insertBefore(objElement,objSibling.nextSibling);}
this.getInput=function(sType,sName,sId){var Obj;if(!window.addEventListener){Obj=document.createElement('<input type="'+sType+'" id="'+sId+'" name="'+sName+'">');}
else{Obj=document.createElement('input');Obj.setAttribute('type',sType);Obj.setAttribute('name',sName);Obj.setAttribute('id',sId);}
return Obj;}
this.createInput=function(sParentId,sType,sName,sId){var objParent=this.$(sParentId);var objElement=this.getInput(sType,sName,sId);if(objParent&&objElement)
objParent.appendChild(objElement);}
this.insertInput=function(sBeforeId,sType,sName,sId){var objSibling=this.$(sBeforeId);var objElement=this.getInput(sType,sName,sId);if(objElement&&objSibling&&objSibling.parentNode)
objSibling.parentNode.insertBefore(objElement,objSibling);}
this.insertInputAfter=function(sAfterId,sType,sName,sId){var objSibling=this.$(sAfterId);var objElement=this.getInput(sType,sName,sId);if(objElement&&objSibling&&objSibling.parentNode){objSibling.parentNode.insertBefore(objElement,objSibling.nextSibling);}
}
this.remove=function(sId){objElement=this.$(sId);if(objElement&&objElement.parentNode&&objElement.parentNode.removeChild){objElement.parentNode.removeChild(objElement);}
}
this.replace=function(sId,sAttribute,sSearch,sReplace){var bFunction=false;if(sAttribute=="innerHTML")
sSearch=this.getBrowserHTML(sSearch);eval("var txt=this.$('"+sId+"')."+sAttribute);if(typeof txt=="function"){txt=txt.toString();bFunction=true;}
if(txt.indexOf(sSearch)>-1){var newTxt='';while(txt.indexOf(sSearch)>-1){x=txt.indexOf(sSearch)+sSearch.length+1;newTxt+=txt.substr(0,x).replace(sSearch,sReplace);txt=txt.substr(x,txt.length-x);}
newTxt+=txt;if(bFunction){eval('this.$("'+sId+'").'+sAttribute+'=newTxt;');}
else if(this.willChange(sId,sAttribute,newTxt)){eval('this.$("'+sId+'").'+sAttribute+'=newTxt;');}
}
}
this.getFormValues=function(frm){var objForm;var submitDisabledElements=false;if(arguments.length > 1&&arguments[1]==true)
submitDisabledElements=true;var prefix="";if(arguments.length > 2)
prefix=arguments[2];if(typeof(frm)=="string")
objForm=this.$(frm);else
objForm=frm;var sXml="<xjxquery><q>";if(objForm&&objForm.tagName=='FORM'){var formElements=objForm.elements;for(var i=0;i < formElements.length;i++){if(!formElements[i].name)
continue;if(formElements[i].name.substring(0,prefix.length)!=prefix)
continue;if(formElements[i].type&&(formElements[i].type=='radio'||formElements[i].type=='checkbox')&&formElements[i].checked==false)
continue;if(formElements[i].disabled&&formElements[i].disabled==true&&submitDisabledElements==false)
continue;var name=formElements[i].name;if(name){if(sXml!='<xjxquery><q>')
sXml+='&';if(formElements[i].type=='select-multiple'){for(var j=0;j < formElements[i].length;j++){if(formElements[i].options[j].selected==true)
sXml+=name+"="+encodeURIComponent(formElements[i].options[j].value)+"&";}
}
else{sXml+=name+"="+encodeURIComponent(formElements[i].value);}
}
}
}
sXml+="</q></xjxquery>";return sXml;}
this.objectToXML=function(obj){var sXml="<xjxobj>";for(i in obj){try{if(i=='constructor')
continue;if(obj[i]&&typeof(obj[i])=='function')
continue;var key=i;var value=obj[i];if(value&&typeof(value)=="object"&&this.depth <=50){this.depth++;value=this.objectToXML(value);this.depth--;}
sXml+="<e><k>"+key+"</k><v>"+value+"</v></e>";}
catch(e){if(xajaxDebug)this.DebugMessage(e.name+": "+e.message);}
}
sXml+="</xjxobj>";return sXml;}
this._nodeToObject=function(node){if(node.nodeName=='#cdata-section'){var data="";for(var j=0;j<node.parentNode.childNodes.length;j++){data+=node.parentNode.childNodes[j].data;}
return data;}
else if(node.nodeName=='xjxobj'){var data=new Array();for(var j=0;j<node.childNodes.length;j++){var child=node.childNodes[j];var key;var value;if(child.nodeName=='e'){for(var k=0;k<child.childNodes.length;k++){if(child.childNodes[k].nodeName=='k'){key=child.childNodes[k].firstChild.data;}
else if(child.childNodes[k].nodeName=='v'){value=this._nodeToObject(child.childNodes[k].firstChild);}
}
if(key!=null&&value!=null){data[key]=value;key=value=null;}
}
}
return data;}
}
this.loadingFunction=function(){};this.doneLoadingFunction=function(){};var loadingTimeout;this.call=function(sFunction,aArgs,sRequestType){var i,r,postData;if(document.body&&xajaxWaitCursor)
document.body.style.cursor='wait';if(xajaxStatusMessages==true)window.status='Sending Request...';clearTimeout(loadingTimeout);loadingTimeout=setTimeout("xajax.loadingFunction();",400);if(xajaxDebug)this.DebugMessage("Starting xajax...");if(sRequestType==null){var xajaxRequestType=xajaxDefinedPost;}
else{var xajaxRequestType=sRequestType;}
var uri=xajaxRequestUri;var value;switch(xajaxRequestType){case xajaxDefinedGet:{var uriGet=uri.indexOf("?")==-1?"?xajax="+encodeURIComponent(sFunction):"&xajax="+encodeURIComponent(sFunction);if(aArgs){for(i=0;i<aArgs.length;i++){value=aArgs[i];if(typeof(value)=="object")
value=this.objectToXML(value);uriGet+="&xajaxargs[]="+encodeURIComponent(value);}
}
uriGet+="&xajaxr="+new Date().getTime();uri+=uriGet;postData=null;}break;case xajaxDefinedPost:{postData="xajax="+encodeURIComponent(sFunction);postData+="&xajaxr="+new Date().getTime();if(aArgs){for(i=0;i <aArgs.length;i++){value=aArgs[i];if(typeof(value)=="object")
value=this.objectToXML(value);postData=postData+"&xajaxargs[]="+encodeURIComponent(value);}
}
}break;default:
//alert("Illegal request type: "+xajaxRequestType);
return false;
break;}
r=this.getRequestObject();if(!r)return false;r.open(xajaxRequestType==xajaxDefinedGet?"GET":"POST",uri,true);if(xajaxRequestType==xajaxDefinedPost){try{r.setRequestHeader("Method","POST "+uri+" HTTP/1.1");r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");}
catch(e){alert("Your browser does not appear to  support asynchronous requests using POST.");return false;}
}
r.onreadystatechange=function(){if(r.readyState!=4)
return;if(r.status==200){if(xajaxDebug)xajax.DebugMessage("Received:\n"+r.responseText);if(r.responseXML&&r.responseXML.documentElement)
xajax.processResponse(r.responseXML);else{var errorString="Error: the XML response that was returned from the server is invalid.";errorString+="\nReceived:\n"+r.responseText;trimmedResponseText=r.responseText.replace(/^\s+/g,"");trimmedResponseText=trimmedResponseText.replace(/\s+$/g,"");if(trimmedResponseText!=r.responseText)
errorString+="\nYou have whitespace in your response.";alert(errorString);document.body.style.cursor='default';if(xajaxStatusMessages==true)window.status='Invalid XML response error';}
}
else{if(xajax.responseErrorsForAlert.containsValue(r.status)){var errorString="Error: the server returned the following HTTP status: "+r.status;errorString+="\nReceived:\n"+r.responseText;alert(errorString);}
document.body.style.cursor='default';if(xajaxStatusMessages==true)window.status='Invalid XML response error';}
delete r;r=null;}
if(xajaxDebug)this.DebugMessage("Calling "+sFunction+" uri="+uri+" (post:"+postData+")");r.send(postData);if(xajaxStatusMessages==true)window.status='Waiting for data...';delete r;return true;}
this.getBrowserHTML=function(html){tmpXajax=this.$(this.workId);if(!tmpXajax){tmpXajax=document.createElement("div");tmpXajax.setAttribute('id',this.workId);tmpXajax.style.display="none";tmpXajax.style.visibility="hidden";document.body.appendChild(tmpXajax);}
tmpXajax.innerHTML=html;var browserHTML=tmpXajax.innerHTML;tmpXajax.innerHTML='';return browserHTML;}
this.willChange=function(element,attribute,newData){if(!document.body){return true;}
if(attribute=="innerHTML"){newData=this.getBrowserHTML(newData);}
elementObject=this.$(element);if(elementObject){var oldData;eval("oldData=this.$('"+element+"')."+attribute);if(newData!==oldData)
return true;}
return false;}
this.viewSource=function(){return "<html>"+document.getElementsByTagName("HTML")[0].innerHTML+"</html>";}
this.processResponse=function(xml){clearTimeout(loadingTimeout);this.doneLoadingFunction();if(xajaxStatusMessages==true)window.status='Processing...';var tmpXajax=null;xml=xml.documentElement;if(xml==null)
return;var skipCommands=0;for(var i=0;i<xml.childNodes.length;i++){if(skipCommands > 0){skipCommands--;continue;}
if(xml.childNodes[i].nodeName=="cmd"){var cmd;var id;var property;var data;var search;var type;var before;var objElement=null;for(var j=0;j<xml.childNodes[i].attributes.length;j++){if(xml.childNodes[i].attributes[j].name=="n"){cmd=xml.childNodes[i].attributes[j].value;}
else if(xml.childNodes[i].attributes[j].name=="t"){id=xml.childNodes[i].attributes[j].value;}
else if(xml.childNodes[i].attributes[j].name=="p"){property=xml.childNodes[i].attributes[j].value;}
else if(xml.childNodes[i].attributes[j].name=="c"){type=xml.childNodes[i].attributes[j].value;}
}
if(xml.childNodes[i].childNodes.length > 1&&xml.childNodes[i].firstChild.nodeName=="#cdata-section"){data="";for(var j=0;j<xml.childNodes[i].childNodes.length;j++){data+=xml.childNodes[i].childNodes[j].data;}
}
else if(xml.childNodes[i].firstChild&&xml.childNodes[i].firstChild.nodeName=='xjxobj'){data=this._nodeToObject(xml.childNodes[i].firstChild);objElement="XJX_SKIP";}
else if(xml.childNodes[i].childNodes.length > 1){for(var j=0;j<xml.childNodes[i].childNodes.length;j++){if(xml.childNodes[i].childNodes[j].childNodes.length > 1&&xml.childNodes[i].childNodes[j].firstChild.nodeName=="#cdata-section"){var internalData="";for(var k=0;k<xml.childNodes[i].childNodes[j].childNodes.length;k++){internalData+=xml.childNodes[i].childNodes[j].childNodes[k].nodeValue;}
}else{var internalData=xml.childNodes[i].childNodes[j].firstChild.nodeValue;}
if(xml.childNodes[i].childNodes[j].nodeName=="s"){search=internalData;}
if(xml.childNodes[i].childNodes[j].nodeName=="r"){data=internalData;}
}
}
else if(xml.childNodes[i].firstChild)
data=xml.childNodes[i].firstChild.nodeValue;else
data="";if(objElement!="XJX_SKIP")objElement=this.$(id);var cmdFullname;try{if(cmd=="cc"){cmdFullname="addConfirmCommands";var confirmResult=confirm(data);if(!confirmResult){skipCommands=id;}
}
if(cmd=="al"){cmdFullname="addAlert";alert(data);}
else if(cmd=="js"){cmdFullname="addScript/addRedirect";eval(data);}
else if(cmd=="jc"){cmdFullname="addScriptCall";var scr=id+'(';if(data[0]!=null){scr+='data[0]';for(var l=1;l<data.length;l++){scr+=',data['+l+']';}
}
scr+=');';eval(scr);}
else if(cmd=="in"){cmdFullname="addIncludeScript";this.include(data);}
else if(cmd=="as"){cmdFullname="addAssign/addClear";if(this.willChange(id,property,data)){eval("objElement."+property+"=data;");}
}
else if(cmd=="ap"){cmdFullname="addAppend";eval("objElement."+property+"+=data;");}
else if(cmd=="pp"){cmdFullname="addPrepend";eval("objElement."+property+"=data+objElement."+property);}
else if(cmd=="rp"){cmdFullname="addReplace";this.replace(id,property,search,data)
}
else if(cmd=="rm"){cmdFullname="addRemove";this.remove(id);}
else if(cmd=="ce"){cmdFullname="addCreate";this.create(id,data,property);}
else if(cmd=="ie"){cmdFullname="addInsert";this.insert(id,data,property);}
else if(cmd=="ia"){cmdFullname="addInsertAfter";this.insertAfter(id,data,property);}
else if(cmd=="ci"){cmdFullname="addCreateInput";this.createInput(id,type,data,property);}
else if(cmd=="ii"){cmdFullname="addInsertInput";this.insertInput(id,type,data,property);}
else if(cmd=="iia"){cmdFullname="addInsertInputAfter";this.insertInputAfter(id,type,data,property);}
else if(cmd=="ev"){cmdFullname="addEvent";property=this.addOnPrefix(property);eval("this.$('"+id+"')."+property+"= function(){"+data+";}");}
else if(cmd=="ah"){cmdFullname="addHandler";this.addHandler(id,property,data);}
else if(cmd=="rh"){cmdFullname="addRemoveHandler";this.removeHandler(id,property,data);}
}
catch(e){if(xajaxDebug)
alert("While trying to '"+cmdFullname+"' (command number "+i+"), the following error occured:\n"
+e.name+": "+e.message+"\n"
+(id&&!objElement?"Object with id='"+id+"' wasn't found.\n":""));}
delete objElement;delete cmd;delete cmdFullname;delete id;delete property;delete search;delete data;delete type;delete before;delete internalData;delete j;delete k;}
}
delete xml;delete i;document.body.style.cursor='default';if(xajaxStatusMessages==true)window.status='Done';}
}
var xajax=new Xajax();xajaxLoaded=true;
/* Google Maps */

function googleMap(address) {
	if(typeof(GBrowserIsCompatible) != "undefined")
	{
		if (GBrowserIsCompatible()) 
		{
			var currentmap = new GMap2(document.getElementById("currentmap"));
			currentmap.addControl(new GSmallMapControl());
			currentmap.addControl(new GMapTypeControl());
			currentmap.setCenter(mhb, 13);
			geocoder = new GClientGeocoder();
			
			geocoder.getLatLng(
				address,
				function(point) 
				{
					if (point) 
					{
						currentmap.setCenter(point, 13);
						var marker = new GMarker(point);
						currentmap.addOverlay(marker);
						// marker.openInfoWindowHtml("april5 GmbH - advertising architects<br />Hammer Dorfstra&szlig;e 35, 40221 D&uuml;sseldorf");
					}
				}
			);
		}
	}
}
/* Google Search */

function search_start()
{
	xajax_globalsearch(document.searchform.globalsearchterm.value);
}

function search_start_old()
{
	var area = '';

	if(document.searchform.globalsearchterm.value != '')
	{
		searchOptions = new GsearcherOptions();
		searchOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
	
		for (i=0;i<document.searchform.searcharea.length;i++) 
		{
			if(document.searchform.searcharea[i].checked) area = document.searchform.searcharea[i].value;
		}
	
		var searchControl = new google.search.SearchControl();
		
		switch(area)
		{
			case "Web":
				var siteSearch = new GwebSearch();
				siteSearch.setUserDefinedLabel("Ergebnisse f&uuml;r &quot;" + document.searchform.globalsearchterm.value + "&quot; aus dem Web");
			
				siteSearch.setUserDefinedClassSuffix("siteSearch");
			
				searchControl.addSearcher(siteSearch,searchOptions);
				searchControl.draw(document.getElementById("googlesearch_popup_contentbox"));
				searchControl.execute(document.searchform.globalsearchterm.value);
				dijit.byId("googlesearch_popup").show();
	
				break;
	
			case "Portal_old":
				var siteSearch = new GwebSearch();
				siteSearch.setUserDefinedLabel("Ergebnisse f&uuml;r &quot;" + document.searchform.globalsearchterm.value + "&quot; aus Medienhandbuch.de");
				siteSearch.setSiteRestriction(window.location.host + basepath);
			
				siteSearch.setUserDefinedClassSuffix("siteSearch");
			
				searchControl.addSearcher(siteSearch,searchOptions);
				searchControl.draw(document.getElementById("googlesearch_popup_contentbox"));
				searchControl.execute(document.searchform.globalsearchterm.value);
				dijit.byId("googlesearch_popup").show();
	
				break;
	
			case "Portal":
				xajax_globalsearch(document.searchform.globalsearchterm.value);
				//window.location.href = basepath + '/suche.php?globalsearchterm=' + escape(document.searchform.globalsearchterm.value);
				break;
		}
	}
}

function OnLoad() {
	// Create a search control
	var searchControl = new google.search.SearchControl();
	
	var siteSearch = new GwebSearch();
	siteSearch.setUserDefinedLabel("Medienhandbuch.de");
	siteSearch.setUserDefinedClassSuffix("siteSearch");
	siteSearch.setSiteRestriction(window.location.host + basepath);
	searchControl.addSearcher(siteSearch);
	
	// Add in a full set of searchers
	//var localSearch = new google.search.LocalSearch();
	//searchControl.addSearcher(localSearch);
	//searchControl.addSearcher(new google.search.WebSearch());
	//searchControl.addSearcher(new google.search.VideoSearch());
	//searchControl.addSearcher(new google.search.BlogSearch());
	
	// Set the Local Search center point
	//localSearch.setCenterPoint("New York, NY");
	
	// Tell the searcher to draw itself and tell it where to attach
	searchControl.draw(document.getElementById("googlesearch_popup_contentbox"));
	
	// Execute an inital search
	//searchControl.execute("Google");
}

if(typeof(google) != "undefined") 
{
	try{google.load("search", "1");}
	catch(e){}
}
var searchControl = null;
var searchOptions = null;
/* News */

function add_item_detail_code(address,name)
{
	document.write('<a href="javascript:item_detail(\'' + address + '\');">' + name + '</a>');
}

function add_news_commentform(news_id)
{
	if(document.getElementById("newsarticle_commentformcontainer"))
	{
		document.getElementById("newsarticle_commentformcontainer").innerHTML = '<form id="newsarticle_commentform" class="newsarticle_commentform" name="newsarticle_commentform" method="post" action="javascript:void(null);">\
			<h2 class="headline_orange">Neuen Kommentar hinzufügen</h2>\
			<label for="comment" class="label_textarea">Ihr Kommentar:</label><textarea class="input_textarea" id="comment" name="comment" style="margin: 0; padding: 0;"></textarea>\
			<div class="clearer"></div>\
			<button class="link_button_orange" onclick="news_savecomment(0,' + news_id + ');">absenden</button>\
		</form>';
	}
}

function news_savecomment(comment_id, news_id)
{
	xajax_news_comment(comment_id, news_id, xajax.getFormValues('newsarticle_commentform'));
	document.getElementById("comment").value = '';
}

function show_contentad_popup()
{
	if(dojo.byId('contentad_popup'))
	{
		dojo.byId('contentad_contentbox').innerHTML = dojo.byId('contentad').innerHTML.replace(/\-medium/,'-large') + '<div id="contentad_countdown"></div>';
		dijit.byId('contentad_popup').show();
		countdown_contentad_popup(8);
	}
}

function countdown_contentad_popup(second)
{
	dojo.byId('contentad_countdown').innerHTML = second;
	if(second > 0) window.setTimeout('countdown_contentad_popup(' + (second - 1) + ');',1000);
	else window.setTimeout('close_contentad_popup();',1000);
}

function close_contentad_popup()
{
	if(dojo.byId('contentad_popup')) dijit.byId('contentad_popup').hide();
}

/* Lightbox */

function refreshlightbox(object_id,object_type)
{
	xajax_refreshlightbox();
}

function addlightbox(object_id,object_type)
{
	xajax_addlightbox(object_id,object_type);
}

function removelightbox(object_id,object_type)
{
	xajax_removelightbox(object_id,object_type);
}

function addlightbox_button_code(object_id,object_type)
{
	document.write('<span class="lightboxform"><input type="image" class="image" src="' + basepath + '/design/note_add.png" alt="+" title="zum Merkzettel hinzuf&uuml;gen" onclick="addlightbox(' + object_id + ',\'' + object_type + '\');" /></span>');
}

function removelightbox_button_code(object_id,object_type)
{
	document.write('<span class="lightboxform"><input type="image" class="image" src="' + basepath + '/design/note_delete.png" alt="-" title="vom Merkzettel entfernen" onclick="removelightbox(' + object_id + ',\'' + object_type + '\');" /></span>');
}

function close_lightbox()
{
	if(dojo.byId('lightbox_handle'))
	{
		dojo.byId('lightbox_handle').blur();
		dojo.byId('lightbox_handle').src = dojo.byId('lightbox_handle').src.replace(/arrow-right/,'arrow-left');
		dojo.byId('lightbox_handle').onclick = function () {open_lightbox();};
	}
	
	if(dojo.byId('lightbox_wrapper'))
	{
		var maxPosition = 18;
		var currentPosition = parseFloat(dojo.byId('lightbox_wrapper').style.left.replace(/em/,''));
		var newPosition = currentPosition + 1;
		if(newPosition > maxPosition) newPosition = maxPosition;
		dojo.byId('lightbox_wrapper').style.left = newPosition + 'em';

		if(newPosition < maxPosition) moveLightboxTimer = window.setTimeout('close_lightbox()',20);	
		else xajax_lightbox_position('close');	
	}
}

function open_lightbox()
{
	if(dojo.byId('lightbox_handle'))
	{
		dojo.byId('lightbox_handle').blur();
		dojo.byId('lightbox_handle').src = dojo.byId('lightbox_handle').src.replace(/arrow-left/,'arrow-right');
		dojo.byId('lightbox_handle').onclick = function() {close_lightbox();};
	}
	
	if(dojo.byId('lightbox_wrapper'))
	{
		var minPosition = 0.9375;
		var currentPosition = parseFloat(dojo.byId('lightbox_wrapper').style.left.replace(/em/,''));
		var newPosition = currentPosition - 1;
		if(newPosition < minPosition) newPosition = minPosition;
		dojo.byId('lightbox_wrapper').style.left = newPosition + 'em';

		if(newPosition > minPosition) moveLightboxTimer = window.setTimeout('open_lightbox()',20);	
		else xajax_lightbox_position('open');	
	}
}

function clear_lightbox()
{
	if(lightboxSaved == 0)
	{
		var chk = window.confirm('Der aktuelle Merkzettel ist nicht gespeichert, wollen Sie trotzdem alle Einträge aus dem aktuellen Merkzettel entfernen?');
		if(chk == true) xajax_lightbox_clear();
	}
	else xajax_lightbox_clear();
}

function load_lightbox(lightbox_id)
{
	if(lightboxSaved == 0)
	{
		var chk = window.confirm('Der aktuelle Merkzettel ist nicht gespeichert, wollen Sie trotzdem den gespeicherten Merkzettel einladen?');
		if(chk == true) xajax_lightbox_load(lightbox_id);
	}
	else xajax_lightbox_load(lightbox_id);
}

function delete_lightbox(lightbox_name,lightbox_id)
{
	var chk = window.confirm('Wollen Sie Ihren gespeicherten Merkzettel ' + lightbox_name + ' wirklich löschen?');
	if(chk == true) xajax_lightbox_delete(lightbox_id);
}

function meinmedienhandbuch_logout()
{
	if(lightboxSaved == 0)
	{
		var chk = window.confirm('Der aktuelle Merkzettel ist nicht gespeichert, wollen Sie sich trotzdem ausloggen?');
		if(chk == true) xajax_meinmedienhandbuch_final_logout();
	}
	else xajax_meinmedienhandbuch_final_logout();
}

function highlight_lightbox()
{
	startcolorR = 255;
	startcolorG = 255;
	startcolorB = 255;
	endcolorR = 255;
	endcolorG = 196;
	endcolorB = 196;
	lightboxTotalColorSteps = 16;
	
	switch(lightboxColorDirection)
	{
		default:
		case 'up':
			lightboxColorStep++;
			break;

		case 'down':
			lightboxColorStep--;
			break;
	}
	
	currentR = startcolorR + Math.floor(((endcolorR - startcolorR) / lightboxTotalColorSteps) * lightboxColorStep);
	currentG = startcolorG + Math.floor(((endcolorG - startcolorG) / lightboxTotalColorSteps) * lightboxColorStep);
	currentB = startcolorB + Math.floor(((endcolorB - startcolorB) / lightboxTotalColorSteps) * lightboxColorStep);
	
	dojo.byId('lightbox').style.backgroundColor = 'rgb(' + currentR + ',' + currentG + ',' + currentB + ');'
	if(dojo.byId('shop_cart_summary')) dojo.byId('shop_cart_summary').style.backgroundColor = 'rgb(' + currentR + ',' + currentG + ',' + currentB + ');'

	if(lightboxColorStep == 16) lightboxColorDirection = 'down';
	if(lightboxColorStep == 0) 
	{
		lightboxColorDirection = 'up';
	}
	else window.setTimeout('highlight_lightbox();',30);
}

function lightbox_switch(tab)
{
	tabcount = 2;
	
	for(i=0;i<tabcount;i++)
	{
		if(i != tab) 
		{
			dojo.byId('lightbox_switchbox_menu_' + i).className = "";
			dojo.byId('lightbox_switchbox_content_' + i).className = "";
		}
		else
		{
			dojo.byId('lightbox_switchbox_menu_' + i).className = "selected";
			dojo.byId('lightbox_switchbox_content_' + i).className = "selected";
		}
	}
}

var lightboxColorStep = 0;
var lightboxColorDirection = 'up';

/* Shop */

function addcart(object_id)
{
	xajax_addcart(object_id);
}

function changecart(object_id,object_count)
{
	xajax_changecart(object_id,object_count);
}

function removecart(object_id)
{
	xajax_removecart(object_id);
}

function addcart_button_code(object_id)
{
	document.write('<span class="lightboxform"><input type="image" class="image" src="' + basepath + '/design/cart_add.png" alt="+" title="zum Warenkorb hinzuf&uuml;gen" onclick="addcart(' + object_id + ');" /></span>');
}

function removecart_button_code(object_id)
{
	document.write('<span class="lightboxform"><input type="image" class="image" src="' + basepath + '/design/cart_delete.png" alt="-" title="aus dem Warenkorb entfernen" onclick="removecart(' + object_id + ');" /></span>');
}

function changecart_button_code(object_id,object_count)
{
	document.write('<input type="text" size="2" class="dijitTextBox" value="' + object_count + '" onkeyup="changecart(' + object_id + ',this.value);" />');
}

/* Item Search */

function item_detail_button_code(object_url,object_name,object_onclick)
{
	if(object_onclick != '')
	{
		document.write('<a href="javascript:item_detail(\'' + object_url + '\');" onclick="' + object_onclick + '" title="Details (&ouml;ffnet ein neues Fenster)">' + object_name + '</a>');
	}
	else
	{
		document.write('<a href="javascript:item_detail(\'' + object_url + '\');" title="Details (&ouml;ffnet ein neues Fenster)">' + object_name + '</a>');
	}
}

function item_detail(url)
{
	if(global_current_size != null) var current_size = global_current_size;
	else var current_size = "66.7%";
	current_size = parseFloat(current_size.replace(/[^\.0-9]/,''));

	try
	{
		if(window.name != "Detail")
		{
			
			setCookie('popup',1);
			//Detail = window.open("about:blank", "Detail", "statusbar=no,menubar=yes,height=640,width=1020,dependent=yes,location=yes,scrollbars=no,resizable=yes");
			Detail = window.open("http://" + window.location.hostname + url, "Detail", "statusbar=no,menubar=yes,height=" + Math.round((640 * current_size) / 66.7) + ",width=" + Math.round((1020 * current_size) / 66.7) + ",dependent=yes,location=yes,scrollbars=no,resizable=yes");
			//Detail.focus();
			//Detail.onload = function() {xajax_item_popup(url);};
			//window.opener.xajax_item_popup(url);
		}
		else window.location.href = "http://" + window.location.hostname + url;
	}
	catch(e) {}
}

function item_detail_old3(url)
{
	if(typeof(Xajax) != "undefined")
	{
		try
		{
			if(window.name != "Detail" && typeof(Detail) == "undefined")
			{
				Detail = window.open("about:blank", "Detail", "statusbar=no,menubar=yes,height=" + Math.round((640 * current_size) / 66.7) + ",width=" + Math.round((1020 * current_size) / 66.7) + ",dependent=yes,location=yes,scrollbars=no,resizable=yes");
				//Detail.focus();
				Detail.onload = function() {Detail.opener.xajax_item_popup(url);};
				//window.opener.xajax_item_popup(url);
			}
			else xajax_item_popup(url);
		}
		catch(e)
		{
			window.setTimeout('item_detail("' + url + '");',250);
		}
	}
	else window.setTimeout('item_detail("' + url + '");',250);
}

function item_detail_old2(url)
{
	if(window.name != "Detail" && typeof(Detail) == "undefined")
	{
		Detail = window.open("about:blank", "Detail", "statusbar=no,menubar=yes,height=640,width=1020,dependent=yes,location=yes,scrollbars=no,resizable=yes");
		Detail.focus();
	}

	try
	{
		window.opener.xajax_item_popup(url);
	}
	catch(e)
	{
		try
		{
			xajax_item_popup(url);
		}
		catch(e)
		{
			window.setTimeout('item_detail("' + url + '");',250);
		}
	}
}

function item_detail_old(url)
{
	if(typeof(popup) == "undefined") 
	{
		xajax_item_popup(url);
		Detail = window.open("about:blank", "Detail", "statusbar=no,menubar=yes,height=640,width=1020,dependent=yes,location=yes,scrollbars=no,resizable=yes");
		Detail.focus();
	}
	else 
	{
		try
		{
			window.opener.xajax_item_popup(url);
		}
		catch(e)
		{
			xajax_item_popup(url);
		}
	}
}

function item_popup(url)
{
	if(typeof(is_ie) == "undefined")
	{
		Detail.location.href = url;
		Detail.focus();
	}
	else window.setTimeout('item_popup_delayed("' + url + '");',2000);
}

function item_popup_delayed(url)
{
	//Detail.location.href = url;
	//Detail.focus();
}

var item_reduce_all = function ()
{
	if(itemResizeCurrent != null)
	{
		window.clearTimeout(itemResizeTimer);
		item_reduce(itemResizeCurrent);	
	}
}

function item_enlarge(item_id)
{
	if(itemResizeCurrent != null && itemResizeCurrent != item_id) 
	{
		window.clearTimeout(itemResizeTimer);
		item_reduce(itemResizeCurrent);	
	}
	itemResizeCurrent = item_id;
	window.clearTimeout(itemResizeArray[item_id]);
	if(document.getElementById('item' + item_id))
	{
		var wrapperheight = document.getElementById('item' + item_id).offsetHeight;
		var contentheight = document.getElementById('item' + item_id).getElementsByTagName('div')[1].offsetHeight;
		if(contentheight > (wrapperheight * 1.15))
		{
			var maxheight = 5;
			var currentheight = parseFloat(document.getElementById('item' + item_id).style.height.replace(/em/,''));
			var newheight = currentheight + 1;
			if(newheight > maxheight) newheight = maxheight;
			document.getElementById('item' + item_id).style.height = newheight + 'em';
			document.getElementById('item' + item_id).style.backgroundPosition = 'right ' + (document.getElementById('item' + item_id).offsetHeight - 16) + 'px';
			
			if(newheight < maxheight) 
			{
				itemResizeTimer = window.setTimeout('item_enlarge(' + item_id + ')',20);	
			}	
		}
	}
}

function item_reduce(item_id)
{
	if(document.getElementById('item' + item_id))
	{
		var minheight = 3.2;
		var minheight = 5;
		var currentheight = parseFloat(document.getElementById('item' + item_id).style.height.replace(/em/,''));
		var newheight = currentheight - 1;
		if(newheight < minheight) newheight = minheight;
		document.getElementById('item' + item_id).style.height = newheight + 'em';
		document.getElementById('item' + item_id).style.backgroundPosition = 'right ' + (document.getElementById('item' + item_id).offsetHeight - 16) + 'px';
		
		if(newheight > minheight) itemResizeArray[item_id] = window.setTimeout('item_reduce(' + item_id + ')',20);
		else window.clearTimeout(itemResizeArray[item_id]);
	}
}

function item_show_htmlad(adresse)
{
	if(document.getElementById('htmlad_contentbox'))
	{
		document.getElementById('htmlad_contentbox').innerHTML = '<iframe class="item_popup_html_ad" src="' + adresse + '" security="restricted" marginwidth="0" marginheight="0" frameborder="0" title="Gestaltete Anzeige"></iframe>';
		dijit.byId('htmlad_popup').show();
	}
}

function item_readspeaker(adresse)
{
	if(document.getElementById('readspeaker_contentbox'))
	{
		document.getElementById('readspeaker_contentbox').innerHTML = '<iframe class="item_popup_readspeaker" src="http://asp.readspeaker.net/cgi-bin/medienhandbuchrsone?customerid=1003602&amp;lang=de&amp;url=' + escape(adresse) + '" security="restricted" marginwidth="0" marginheight="0" frameborder="0" title="Vorleseservice"></iframe>';
		dijit.byId('readspeaker_popup').show();
	}
}

function item_show_loader()
{
	if(document.getElementById("page_ajaxloadersmall")) document.getElementById("page_ajaxloadersmall").style.display = "block";
}

function item_hide_loader()
{
	if(document.getElementById("page_ajaxloadersmall")) document.getElementById("page_ajaxloadersmall").style.display = "none";
}


/* Company Search */

function company_searchTerm(term)
{
	if(term != searchTerm)
	{
		if(searchTimer != null) clearTimeout(searchTimer);
		searchTimer = window.setTimeout('currentOffset=0;company_search();',searchWaitTime);
	}
}

function company_triggersearch()
{
	if(searchTimer != null) clearTimeout(searchTimer);
	searchTimer = window.setTimeout('currentOffset=0;company_search();',searchWaitTime);
}

function company_search()
{
	item_show_loader();
	xajax_company_searchresults(currentOffset,xajax.getFormValues("itemform"));
}

function toggle_agencies(checkedStatus)
{
	if(checkedStatus == true)
	{
		getElementById('itemform_type').style.display = 'block';
	}
	else
	{
		getElementById('itemform_type').style.display = 'none';
	}
}


/* Educational Offer Search */

function educationaloffer_searchTerm(term)
{
	if(term != searchTerm)
	{
		if(searchTimer != null) clearTimeout(searchTimer);
		searchTimer = window.setTimeout('currentOffset=0;educationaloffer_search();',searchWaitTime);
	}
}

function educationaloffer_triggersearch()
{
	if(searchTimer != null) clearTimeout(searchTimer);
	searchTimer = window.setTimeout('currentOffset=0;educationaloffer_search();',searchWaitTime);
}

function educationaloffer_search()
{
	item_show_loader();
	xajax_educationaloffer_searchresults(currentOffset,xajax.getFormValues("itemform"));
}

/* Job Offer Search */

function joboffer_searchTerm(term)
{
	if(term != searchTerm)
	{
		if(searchTimer != null) clearTimeout(searchTimer);
		searchTimer = window.setTimeout('currentOffset=0;joboffer_search();',searchWaitTime);
	}
}

function joboffer_triggersearch()
{
	if(searchTimer != null) clearTimeout(searchTimer);
	searchTimer = window.setTimeout('currentOffset=0;joboffer_search();',searchWaitTime);
}

function joboffer_search()
{
	item_show_loader();
	xajax_joboffer_searchresults(currentOffset,xajax.getFormValues("itemform"));
}

function show_joboffercontact(joboffer_id)
{
	if(dojo.byId('joboffercontact_popup'))
	{
		xajax_joboffer_contact(joboffer_id);
		dijit.byId('joboffercontact_popup').show();
	}
}

function close_joboffercontact()
{
	clear_dojo_instances('joboffercontact');
	if(dojo.byId('joboffercontact_popup'))
	{
		dijit.byId('joboffercontact_popup').hide();
	}
}

function jobboerse_popup(url)
{
	if(global_current_size != null) var current_size = global_current_size;
	else var current_size = "66.7%";
	current_size = parseFloat(current_size.replace(/[^\.0-9]/,''));

	try
	{
		if(window.name != "Detail")
		{
			Detail = window.open(url, "Detail", "statusbar=no,menubar=yes,height=" + Math.round((640 * current_size) / 66.7) + ",width=" + Math.round((1020 * current_size) / 66.7) + ",dependent=yes,location=yes,scrollbars=no,resizable=yes");
		}
		else window.location.href = url;
	}
	catch(e) {}
	return false;
}

/* Educational Offer Search */

function jobrequest_searchTerm(term)
{
	if(term != searchTerm)
	{
		if(searchTimer != null) clearTimeout(searchTimer);
		searchTimer = window.setTimeout('currentOffset=0;jobrequest_search();',searchWaitTime);
	}
}

function jobrequest_triggersearch()
{
	if(searchTimer != null) clearTimeout(searchTimer);
	searchTimer = window.setTimeout('currentOffset=0;jobrequest_search();',searchWaitTime);
}

function jobrequest_search()
{
	item_show_loader();
	xajax_jobrequest_searchresults(currentOffset,xajax.getFormValues("itemform"));
}

/* Jobportraits Search */

function jobportrait_searchTerm(term)
{
	if(term != searchTerm)
	{
		if(searchTimer != null) clearTimeout(searchTimer);
		searchTimer = window.setTimeout('currentOffset=0;jobportrait_search();',searchWaitTime);
	}
}

function jobportrait_triggersearch()
{
	if(searchTimer != null) clearTimeout(searchTimer);
	searchTimer = window.setTimeout('currentOffset=0;jobportrait_search();',searchWaitTime);
}

function jobportrait_search()
{
	item_show_loader();
	xajax_jobportrait_searchresults(currentOffset,xajax.getFormValues("itemform"));
}

function meinmedienhandbuch_deletecompanyentry(object_id)
{
	var chk = window.confirm('Wollen Sie den Adresseintrag wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deletecompanyentry(object_id);
}

function meinmedienhandbuch_deleteeducationalofferentry(object_id)
{
	var chk = window.confirm('Wollen Sie das Bildungsangebot wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deleteeducationalofferentry(object_id);
}

function meinmedienhandbuch_deletejobofferentry(object_id)
{
	var chk = window.confirm('Wollen Sie das Stellenangebot wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deletejobofferentry(object_id);
}

function meinmedienhandbuch_deletejobrequestentry(object_id)
{
	var chk = window.confirm('Wollen Sie das Stellengesuch wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deletejobrequestentry(object_id);
}

function meinmedienhandbuch_deletecontentadentry(object_id)
{
	var chk = window.confirm('Wollen Sie die Textanzeige wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deletecontentadentry(object_id);
}

function meinmedienhandbuch_deletenewsletteradentry(object_id)
{
	var chk = window.confirm('Wollen Sie die Textanzeige wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deletenewsletteradentry(object_id);
}

function meinmedienhandbuch_deleteshopproductentry(object_id)
{
	var chk = window.confirm('Wollen Sie das Shopprodukt wirklich löschen?');
	if(chk == true) xajax_meinmedienhandbuch_deleteshopproductentry(object_id);
}

function togglemanagerentry(object_id,status)
{
	if(typeof(document.getElementById(object_id)) != "undefined")
	{
		elem = document.getElementById(object_id);
		if(elem.className.search(/status0/) != -1) 
		{
			elem.className = elem.className.replace(/status0/,'status1');
			elem.innerHTML = elem.innerHTML.replace(/sichtbar schalten/,'unsichtbar schalten');
			alert('Eintrag wurde sichtbar geschaltet');
		}
		else 
		{
			elem.className = elem.className.replace(/status1/,'status0');
			elem.innerHTML = elem.innerHTML.replace(/unsichtbar schalten/,'sichtbar schalten');
			alert('Eintrag wurde unsichtbar geschaltet');
		}
	}
}

function invoice_detail(url)
{
	Detail = window.open("about:blank", "Detailansicht", "statusbar=no,menubar=yes,height=640,width=980");
	Detail.location.href = url;
	Detail.focus();
}

function chart2(container_id,dataArray)
{
	lineArray = new Array("red","blue","green");
	fillArray = new Array("lightpink","lightblue","lightgreen");
	
	charts[container_id] = new dojox.charting.Chart2D;
	charts[container_id].addAxis("x", {fixLower: "major", fixUpper: "major"});
	charts[container_id].addAxis("y", {vertical: true, fixLower: "major", fixUpper: "major"});
	charts[container_id].addPlot("default", {type: "StackedAreas", tension: 3});
	for(i=0;i<dataArray.length;i++)
	{
		charts[container_id].addSeries(dataArray[i][0],dataArray[i][1], {stroke: {color: lineArray[i], width: 2}, fill: fillArray[i]});
	}
	charts[container_id].render();
}

function stats_chart(container_id,dataArray,timestart,timeend,maxcount)
{
	initDojoChart();
	
	lineArray = new Array("lightpink","lightblue","lightgreen");

	seriesValues = new Array();
	xaxisLabels = new Array();
	datum = new Date();
	x = 1;
	
	for(j=0;j<dataArray.length;j++)
	{
		seriesValues[j] = new Array();
		for(i=parseInt(timestart);i<parseInt(timeend);i = i + (24 * 60 * 60))
		{
			if(typeof(dataArray[j][i]) != "undefined") seriesValues[j].push(parseInt(dataArray[j][i]));
			else if(typeof(dataArray[j][i - 3600]) != "undefined") seriesValues[j].push(parseInt(dataArray[j][i - 3600]));
			else if(typeof(dataArray[j][i + 3600]) != "undefined") seriesValues[j].push(parseInt(dataArray[j][i + 3600]));
			else seriesValues[j].push(0);
			
			//if(mhb_debug == 1) alert(i);
			
			if(j == 0)
			{
				datum.setTime(i * 1000);
				labelTag = datum.getDate() + '';
				if(labelTag.length == 1) labelTag = '0' + labelTag;
				labelMonat = (datum.getMonth() + 1) + '';
				if(labelMonat.length == 1) labelMonat = '0' + labelMonat;
				
				labeltext = labelTag + '.' + labelMonat;
				//alert(i + ': ' + text);
				xaxisLabels.push({value: x, text: labeltext });
				x++;
			}
		}
		
		if(typeof(dataArray[j][timeend]) != "undefined") seriesValues[j].push(parseInt(dataArray[j][timeend]));
		else seriesValues[j].push(0);

		if(j == 0)
		{
			datum.setTime(timeend * 1000);
			labelTag = datum.getDate() + '';
			if(labelTag.length == 1) labelTag = '0' + labelTag;
			labelMonat = (datum.getMonth() + 1) + '';
			if(labelMonat.length == 1) labelMonat = '0' + labelMonat;
			
			labeltext = labelTag + '.' + labelMonat;
			//alert(i + ': ' + text);
			xaxisLabels.push({value: x, text: labeltext });
			x++;
		}

		//if(mhb_debug == 1) alert(seriesValues[j].join("\n"));
	}

	charts[container_id] = new dojox.charting.Chart2D(container_id);
	charts[container_id].addAxis("x", {majorTick: {stroke: "gray", length: 7}, minorTick: {stroke: "gray", length: 4}, fixLower: "minor", labels: xaxisLabels});
	//charts[container_id].addAxis("y", {vertical: true, majorTick: {stroke: "gray", length: 5}});
	charts[container_id].addPlot("default", {type: "Default", markers: true, lines: true, tension: 1});
	
	for(j=0;j<seriesValues.length;j++)
	{
		charts[container_id].addSeries("kurve" + j, seriesValues[j], {stroke: {color: lineArray[j], width: 1}});
	}
	
	window.setTimeout('stats_chart_render("' + container_id + '");',200);
	//charts[container_id].render();
	//window.setTimeout('stats_chart_scroll("' + container_id + '","' + container_id + '_scroll");',500);
}

function stats_chart_render(container_id)
{
	charts[container_id].render();
	window.setTimeout('stats_chart_scroll("' + container_id + '","' + container_id + '_scroll");',500);
}

function stats_chart2(container_id,dataArray,timestart,timeend,maxcount)
{
	initDojoChart();
	
	seriesValues = new Array();
	seriesLabels = new Array();
	datum = new Date();
	x = 0;
	for(i=parseInt(timestart);i<parseInt(timeend);i = i + (24 * 60 * 60))
	{
		if(typeof(dataArray[i]) != "undefined") seriesValues.push(parseInt(dataArray[i]));
		else if(typeof(dataArray[i - 3600]) != "undefined") seriesValues.push(parseInt(dataArray[i - 3600]));
		else if(typeof(dataArray[i + 3600]) != "undefined") seriesValues.push(parseInt(dataArray[i + 3600]));
		else seriesValues.push(0);
		
		datum.setTime(i * 1000);
		labelTag = datum.getDate() + '';
		if(labelTag.length == 1) labelTag = '0' + labelTag;
		labelMonat = (datum.getMonth() + 1) + '';
		if(labelMonat.length == 1) labelMonat = '0' + labelMonat;
		
		labeltext = labelTag + '.' + labelMonat;
		//alert(i + ': ' + text);
		seriesLabels.push({value: x, text: labeltext });
		x++;
	}
	if(typeof(dataArray[timeend]) != "undefined") seriesValues.push(parseInt(dataArray[timeend]));
	else seriesValues.push(0);
	
	datum.setTime(i * 1000);
	labelTag = datum.getDate() + '';
	if(labelTag.length == 1) labelTag = '0' + labelTag;
	labelMonat = (datum.getMonth() + 1) + '';
	if(labelMonat.length == 1) labelMonat = '0' + labelMonat;
	
	labeltext = labelTag + '.' + labelMonat;
	//alert(i + ': ' + text);
	seriesLabels.push({value: x, text: labeltext });
	
	charts[container_id] = new dojox.charting.Chart2D(container_id);
	//charts[container_id].setTheme(dojox.charting.themes.PlotKit.blue);
	charts[container_id].addAxis("x", {majorTick: {stroke: "gray", length: 7}, minorTick: {stroke: "gray", length: 4}, fixLower: "minor", labels: seriesLabels});
	
	//charts[container_id].addAxis("y", {vertical: true, majorTick: {stroke: "gray", length: 5}});
	charts[container_id].addPlot("default", {type: "Default", markers: true, lines: true, tension: 1});
	charts[container_id].addSeries("Aufrufe", seriesValues, {stroke: {color: "lightblue", width: 1}, fill: "lightblue"});
	charts[container_id].render();
	window.setTimeout('stats_chart_scroll("' + container_id + '","chart_contentbox_scroll");',500);
	//stats_chart_scroll(container_id,"chart_contentbox_scroll");
}

function stats_chart_scroll(container_id,scrollcontainer_id)
{
	if(typeof(dojo.byId(container_id)) != "undefined")
	{
		try
		{
			if(dojo.byId(container_id).getElementsByTagName('div').length == 0) window.setTimeout('stats_chart_scroll("' + container_id + '","' + scrollcontainer_id + '");',500);
			else dojo.byId(scrollcontainer_id).scrollLeft = dojo.byId(scrollcontainer_id).scrollWidth;
			document.body.style.cursor = "auto";
		}
		catch(e) {}
	}
}

/* Video Upload */

function meinmedienhandbuch_companyvideopreview(object_id,video)
{
	var FO = {
		movie: basepath + "/swf/flvplayer/flvplayer.swf",
		width:"320",
		height:"260",
		majorversion:"8",
		build:"0",
		bgcolor:"#FFFFFF",
		allowfullscreen:"true",
		wmode:"transparent",
		flashvars:"file=" + filesbasepath + "company-videos/" + video + '&image=' + filesbasepath + "companyvideo-images-medium/" + object_id + '.jpg%3Fnocache%3D'  + new Date().getTime() + '&overstretch=false'
	};
	UFO.create(FO,"videocontainer");
}

/* Audio Upload */

function meinmedienhandbuch_companyaudiopreview(object_id,audio)
{
	audioFO[object_id] = {
		movie: basepath + "/swf/flvplayer/flvplayer.swf",
		width:"320",
		height:"20",
		majorversion:"8",
		build:"0",
		bgcolor:"#FFFFFF",
		allowfullscreen:"false",
		wmode:"transparent",
		flashvars:"file=" + filesbasepath + "company-audios/" + audio
	};
	UFO.create(audioFO[object_id],"audiocontainer" + object_id);
}

var audioFO = new Object();
var charts = new Object();

/* Login */

function showlogin()
{
	if(checkCookie()) xajax_showlogin();
}

/* Forgot Password */

function show_forgotpassword()
{
	if(dojo.byId('forgotpassword_popup'))
	{
		xajax_meinmedienhandbuch_forgotpassword();
		dijit.byId('forgotpassword_popup').show();
	}
}

function close_forgotpassword()
{
	clear_dojo_instances('forgotpassword');
	if(dojo.byId('forgotpassword_popup'))
	{
		dijit.byId('forgotpassword_popup').hide();
	}
}

/* Content Ad */

function meinmedienhandbuch_previewcontentadentry(object_id)
{
	if(dojo.byId('ad_popup'))
	{
		if(dojo.byId('ad_popup').style.display != 'block') 
		{
			dijit.byId('ad_popup').show();
		}
		xajax_meinmedienhandbuch_previewcontentadentry(object_id);
	}
}

function meinmedienhandbuch_previewnewsletteradentry(object_id)
{
	if(dojo.byId('ad_popup'))
	{
		if(dojo.byId('ad_popup').style.display != 'block') 
		{
			dijit.byId('ad_popup').show();
		}
		xajax_meinmedienhandbuch_previewnewsletteradentry(object_id);
	}
}

function meinmedienhandbuch_getcompanycontactvalues(object_id)
{
	contactFieldsArray = new Array('division','salutation','firstname','lastname','phone','fax','mobile','email','skype');
	valuesArray = new Array();
	
	for(i=0;i<contactFieldsArray.length;i++)
	{
		valuesArray[contactFieldsArray[i]] = dojo.byId(contactFieldsArray[i] + object_id).value;
	}
	
	return valuesArray;
}

/* Company to Profile Update */
function meinmedienhandbuch_company_to_profile(message)
{
	var chk = window.confirm("Sollen die gerade erfolgten Änderungen Ihrer Firmendaten auf Ihre persönlichen Benutzerdaten und Rechnungsadresse übertragen werden?\n\n" + message + "\n\nFalls ja, klicken Sie OK. Ansonsten klicken Sie abbrechen.");
	if(chk == true) xajax_meinmedienhandbuch_company_to_profile();
}


/*----------------------------------------------------------*/
/* http://tinymce.moxiecode.com/punbb/viewtopic.php?id=4673 */

function seteditorFields(editorFieldsArray)
{
	editorFields = editorFieldsArray;
}

function activateEditor(editor_id) {
    if(typeof(tinyMCE) == "undefined" || typeof(document.getElementById(editor_id)) == "undefined") window.setTimeout('activateEditor("' + editor_id + '");',250);
	else
	{
		//alert('activateEditor("' + editor_id + '")');
		activeEditors[activeEditors.length] = editor_id;
		//toggleEditor(editor_id);
		if(tinyMCE.getInstanceById(editor_id) == null) tinyMCE.execCommand('mceAddControl', false, editor_id);
	}
}

function clear_tiny_instances() 
{
 	if(typeof(tinyMCE) == "undefined") window.setTimeout('clear_tiny_instances();',250);
	else
	{
		for(x=0;x<activeEditors.length;x++) 
		{
			//toggleEditor(activeEditors[x]);
			if(tinyMCE.getInstanceById(activeEditors[x]) != null) tinyMCE.execCommand('mceRemoveControl', false, activeEditors[x]);
		}
		activeEditors = new Array();
	}
}

function toggleEditor(editor_id) {
    if(typeof(tinyMCE) == "undefined") window.setTimeout('toggleEditor("' + editor_id + '");',250);
	else
	{
		if (tinyMCE.getInstanceById(editor_id) == null)
			tinyMCE.execCommand('mceAddControl', false, editor_id);
		else
		{
			tinyMCE.execCommand('mceRemoveControl', false, editor_id);
		}
	}
}

function triggersave_tiny_instances() 
{
 	for(x=0;x<activeEditors.length;x++) 
	{
        triggerSaveEditor(activeEditors[x]);
    }
}

function triggerSaveEditor(editor_id)
{
	try
	{
		if(typeof(document.getElementById(editor_id)) != "undefined") document.getElementById(editor_id).value = tinyMCE.getInstanceById(editor_id).getContent();
	}
	catch(e) {}
}

function tinymceEvent(e) {
	if (tinyMCE.selectedInstance)
	{
		tinyMCE.selectedInstance.getElement().value = tinyMCE.selectedInstance.getContent();
		if(document.getElementById(tinyMCE.selectedInstance.getElement().id + 'charcount'))
		{
			document.getElementById(tinyMCE.selectedInstance.getElement().id + 'charcount').value = tinyMCE.selectedInstance.getContent().length + ' Zeichen';
		}
	}
}

var activeEditors = new Array();
var editorFields = '';
function tiny_user_init()
{
	if(typeof(tinyMCE) == "undefined") window.setTimeout('tiny_user_init();',100);
	else tinyMCE.init({
		mode : "exact",
		theme : "advanced",
		language : "de",
		content_css : basepath + "/css/editor.css",
		valid_elements : "p,em/i,strong/b,br,strike,u,ul,ol,li",
		theme_advanced_buttons1 : "undo,redo,bold,italic,underline,strikethrough,bullist,numlist,outdent,indent,code",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		apply_source_formatting : true,
		entity_encoding : "named",
		handle_event_callback : "tinymceEvent", 
		strict_loading_mode : false,
		debug : false
	});
}

function tiny_green_init()
{
	if(typeof(tinyMCE) == "undefined") window.setTimeout('tiny_green_init();',100);
	else tinyMCE.init({
		mode : "exact",
		theme : "advanced",
		language : "de",
		content_css : basepath + "/css/editor_news.css",
		valid_elements : "a[*],p,em/i,strong/b,br,strike,u,ul,ol,li,img[*],embed[*],script[*]",
		extended_valid_elements : "object[id|class|classid|codebase|width|height|align|type|data],param[id|name|type|value|valuetype<DATA?OBJECT?REF]",
		theme_advanced_buttons1 : "undo,redo,bold,italic,underline,strikethrough,link,unlink,bullist,numlist,outdent,indent,code,image,media",
		theme_advanced_buttons2 : "",
		theme_advanced_buttons3 : "",
		apply_source_formatting : true,
		entity_encoding : "named",
		plugins : "inlinepopups,media", 
		file_browser_callback : "green_createnews_imagebrowser", 
		theme_advanced_styles : "Bild links im Umfluss=imageleft;Bild rechts im Umfluss=imageright;Bild einzeln ohne Umfluss=imageblock", 
		strict_loading_mode : false,
		verify_html: true,
		debug : false
	});
}

function set_dojo_instances(form_name,widgets,widgettypes)
{
	dojoWidgetsArray[form_name] = new Array();
	dojoWidgetsArray[form_name] = widgets;
	dojoWidgetTypesArray[form_name] = new Array();
	dojoWidgetTypesArray[form_name] = widgettypes;
}

function clear_dojo_instances(form_name) 
{
	clear_tiny_instances();
	dijit.byId(form_name + 'form').destroyRecursive();
	for(i=0;i<dojoWidgetsArray[form_name].length;i++)
	{
		if(dijit.byId(dojoWidgetsArray[form_name][i]))
		{
			dijit.byId(dojoWidgetsArray[form_name][i]).destroyRecursive();
		}
	}
}

function dojo_formparse(form_container)
{
    if(typeof(dojo) == "undefined" || typeof(document.getElementById(form_container)) == "undefined") window.setTimeout('dojo_formparse("' + form_container + '");',200);
	else
	{
		dojo.byId(form_container).className = "formvisible";
		dojo.parser.parse(form_container);
		finduploadtype();
		window.setTimeout('dojo_formparse_continue();',500);
	}
}

function dojo_formparse_continue()
{
	if(typeof(editorFields) == "object" || typeof(editorFields) == "array")
	{
		for(i=0;i<editorFields.length;i++) activateEditor(editorFields[i]);
	}
}

function get_dojo_formvalues(form_name)
{
	item_show_loader();
	triggersave_tiny_instances();
	//if(typeof(tinyMCE) != "undefined") tinyMCE.triggerSave();
	/*
	var tas = dojo.byId(form_name + 'form').getElementsByTagName('textarea');
	for(var i = 0; i < tas.length; i++) {
		// snag the textarea
		var ta = tas[i];
		// put focus in the editor
		tinyMCE.execCommand('mceFocus', ta.id);
		// manually save the content
		ta.value = tinyMCE.getContent();
	}
	*/
	//clear_tiny_instances();
	//console.log(dijit.byId(form_name + 'form').getValues());
	var aFormValues = dijit.byId(form_name + 'form').getValues();

	for(i=0;i<dojoWidgetsArray[form_name].length;i++)
	{
		if(dojo.byId(dojoWidgetsArray[form_name][i])) 
		{
			switch(dojoWidgetTypesArray[form_name][i])
			{
				default:
					break;

				case "date":
					aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] = dijit.byId(dojoWidgetsArray[form_name][i]).getDisplayedValue();
					break;
					
				case "hidden":
				case "textarea":
				case "html":
					aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] = dojo.byId(dojoWidgetsArray[form_name][i]).value;
					break;
					
				case "richtext":
					aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] = dojo.byId(dojoWidgetsArray[form_name][i]).value;
					if(aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] == '') aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] = tinyMCE.getInstanceById(dojoWidgetsArray[form_name][i]).getContent();
					//alert(aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')]);
					//alert(dojo.byId(dojoWidgetsArray[form_name][i]).value);
					break;

				case "drichtext":
					alert(dojo.byId(dojoWidgetsArray[form_name][i]).value);
					alert(dojoWidgetsArray[form_name][i] + ' = ' + tinyMCE.getInstanceById(dojoWidgetsArray[form_name][i]).getContent());
					aFormValues[dojoWidgetsArray[form_name][i].replace(/^input_/,'')] = tinyMCE.getInstanceById(dojoWidgetsArray[form_name][i]).getContent();
			}
		}
	}
	return aFormValues;
}

function dojo_update_inputs(input_type,input_name,input_value,input_validation)
{
	switch(input_type)
	{
		default:
			if(dojo.byId('label_' + input_name)) dojo.byId('label_' + input_name).className = 'label_' + input_type + ' label_' + input_validation;
			if(dojo.byId('input_' + input_name)) 
			{
				switch(input_type)
				{
					default:
						dojo.byId('input_' + input_name).value = input_value;
						break;
						
					case "date":
						var datum = input_value.split('-');
						if(datum.length == 3) dojo.byId('input_' + input_name).value = datum[2] + '.' + datum[1] + '.' + datum[0];
						break;
		
					case "currency":
						dojo.byId('input_' + input_name).value = '\u20AC ' + input_value.replace(/\./,',');
						break;
						
					case "select":
						dijit.byId('input_' + input_name).valueNode.value = input_value;
						break;
						
					case "checkbox":
					case "separatorstart":
					case "separatorend":
					case "clearer":
					case "button":
						break;
				}
			}
			break;
		
		case "checkboxgroup":
		case "radiogroup":
			if(dojo.byId('formbox_' + input_name)) dojo.byId('formbox_' + input_name).className = 'formbox_' + input_type + ' formbox_' + input_validation;
			break;
	}
}

function dojo_dnd_clear()
{
	if(c1 != null) 
	{
		c1.selectAll();
		c1.deleteSelectedNodes();
		c1.clearItems();
		c1.destroy();
		c1 = null;
	}
	if(c2 != null) 
	{
		c2.selectAll();
		c2.deleteSelectedNodes();
		c2.clearItems();
		c2.destroy();
		c2 = null;
	}
	return true;
}

function dojo_dnd_delete_old(object)
{
	for (attribut in dojoSubscriptions) {
	    dojo.unsubscribe(dojoSubscriptions[attribut]);
	}
	dojoSubscriptions = new Object();

	var nodes = object.getAllNodes();
	alert(nodes.length);
	for(i=0;i<nodes.length;i++)
	{
		if(typeof(nodes[i]) != "undefined") nodes[i].destroy();
	}
	//object.selectAll();
	//object.deleteSelectedNodes();
	object.clearItems();
	object.destroy();
	//object.destroyRecursive();
	//object = null;
	object.startup();

	dojo.dnd.manager().source.clearItems();
	//dojo.dnd.manager().source.destroy();
	dojo.dnd.manager().source.startup();
	
	dojo.dnd.manager().target.clearItems();
	//dojo.dnd.manager().target.destroy();
	dojo.dnd.manager().source.startup();

	dojo.dnd._manager.source.destroy();
	dojo.dnd._manager.target.destroy();
	dojo.dnd._manager.object.destroy();

	dojo.dnd.manager().destroyRecursive();
}

function initDojoForm()
{
	clear_tiny_instances();
}

function initDojoChart()
{
	/*
	dojo.require("dojox.charting.Chart2D");
	dojo.require("dojox.charting.themes.GreySkies");
	*/
}

function dojo_repair(object)
{
	elem = document.getElementById(object);
	elems = elem.getElementsByTagName("*");
	for(i=0;i<elems.length;i++)
	{
		var display_mem = elems[i].style.display;
		elems[i].style.display = "none";
		elems[i].style.display = display_mem;
	}
}
/************************************************************************************************

  JavaScript source code        March 10, 2006

  Copyright (c) 2003-2006 Scandinavian Digital Systems AB

  Internet: http://www.digsys.se

  Freeware: The source code and its methods and algorithms may be
            used as desired without restrictions.

************************************************************************************************/

/*
  CRC-8 in table form

  Copyright (c) 1989 AnDan Software. You may use this program, or
  code or tables extracted from it, as long as this notice is not
  removed or changed.
*/
var Crc8Tab = new Array(
/*
  C/C++ language:

  unsigned char Crc8Tab[] = {...};
*/
0x00,0x1B,0x36,0x2D,0x6C,0x77,0x5A,0x41,0xD8,0xC3,0xEE,0xF5,0xB4,0xAF,0x82,0x99,0xD3,0xC8,0xE5,
0xFE,0xBF,0xA4,0x89,0x92,0x0B,0x10,0x3D,0x26,0x67,0x7C,0x51,0x4A,0xC5,0xDE,0xF3,0xE8,0xA9,0xB2,
0x9F,0x84,0x1D,0x06,0x2B,0x30,0x71,0x6A,0x47,0x5C,0x16,0x0D,0x20,0x3B,0x7A,0x61,0x4C,0x57,0xCE,
0xD5,0xF8,0xE3,0xA2,0xB9,0x94,0x8F,0xE9,0xF2,0xDF,0xC4,0x85,0x9E,0xB3,0xA8,0x31,0x2A,0x07,0x1C,
0x5D,0x46,0x6B,0x70,0x3A,0x21,0x0C,0x17,0x56,0x4D,0x60,0x7B,0xE2,0xF9,0xD4,0xCF,0x8E,0x95,0xB8,
0xA3,0x2C,0x37,0x1A,0x01,0x40,0x5B,0x76,0x6D,0xF4,0xEF,0xC2,0xD9,0x98,0x83,0xAE,0xB5,0xFF,0xE4,
0xC9,0xD2,0x93,0x88,0xA5,0xBE,0x27,0x3C,0x11,0x0A,0x4B,0x50,0x7D,0x66,0xB1,0xAA,0x87,0x9C,0xDD,
0xC6,0xEB,0xF0,0x69,0x72,0x5F,0x44,0x05,0x1E,0x33,0x28,0x62,0x79,0x54,0x4F,0x0E,0x15,0x38,0x23,
0xBA,0xA1,0x8C,0x97,0xD6,0xCD,0xE0,0xFB,0x74,0x6F,0x42,0x59,0x18,0x03,0x2E,0x35,0xAC,0xB7,0x9A,
0x81,0xC0,0xDB,0xF6,0xED,0xA7,0xBC,0x91,0x8A,0xCB,0xD0,0xFD,0xE6,0x7F,0x64,0x49,0x52,0x13,0x08,
0x25,0x3E,0x58,0x43,0x6E,0x75,0x34,0x2F,0x02,0x19,0x80,0x9B,0xB6,0xAD,0xEC,0xF7,0xDA,0xC1,0x8B,
0x90,0xBD,0xA6,0xE7,0xFC,0xD1,0xCA,0x53,0x48,0x65,0x7E,0x3F,0x24,0x09,0x12,0x9D,0x86,0xAB,0xB0,
0xF1,0xEA,0xC7,0xDC,0x45,0x5E,0x73,0x68,0x29,0x32,0x1F,0x04,0x4E,0x55,0x78,0x63,0x22,0x39,0x14,
0x0F,0x96,0x8D,0xA0,0xBB,0xFA,0xE1,0xCC,0xD7);

function Crc8Add(crc,c)
/*
  'crc' should be initialized to 0x00.
*/
{
  return Crc8Tab[(crc^c)&0xFF];
}
/*
  C/C++ language:

  inline unsigned char Crc8Add(unsigned char crc, unsigned char c)
  {
    return Crc8Tab[crc^c];
  }
*/

/*
  CRC-16 (as it is in SEA's ARC) in table form

  The logic for this method of calculating the CRC 16 bit polynomial
  is taken from an article by David Schwaderer in the April 1985
  issue of PC Tech Journal.
*/
var CrcArcTab = new Array(
/*
  C/C++ language:

  unsigned short CrcArcTab[] = {...};
*/
0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500,
0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1,
0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,
0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,0x1400,0xD4C1,0xD581,0x1540,
0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,0xF001,
0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,
0x3480,0xF441,0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80,
0xFB41,0x3900,0xF9C1,0xF881,0x3840,0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41,
0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,0xE401,0x24C0,0x2580,0xE541,0x2700,
0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,0xA001,0x60C0,
0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,
0xA441,0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41,
0x6900,0xA9C1,0xA881,0x6840,0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01,
0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,
0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,0x5000,0x90C1,0x9181,
0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440,
0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,
0x59C0,0x5880,0x9841,0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1,
0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,
0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040);

function CrcArcAdd(crc,c)
/*
  'crc' should be initialized to 0x0000.
*/
{
  return CrcArcTab[(crc^c)&0xFF]^((crc>>8)&0xFF);
}
/*
  C/C++ language:

  inline unsigned short CrcArcAdd(unsigned short crc, unsigned char c)
  {                                                     
    return CrcArcTab[(unsigned char)crc^c]^(unsigned short)(crc>>8);
  }
*/

/*
  CRC-16 (as it is in ZMODEM) in table form

  Copyright (c) 1989 AnDan Software. You may use this program, or
  code or tables extracted from it, as long as this notice is not
  removed or changed.
*/
var Crc16Tab = new Array(
/*
  C/C++ language:

  unsigned short Crc16Tab[] = {...};
*/
0x0000,0x1021,0x2042,0x3063,0x4084,0x50A5,0x60C6,0x70E7,0x8108,0x9129,0xA14A,0xB16B,0xC18C,
0xD1AD,0xE1CE,0xF1EF,0x1231,0x0210,0x3273,0x2252,0x52B5,0x4294,0x72F7,0x62D6,0x9339,0x8318,
0xB37B,0xA35A,0xD3BD,0xC39C,0xF3FF,0xE3DE,0x2462,0x3443,0x0420,0x1401,0x64E6,0x74C7,0x44A4,
0x5485,0xA56A,0xB54B,0x8528,0x9509,0xE5EE,0xF5CF,0xC5AC,0xD58D,0x3653,0x2672,0x1611,0x0630,
0x76D7,0x66F6,0x5695,0x46B4,0xB75B,0xA77A,0x9719,0x8738,0xF7DF,0xE7FE,0xD79D,0xC7BC,0x48C4,
0x58E5,0x6886,0x78A7,0x0840,0x1861,0x2802,0x3823,0xC9CC,0xD9ED,0xE98E,0xF9AF,0x8948,0x9969,
0xA90A,0xB92B,0x5AF5,0x4AD4,0x7AB7,0x6A96,0x1A71,0x0A50,0x3A33,0x2A12,0xDBFD,0xCBDC,0xFBBF,
0xEB9E,0x9B79,0x8B58,0xBB3B,0xAB1A,0x6CA6,0x7C87,0x4CE4,0x5CC5,0x2C22,0x3C03,0x0C60,0x1C41,
0xEDAE,0xFD8F,0xCDEC,0xDDCD,0xAD2A,0xBD0B,0x8D68,0x9D49,0x7E97,0x6EB6,0x5ED5,0x4EF4,0x3E13,
0x2E32,0x1E51,0x0E70,0xFF9F,0xEFBE,0xDFDD,0xCFFC,0xBF1B,0xAF3A,0x9F59,0x8F78,0x9188,0x81A9,
0xB1CA,0xA1EB,0xD10C,0xC12D,0xF14E,0xE16F,0x1080,0x00A1,0x30C2,0x20E3,0x5004,0x4025,0x7046,
0x6067,0x83B9,0x9398,0xA3FB,0xB3DA,0xC33D,0xD31C,0xE37F,0xF35E,0x02B1,0x1290,0x22F3,0x32D2,
0x4235,0x5214,0x6277,0x7256,0xB5EA,0xA5CB,0x95A8,0x8589,0xF56E,0xE54F,0xD52C,0xC50D,0x34E2,
0x24C3,0x14A0,0x0481,0x7466,0x6447,0x5424,0x4405,0xA7DB,0xB7FA,0x8799,0x97B8,0xE75F,0xF77E,
0xC71D,0xD73C,0x26D3,0x36F2,0x0691,0x16B0,0x6657,0x7676,0x4615,0x5634,0xD94C,0xC96D,0xF90E,
0xE92F,0x99C8,0x89E9,0xB98A,0xA9AB,0x5844,0x4865,0x7806,0x6827,0x18C0,0x08E1,0x3882,0x28A3,
0xCB7D,0xDB5C,0xEB3F,0xFB1E,0x8BF9,0x9BD8,0xABBB,0xBB9A,0x4A75,0x5A54,0x6A37,0x7A16,0x0AF1,
0x1AD0,0x2AB3,0x3A92,0xFD2E,0xED0F,0xDD6C,0xCD4D,0xBDAA,0xAD8B,0x9DE8,0x8DC9,0x7C26,0x6C07,
0x5C64,0x4C45,0x3CA2,0x2C83,0x1CE0,0x0CC1,0xEF1F,0xFF3E,0xCF5D,0xDF7C,0xAF9B,0xBFBA,0x8FD9,
0x9FF8,0x6E17,0x7E36,0x4E55,0x5E74,0x2E93,0x3EB2,0x0ED1,0x1EF0);

function Crc16Add(crc,c)
/*
  'crc' should be initialized to 0x0000.
*/
{
  return Crc16Tab[((crc>>8)^c)&0xFF]^((crc<<8)&0xFFFF);
}
/*
  C/C++ language:

  inline unsigned short Crc16Add(unsigned short crc, unsigned char c)
  {
    return Crc16Tab[(unsigned char)(crc>>8)^c]^(unsigned short)(crc<<8);
  }
*/

/*
  FCS-16 (as it is in PPP) in table form

  Described in RFC-1662 by William Allen Simpson, see RFC-1662 for references.

  Modified by Anders Danielsson, March 10, 2006.
*/
var Fcs16Tab = new Array(
/*
  C/C++ language:

  unsigned short Fcs16Tab[256] = {...};
*/
0x0000,0x1189,0x2312,0x329B,0x4624,0x57AD,0x6536,0x74BF,0x8C48,0x9DC1,0xAF5A,0xBED3,0xCA6C,
0xDBE5,0xE97E,0xF8F7,0x1081,0x0108,0x3393,0x221A,0x56A5,0x472C,0x75B7,0x643E,0x9CC9,0x8D40,
0xBFDB,0xAE52,0xDAED,0xCB64,0xF9FF,0xE876,0x2102,0x308B,0x0210,0x1399,0x6726,0x76AF,0x4434,
0x55BD,0xAD4A,0xBCC3,0x8E58,0x9FD1,0xEB6E,0xFAE7,0xC87C,0xD9F5,0x3183,0x200A,0x1291,0x0318,
0x77A7,0x662E,0x54B5,0x453C,0xBDCB,0xAC42,0x9ED9,0x8F50,0xFBEF,0xEA66,0xD8FD,0xC974,0x4204,
0x538D,0x6116,0x709F,0x0420,0x15A9,0x2732,0x36BB,0xCE4C,0xDFC5,0xED5E,0xFCD7,0x8868,0x99E1,
0xAB7A,0xBAF3,0x5285,0x430C,0x7197,0x601E,0x14A1,0x0528,0x37B3,0x263A,0xDECD,0xCF44,0xFDDF,
0xEC56,0x98E9,0x8960,0xBBFB,0xAA72,0x6306,0x728F,0x4014,0x519D,0x2522,0x34AB,0x0630,0x17B9,
0xEF4E,0xFEC7,0xCC5C,0xDDD5,0xA96A,0xB8E3,0x8A78,0x9BF1,0x7387,0x620E,0x5095,0x411C,0x35A3,
0x242A,0x16B1,0x0738,0xFFCF,0xEE46,0xDCDD,0xCD54,0xB9EB,0xA862,0x9AF9,0x8B70,0x8408,0x9581,
0xA71A,0xB693,0xC22C,0xD3A5,0xE13E,0xF0B7,0x0840,0x19C9,0x2B52,0x3ADB,0x4E64,0x5FED,0x6D76,
0x7CFF,0x9489,0x8500,0xB79B,0xA612,0xD2AD,0xC324,0xF1BF,0xE036,0x18C1,0x0948,0x3BD3,0x2A5A,
0x5EE5,0x4F6C,0x7DF7,0x6C7E,0xA50A,0xB483,0x8618,0x9791,0xE32E,0xF2A7,0xC03C,0xD1B5,0x2942,
0x38CB,0x0A50,0x1BD9,0x6F66,0x7EEF,0x4C74,0x5DFD,0xB58B,0xA402,0x9699,0x8710,0xF3AF,0xE226,
0xD0BD,0xC134,0x39C3,0x284A,0x1AD1,0x0B58,0x7FE7,0x6E6E,0x5CF5,0x4D7C,0xC60C,0xD785,0xE51E,
0xF497,0x8028,0x91A1,0xA33A,0xB2B3,0x4A44,0x5BCD,0x6956,0x78DF,0x0C60,0x1DE9,0x2F72,0x3EFB,
0xD68D,0xC704,0xF59F,0xE416,0x90A9,0x8120,0xB3BB,0xA232,0x5AC5,0x4B4C,0x79D7,0x685E,0x1CE1,
0x0D68,0x3FF3,0x2E7A,0xE70E,0xF687,0xC41C,0xD595,0xA12A,0xB0A3,0x8238,0x93B1,0x6B46,0x7ACF,
0x4854,0x59DD,0x2D62,0x3CEB,0x0E70,0x1FF9,0xF78F,0xE606,0xD49D,0xC514,0xB1AB,0xA022,0x92B9,
0x8330,0x7BC7,0x6A4E,0x58D5,0x495C,0x3DE3,0x2C6A,0x1EF1,0x0F78);

function Fcs16Add(fcs,c)
/*
  'fcs' should be initialized to 0xFFFF and after the computation it should be
  complemented (inverted).

  If the FCS-16 is calculated over the data and over the complemented FCS-16, the
  result will always be 0xF0B8 (without the complementation).
*/
{
  return Fcs16Tab[(fcs^c)&0xFF]^((fcs>>8)&0xFF);
}
/*
  C/C++ language:

  inline unsigned short Fcs16Add(unsigned short fcs, unsigned char c)
  {
    return Fcs16Tab[(unsigned char)fcs^c]^(unsigned short)(fcs>>8);
  }
*/

/*
  CRC-32 (as it is in ZMODEM) in table form

  Copyright (C) 1986 Gary S. Brown. You may use this program, or
  code or tables extracted from it, as desired without restriction.

  Modified by Anders Danielsson, February 5, 1989 and March 10, 2006.

  This is also known as FCS-32 (as it is in PPP), described in
  RFC-1662 by William Allen Simpson, see RFC-1662 for references.
*/
var Crc32Tab = new Array( /* CRC polynomial 0xEDB88320 */
/*
  C/C++ language:

  unsigned long Crc32Tab[] = {...};
*/
0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3,
0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91,
0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7,
0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,
0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,
0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59,
0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F,
0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D,
0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433,
0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01,
0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,
0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65,
0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB,
0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9,
0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F,
0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD,
0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683,
0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1,
0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7,
0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5,
0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B,
0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79,
0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F,
0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D,
0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713,
0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21,
0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777,
0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45,
0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB,
0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9,
0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF,
0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D);

function Crc32Add(crc,c)
/*
  'crc' should be initialized to 0xFFFFFFFF and after the computation it should be
  complemented (inverted).

  CRC-32 is also known as FCS-32.

  If the FCS-32 is calculated over the data and over the complemented FCS-32, the
  result will always be 0xDEBB20E3 (without the complementation).
*/
{
  return Crc32Tab[(crc^c)&0xFF]^((crc>>8)&0xFFFFFF);
}
/*
  C/C++ language:

  inline unsigned long Crc32Add(unsigned long crc, unsigned char c)
  {
    return Crc32Tab[(unsigned char)crc^c]^(crc>>8);
  }
*/

/*
  Application functions that calculates CRC of a string
*/

function Crc8Str(str)
{
  var n;
  var len=str.length;
  var crc;

  crc=0;
  for (n=0; n<len; n++)
  {
    crc=Crc8Add(crc,str.charCodeAt(n));
  }
  return crc;
}

function CrcArcStr(str)
{
  var n;
  var len=str.length;
  var crc;

  crc=0;
  for (n=0; n<len; n++)
  {
    crc=CrcArcAdd(crc,str.charCodeAt(n));
  }
  return crc;
}

function Crc16Str(str)
{
  var n;
  var len=str.length;
  var crc;

  crc=0;
  for (n=0; n<len; n++)
  {
    crc=Crc16Add(crc,str.charCodeAt(n));
  }
  return crc;
}

function Fcs16Str(str)
{
  var n;
  var len=str.length;
  var fcs;

  fcs=0xFFFF;
  for (n=0; n<len; n++)
  {
    fcs=Fcs16Add(fcs,str.charCodeAt(n));
  }
  return fcs^0xFFFF;
}

function Crc32Str(str)
{
  var n;
  var len=str.length;
  var crc;

  crc=0xFFFFFFFF;
  for (n=0; n<len; n++)
  {
    crc=Crc32Add(crc,str.charCodeAt(n));
  }
  return crc^0xFFFFFFFF;
}

/*
  Hex convert functions
*/

function Hex8(val)
/*
  Convert value as 8-bit unsigned integer to 2 digit hexadecimal number prefixed with "0x".
*/
{
  var n;
  var str;

  n=val&0xFF;
  str=n.toString(16).toUpperCase();
  while (str.length<2)
  {
    str="0"+str;
  }
  return "0x"+str;
}

function Hex16(val)
/*
  Convert value as 16-bit unsigned integer to 4 digit hexadecimal number prefixed with "0x".
*/
{
  var n;
  var str;

  n=val&0xFFFF;
  str=n.toString(16).toUpperCase();
  while (str.length<4)
  {
    str="0"+str;
  }
  return "0x"+str;
}

function Hex32(val)
/*
  Convert value as 32-bit unsigned integer to 8 digit hexadecimal number prefixed with "0x".
*/
{
  var n;
  var str1;
  var str2;

  n=val&0xFFFF;
  str1=n.toString(16).toUpperCase();
  while (str1.length<4)
  {
    str1="0"+str1;
  }
  n=(val>>>16)&0xFFFF;
  str2=n.toString(16).toUpperCase();
  while (str2.length<4)
  {
    str2="0"+str2;
  }
  return "0x"+str2+str1;
}

/*
  Execute function
*/

function OnClickCalc()
{
  var str;

  window.defaultStatus="Wait...";
  str=document.form.textinput.value;
  if (str.length>10240)  // Limit to make execution time reasonable
  {
    str="(Too many chars)";
    document.getElementById('idCrc8').innerHTML=str;
    document.getElementById('idCrcArc').innerHTML=str;
    document.getElementById('idCrc16').innerHTML=str;
    document.getElementById('idFcs16').innerHTML=str;
    document.getElementById('idCrc32').innerHTML=str;
  }
  else
  {
    document.getElementById('idCrc8').innerHTML=Hex8(Crc8Str(str));
    document.getElementById('idCrcArc').innerHTML=Hex16(CrcArcStr(str));
    document.getElementById('idCrc16').innerHTML=Hex16(Crc16Str(str));
    document.getElementById('idFcs16').innerHTML=Hex16(Fcs16Str(str));
    document.getElementById('idCrc32').innerHTML=Hex32(Crc32Str(str));
  }
  window.defaultStatus="Done.";
}

if(!gup)
{
	var gup = function (name)
	{
	  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
	  var regexS = "[\\?&]"+name+"=([^&#]*)";
	  var regex = new RegExp( regexS );
	  var results = regex.exec( window.location.href );
	  if( results == null )
			return "";
	  else
			return results[1];
	}
}

if(!aup)
{
	var aup = function ()
	{
		//alert(window.location.search.length);
		parameterArray = new Array();
		parameterPairs = unescape(window.location.search).substr(1).split("&");
		for(i=0;i<parameterPairs.length;i++)
		{
			parameterPairArray = parameterPairs[i].split("=");
			if(parameterPairArray[0].indexOf('[') == -1 && parameterPairArray[0].indexOf(']') == -1)
			{
				if(parameterPairArray[1] != '') parameterArray[parameterPairArray[0]] = parameterPairArray[1];
				alert('String: ' + parameterPairArray[0] + ': ' + parameterPairArray[1] + '(' + typeof parameterPairArray[0] + ')');
			}
			else
			{
				parameterPairArrayName =  parameterPairArray[0].replace(/\[[0-9+]\]/,'');
				parameterPairArrayIndex =  parseInt(parameterPairArray[0].replace(/[^0-9]/,''));
				if(parameterPairArray[1] != '') 
				{
					if(!parameterArray[parameterPairArrayName]) parameterArray[parameterPairArrayName] = new Array();
					parameterArray[parameterPairArrayName][parameterPairArrayIndex] = parameterPairArray[1];
				}
				alert('Array: ' + parameterPairArray[0] + ': ' + parameterPairArray[1] + '(' + typeof parameterPairArray[parameterPairArrayName] + ')');
			}
		}
		return(parameterArray);
		
	}
}

if(!serialize)
{
	var serialize = function (eingabe) 
	{
		var input = eingabe;
		if(typeof input != 'object') return false;
		if(typeof giveback == 'undefined') var giveback = new String();
		giveback = giveback+'a:'+input.length+':{';
		for(var position in input) 
			{
			if(typeof position == 'object') serialize(position);
			else 
			{
				if(typeof position == 'string') giveback = giveback+'s'+':'+position.length+':"'+position+'";';
				if(typeof position == 'number') giveback = giveback+'i:'+position+';';
				if(typeof input[position] == 'string') giveback = giveback+'s'+':'+input[position].length+':"'+input[position]+'";';
				if(typeof input[position] == 'number') giveback = giveback+'i:'+input[position]+';';				
			}
		}
		giveback = giveback+'}';
		return giveback;
	}
}

/* Recommend */

function show_recommend()
{
	if(dojo.byId('recommend_popup'))
	{
		xajax_recommend(window.location.href,document.title);
		dijit.byId('recommend_popup').show();
	}
}

function close_recommend()
{
	clear_dojo_instances('recommend');
	if(dojo.byId('recommend_popup'))
	{
		dijit.byId('recommend_popup').hide();
	}
	item_hide_loader();
}

function track() 
{
	// IVW
	if(window.location.hostname == 'www.medienhandbuch.de')
	{
		if(document.getElementById('ivw'))
		{
			if(previousaddress == '') var ivwreferrer = document.referrer;
			else var ivwreferrer = previousaddress;
	
			document.getElementById('ivw').innerHTML = '<img src="' + IVW + '?r=' + escape(ivwreferrer) + '" width="1" height="1" align="right" />';
			
			//alert('IVW');
	
		}
		previousaddress = window.location;
		window.setTimeout('trackgoogle();',500);
	}
}

function trackgoogle()
{
	// Google Analytics
	//if(typeof(urchinTracker) != "undefined") urchinTracker();
	if(typeof(pageTracker) != "undefined") 
	{
		pageTracker._trackPageview(window.location.pathname + window.location.search + window.location.hash);
		//alert('Analytics');
	}
	else window.setTimeout('trackgoogle();',500);
}

function transaction(product_type,product_name,order_id,quantity,price,city,country)
{
	if(typeof(pageTracker) != "undefined") 
	{
		pageTracker._addTrans(order_id + "","medienhandbuch.de",price + ".00",round((price / 1.19) * 0.19) + ".00","0",city,"",country);
		pageTracker._addItem(order_id + "",product_name,product_name,product_type,price + ".00",quantity + "");
		pageTracker._trackTrans();
	}
	else window.setTimeout('transaction("' + product_type + '","' + product_name + '",' + order_id + ',' + quantity + ',' + price + ',"' + city + '","' + country + '");',500);
}
function autosize(id_name)
{
	if(document.getElementById(id_name))
	{
		var elem = document.getElementById(id_name);
		currentmargin = elem.style.marginBottom;
		elem.style.marginBottom = currentmargin + elem.style.height;
		elem.style.height = '0px';
		elem.style.height = elem.scrollHeight + 'px';
		elem.style.marginBottom = currentmargin;
	}
}

function counttexareachars(id_name)
{
	if(document.getElementById(id_name + 'charcount'))
	{
		document.getElementById(id_name + 'charcount').value = document.getElementById(id_name).value.length + ' Zeichen';
	}
}

function show_green()
{
	if(dojo.byId('green_popup'))
	{
		if(dojo.byId('green_popup').style.display != 'block') 
		{
			close_greensort();
			dijit.byId('green_popup').show();
		}
	}
}

function close_green()
{
	if(dojo.byId('green_popup'))
	{
		dijit.byId('green_popup').hide();
	}
}

function show_greensort()
{
	if(dojo.byId('greensort_popup'))
	{
		if(dojo.byId('greensort_popup').style.display != 'block') 
		{
			dojo_dnd_clear();
			close_green();
			dijit.byId('greensort_popup').show();
		}
	}
}

function close_greensort()
{
	if(dojo.byId('greensort_popup'))
	{
		dijit.byId('greensort_popup').hide();
	}
}

function show_subgreen()
{
	if(dojo.byId('green_subpopup'))
	{
		if(dojo.byId('green_subpopup').style.display != 'block') dijit.byId('green_subpopup').show();
	}
}

function close_subgreen()
{
	if(dojo.byId('green_subpopup'))
	{
		dijit.byId('green_subpopup').hide();
	}
}

function show_detailgreen()
{
	if(dojo.byId('green_detailpopup'))
	{
		if(dojo.byId('green_detailpopup').style.display != 'block') dijit.byId('green_detailpopup').show();
		greenDetailShow = 1;
	}
}

function close_detailgreen()
{
	if(dojo.byId('green_detailpopup'))
	{
		dijit.byId('green_detailpopup').hide();
	}
}

/* News */

function green_savecreatenews(object_id)
{
	tinyMCE.triggerSave();
	xajax_green_savecreatenews(object_id,xajax.getFormValues('createnewsentry'));
}

function news_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('news_search();',1000);
	}
}

function news_offset(offset)
{
	greenCurrentOffset = offset;
	news_search();
}

function news_search()
{
	xajax_green_shownewscenter(greenCurrentOffset,greenSearchTerm,greenCurrentStatus,greenCurrentType);
}

function news_status(status)
{
	switch(status)
	{
		default:
		case false:
			greenCurrentStatus = 'active';
			break;		

		case true:
			greenCurrentStatus = 'all';
			break;		
	}
	news_search();
}

function news_type(typename)
{
	greenCurrentType = typename;
	greenCurrentOffset = 0;
	news_search();
}

function green_newsdelete(object_id)
{
	object_name = dojo.byId('news' + object_id).getElementsByTagName('td')[1].firstChild.data;
	var chk = window.confirm('Wollen Sie die Meldung "' + object_name + '" wirklich löschen?');
	if(chk == true) xajax_green_newsdelete(object_id);
}

/* News tinyMCE */

function green_createnews_tinyMCELoad()
{
	if(typeof(tinyMCE) == "undefined") window.setTimeout('green_createnews_tinyMCELoad();',500);
	else 
	{
		/*tinyMCE.init({
			mode : "exact",
			theme : "advanced",
			language : "de",
			content_css : basepath + "/css/editor_news.css",
			valid_elements : "a[*],p,em/i,strong/b,br,strike,u,ul,ol,li,img[width|height|align|vspace|hspace|class|alt],object[*],embed[*],param[*]",
			theme_advanced_buttons1 : "undo,redo,bold,italic,underline,strikethrough,link,unlink,bullist,numlist,outdent,indent,code,image,media",
			theme_advanced_buttons2 : "",
			theme_advanced_buttons3 : "",
			apply_source_formatting : true,
			entity_encoding : "named",
			plugins : "inlinepopups,media", 
			file_browser_callback : 'green_createnews_imagebrowser', 
			strict_loading_mode : false,
			debug : false
		});*/
		
		activateEditor("contenttext");
		activateEditor("linkstext");
	}
}

function green_createnews_newsimagesubmit(url, image_id) 
{
	dojo.byId("news_image_preview").src = url;
	dojo.byId("news_image_id").value = image_id;
	close_green();
}

function green_createnews_imagebrowser(field_name, url, type, win) 
{
	
	// alert("Field_Name: " + field_name + "\nURL: " + url + "\nType: " + type + "\nWin: " + win); // debug/testing
	
	current_window = win;
	
	xajax_green_showlibrary('','','',0,1,'');

	return false;
}

function green_createnews_imagesubmit(url, alt) 
{
	//call this function only after page has loaded
	//otherwise tinyMCEPopup.close will close the
	//"Insert/Edit Image" or "Insert/Edit Link" window instead
	
	current_window.document.getElementById("src").value = url;
	current_window.document.getElementById("alt").value = alt;
	current_window.document.getElementById("align").value = 'left';
	current_window.ImageDialog.updateStyle();
	//current_window.ImageDialog.getImageData();
	
	close_green();
}

/* ---------------------------------------- */

function green_newssort(section_id)
{
	xajax_green_newssort(section_id);
}

function newssortNodeCreator(node_innerhtml)
{
		var node;

		// doe whatever u wanna do... just make any markup
		node = dojo.doc.createElement("div");
		node.id = dojo.dnd.getUniqueId();
		node.className = "dojoDndItem";
		node.innerHTML = node_innerhtml;

		//console.log('create node ' + node_innerhtml);

		// return the stuff
		return {node: node, data: node_innerhtml, type: ["newsletteritem"]};
};

function newssortCreateSource(nodes_array_source,nodes_array_target)
{
	if(dojo_dnd_clear())
	{
		// here u link your own creator to the container
		c1 = new dojo.dnd.Source("newssort_source_container", {creator: newssortNodeCreator,accept: ["newsletteritem"]});
		if(nodes_array_source.length > 0)
		{
			// here u call the creator by passing an array of "items"
			c1.insertNodes(null, nodes_array_source);
		}
	
		// here u link your own creator to the container
		c2 = new dojo.dnd.Source("newssort_target_container", {creator: newssortNodeCreator,accept: ["newsletteritem"]});
		// here u call the creator by passing an array of "items"
		if(nodes_array_target.length > 0)
		{
			c2.insertNodes(null, nodes_array_target);
		}
	
		dojoSubscription = dojo.subscribe("/dnd/drop", function(source,nodes,iscopy)
		{
			newssortitemupdate(c1);
			newssortitemupdate(c2);
		});
	}
}

function newssortitemupdate(source)
{
	if(source)
	{
		var items = new Array();
		var nodes = source.getAllNodes();
		for(i=0;i<nodes.length;i++)
		{
			data = parseInt(nodes[i].getElementsByTagName("div")[0].id.replace(/newssortitem_/,''));
			items.push(data);
			//console.log(data);
		}
		xajax_green_newssortitemupdate_sectionpage(greenCurrentNewsSection,source.node.id,items);
	}
}

var c1 = null;
var c2 = null;
var dojoSubscription = null;

/* News Comments */

function newscomment_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('newscomment_search();',1000);
	}
}

function newscomment_offset(offset)
{
	greenCurrentOffset = offset;
	newscomment_search();
}

function newscomment_sort(sortvalue)
{
	greenCurrentSort = sortvalue;
	newscomment_search();
}

function newscomment_search()
{
	xajax_green_shownewscomments(greenCurrentOffset,greenSearchTerm,greenCurrentStatus,greenCurrentSort);
}

function newscomment_status(status)
{
	switch(status)
	{
		default:
		case false:
			greenCurrentStatus = 'active';
			break;		

		case true:
			greenCurrentStatus = 'all';
			break;		
	}
	newscomment_search();
}

/* News Importer */

function importnews_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('importnews_search();',1000);
	}
}

function importnews_offset(offset)
{
	greenCurrentOffset = offset;
	importnews_search();
}

function importnews_search()
{
	xajax_green_showimportnews(greenCurrentOffset,greenSearchTerm,greenCurrentStatus);
}



/* Library */

function library_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('library_search();',1000);
	}
}

function library_offset(offset)
{
	greenCurrentOffset = offset;
	library_search();
}

function library_search()
{
	xajax_green_showlibrary(greenCurrentOffset,greenSearchTerm,greenCurrentStatus,greenNewsImage,greenTinyMCE,greenNewsType);
}

function library_upload()
{
	var_upload_script = basepath + "/meinmedienhandbuch/library-upload.php?params=" + session_id;
	var_allowed_filesize = 8096;
	var_allowed_filetypes = "*.jpg;*.gif;*.png";
	var_description = "JPEG-, GIF- und PNG-Dateien";
	var_browse_link_innerhtml = "Bild von Festplatte ausw&auml;hlen...";
	var_uploadFileComplete_action = 'xajax_green_libraryupload()';

	window.scrollTo(0,1);
	swfu['library'] = new SWFUpload({
		// Backend Settings
		upload_url: var_upload_script,	// Relative to the SWF file (or you can use absolute paths)
		post_params: {},
	
		// File Upload Settings
		file_size_limit : var_allowed_filesize,	// 100MB
		file_types : var_allowed_filetypes,
		file_types_description : var_description,
		file_upload_limit : "0",
		file_queue_limit : "0",
	
		// Event Handler Settings (all my handlers are in the Handler.js file)
		file_dialog_start_handler : fileDialogStart,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
	
		// Flash Settings
		flash_url : basepath + "/swf/SWFUpload/swfupload.swf",	// Relative to this file (or you can use absolute paths)
		
		swfupload_element_id : "libraryflashUI",		// Setting from graceful degradation plugin
		degraded_element_id : "librarydegradedUI",	// Setting from graceful degradation plugin
	
		custom_settings : {
			progressTarget : "libraryfsUploadProgress",
			cancelButtonId : "librarybtnCancel"
		},
		
		// Debug Settings
		debug: false
	});
	//window.setTimeout(var_uploadFileComplete_action,0);
	window.scrollTo(0,0);
}

/* ----------------- */

/* Accounts */

function accounts_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('accounts_search();',1000);
		greenCurrentOffset = 0;
	}
}

function accounts_searchTag(term)
{
	if(term != greenTag)
	{
		greenTag = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('accounts_search();',1000);
		greenCurrentOffset = 0;
	}
}

function accounts_noTag(value)
{
	switch(value)
	{
		default:
		case false:
			greenNoTag = 0;
			break;
			
		case true:
			greenTag = '';
			greenNoTag = 1;
			break;
	}
	greenCurrentOffset = 0;
	accounts_search();
}

function accounts_offset(offset)
{
	greenCurrentOffset = offset;
	accounts_search();
}

function accounts_search()
{
	xajax_green_showaccounts(greenCurrentOffset,greenSearchTerm,greenCurrentType,greenSubCurrentType,greenTag,greenNoTag);
}

function accounts_type(typename)
{
	greenCurrentType = typename;
	greenCurrentOffset = 0;
	accounts_search();
}

function accounts_subtype(typename)
{
	greenSubCurrentType = typename;
	greenCurrentOffset = 0;
	accounts_search();
}


function green_deleteaccount(object_name,object_id,object_type)
{
	switch(object_type)
	{
		default:
			break;
			
		case "company":
			var chk = window.confirm('Wollen Sie den Adresseintrag "' + object_name + '" wirklich löschen? Alle an diesen Adresseintrag gekoppelten Bildungsangebote, Stellen- und Textanzeigen werden dann abgeschaltet.');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "educationaloffer_account":
			var chk = window.confirm('Wollen Sie das Bildungspaket wirklich löschen? Alle an dieses Bildungspaket gekoppelten Bildungsangebote werden dann abgeschaltet.');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "educationaloffer":
			var chk = window.confirm('Wollen Sie das Bildungsangebot "' + object_name + '" wirklich löschen?');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "joboffer":
			var chk = window.confirm('Wollen Sie das Stellenangebot "' + object_name + '" wirklich löschen?');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "jobrequest":
			var chk = window.confirm('Wollen Sie das Stellengesuch "' + object_name + '" wirklich löschen?');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "contentad":
			var chk = window.confirm('Wollen Sie die Textanzeige Content "' + object_name + '" wirklich löschen?');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
			
		case "newsletterad":
			var chk = window.confirm('Wollen Sie die Textanzeige Newsletter "' + object_name + '" wirklich löschen?');
			if(chk == true) xajax_green_deleteaccount(object_id,object_type);
			break;
	}
}

/* Educationaloffer Accounts */

function educationalofferaccounts_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSubSearchTerm = term;
		if(greenSubSearchTimer != null) clearTimeout(greenSubSearchTimer);
		greenSubSearchTimer = window.setTimeout('educationalofferaccounts_search();',1000);
	}
}

function educationalofferaccounts_offset(offset)
{
	greenSubCurrentOffset = offset;
	educationalofferaccounts_search();
}

function educationalofferaccounts_search()
{
	xajax_green_showeducationalofferaccount(greenSubCurrentId,greenSubCurrentOffset,greenSubSearchTerm,greenSubCurrentType);
}

function educationalofferaccounts_type(typename)
{
	greenSubCurrentType = typename;
	educationalofferaccounts_search();
}



/* Accounts Duplicates */

function accountsduplicates_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('accountsduplicates_search();',1000);
		greenCurrentOffset = 0;
	}
}

function accountsduplicates_offset(offset)
{
	greenCurrentOffset = offset;
	accountsduplicates_search();
}

function accountsduplicates_search()
{
	xajax_green_showaccountsduplicates(greenCurrentOffset,greenSearchTerm);
}



/* Invoices */

function invoices_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSubSearchTerm = term;
		if(greenSubSearchTimer != null) clearTimeout(greenSubSearchTimer);
		greenSubSearchTimer = window.setTimeout('invoices_search();',1000);
	}
}

function invoices_offset(offset)
{
	greenSubCurrentOffset = offset;
	invoices_search();
}

function invoices_search()
{
	xajax_green_showinvoices(greenSubCurrentId,greenSubCurrentProductType,greenSubCurrentOffset,greenSubSearchTerm,greenSubCurrentType);
}

function invoices_type(typename)
{
	greenSubCurrentType = typename;
	invoices_search();
}

/* ----------------- */

/* Users */

function users_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('users_search();',1000);
	}
}

function users_searchTag(term)
{
	if(term != greenTag)
	{
		greenTag = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('users_search();',1000);
	}
}

function users_noTag(value)
{
	switch(value)
	{
		default:
		case false:
			greenNoTag = 0;
			break;
			
		case true:
			greenTag = '';
			greenNoTag = 1;
			break;
	}
	users_search();
}

function users_offset(offset)
{
	greenCurrentOffset = offset;
	users_search();
}

function users_search()
{
	xajax_green_showusers(greenCurrentOffset,greenSearchTerm,greenCurrentType,greenTag,greenNoTag,greenSubCurrentType);
}

function users_type(typename)
{
	greenCurrentType = typename;
	users_search();
}

function users_viewtype(typename)
{
	greenSubCurrentType = typename;
	users_search();
}

function green_deleteuser(object_name,object_id)
{
	var chk = window.confirm('Wollen Sie den Benutzer "' + object_name + '" wirklich löschen?');
	if(chk == true) 
	{
		close_detailgreen();
		xajax_green_deleteuser(object_id);
	}
}


function green_taguser(object_id,term)
{
	if(term != greenTagTerm)
	{
		greenTagTerm = term;
		if(greenTagTimer != null) clearTimeout(greenTagTimer);
		greenTagTimer = window.setTimeout('xajax_green_taguser(' + object_id + ',"' + greenTagTerm + '");',1000);
	}
}

function green_closeuser()
{
	dijit.byId('green_detailpopup').hide();
	if(greenDetailShow == 1)
	{
		window.setTimeout('xajax_green_showusers();',250);
		greenDetailShow = 0;
	}
}

/* Users SPAM */

function usersspam_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('usersspam_search();',1000);
	}
}

function usersspam_offset(offset)
{
	greenCurrentOffset = offset;
	usersspam_search();
}

function usersspam_search()
{
	xajax_green_showusersspam(greenCurrentOffset,greenSearchTerm);
}

/* Users Duplicate */

function usersduplicate_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('usersduplicate_search();',1000);
	}
}

function usersduplicate_offset(offset)
{
	greenCurrentOffset = offset;
	usersduplicate_search();
}

function usersduplicate_search()
{
	xajax_green_showusersduplicate(greenCurrentOffset,greenSearchTerm);
}

/* ----------------- */

function wallpapers_searchTerm(term)
{
	if(term != greenSearchTerm)
	{
		greenSearchTerm = term;
		if(greenSearchTimer != null) clearTimeout(greenSearchTimer);
		greenSearchTimer = window.setTimeout('library_search();',1000);
	}
}

function wallpapers_offset(offset)
{
	greenCurrentOffset = offset;
	wallpapers_search();
}

function wallpapers_search()
{
	xajax_green_showwallpapers(greenCurrentOffset,greenSearchTerm,greenCurrentStatus);
}

function wallpapers_upload(object_id)
{
	var_allowed_filesize = 20;
	var_allowed_filetypes = "*.jpg;*.gif;*.png;*.swf";
	var_description = "SWF-, JPEG-, GIF- und PNG-Dateien (max. 20 KB)";
	var_browse_link_innerhtml = "Banner von Festplatte ausw&auml;hlen...";
	var_uploadFileComplete_action = 'xajax_green_showwallpapers()';

	window.scrollTo(0,1);

	bannerArray = new Array("top","right");
	for(i=0;i<bannerArray.length;i++)
	{
		var banner = bannerArray[i];
		swfu[banner + 'Wallpaper' + object_id] = new SWFUpload({
			// Backend Settings
			upload_url: basepath + "/meinmedienhandbuch/wallpaper-upload.php?params=" + object_id + "-" + banner,	// Relative to the SWF file (or you can use absolute paths)
			post_params: {},
		
			// File Upload Settings
			file_size_limit : var_allowed_filesize,	// 100MB
			file_types : var_allowed_filetypes,
			file_types_description : var_description,
			file_upload_limit : "0",
			file_queue_limit : "0",
		
			// Event Handler Settings (all my handlers are in the Handler.js file)
			file_dialog_start_handler : fileDialogStart,
			file_queued_handler : fileQueued,
			file_queue_error_handler : fileQueueError,
			file_dialog_complete_handler : fileDialogComplete,
			upload_start_handler : uploadStart,
			upload_progress_handler : uploadProgress,
			upload_error_handler : uploadError,
			upload_success_handler : uploadSuccess,
			upload_complete_handler : uploadComplete,
		
			// Flash Settings
			flash_url : basepath + "/swf/SWFUpload/swfupload.swf",	// Relative to this file (or you can use absolute paths)
			
			swfupload_element_id : banner + "Wallpaper" + object_id + "flashUI",		// Setting from graceful degradation plugin
			degraded_element_id : banner + "Wallpaper" + object_id + "degradedUI",	// Setting from graceful degradation plugin
		
			custom_settings : {
				progressTarget : "WallpaperfsUploadProgress",
				cancelButtonId : banner + "Wallpaper" + object_id + "librarybtnCancel"
			},
			
			// Debug Settings
			debug: false
		});
	}
	//window.setTimeout(var_uploadFileComplete_action,0);
	window.scrollTo(0,0);
}

function wallpapers_upload_old(object_id)
{
	window.scrollTo(0,1);

	var banner = "top";
	swfu = new SWFUpload({
		upload_script : basepath + "/meinmedienhandbuch/wallpaper-upload.php?params=" + object_id + "-" + banner,
		target : banner + "SWFUploadTarget" + object_id,
		flash_path : basepath + "/swf/SWFUpload/SWFUpload.swf",
		allowed_filesize : 8096,
		allowed_filetypes : "*.jpg;*.gif;*.png;*.swf",
		allowed_filetypes_description : "SWF-, JPEG-, GIF- und PNG-Dateien",
		browse_link_innerhtml : "Banner von Festplatte ausw&auml;hlen...",
		upload_link_innerhtml : "&Uuml;bertragung starten",
		browse_link_class : "link_button_green",
		upload_link_class : "link_button_green",
		
		flash_loaded_callback : "swfu.flashLoaded",
		upload_file_queued_callback : "fileQueued",
		upload_file_start_callback : "uploadFileStart",
		upload_progress_callback : "uploadProgress",
		upload_file_complete_callback : "wallpaper_uploadcomplete",
		upload_file_cancel_callback : "uploadFileCancelled",
		upload_queue_complete_callback : "uploadQueueComplete",
		upload_error_callback : "uploadError",
		upload_cancel_callback : "uploadCancel",
		debug : true, 
		auto_upload : true			
	});

	var banner = "right";
	swfu = new SWFUpload({
		upload_script : basepath + "/meinmedienhandbuch/wallpaper-upload.php?params=" + object_id + "-" + banner,
		target : banner + "SWFUploadTarget" + object_id,
		flash_path : basepath + "/swf/SWFUpload/SWFUpload.swf",
		allowed_filesize : 8096,
		allowed_filetypes : "*.jpg;*.gif;*.png;*.swf",
		allowed_filetypes_description : "SWF-, JPEG-, GIF- und PNG-Dateien",
		browse_link_innerhtml : "Banner von Festplatte ausw&auml;hlen...",
		upload_link_innerhtml : "&Uuml;bertragung starten",
		browse_link_class : "link_button_green",
		upload_link_class : "link_button_green",
		
		flash_loaded_callback : "swfu.flashLoaded",
		upload_file_queued_callback : "fileQueued",
		upload_file_start_callback : "uploadFileStart",
		upload_progress_callback : "uploadProgress",
		upload_file_complete_callback : "wallpaper_uploadcomplete",
		upload_file_cancel_callback : "uploadFileCancelled",
		upload_queue_complete_callback : "uploadQueueComplete",
		upload_error_callback : "uploadError",
		upload_cancel_callback : "uploadCancel",
		debug : true, 
		auto_upload : true			
	});

	window.scrollTo(0,0);
}

function wallpaper_uploadcomplete(file)
{
	xajax_green_showwallpapers();
}

/* ----------------- */

function newsletter_offset(offset)
{
	greenCurrentOffset = offset;
	newsletter_search();
}

function newsletter_search()
{
	xajax_green_shownewsletters(greenCurrentOffset,greenSearchTerm,greenCurrentStatus);
}

function newsletter_init_before()
{
	eval('if(typeof(newsletter_source) != "undefined") dojo_dnd_delete(newsletter_source);');
	eval('if(typeof(newsletter_flashbacks) != "undefined") dojo_dnd_delete(newsletter_flashbacks);');
	eval('if(typeof(newsletter_topnews) != "undefined") dojo_dnd_delete(newsletter_topnews);');
	eval('if(typeof(newsletter_ausblick) != "undefined") dojo_dnd_delete(newsletter_ausblick);');
	/*
	for (attribut in dojoSubscriptions) {
		dojo.unsubscribe(dojoSubscriptions[attribut]);
	}
	
	dojo.dnd.manager().source.selectAll();
	dojo.dnd.manager().source.deleteSelectedNodes();
	dojo.dnd.manager().source.clearItems();
	dojo.dnd.manager().source.destroy();
	
	dojo.dnd.manager().target.selectAll();
	dojo.dnd.manager().target.deleteSelectedNodes();
	dojo.dnd.manager().target.clearItems();
	dojo.dnd.manager().target.destroy();
	*/
}

function newsletter_init_after()
{
	for (attribut in dojoSubscriptions) {
	    dojo.unsubscribe(dojoSubscriptions[attribut]);
	}
	dojoSubscriptions['newsletter'] = dojo.subscribe("/dnd/drop", function(source,nodes,iscopy)
	{
		/*
		var t = dojo.dnd.manager().target;
		var s = dojo.dnd.manager().source;
		*/
		//alert(t.node.id + ' enthaelt ' + t.getAllNodes().length);
		newsletteritemupdate(newsletter_source);
		newsletteritemupdate(newsletter_flashbacks);
		newsletteritemupdate(newsletter_topnews);
		newsletteritemupdate(newsletter_ausblick);
		//newsletteritemupdate(s);
	});
}

function newsletter_init()
{
	for (attribut in dojoSubscriptions) {
	    dojo.unsubscribe(dojoSubscriptions[attribut]);
	}
	dojoSubscriptions['newsletter'] = dojo.subscribe("/dnd/drop", function(source,nodes,iscopy)
	{
		var t = dojo.dnd.manager().target;
		var s = dojo.dnd.manager().source;
		//alert(t.node.id + ' enthaelt ' + t.getAllNodes().length);
		newsletteritemupdate(t);
		newsletteritemupdate(s);
		//newsletteritemupdate(s);
	});
}

function newsletteritemupdate(source)
{
	var items = new Array();
	var nodes = source.getAllNodes();
	for(i=0;i<nodes.length;i++)
	{
		//alert('ID: ' + nodes[i].id);
		data = parseInt(nodes[i].id.replace(/[^0-9]*/,''));
		//alert('Data: ' + data);
		items.push(data);
	}
	xajax_green_newsletteritemupdate(source.node.id,items);
}

function newsletter_delete(object_id)
{
	var chk = window.confirm('Wollen Sie den Newsletter wirklich löschen?');
	if(chk == true) xajax_green_newsletterdelete(object_id);
}

function newsletter_sent(object_id, status)
{
	switch(status)
	{
		default:
		case false:
			xajax_green_newslettersent(object_id,0);
			break;		

		case true:
			xajax_green_newslettersent(object_id,1);
			break;		
	}
}


/* ----------------- */

function green_shop()
{
	Detail = window.open(basepath + "/shop/admin", "Detailansicht", "statusbar=yes,menubar=yes,resizable=yes,scrollbars=yes,location=yes,toolbar=yes,status=yes");
	Detail.focus();
}

function show_shopcategory(category_id)
{
	if(dojo.byId('shopcategory_popup'))
	{
		xajax_green_shoploadcategory(category_id);
		dijit.byId('shopcategory_popup').show();
	}
}

function close_shopcategory()
{
	clear_dojo_instances('shopcategory');
	if(dojo.byId('shopcategory_popup'))
	{
		dijit.byId('shopcategory_popup').hide();
	}
}


/* ----------------- */

var greenSearchTerm = '';
var greenSearchTimer = null;
var greenSubSearchTerm = '';
var greenSubSearchTimer = null;

var greenSubCurrentId = 0;
var greenCurrentOffset = 0;
var greenSubCurrentOffset = 0;
var greenCurrentStatus = 'all';
var greenSubCurrentStatus = 'all';
var greenCurrentSource = '';
var greenSubCurrentSource = '';
var greenCurrentType = 'all';
var greenSubCurrentType = 'all';
var greenCurrentSort = '';
var greenSubCurrentSort = '';
var greenCurrentNewsSection = 0;
var greenSubCurrentProductType = '';
var greenNewsImage = 0;
var greenNewsType = '';
var greenTinyMCE = 0;
var greenTag = '';
var greenTagTerm = '';
var greenTagTimer = null;
var greenNoTag = 0;

var greenNewsletter = new Object();
var greenDetailShow = 0;

var current_window = '';
/*	Unobtrusive Flash Objects (UFO) v3.21 <http://www.bobbyvandersluis.com/ufo/>
	Copyright 2005, 2006 Bobby van der Sluis
	This software is licensed under the CC-GNU LGPL <http://creativecommons.org/licenses/LGPL/2.1/>
*/

var UFO = {
	req: ["movie", "width", "height", "majorversion", "build"],
	opt: ["play", "loop", "menu", "quality", "scale", "salign", "wmode", "bgcolor", "base", "flashvars", "devicefont", "allowscriptaccess", "seamlesstabbing", "allowfullscreen"],
	optAtt: ["id", "name", "align"],
	optExc: ["swliveconnect"],
	ximovie: "ufo.swf",
	xiwidth: "215",
	xiheight: "138",
	ua: navigator.userAgent.toLowerCase(),
	pluginType: "",
	fv: [0,0],
	foList: [],
		
	create: function(FO, id) {
		if (!UFO.uaHas("w3cdom") || UFO.uaHas("ieMac")) return;
		UFO.getFlashVersion();
		UFO.foList[id] = UFO.updateFO(FO);
		UFO.createCSS("#" + id, "visibility:hidden;");
		UFO.domLoad(id);
	},

	updateFO: function(FO) {
		if (typeof FO.xi != "undefined" && FO.xi == "true") {
			if (typeof FO.ximovie == "undefined") FO.ximovie = UFO.ximovie;
			if (typeof FO.xiwidth == "undefined") FO.xiwidth = UFO.xiwidth;
			if (typeof FO.xiheight == "undefined") FO.xiheight = UFO.xiheight;
		}
		FO.mainCalled = false;
		return FO;
	},

	domLoad: function(id) {
		var _t = setInterval(function() {
			if ((document.getElementsByTagName("body")[0] != null || document.body != null) && document.getElementById(id) != null) {
				UFO.main(id);
				clearInterval(_t);
			}
		}, 250);
		if (typeof document.addEventListener != "undefined") {
			document.addEventListener("DOMContentLoaded", function() { UFO.main(id); clearInterval(_t); } , null); // Gecko, Opera 9+
		}
	},

	main: function(id) {
		var _fo = UFO.foList[id];
		if (_fo.mainCalled) return;
		UFO.foList[id].mainCalled = true;
		document.getElementById(id).style.visibility = "hidden";
		if (UFO.hasRequired(id)) {
			if (UFO.hasFlashVersion(parseInt(_fo.majorversion, 10), parseInt(_fo.build, 10))) {
				if (typeof _fo.setcontainercss != "undefined" && _fo.setcontainercss == "true") UFO.setContainerCSS(id);
				UFO.writeSWF(id);
			}
			else if (_fo.xi == "true" && UFO.hasFlashVersion(6, 65)) {
				UFO.createDialog(id);
			}
		}
		document.getElementById(id).style.visibility = "visible";
	},
	
	createCSS: function(selector, declaration) {
		var _h = document.getElementsByTagName("head")[0]; 
		var _s = UFO.createElement("style");
		if (!UFO.uaHas("ieWin")) _s.appendChild(document.createTextNode(selector + " {" + declaration + "}")); // bugs in IE/Win
		_s.setAttribute("type", "text/css");
		_s.setAttribute("media", "screen"); 
		_h.appendChild(_s);
		if (UFO.uaHas("ieWin") && document.styleSheets && document.styleSheets.length > 0) {
			var _ls = document.styleSheets[document.styleSheets.length - 1];
			if (typeof _ls.addRule == "object") _ls.addRule(selector, declaration);
		}
	},
	
	setContainerCSS: function(id) {
		var _fo = UFO.foList[id];
		var _w = /%/.test(_fo.width) ? "" : "px";
		var _h = /%/.test(_fo.height) ? "" : "px";
		UFO.createCSS("#" + id, "width:" + _fo.width + _w +"; height:" + _fo.height + _h +";");
		if (_fo.width == "100%") {
			UFO.createCSS("body", "margin-left:0; margin-right:0; padding-left:0; padding-right:0;");
		}
		if (_fo.height == "100%") {
			UFO.createCSS("html", "height:100%; overflow:hidden;");
			UFO.createCSS("body", "margin-top:0; margin-bottom:0; padding-top:0; padding-bottom:0; height:100%;");
		}
	},

	createElement: function(el) {
		return (UFO.uaHas("xml") && typeof document.createElementNS != "undefined") ?  document.createElementNS("http://www.w3.org/1999/xhtml", el) : document.createElement(el);
	},

	createObjParam: function(el, aName, aValue) {
		var _p = UFO.createElement("param");
		_p.setAttribute("name", aName);	
		_p.setAttribute("value", aValue);
		el.appendChild(_p);
	},

	uaHas: function(ft) {
		var _u = UFO.ua;
		switch(ft) {
			case "w3cdom":
				return (typeof document.getElementById != "undefined" && typeof document.getElementsByTagName != "undefined" && (typeof document.createElement != "undefined" || typeof document.createElementNS != "undefined"));
			case "xml":
				var _m = document.getElementsByTagName("meta");
				var _l = _m.length;
				for (var i = 0; i < _l; i++) {
					if (/content-type/i.test(_m[i].getAttribute("http-equiv")) && /xml/i.test(_m[i].getAttribute("content"))) return true;
				}
				return false;
			case "ieMac":
				return /msie/.test(_u) && !/opera/.test(_u) && /mac/.test(_u);
			case "ieWin":
				return /msie/.test(_u) && !/opera/.test(_u) && /win/.test(_u);
			case "gecko":
				return /gecko/.test(_u) && !/applewebkit/.test(_u);
			case "opera":
				return /opera/.test(_u);
			case "safari":
				return /applewebkit/.test(_u);
			default:
				return false;
		}
	},
	
	getFlashVersion: function() {
		if (UFO.fv[0] != 0) return;  
		if (navigator.plugins && typeof navigator.plugins["Shockwave Flash"] == "object") {
			UFO.pluginType = "npapi";
			var _d = navigator.plugins["Shockwave Flash"].description;
			if (typeof _d != "undefined") {
				_d = _d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
				var _m = parseInt(_d.replace(/^(.*)\..*$/, "$1"), 10);
				var _r = /r/.test(_d) ? parseInt(_d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
				UFO.fv = [_m, _r];
			}
		}
		else if (window.ActiveXObject) {
			UFO.pluginType = "ax";
			try { // avoid fp 6 crashes
				var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
			}
			catch(e) {
				try { 
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
					UFO.fv = [6, 0];
					_a.AllowScriptAccess = "always"; // throws if fp < 6.47 
				}
				catch(e) {
					if (UFO.fv[0] == 6) return;
				}
				try {
					var _a = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
				}
				catch(e) {}
			}
			if (typeof _a == "object") {
				var _d = _a.GetVariable("$version"); // bugs in fp 6.21/6.23
				if (typeof _d != "undefined") {
					_d = _d.replace(/^\S+\s+(.*)$/, "$1").split(",");
					UFO.fv = [parseInt(_d[0], 10), parseInt(_d[2], 10)];
				}
			}
		}
	},

	hasRequired: function(id) {
		var _l = UFO.req.length;
		for (var i = 0; i < _l; i++) {
			if (typeof UFO.foList[id][UFO.req[i]] == "undefined") return false;
		}
		return true;
	},
	
	hasFlashVersion: function(major, release) {
		return (UFO.fv[0] > major || (UFO.fv[0] == major && UFO.fv[1] >= release)) ? true : false;
	},

	writeSWF: function(id) {
		var _fo = UFO.foList[id];
		var _e = document.getElementById(id);
		if (UFO.pluginType == "npapi") {
			if (UFO.uaHas("gecko") || UFO.uaHas("xml")) {
				while(_e.hasChildNodes()) {
					_e.removeChild(_e.firstChild);
				}
				var _obj = UFO.createElement("object");
				_obj.setAttribute("type", "application/x-shockwave-flash");
				_obj.setAttribute("data", _fo.movie);
				_obj.setAttribute("width", _fo.width);
				_obj.setAttribute("height", _fo.height);
				var _l = UFO.optAtt.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[UFO.optAtt[i]] != "undefined") _obj.setAttribute(UFO.optAtt[i], _fo[UFO.optAtt[i]]);
				}
				var _o = UFO.opt.concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") UFO.createObjParam(_obj, _o[i], _fo[_o[i]]);
				}
				_e.appendChild(_obj);
			}
			else {
				var _emb = "";
				var _o = UFO.opt.concat(UFO.optAtt).concat(UFO.optExc);
				var _l = _o.length;
				for (var i = 0; i < _l; i++) {
					if (typeof _fo[_o[i]] != "undefined") _emb += ' ' + _o[i] + '="' + _fo[_o[i]] + '"';
				}
				_e.innerHTML = '<embed type="application/x-shockwave-flash" src="' + _fo.movie + '" width="' + _fo.width + '" height="' + _fo.height + '" pluginspage="http://www.macromedia.com/go/getflashplayer"' + _emb + '></embed>';
			}
		}
		else if (UFO.pluginType == "ax") {
			var _objAtt = "";
			var _l = UFO.optAtt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.optAtt[i]] != "undefined") _objAtt += ' ' + UFO.optAtt[i] + '="' + _fo[UFO.optAtt[i]] + '"';
			}
			var _objPar = "";
			var _l = UFO.opt.length;
			for (var i = 0; i < _l; i++) {
				if (typeof _fo[UFO.opt[i]] != "undefined") _objPar += '<param name="' + UFO.opt[i] + '" value="' + _fo[UFO.opt[i]] + '" />';
			}
			var _p = window.location.protocol == "https:" ? "https:" : "http:";
			_e.innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + _objAtt + ' width="' + _fo.width + '" height="' + _fo.height + '" codebase="' + _p + '//download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=' + _fo.majorversion + ',0,' + _fo.build + ',0"><param name="movie" value="' + _fo.movie + '" />' + _objPar + '</object>';
		}
	},
		
	createDialog: function(id) {
		var _fo = UFO.foList[id];
		UFO.createCSS("html", "height:100%; overflow:hidden;");
		UFO.createCSS("body", "height:100%; overflow:hidden;");
		UFO.createCSS("#xi-con", "position:absolute; left:0; top:0; z-index:1000; width:100%; height:100%; background-color:#fff; filter:alpha(opacity:75); opacity:0.75;");
		UFO.createCSS("#xi-dia", "position:absolute; left:50%; top:50%; margin-left: -" + Math.round(parseInt(_fo.xiwidth, 10) / 2) + "px; margin-top: -" + Math.round(parseInt(_fo.xiheight, 10) / 2) + "px; width:" + _fo.xiwidth + "px; height:" + _fo.xiheight + "px;");
		var _b = document.getElementsByTagName("body")[0];
		var _c = UFO.createElement("div");
		_c.setAttribute("id", "xi-con");
		var _d = UFO.createElement("div");
		_d.setAttribute("id", "xi-dia");
		_c.appendChild(_d);
		_b.appendChild(_c);
		var _mmu = window.location;
		if (UFO.uaHas("xml") && UFO.uaHas("safari")) {
			var _mmd = document.getElementsByTagName("title")[0].firstChild.nodeValue = document.getElementsByTagName("title")[0].firstChild.nodeValue.slice(0, 47) + " - Flash Player Installation";
		}
		else {
			var _mmd = document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		}
		var _mmp = UFO.pluginType == "ax" ? "ActiveX" : "PlugIn";
		var _uc = typeof _fo.xiurlcancel != "undefined" ? "&xiUrlCancel=" + _fo.xiurlcancel : "";
		var _uf = typeof _fo.xiurlfailed != "undefined" ? "&xiUrlFailed=" + _fo.xiurlfailed : "";
		UFO.foList["xi-dia"] = { movie:_fo.ximovie, width:_fo.xiwidth, height:_fo.xiheight, majorversion:"6", build:"65", flashvars:"MMredirectURL=" + _mmu + "&MMplayerType=" + _mmp + "&MMdoctitle=" + _mmd + _uc + _uf };
		UFO.writeSWF("xi-dia");
	},

	expressInstallCallback: function() {
		var _b = document.getElementsByTagName("body")[0];
		var _c = document.getElementById("xi-con");
		_b.removeChild(_c);
		UFO.createCSS("body", "height:auto; overflow:auto;");
		UFO.createCSS("html", "height:auto; overflow:auto;");
	},

	cleanupIELeaks: function() {
		var _o = document.getElementsByTagName("object");
		var _l = _o.length
		for (var i = 0; i < _l; i++) {
			_o[i].style.display = "none";
			for (var x in _o[i]) {
				if (typeof _o[i][x] == "function") {
					_o[i][x] = null;
				}
			}
		}
	}

};

if (typeof window.attachEvent != "undefined" && UFO.uaHas("ieWin")) {
	window.attachEvent("onunload", UFO.cleanupIELeaks);
}

// Flash Player Version Detection - Rev 1.6
// Detect Client Browser type
// Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
    var str = '';
    if (isIE && isWin && !isOpera)
    {
  		str += '<object ';
  		for (var i in objAttrs)
  			str += i + '="' + objAttrs[i] + '" ';
  		for (var i in params)
  			str += '><param name="' + i + '" value="' + params[i] + '" /> ';
  		str += '></object>';
    } else {
  		str += '<embed ';
  		for (var i in embedAttrs)
  			str += i + '="' + embedAttrs[i] + '" ';
  		str += '> </embed>';
    }

    document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblClick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "id":
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}



/**
 * SWFUpload v2.1.0 by Jacob Roberts, Feb 2008, http://www.swfupload.org, http://swfupload.googlecode.com, http://www.swfupload.org
 * -------- -------- -------- -------- -------- -------- -------- --------
 * SWFUpload is (c) 2006 Lars Huring, Olov Nilzn and Mammon Media and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * See Changelog.txt for version history
 *
 */


/* *********** */
/* Constructor */
/* *********** */

var SWFUpload = function (settings) {
	this.initSWFUpload(settings);
};

SWFUpload.prototype.initSWFUpload = function (settings) {
	try {
		this.customSettings = {};	// A container where developers can place their own settings associated with this instance.
		this.settings = settings;
		this.eventQueue = [];
		this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
		this.movieElement = null;

		// Setup global control tracking
		SWFUpload.instances[this.movieName] = this;

		// Load the settings.  Load the Flash movie.
		this.initSettings();
		this.loadFlash();
		this.displayDebugInfo();
	} catch (ex) {
		delete SWFUpload.instances[this.movieName];
		throw ex;
	}
};

/* *************** */
/* Static Members  */
/* *************** */
SWFUpload.instances = {};
SWFUpload.movieCount = 0;
SWFUpload.version = "2.2.0 Alpha";
SWFUpload.QUEUE_ERROR = {
	QUEUE_LIMIT_EXCEEDED	  		: -100,
	FILE_EXCEEDS_SIZE_LIMIT  		: -110,
	ZERO_BYTE_FILE			  		: -120,
	INVALID_FILETYPE		  		: -130
};
SWFUpload.UPLOAD_ERROR = {
	HTTP_ERROR				  		: -200,
	MISSING_UPLOAD_URL	      		: -210,
	IO_ERROR				  		: -220,
	SECURITY_ERROR			  		: -230,
	UPLOAD_LIMIT_EXCEEDED	  		: -240,
	UPLOAD_FAILED			  		: -250,
	SPECIFIED_FILE_ID_NOT_FOUND		: -260,
	FILE_VALIDATION_FAILED	  		: -270,
	FILE_CANCELLED			  		: -280,
	UPLOAD_STOPPED					: -290
};
SWFUpload.FILE_STATUS = {
	QUEUED		 : -1,
	IN_PROGRESS	 : -2,
	ERROR		 : -3,
	COMPLETE	 : -4,
	CANCELLED	 : -5
};
SWFUpload.BUTTON_ACTION = {
	SELECT_FILE  : -100,
	SELECT_FILES : -110,
	START_UPLOAD : -120
};

/* ******************** */
/* Instance Members  */
/* ******************** */

// Private: initSettings ensures that all the
// settings are set, getting a default value if one was not assigned.
SWFUpload.prototype.initSettings = function () {
	this.ensureDefault = function (settingName, defaultValue) {
		this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
	};
	
	// Upload backend settings
	this.ensureDefault("upload_url", "");
	this.ensureDefault("file_post_name", "Filedata");
	this.ensureDefault("post_params", {});
	this.ensureDefault("use_query_string", false);
	this.ensureDefault("requeue_on_error", false);
	
	// File Settings
	this.ensureDefault("file_types", "*.*");
	this.ensureDefault("file_types_description", "All Files");
	this.ensureDefault("file_size_limit", 0);	// Default zero means "unlimited"
	this.ensureDefault("file_upload_limit", 0);
	this.ensureDefault("file_queue_limit", 0);

	// Flash Settings
	this.ensureDefault("flash_url", "swfupload_f9.swf");
	this.ensureDefault("flash_color", "#FFFFFF");
	this.ensureDefault("flash_wmode", "transparent");
	this.ensureDefault("flash_container_id", null);
	this.ensureDefault("flash_width", '100%');
	this.ensureDefault("flash_height", '100%');

	// Button Settings
	/*
	this.ensureDefault("button_image_url", 0);
	this.ensureDefault("button_width", 1);
	this.ensureDefault("button_height", 1);
	this.ensureDefault("button_text", "");
	this.ensureDefault("button_text_style", "");
	this.ensureDefault("button_action", SWFUpload.BUTTON_ACTION.SELECT_FILES);
	this.ensureDefault("button_disabled", false);
	this.ensureDefault("button_placeholder_id", null);
	*/

	// Debug Settings
	this.ensureDefault("debug", false);
	this.settings.debug_enabled = this.settings.debug;	// Here to maintain v2 API
	
	// Event Handlers
	this.settings.return_upload_start_handler = this.returnUploadStart;
	this.ensureDefault("swfupload_loaded_handler", null);
	this.ensureDefault("file_dialog_start_handler", null);
	this.ensureDefault("file_queued_handler", null);
	this.ensureDefault("file_queue_error_handler", null);
	this.ensureDefault("file_dialog_complete_handler", null);
	
	this.ensureDefault("upload_start_handler", null);
	this.ensureDefault("upload_progress_handler", null);
	this.ensureDefault("upload_error_handler", null);
	this.ensureDefault("upload_success_handler", null);
	this.ensureDefault("upload_complete_handler", null);
	
	this.ensureDefault("debug_handler", this.debugMessage);

	this.ensureDefault("custom_settings", {});

	// Other settings
	this.customSettings = this.settings.custom_settings;
	
	delete this.ensureDefault;
};

SWFUpload.prototype.loadFlash = function () {
	this.insertFlash();
};

// Private: appendFlash gets the HTML tag for the Flash
// It then appends the flash to the body
SWFUpload.prototype.appendFlash = function () {
	var targetElement, container;

	// Make sure an element with the ID we are going to use doesn't already exist
	if (document.getElementById(this.movieName) !== null) {
		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
	}

	// Get the body tag where we will be adding the flash movie
	targetElement = document.getElementsByTagName("body")[0];

	if (targetElement == undefined) {
		throw "Could not find the 'body' element.";
	}

	// Append the container and load the flash
	container = document.createElement("div");
	container.style.width = "1px";
	container.style.height = "1px";

	targetElement.appendChild(container);
	container.innerHTML = this.getFlashHTML();	// Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
};

// Private: insertFlash inserts the flash movie into the container element.
SWFUpload.prototype.insertFlash = function () {

	var targetElement, container;

	// Make sure an element with the ID we are going to use doesn't already exist
	if (document.getElementById(this.movieName) !== null) {
		throw "ID " + this.movieName + " is already in use. The Flash Object could not be added";
	}

	// Schepp
	if(typeof(this.settings.swfupload_element_id) != "undefined")
	{
		var element = document.getElementById(this.settings.swfupload_element_id).getElementsByTagName('input')[0];
	}
	else if(typeof(document.getElementById('btnBrowse')) != "undefined")
	{
		var element = document.getElementById('btnBrowse');
	}
	if(typeof(document.getElementById(this.settings.swfupload_element_id)) != "undefined")
	{
		document.getElementById(this.settings.swfupload_element_id).style.display = "block";
	}
	if(typeof(element) != "undefined")
	{
		var width = element.offsetWidth + element.style.marginLeft + element.style.marginRight;
		var height = element.offsetHeight + element.style.marginTop + element.style.marginBottom;
		var overlayelement = document.createElement("div");
		overlayelement.setAttribute('id',element.id + "overlay");
		overlayelement.style.position = "absolute";
		overlayelement.style.zIndex = "1000";
		overlayelement.style.width = width + 'px';
		overlayelement.style.height = height + 'px';
		//overlayelement.style.backgroundColor = '#FF0000';
		var parentelement = element.parentNode;
		parentelement.insertBefore(overlayelement,element);
	}
	
	// place flash embed inside the container element
	overlayelement.innerHTML = this.getFlashHTML();
};

// Private: getFlashHTML generates the object tag needed to embed the flash in to the document
SWFUpload.prototype.getFlashHTML = function () {
	// Flash Satay object syntax: http://www.alistapart.com/articles/flashsatay
	return ['<object id="', this.movieName, '" type="application/x-shockwave-flash" data="', this.settings.flash_url, '" width="', this.settings.flash_width, '" height="', this.settings.flash_height, '" style="position: relative; z-index: 1001;display: block">',
				'<param name="movie" value="', this.settings.flash_url, '" />',
				'<param name="bgcolor" value="', this.settings.flash_color, '" />',
				'<param name="quality" value="high" />',
				'<param name="menu" value="false" />',
				'<param name="wmode" value="', this.settings.flash_wmode ,'" />',
				'<param name="allowScriptAccess" value="always" />',
				'<param name="flashvars" value="' + this.getFlashVars() + '" />',
				'</object>'].join("");
};

// Private: getFlashVars builds the parameter string that will be passed
// to flash in the flashvars param.
SWFUpload.prototype.getFlashVars = function () {
	// Build a string from the post param object
	var paramString = this.buildParamString();

	// Build the parameter string
	return ["movieName=", encodeURIComponent(this.movieName),
			"&amp;uploadURL=", encodeURIComponent(this.settings.upload_url),
			"&amp;useQueryString=", encodeURIComponent(this.settings.use_query_string),
			"&amp;requeueOnError=", encodeURIComponent(this.settings.requeue_on_error),
			"&amp;params=", encodeURIComponent(paramString),
			"&amp;filePostName=", encodeURIComponent(this.settings.file_post_name),
			"&amp;fileTypes=", encodeURIComponent(this.settings.file_types),
			"&amp;fileTypesDescription=", encodeURIComponent(this.settings.file_types_description),
			"&amp;fileSizeLimit=", encodeURIComponent(this.settings.file_size_limit),
			"&amp;fileUploadLimit=", encodeURIComponent(this.settings.file_upload_limit),
			//"&amp;fileQueueLimit=", encodeURIComponent(this.settings.file_queue_limit),
			//"&amp;buttonImage_url=", encodeURIComponent(this.settings.button_image_url),
			//"&amp;buttonWidth=", encodeURIComponent(this.settings.button_width),
			//"&amp;buttonHeight=", encodeURIComponent(this.settings.button_height),
			//"&amp;buttonText=", encodeURIComponent(this.settings.button_text),
			//"&amp;buttonTextStyle=", encodeURIComponent(this.settings.button_text_style),
			//"&amp;buttonAction=", encodeURIComponent(this.settings.button_action),
			//"&amp;buttonDisabled=", encodeURIComponent(this.settings.button_disabled)
		].join("");
};

// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
// The element is cached after the first lookup
SWFUpload.prototype.getMovieElement = function () {
	if (this.movieElement == undefined) {
		this.movieElement = document.getElementById(this.movieName);
	}

	if (this.movieElement === null) {
		throw "Could not find Flash element";
	}
	
	return this.movieElement;
};

// Private: buildParamString takes the name/value pairs in the post_params setting object
// and joins them up in to a string formatted "name=value&amp;name=value"
SWFUpload.prototype.buildParamString = function () {
	var postParams = this.settings.post_params;
	var paramStringPairs = [];

	if (typeof(postParams) === "object") {
		for (var name in postParams) {
			if (postParams.hasOwnProperty(name)) {
				paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
			}
		}
	}

	return paramStringPairs.join("&amp;");
};

// Public: Used to remove a SWFUpload instance from the page. This method strives to remove
// all references to the SWF, and other objects so memory is properly freed.
// Returns true if everything was destroyed. Returns a false if a failure occurs leaving SWFUpload in an inconsistant state.
SWFUpload.prototype.destroy = function () {
	try {
		// Make sure Flash is done before we try to remove it
		this.stopUpload();
		
		// Remove the SWFUpload DOM nodes
		var movieElement = null;
		try {
			movieElement = this.getMovieElement();
		} catch (ex) {
		}
		
		if (movieElement != undefined && movieElement.parentNode != undefined && typeof(movieElement.parentNode.removeChild) === "function") {
			var container = movieElement.parentNode;
			if (container != undefined) {
				container.removeChild(movieElement);
				if (container.parentNode != undefined && typeof(container.parentNode.removeChild) === "function") {
					container.parentNode.removeChild(container);
				}
			}
		}
		
		// Destroy references
		SWFUpload.instances[this.movieName] = null;
		delete SWFUpload.instances[this.movieName];

		delete this.movieElement;
		delete this.settings;
		delete this.customSettings;
		delete this.eventQueue;
		delete this.movieName;
		
		return true;
	} catch (ex1) {
		return false;
	}
};

// Public: displayDebugInfo prints out settings and configuration
// information about this SWFUpload instance.
// This function (and any references to it) can be deleted when placing
// SWFUpload in production.
SWFUpload.prototype.displayDebugInfo = function () {
	this.debug(
		[
			"---SWFUpload Instance Info---\n",
			"Version: ", SWFUpload.version, "\n",
			"Movie Name: ", this.movieName, "\n",
			"Settings:\n",
			"\t", "upload_url:             ", this.settings.upload_url, "\n",
			"\t", "use_query_string:       ", this.settings.use_query_string.toString(), "\n",
			"\t", "file_post_name:         ", this.settings.file_post_name, "\n",
			"\t", "post_params:            ", this.settings.post_params.toString(), "\n",
			"\t", "file_types:             ", this.settings.file_types, "\n",
			"\t", "file_types_description: ", this.settings.file_types_description, "\n",
			"\t", "file_size_limit:        ", this.settings.file_size_limit, "\n",
			"\t", "file_upload_limit:      ", this.settings.file_upload_limit, "\n",
			"\t", "file_queue_limit:       ", this.settings.file_queue_limit, "\n",
			"\t", "flash_url:              ", this.settings.flash_url, "\n",
			"\t", "flash_color:            ", this.settings.flash_color, "\n",
			"\t", "debug:                  ", this.settings.debug.toString(), "\n",
			"\t", "custom_settings:        ", this.settings.custom_settings.toString(), "\n",
			"Event Handlers:\n",
			"\t", "swfupload_loaded_handler assigned:  ", (typeof(this.settings.swfupload_loaded_handler) === "function").toString(), "\n",
			"\t", "file_dialog_start_handler assigned: ", (typeof(this.settings.file_dialog_start_handler) === "function").toString(), "\n",
			"\t", "file_queued_handler assigned:       ", (typeof(this.settings.file_queued_handler) === "function").toString(), "\n",
			"\t", "file_queue_error_handler assigned:  ", (typeof(this.settings.file_queue_error_handler) === "function").toString(), "\n",
			"\t", "upload_start_handler assigned:      ", (typeof(this.settings.upload_start_handler) === "function").toString(), "\n",
			"\t", "upload_progress_handler assigned:   ", (typeof(this.settings.upload_progress_handler) === "function").toString(), "\n",
			"\t", "upload_error_handler assigned:      ", (typeof(this.settings.upload_error_handler) === "function").toString(), "\n",
			"\t", "upload_success_handler assigned:    ", (typeof(this.settings.upload_success_handler) === "function").toString(), "\n",
			"\t", "upload_complete_handler assigned:   ", (typeof(this.settings.upload_complete_handler) === "function").toString(), "\n",
			"\t", "debug_handler assigned:             ", (typeof(this.settings.debug_handler) === "function").toString(), "\n"
		].join("")
	);
};

/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
	the maintain v2 API compatibility
*/
// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
SWFUpload.prototype.addSetting = function (name, value, default_value) {
    if (value == undefined) {
        return (this.settings[name] = default_value);
    } else {
        return (this.settings[name] = value);
	}
};

// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
SWFUpload.prototype.getSetting = function (name) {
    if (this.settings[name] != undefined) {
        return this.settings[name];
	}

    return "";
};



// Private: callFlash handles function calls made to the Flash element.
// Calls are made with a setTimeout for some functions to work around
// bugs in the ExternalInterface library.
SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
	argumentArray = argumentArray || [];
	
	var self = this;
	var callFunction = function () {
		var movieElement = self.getMovieElement();
		var returnValue;
		if (typeof(movieElement[functionName]) === "function") {
			// We have to go through all this if/else stuff because the Flash functions don't have apply() and only accept the exact number of arguments.
			if (argumentArray.length === 0) {
				returnValue = movieElement[functionName]();
			} else if (argumentArray.length === 1) {
				returnValue = movieElement[functionName](argumentArray[0]);
			} else if (argumentArray.length === 2) {
				returnValue = movieElement[functionName](argumentArray[0], argumentArray[1]);
			} else if (argumentArray.length === 3) {
				returnValue = movieElement[functionName](argumentArray[0], argumentArray[1], argumentArray[2]);
			} else {
				throw "Too many arguments";
			}
			
			// Unescape file post param values
			if (returnValue != undefined && typeof(returnValue.post) === "object") {
				returnValue = self.unescapeFilePostParams(returnValue);
			}
			
			return returnValue;
		} else {
			throw "Invalid function name";
		}
	};
	
	return callFunction();
};


/* *****************************
	-- Flash control methods --
	Your UI should use these
	to operate SWFUpload
   ***************************** */

// Public: selectFile causes a File Selection Dialog window to appear.  This
// dialog only allows 1 file to be selected. WARNING: this function does not work in Flash Player 10
SWFUpload.prototype.selectFile = function () {
	this.callFlash("SelectFile");
};

// Public: selectFiles causes a File Selection Dialog window to appear/ This
// dialog allows the user to select any number of files
// Flash Bug Warning: Flash limits the number of selectable files based on the combined length of the file names.
// If the selection name length is too long the dialog will fail in an unpredictable manner.  There is no work-around
// for this bug.  WARNING: this function does not work in Flash Player 10
SWFUpload.prototype.selectFiles = function () {
	this.callFlash("SelectFiles");
};


// Public: startUpload starts uploading the first file in the queue unless
// the optional parameter 'fileID' specifies the ID 
SWFUpload.prototype.startUpload = function (fileID) {
	this.callFlash("StartUpload", [fileID]);
};

/* Cancels a the file upload.  You must specify a file_id */
// Public: cancelUpload cancels any queued file.  The fileID parameter
// must be specified.
SWFUpload.prototype.cancelUpload = function (fileID) {
	this.callFlash("CancelUpload", [fileID]);
};

// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
// If nothing is currently uploading then nothing happens.
SWFUpload.prototype.stopUpload = function () {
	this.callFlash("StopUpload");
};

/* ************************
 * Settings methods
 *   These methods change the SWFUpload settings.
 *   SWFUpload settings should not be changed directly on the settings object
 *   since many of the settings need to be passed to Flash in order to take
 *   effect.
 * *********************** */

// Public: getStats gets the file statistics object.
SWFUpload.prototype.getStats = function () {
	return this.callFlash("GetStats");
};

// Public: setStats changes the SWFUpload statistics.  You shouldn't need to 
// change the statistics but you can.  Changing the statistics does not
// affect SWFUpload accept for the successful_uploads count which is used
// by the upload_limit setting to determine how many files the user may upload.
SWFUpload.prototype.setStats = function (statsObject) {
	this.callFlash("SetStats", [statsObject]);
};

// Public: getFile retrieves a File object by ID or Index.  If the file is
// not found then 'null' is returned.
SWFUpload.prototype.getFile = function (fileID) {
	if (typeof(fileID) === "number") {
		return this.callFlash("GetFileByIndex", [fileID]);
	} else {
		return this.callFlash("GetFile", [fileID]);
	}
};

// Public: addFileParam sets a name/value pair that will be posted with the
// file specified by the Files ID.  If the name already exists then the
// exiting value will be overwritten.
SWFUpload.prototype.addFileParam = function (fileID, name, value) {
	return this.callFlash("AddFileParam", [fileID, name, value]);
};

// Public: removeFileParam removes a previously set (by addFileParam) name/value
// pair from the specified file.
SWFUpload.prototype.removeFileParam = function (fileID, name) {
	this.callFlash("RemoveFileParam", [fileID, name]);
};

// Public: setUploadUrl changes the upload_url setting.
SWFUpload.prototype.setUploadURL = function (url) {
	this.settings.upload_url = url.toString();
	this.callFlash("SetUploadURL", [url]);
};

// Public: setPostParams changes the post_params setting
SWFUpload.prototype.setPostParams = function (paramsObject) {
	this.settings.post_params = paramsObject;
	this.callFlash("SetPostParams", [paramsObject]);
};

// Public: addPostParam adds post name/value pair.  Each name can have only one value.
SWFUpload.prototype.addPostParam = function (name, value) {
	this.settings.post_params[name] = value;
	this.callFlash("SetPostParams", [this.settings.post_params]);
};

// Public: removePostParam deletes post name/value pair.
SWFUpload.prototype.removePostParam = function (name) {
	delete this.settings.post_params[name];
	this.callFlash("SetPostParams", [this.settings.post_params]);
};

// Public: setFileTypes changes the file_types setting and the file_types_description setting
SWFUpload.prototype.setFileTypes = function (types, description) {
	this.settings.file_types = types;
	this.settings.file_types_description = description;
	this.callFlash("SetFileTypes", [types, description]);
};

// Public: setFileSizeLimit changes the file_size_limit setting
SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
	this.settings.file_size_limit = fileSizeLimit;
	this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
};

// Public: setFileUploadLimit changes the file_upload_limit setting
SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
	this.settings.file_upload_limit = fileUploadLimit;
	this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
};

// Public: setFileQueueLimit changes the file_queue_limit setting
SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
	this.settings.file_queue_limit = fileQueueLimit;
	this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
};

// Public: setFilePostName changes the file_post_name setting
SWFUpload.prototype.setFilePostName = function (filePostName) {
	this.settings.file_post_name = filePostName;
	this.callFlash("SetFilePostName", [filePostName]);
};

// Public: setUseQueryString changes the use_query_string setting
SWFUpload.prototype.setUseQueryString = function (useQueryString) {
	this.settings.use_query_string = useQueryString;
	this.callFlash("SetUseQueryString", [useQueryString]);
};

// Public: setRequeueOnError changes the requeue_on_error setting
SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
	this.settings.requeue_on_error = requeueOnError;
	this.callFlash("SetRequeueOnError", [requeueOnError]);
};

// Public: setDebugEnabled changes the debug_enabled setting
SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
	this.settings.debug_enabled = debugEnabled;
	this.callFlash("SetDebugEnabled", [debugEnabled]);
};

// Public: setButtonImageURL loads a button image sprite
SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
	this.settings.button_image_url = buttonImageURL;
	this.callFlash("SetButtonImageURL", [buttonImageURL]);
};

// Public: setButtonDimensions resizes the Flash Movie and button
SWFUpload.prototype.setButtonDimensions = function (width, height) {
	this.settings.button_width = width;
	this.settings.button_height = height;
	
	// FIXME -- resize the movie
	
	this.callFlash("SetButtonDimensions", [width, height]);
};
// Public: setButtonText Changes the text overlaid on the button
SWFUpload.prototype.setButtonText = function (html) {
	this.settings.button_text= html;
	this.callFlash("SetButtonText", [html]);
};
// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
SWFUpload.prototype.setButtonTextStyle = function (css) {
	this.settings.button_text_style = css;
	this.callFlash("SetButtonTextStyle", [css]);
};
// Public: setButtonDisabled disables/enables the button
SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
	this.settings.button_disabled = isDisabled;
	this.callFlash("SetButtonDisabled", [isDisabled]);
};
// Public: setButtonAction sets the action that occurs when the button is clicked
SWFUpload.prototype.setButtonAction = function (buttonAction) {
	this.settings.button_action = buttonAction;
	this.callFlash("SetButtonAction", [buttonAction]);
};

/* *******************************
	Flash Event Interfaces
	These functions are used by Flash to trigger the various
	events.
	
	All these functions a Private.
	
	Because the ExternalInterface library is buggy the event calls
	are added to a queue and the queue then executed by a setTimeout.
	This ensures that events are executed in a determinate order and that
	the ExternalInterface bugs are avoided.
******************************* */

SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
	// Warning: Don't call this.debug inside here or you'll create an infinite loop
	
	if (argumentArray == undefined) {
		argumentArray = [];
	} else if (!(argumentArray instanceof Array)) {
		argumentArray = [argumentArray];
	}
	
	var self = this;
	if (typeof(this.settings[handlerName]) === "function") {
		// Queue the event
		this.eventQueue.push(function () {
			this.settings[handlerName].apply(this, argumentArray);
		});
		
		// Execute the next queued event
		setTimeout(function () {
			self.executeNextEvent();
		}, 0);
		
	} else if (this.settings[handlerName] !== null) {
		throw "Event handler " + handlerName + " is unknown or is not a function";
	}
};

// Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
// we must queue them in order to garentee that they are executed in order.
SWFUpload.prototype.executeNextEvent = function () {
	// Warning: Don't call this.debug inside here or you'll create an infinite loop

	var  f = this.eventQueue ? this.eventQueue.shift() : null;
	if (typeof(f) === "function") {
		f.apply(this);
	}
};

// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterfance cannot have
// properties that contain characters that are not valid for JavaScript identifiers. To work around this
// the Flash Component escapes the parameter names and we must unescape again before passing them along.
SWFUpload.prototype.unescapeFilePostParams = function (file) {
	var reg = /[$]([0-9a-f]{4})/i;
	var unescapedPost = {};
	var uk;

	if (file != undefined) {
		for (var k in file.post) {
			if (file.post.hasOwnProperty(k)) {
				uk = k;
				var match;
				while ((match = reg.exec(uk)) !== null) {
					uk = uk.replace(match[0], String.fromCharCode(parseInt("0x"+match[1], 16)));
				}
				unescapedPost[uk] = file.post[k];
			}
		}

		file.post = unescapedPost;
	}

	return file;
};

SWFUpload.prototype.flashReady = function () {
	// Check that the movie element is loaded correctly with its ExternalInterface methods defined
	var movieElement = this.getMovieElement();
	if (typeof(movieElement.StartUpload) !== "function") {
		throw "ExternalInterface methods failed to initialize.";
	}
	
	this.queueEvent("swfupload_loaded_handler");
};


/* This is a chance to do something before the browse window opens */
SWFUpload.prototype.fileDialogStart = function () {
	this.queueEvent("file_dialog_start_handler");
};


/* Called when a file is successfully added to the queue. */
SWFUpload.prototype.fileQueued = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("file_queued_handler", file);
};


/* Handle errors that occur when an attempt to queue a file fails. */
SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("file_queue_error_handler", [file, errorCode, message]);
};

/* Called after the file dialog has closed and the selected files have been queued.
	You could call startUpload here if you want the queued files to begin uploading immediately. */
SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
	this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
};

SWFUpload.prototype.uploadStart = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("return_upload_start_handler", file);
};

SWFUpload.prototype.returnUploadStart = function (file) {
	var returnValue;
	if (typeof(this.settings.upload_start_handler) === "function") {
		file = this.unescapeFilePostParams(file);
		returnValue = this.settings.upload_start_handler.call(this, file);
	} else if (this.settings.upload_start_handler != undefined) {
		throw "upload_start_handler must be a function";
	}

	// Convert undefined to true so if nothing is returned from the upload_start_handler it is
	// interpretted as 'true'.
	if (returnValue === undefined) {
		returnValue = true;
	}
	
	returnValue = !!returnValue;
	
	this.callFlash("ReturnUploadStart", [returnValue]);
};



SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
};

SWFUpload.prototype.uploadError = function (file, errorCode, message) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_error_handler", [file, errorCode, message]);
};

SWFUpload.prototype.uploadSuccess = function (file, serverData) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_success_handler", [file, serverData]);
};

SWFUpload.prototype.uploadComplete = function (file) {
	file = this.unescapeFilePostParams(file);
	this.queueEvent("upload_complete_handler", file);
};

/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
   internal debug console.  You can override this event and have messages written where you want. */
SWFUpload.prototype.debug = function (message) {
	this.queueEvent("debug_handler", message);
};


/* **********************************
	Debug Console
	The debug console is a self contained, in page location
	for debug message to be sent.  The Debug Console adds
	itself to the body if necessary.

	The console is automatically scrolled as messages appear.
	
	If you are using your own debug handler or when you deploy to production and
	have debug disabled you can remove these functions to reduce the file size
	and complexity.
********************************** */
   
// Private: debugMessage is the default debug_handler.  If you want to print debug messages
// call the debug() function.  When overriding the function your own function should
// check to see if the debug setting is true before outputting debug information.
SWFUpload.prototype.debugMessage = function (message) {
	if (this.settings.debug) {
		var exceptionMessage, exceptionValues = [];

		// Check for an exception object and print it nicely
		if (typeof(message) === "object" && typeof(message.name) === "string" && typeof(message.message) === "string") {
			for (var key in message) {
				if (message.hasOwnProperty(key)) {
					exceptionValues.push(key + ": " + message[key]);
				}
			}
			exceptionMessage = exceptionValues.join("\n") || "";
			exceptionValues = exceptionMessage.split("\n");
			exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
			SWFUpload.Console.writeLine(exceptionMessage);
		} else {
			SWFUpload.Console.writeLine(message);
		}
	}
};

SWFUpload.Console = {};
SWFUpload.Console.writeLine = function (message) {
	var console, documentForm;

	try {
		console = document.getElementById("SWFUpload_Console");

		if (!console) {
			documentForm = document.createElement("form");
			document.getElementsByTagName("body")[0].appendChild(documentForm);

			console = document.createElement("textarea");
			console.id = "SWFUpload_Console";
			console.style.fontFamily = "monospace";
			console.setAttribute("wrap", "off");
			console.wrap = "off";
			console.style.overflow = "auto";
			console.style.width = "700px";
			console.style.height = "350px";
			console.style.margin = "5px";
			documentForm.appendChild(console);
		}

		console.value += message + "\n";

		console.scrollTop = console.scrollHeight - console.clientHeight;
	} catch (ex) {
		alert("Exception: " + ex.name + " Message: " + ex.message);
	}
};

/* 
	SWFUpload Graceful Degradation Plug-in

	This plugin allows SWFUpload to display only if it is loaded successfully.  Otherwise a default form is left displayed.
	
	Usage:
	
	To use this plugin create two HTML containers. Each should have an ID defined.  One container should hold the SWFUpload UI.  The other should hold the degraded UI.
	
	The SWFUpload container should have its CSS "display" property set to "none".
	
	If SWFUpload loads successfully the SWFUpload container will be displayed ("display" set to "block") and the
	degraded container will be hidden ("display" set to "none").
	
	Use the settings "swfupload_element_id" and "degraded_element_id" to indicate your container IDs.  The default values are "swfupload_container" and "degraded_container".
	

var SWFUpload;
if (typeof(SWFUpload) === "function") {
	SWFUpload.gracefulDegradation = {};
	SWFUpload.prototype.initSettings = function (old_initSettings) {
		return function (init_settings) {
			if (typeof(old_initSettings) === "function") {
				old_initSettings.call(this, init_settings);
			}
			
			this.addSetting("swfupload_element_id",		  		init_settings.swfupload_element_id,				"swfupload_container");
			this.addSetting("degraded_element_id",		  		init_settings.degraded_element_id,				"degraded_container");
			this.addSetting("user_swfUploadLoaded_handler",		init_settings.swfupload_loaded_handler,			SWFUpload.swfUploadLoaded);

			this.swfUploadLoaded_handler = SWFUpload.gracefulDegradation.swfUploadLoaded;
		};
	}(SWFUpload.prototype.initSettings);

	SWFUpload.gracefulDegradation.swfUploadLoaded = function () {
		var swfupload_container_id, swfupload_container, degraded_container_id, degraded_container, user_swfUploadLoaded_handler;
		try {
			swfupload_element_id = this.getSetting("swfupload_element_id");
			degraded_element_id = this.getSetting("degraded_element_id");
			
			// Show the UI container
			swfupload_container = document.getElementById(swfupload_element_id);
			if (swfupload_container !== null) {
				swfupload_container.style.display = "block";

				// Now take care of hiding the degraded UI
				degraded_container = document.getElementById(degraded_element_id);
				if (degraded_container !== null) {
					degraded_container.style.display = "none";
				}
			}
		} catch (ex) {
			this.debug(ex);
		}
		
		user_swfUploadLoaded_handler = this.getSetting("user_swfUploadLoaded_handler");
		if (typeof(user_swfUploadLoaded_handler) === "function") {
			user_swfUploadLoaded_handler.apply(this);
		}
	};

}
*/

function finduploadtype()
{
	uploadTypes = new Array('company-logo','joboffer-logo','joboffer-image','company-image','company-pdf','company-contact','company-video','company-audio','joboffer-contact','shopproduct-image');
	for(i=0;i<uploadTypes.length;i++)
	{
		if(document.getElementById('upload-' + uploadTypes[i]))
		{
			setuploadvars(uploadTypes[i]);
		}
	}
	if(dojo.byId("formajax"))
	{
		window.setTimeout(dojo.byId("formajax").getAttribute("title"),0);
	}
}

function setuploadvars(upload_type)
{
	if(detectFlash())
	{
		switch(upload_type)
		{
			default: break;
			case "company-logo":
				var_upload_script = basepath + "/meinmedienhandbuch/company-logo-upload.php?params=" + session_id;
				var_allowed_filesize = 1024;
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Logo von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanylogoupload()';
				break;
	
			case "joboffer-logo":
				var_upload_script = basepath + "/meinmedienhandbuch/joboffer-logo-upload.php?params=" + session_id;
				var_allowed_filesize = 1024;
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Logo von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createjobofferlogoupload()';
				break;
	
			case "joboffer-image":
				var_upload_script = basepath + "/meinmedienhandbuch/joboffer-image-upload.php?params=" + session_id;
				var_allowed_filesize = 2048;
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Anzeigenbild von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createjobofferimageupload()';
				break;
	
			case "company-image":
				var_upload_script = basepath + "/meinmedienhandbuch/company-image-upload.php?params=" + session_id;
				var_allowed_filesize = 2048;
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Bild(er) von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanyimageupload()';
				break;
	
			case "company-pdf":
				var_upload_script = basepath + "/meinmedienhandbuch/company-pdf-upload.php?params=" + session_id;
				var_allowed_filesize = 3072;
				var_allowed_filetypes = "*.pdf";
				var_description = "PDF-Dateien";
				var_browse_link_innerhtml = "PDFs von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanypdfupload()';
				break;
	
			case "company-contact":
				var_upload_script = basepath + "/meinmedienhandbuch/company-contact-upload.php?params=" + session_id;
				var_allowed_filesize = 1024;
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Foto von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanycontactupload()';
				break;
	
			case "company-video":
				var_upload_script = basepath + "/meinmedienhandbuch/company-video-upload.php?params=" + session_id;
				var_allowed_filesize = 102400; // 100MB
				var_allowed_filetypes = "*.wmv;*.avi;*.mov;*.mpg;*.mpeg;*.m2v;*.mp4;*.vob";
				var_description = "Video-Dateien";
				var_browse_link_innerhtml = "Video von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanyvideoupload()';
				break;
	
			case "company-audio":
				var_upload_script = basepath + "/meinmedienhandbuch/company-audio-upload.php?params=" + session_id;
				var_allowed_filesize = 8096; // 8MB
				var_allowed_filetypes = "*.mp3";
				var_description = "MP3-Dateien";
				var_browse_link_innerhtml = "Audiodatei von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanyaudioupload()';
				break;

			case "joboffer-contact":
				var_upload_script = basepath + "/stellenanzeigen/joboffer-document-upload.php?params=" + session_id;
				var_allowed_filesize = 1024; // 1MB
				var_allowed_filetypes = "*.*";
				var_description = "Alle Dateien";
				var_browse_link_innerhtml = "Anhang von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_joboffer_showjobofferdocuments()';
				break;

			case "shopproduct-image":
				var_upload_script = basepath + "/meinmedienhandbuch/shopproduct-image-upload.php?params=" + session_id;
				var_allowed_filesize = 1024; // 1MB
				var_allowed_filetypes = "*.jpg;*.gif;*.png";
				var_description = "JPEG-, GIF- und PNG-Dateien";
				var_browse_link_innerhtml = "Produktbild von Festplatte ausw&auml;hlen...";
				var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createshopproductimageupload()';
				break;
		}
		window.setTimeout('upload("' + upload_type + '")',500);
	}
}

function detectFlash()
{
	// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
	var hasProductInstall = DetectFlashVer(6, 0, 65);
	
	// Version check based upon the values defined in globals
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	
	// Check to see if a player with Flash Product Install is available and the version does not meet the requirements for playback
	if ( hasProductInstall && !hasReqestedVersion ) {
		// MMdoctitle is the stored document.title value used by the installation process to close the window that started the process
		// This is necessary in order to close browser windows that are still utilizing the older version of the player after installation has completed
		// DO NOT MODIFY THE FOLLOWING FOUR LINES
		// Location visited after installation is complete if installation is required
		var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
		var MMredirectURL = window.location;
		document.title = document.title.slice(0, 47) + " - Flash Player Installation";
		var MMdoctitle = document.title;
	
		var chk = window.confirm('Für das Hochladen von Dateien ist ein neuerer Flash-Player als der derzeit bei Ihnen Installierte erforderlich. Drücken Sie OK, um die aktuelle Version zu installieren und anschließend an dieser Stelle fortzufahren.');
		if(chk == true) AC_FL_RunContent(
			"src", basepath + "/swf/playerProductInstall",
			"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
			"width", "550",
			"height", "300",
			"align", "middle",
			"id", "detectionExample",
			"quality", "high",
			"bgcolor", "#3A6EA5",
			"name", "detectionExample",
			"allowScriptAccess","always",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer"
		);
		else return true;
	}
	else return true;
}

function upload(upload_type)
{
	window.scrollTo(0,1);
	swfu[upload_type] = new SWFUpload({
		// Backend Settings
		upload_url: var_upload_script,	// Relative to the SWF file (or you can use absolute paths)
		post_params: {},
	
		// File Upload Settings
		file_size_limit : var_allowed_filesize,	// 100MB
		file_types : var_allowed_filetypes,
		file_types_description : var_description,
		file_upload_limit : "0",
		file_queue_limit : "0",
	
		// Event Handler Settings (all my handlers are in the Handler.js file)
		file_dialog_start_handler : fileDialogStart,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
	
		// Flash Settings
		flash_url : basepath + "/swf/SWFUpload/swfupload.swf?cache=" + Math.random(),	// Relative to this file (or you can use absolute paths)
		
		/*// Flash 10 Start
		button_image_url : basepath + "/design/XPButtonUploadText_61x22.png",
		button_width : 61,
		button_height : 22,
		button_text : "", //var_browse_link_innerhtml
		button_text_style : "",
		button_disabled : false,
		button_action : SWFUpload.BUTTON_ACTION.SELECT_FILES,
		button_placeholder_id : upload_type + "flashUI",
		// Flash 10 End*/
		
		swfupload_element_id : upload_type + "flashUI",		// Setting from graceful degradation plugin
		degraded_element_id : upload_type + "degradedUI",	// Setting from graceful degradation plugin
	
		custom_settings : {
			progressTarget : upload_type + "fsUploadProgress",
			cancelButtonId : upload_type + "btnCancel"
		},
		
		// Debug Settings
		debug: false
	});
	window.setTimeout(var_uploadFileComplete_action,0);
	window.scrollTo(0,0);
}

function contactupload(object_id)
{
	upload_type = 'contact' + object_id;
	var_upload_script = basepath + "/meinmedienhandbuch/company-contact-upload.php?params=" + object_id + "-" + session_id;
	var_allowed_filesize = 8096;
	var_allowed_filetypes = "*.jpg;*.gif;*.png";
	var_description = "JPEG-, GIF- und PNG-Dateien";
	var_browse_link_innerhtml = "Foto von Festplatte ausw&auml;hlen...";
	var_uploadFileComplete_action = 'xajax_meinmedienhandbuch_createcompanycontacts()';
	
	window.scrollTo(0,1);
	swfu[upload_type] = new SWFUpload({
		// Backend Settings
		upload_url: var_upload_script,	// Relative to the SWF file (or you can use absolute paths)
		post_params: {},
	
		// File Upload Settings
		file_size_limit : var_allowed_filesize,	// 100MB
		file_types : var_allowed_filetypes,
		file_types_description : var_description,
		file_upload_limit : "0",
		file_queue_limit : "0",
	
		// Event Handler Settings (all my handlers are in the Handler.js file)
		file_dialog_start_handler : fileDialogStart,
		file_queued_handler : fileQueued,
		file_queue_error_handler : fileQueueError,
		file_dialog_complete_handler : fileDialogComplete,
		upload_start_handler : uploadStart,
		upload_progress_handler : uploadProgress,
		upload_error_handler : uploadError,
		upload_success_handler : uploadSuccess,
		upload_complete_handler : uploadComplete,
	
		// Flash Settings
		flash_url : basepath + "/swf/SWFUpload/swfupload.swf",	// Relative to this file (or you can use absolute paths)
		
		swfupload_element_id : upload_type + "flashUI",		// Setting from graceful degradation plugin
		degraded_element_id : upload_type + "degradedUI",	// Setting from graceful degradation plugin
	
		custom_settings : {
			progressTarget : upload_type + "fsUploadProgress",
			cancelButtonId : upload_type + "btnCancel"
		},
		
		// Debug Settings
		debug: false
	});
	window.scrollTo(0,0);
}

/* ---------------------------------------------------------------------------------------- */

function fileDialogStart() {
	/* I don't need to do anything here */
}
function fileQueued(fileObj) {
	try {
		// You might include code here that prevents the form from being submitted while the upload is in
		// progress.  Then you'll want to put code in the Queue Complete handler to "unblock" the form
		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetStatus("Anstehend...");
		progress.ToggleCancel(true, this);

	} catch (ex) { this.debug(ex); }

}

function fileQueueError(fileObj, error_code, message) {
	try {
		if (error_code === SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED) {
			alert("Sie haben zu viele Dateien in der Warteschlange.\n" + (message === 0 ? "Sie haben das Upload-Limit erreicht." : "Sie können " + (message > 1 ? "bis zu " + message + " Dateien auswählen." : "eine Datei auswählen.")));
			return;
		}

		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetError();
		progress.ToggleCancel(false);

		switch(error_code) {
			case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
				alert("Die Datei ist zu gross!");
				progress.SetStatus("Die Datei ist zu gross!");
				this.debug("Fehler Code: Datei ist zu gross, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
				alert("Die Dateigröße beträgt 0 Bytes!");
				progress.SetStatus("Die Dateigröße beträgt 0 Bytes!");
				this.debug("Fehler Code: Zero byte Datei, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
				alert("Ungültiger Dateityp!");
				progress.SetStatus("Ungültiger Dateityp!");
				this.debug("Fehler Code: Ungueltiger Dateityp, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
				alert("Sie haben zu viele Dateien ausgewählt.  " +  (message > 1 ? "Sie können nur noch " +  message + " Dateien hinzufügen" : "Sie koennen keine weiteren Dateien hinzufügen."));
				break;
			default:
				if (fileObj !== null) {
					alert("Unbekannter Fehler");
					progress.SetStatus("Unbekannter Fehler");
				}
				this.debug("Fehler Code: " + error_code + ", Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
		}
	} catch (ex) {
        this.debug(ex);
    }
}

function fileDialogComplete(num_files_queued) {
	try {
		if (this.getStats().files_queued > 0) {
			document.getElementById(this.customSettings.cancelButtonId).disabled = false;
		}
		
		/* I want auto start and I can do that here */
		this.startUpload();
	} catch (ex)  {
        this.debug(ex);
	}
}

function uploadStart(fileObj) {
	try {
		/* I don't want to do any file validation or anything,  I'll just update the UI and return true to indicate that the upload should start */
		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetStatus("Datei wird gerade hochgeladen. Bitte warten...");
		progress.ToggleCancel(true, this);
	}
	catch (ex) {}
	
	return true;
}

function uploadProgress(fileObj, bytesLoaded, bytesTotal) {

	try {
		var percent = Math.ceil((bytesLoaded / bytesTotal) * 100);

		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetProgress(percent);
		progress.SetStatus("Datei wird gerade hochgeladen. Bitte warten...");
	} catch (ex) { this.debug(ex); }
}

function uploadSuccess(fileObj, server_data) {
	try {
		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetComplete();
		progress.SetStatus("Beendet");
		progress.ToggleCancel(false);

	} catch (ex) { this.debug(ex); }
	window.setTimeout(var_uploadFileComplete_action,0);
}

function uploadComplete(fileObj) {
	try {
		/*  I want the next upload to continue automatically so I'll call startUpload here */
		if (this.getStats().files_queued === 0) {
			document.getElementById(this.customSettings.cancelButtonId).disabled = true;
		} else {	
			this.startUpload();
		}
	} catch (ex) { this.debug(ex); }
	window.setTimeout(var_uploadFileComplete_action,0);
}

function uploadError(fileObj, error_code, message) {
	try {
		var progress = new FileProgress(fileObj, this.customSettings.progressTarget);
		progress.SetError();
		progress.ToggleCancel(false);

		switch(error_code) {
			case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
				progress.SetStatus("Upload Fehler: " + message);
				this.debug("Fehler Code: HTTP Error, Dateiname: " + fileObj.name + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
				progress.SetStatus("Konfigurationsfehler");
				this.debug("Fehler Code: kein Backendscript, Dateiname: " + fileObj.name + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
				progress.SetStatus("Upload fehlgeschlagen.");
				this.debug("Fehler Code: Upload Failed, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.IO_ERROR:
				progress.SetStatus("Server (IO) Fehler");
				this.debug("Fehler Code: IO Error, Dateiname: " + fileObj.name + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
				progress.SetStatus("Sicherheitsfehler");
				this.debug("Fehler Code: Security Error, Dateiname: " + fileObj.name + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
				progress.SetStatus("Upload limit exceeded.");
				this.debug("Fehler Code: Dateigroessen-Begrenzung ueberschritten, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
				progress.SetStatus("Datei nicht gefunden.");
				this.debug("Fehler Code: Die Datei wurde nicht gefunden, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
				progress.SetStatus("Failed Validation.  Upload skipped.");
				this.debug("Fehler Code: Datei Validierung fehlgeschlagen, Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
			case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
				if (this.getStats().files_queued === 0) {
					document.getElementById(this.customSettings.cancelButtonId).disabled = true;
				}
				progress.SetStatus("Abgebrochen");
				progress.SetCancelled();
				break;
			case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
				progress.SetStatus("Gestoppt");
				break;
			default:
				progress.SetStatus("Ungehandleter Fehler: " + error_code);
				this.debug("Fehler Code: " + error_code + ", Dateiname: " + fileObj.name + ", Dateigroesse: " + fileObj.size + ", Hinweis: " + message);
				break;
		}
	} catch (ex) {
        this.debug(ex);
    }
}



function FileProgress(fileObj, target_id) {
	this.file_progress_id = fileObj.id;

	this.opacity = 100;
	this.height = 0;

	this.fileProgressWrapper = document.getElementById(this.file_progress_id);
	if (!this.fileProgressWrapper) {
		this.fileProgressWrapper = document.createElement("div");
		this.fileProgressWrapper.className = "progressWrapper";
		this.fileProgressWrapper.id = this.file_progress_id;

		this.fileProgressElement = document.createElement("div");
		this.fileProgressElement.className = "progressContainer";

		var progressCancel = document.createElement("a");
		progressCancel.className = "progressCancel";
		progressCancel.href = "#";
		progressCancel.style.visibility = "hidden";
		progressCancel.appendChild(document.createTextNode(" "));

		var progressText = document.createElement("div");
		progressText.className = "progressName";
		progressText.appendChild(document.createTextNode(fileObj.name));

		var progressBar = document.createElement("div");
		progressBar.className = "progressBarInProgress";

		var progressStatus = document.createElement("div");
		progressStatus.className = "progressBarStatus";
		progressStatus.innerHTML = "&nbsp;";

		this.fileProgressElement.appendChild(progressCancel);
		this.fileProgressElement.appendChild(progressText);
		this.fileProgressElement.appendChild(progressStatus);
		this.fileProgressElement.appendChild(progressBar);

		this.fileProgressWrapper.appendChild(this.fileProgressElement);

		document.getElementById(target_id).appendChild(this.fileProgressWrapper);
	} else {
		this.fileProgressElement = this.fileProgressWrapper.firstChild;
	}

	this.height = this.fileProgressWrapper.offsetHeight;

}
FileProgress.prototype.SetProgress = function(percentage) {
	this.fileProgressElement.className = "progressContainer green";
	this.fileProgressElement.childNodes[3].className = "progressBarInProgress";
	this.fileProgressElement.childNodes[3].style.width = percentage + "%";
};
FileProgress.prototype.SetComplete = function() {
	this.fileProgressElement.className = "progressContainer blue";
	this.fileProgressElement.childNodes[3].className = "progressBarComplete";
	this.fileProgressElement.childNodes[3].style.width = "";

	var oSelf = this;
	setTimeout(function() { oSelf.Disappear(); }, 10000);
};
FileProgress.prototype.SetError = function() {
	this.fileProgressElement.className = "progressContainer red";
	this.fileProgressElement.childNodes[3].className = "progressBarError";
	this.fileProgressElement.childNodes[3].style.width = "";

	var oSelf = this;
	setTimeout(function() { oSelf.Disappear(); }, 5000);
};
FileProgress.prototype.SetCancelled = function() {
	this.fileProgressElement.className = "progressContainer";
	this.fileProgressElement.childNodes[3].className = "progressBarError";
	this.fileProgressElement.childNodes[3].style.width = "";

	var oSelf = this;
	setTimeout(function() { oSelf.Disappear(); }, 2000);
};
FileProgress.prototype.SetStatus = function(status) {
	this.fileProgressElement.childNodes[2].innerHTML = status;
};

FileProgress.prototype.ToggleCancel = function(show, upload_obj) {
	this.fileProgressElement.childNodes[0].style.visibility = show ? "visible" : "hidden";
	if (upload_obj) {
		var file_id = this.file_progress_id;
		this.fileProgressElement.childNodes[0].onclick = function() { upload_obj.cancelUpload(file_id); return false; };
	}
};

FileProgress.prototype.Disappear = function() {

	var reduce_opacity_by = 15;
	var reduce_height_by = 4;
	var rate = 30;	// 15 fps

	if (this.opacity > 0) {
		this.opacity -= reduce_opacity_by;
		if (this.opacity < 0) {
			this.opacity = 0;
		}

		if(typeof(this.fileProgressWrapper) != "undefined")
		{
			if (this.fileProgressWrapper.filters) {
				try {
					this.fileProgressWrapper.filters.item("DXImageTransform.Microsoft.Alpha").opacity = this.opacity;
				} catch (e) {
					// If it is not set initially, the browser will throw an error.  This will set it if it is not set yet.
					this.fileProgressWrapper.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + this.opacity + ")";
				}
			} else {
				this.fileProgressWrapper.style.opacity = this.opacity / 100;
			}
		}
	}

	if (this.height > 0) {
		this.height -= reduce_height_by;
		if (this.height < 0) {
			this.height = 0;
		}

		if(typeof(this.fileProgressWrapper) != "undefined") this.fileProgressWrapper.style.height = this.height + "px";
	}

	if (this.height > 0 || this.opacity > 0) {
		var oSelf = this;
		setTimeout(function() { oSelf.Disappear(); }, rate);
	} else {
		if(typeof(this.fileProgressWrapper) != "undefined") this.fileProgressWrapper.style.display = "none";
	}
};

function cancelQueue(instance) {
	document.getElementById(instance.customSettings.cancelButtonId).disabled = true;
	instance.stopUpload();
	var stats;
	
	do {
		stats = instance.getStats();
		instance.cancelUpload();
	} while (stats.files_queued !== 0);
	
}
/*
 *
 * ContentLoaded.js
 *
 * Author: Diego Perini (diego.perini at gmail.com)
 * Summary: Cross-browser wrapper for DOMContentLoaded
 * Updated: 17/05/2008
 * License: MIT
 * Version: 1.1
 *
 * URL:
 * http://javascript.nwbox.com/ContentLoaded/
 * http://javascript.nwbox.com/ContentLoaded/MIT-LICENSE
 *
 * Notes:
 * based on code by Dean Edwards and John Resig
 * http://dean.edwards.name/weblog/2006/06/again/
 *
 */

// @w	window reference
// @f	function reference
function ContentLoaded(w, f) {

	var	d = w.document,
		D = 'DOMContentLoaded',
		// user agent, version
		u = w.navigator.userAgent.toLowerCase(),
		v = parseFloat(u.match(/.+(?:rv|it|ml|ra|ie)[\/: ]([\d.]+)/)[1]);

	function init(e) {
		if (!document.loaded) {
			document.loaded = true;
			// pass a fake event if needed
			f((e.type && e.type == D) ? e : {
				type: D,
				target: d,
				eventPhase: 0,
				currentTarget: d,
				timeStamp: +new Date,
				eventType: e.type || e
			});
		}
	}

	// safari < 525.13
	if (/webkit\//.test(u) && v < 525.13) {

		(function () {
			if (/complete|loaded/.test(d.readyState)) {
				init('khtml-poll');
			} else {
				setTimeout(arguments.callee, 10);
			}
		})();

	// internet explorer all versions
	} else if (/msie/.test(u) && !w.opera) {

		d.attachEvent('onreadystatechange',
			function (e) {
				if (d.readyState == 'complete') {
					d.detachEvent('on'+e.type, arguments.callee);
					init(e);
				}
			}
		);
		if (w == top) {
			(function () {
				try {
					d.documentElement.doScroll('left');
				} catch (e) {
					setTimeout(arguments.callee, 10);
					return;
				}
				init('msie-poll');
			})();
		}

	// browsers having native DOMContentLoaded
	} else if (d.addEventListener &&
		(/opera\//.test(u) && v > 9) ||
		(/gecko\//.test(u) && v >= 1.8) ||
		(/khtml\//.test(u) && v >= 4.0) ||
		(/webkit\//.test(u) && v >= 525.13)) {

		d.addEventListener(D,
			function (e) {
				d.removeEventListener(D, arguments.callee, false);
				init(e);
			}, false
		);

	// fallback to last resort for older browsers
	} else {

		// from Simon Willison
		var oldonload = w.onload;
		w.onload = function (e) {
			init(e || w.event);
			if (typeof oldonload == 'function') {
				oldonload(e || w.event);
			}
		};

	}
}


////////////////////////////////////////////////////////////////

// COOKIE

if(!getCookie)
{
	var getCookie = function (c_name)
	{
		if (document.cookie.length > 0)
		{
			c_start = document.cookie.indexOf(c_name + "=");
			if (c_start!=-1)
			{ 
				c_start = c_start + c_name.length + 1; 
				c_end = document.cookie.indexOf(";",c_start);
				if (c_end == -1) c_end = document.cookie.length;
				return unescape(document.cookie.substring(c_start,c_end));
			} 
		}
		return "";
	}
}

if(!setCookie)
{
	var setCookie = function (c_name,value)
	{
		var jetzt=new Date()
		expiredays = 1000 * 60 * 60 * 24 * 365;
		exdate = new Date(jetzt.getTime() + expiredays);
		document.cookie = c_name + "=" + escape(value) + ";domain=" + window.location.host + ";expires=" + exdate.toGMTString() + ";path=/;";
	}
}

if(!checkCookie)
{
	var checkCookie = function()
	{
		setCookie("CookieTest", "OK");
		if(!getCookie("CookieTest")) 
		{
			alert("In Ihrem Browser ist das Akzeptieren von Cookies in den Sicherheitsoptionen abgeschaltet. Um die aufgerufene Seitenfunktion nutzen zu können, müssen Sie für die Seite http://www.medienhandbuch.de das Akzeptieren von Cookies freischalten/erlauben.");
			return false;
		}
		else return true;
	}
}

////////////////////////////////////////////////////////////////

// SITE SCALING

if(!scale_site) 
{
	var scale_site = function (direction) 
	{
		try
		{
			var scale_sizes_asc = new Array(50,66,75,85,100,110,120,130,140,150,200);
			var scale_sizes_desc = new Array();
			scale_sizes_desc = scale_sizes_desc.concat(scale_sizes_asc);
			scale_sizes_desc.reverse();
			var current_size = parseFloat(get_scale_site().replace(/[^0-9\.]/,''));
			current_size = Math.floor(current_size);
			
			switch(direction)
			{
				default:
				case('larger'):
					for(i=0;i<scale_sizes_desc.length;i++)
					{
						if(scale_sizes_desc[i] > current_size) var new_scale_size = scale_sizes_desc[i] + '.7%';
					}
				break;
				
				case('smaller'):
					for(i=0;i<scale_sizes_asc.length;i++)
					{
						if(scale_sizes_asc[i] < current_size) 
						{
							 var new_scale_size = scale_sizes_asc[i] + '.7%';
						}
					}
				break;
			}
			set_scale_site(new_scale_size);
		}
		catch(e) {}
	}
}

if(!get_scale_site) 
{
	var get_scale_site = function () 
	{
		if(global_current_size != null) var current_size = global_current_size;
		else
		{
			var current_size = getCookie('scale_size');
			if(current_size == '') current_size = '66.7%';
		}
		return(current_size);
	}
}

if(!set_scale_site) 
{
	var set_scale_site = function (new_scale_size) 
	{
		if(document.body) document.body.style.fontSize = new_scale_size;
		else document.write('<style type="text/css" media="screen,projection">body {font-size: ' + new_scale_size + ';}</style>');
		setCookie('scale_size',new_scale_size);
		global_current_size = new_scale_size;
	}
}

var global_current_size = null;
set_scale_site(get_scale_site());
/* Include Funtions */

if(!include_dom) 
{
	var include_dom = function (script_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var js = document.createElement('script');
    js.setAttribute('language', 'javascript');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', script_filename);
    html_doc.appendChild(js);
    return false;
	}
}

if(!include_dom_css)
{
	var include_dom_css = function (css_filename) {
    var html_doc = document.getElementsByTagName('head').item(0);
    var css = document.createElement('link');
	css.setAttribute('rel', 'stylesheet');
	css.setAttribute('type', 'text/css');
	css.setAttribute('href', css_filename);
   	/*
    var css = document.createElement('style');
	css.setAttribute('type', 'text/css');
    css.setAttribute('media', 'all');
    css.innerHTML = '@import "/cms.css";';
	*/
    html_doc.appendChild(css);
    return false;
	}
}

function getElementById(id_name)
{
	if(document.getElementById) var elem = document.getElementById(id_name);
	else if(document.all) var elem = document.all(id_name);
	else elem = undefined;
	return elem;
}

/* Body Onload */

function init()
{
	if(initialized == 0)
	{
		try
		{
			initialized = 1;
			if(sectionName != null) xajax_waypoint_init(basepath + '/js/');
			document.body.className = document.body.className.replace(/hidden/,'');
			if(document.getElementById('WallpaperCatcher')) document.getElementById('WallpaperCatcher').style.height = document.getElementsByTagName('body')[0].scrollHeight + 'px';
			initDojoParseWait();
		}
		catch(e) {}
	}
}

function init_all()
{
	init_track();
	init_start();
}

function init_start()
{
	onload_finished = 1;
	init();
}

function init_track()
{
	if(tracked == 0)
	{
		tracked = 1;
		window.setTimeout('track()',500);
	}
}

function init_waypoint()
{
	if(sectionName != null) 
	{
		// When user first hits static base page  
		if(window.location.href.search(/#/) == -1) 
		{
				switch(sectionName)
				{
					default:
						break;
					
					case "company":
						//company_search();
						break;

					case "educationaloffer":
						//educationaloffer_search();
						break;

					case "joboffer":
						//joboffer_search();
						break;

					case "jobrequest":
						//jobrequest_search();
						break;

					case "jobportrait":
						//jobportrait_search();
						break;
				}
		}
		// When user retrieves a bookmark
		else
		{
			var ausdruck = new RegExp("#" + sectionName + ".+$");
			var daten = new Array();
			if(ergebnis = window.location.href.match(ausdruck)) waypoint_name = ergebnis[0];
			else waypoint_name = "";
			//alert(ergebnis[0]);
			xajax_waypoint_handler(waypoint_name,daten);
		}
	}
}

function initDojoWait()
{
	if(typeof(dojo) == "undefined") window.setTimeout('initDojoWait()',100);
	else initDojoContinue();
}

function initDojoContinue()
{
	/* Dojo */
	
	//dojo.require("dojo.parser");
	//dojo.require("dijit.Dialog");
	initDojoParseWait();
}

function initDojoParseWait()
{
	if(typeof(dojo) == "undefined" || typeof(dojo.parser) == "undefined") window.setTimeout('initDojoParseWait()',100);
	else initDojoParseContinue();
}

function initDojoParseContinue()
{
	if(dojo.byId("dialogParse")) dojo.parser.parse(dojo.byId("dialogParse"));
	if(dojo.byId("dojoParse")) dojo.parser.parse(dojo.byId("dojoParse"));
	if(dojo.byId("dojoTooltips")) dojo.parser.parse(dojo.byId("dojoTooltips"));
	if(dojo.byId("dojoLightbox")) dojo.parser.parse(dojo.byId("dojoLightbox"));
	if(dojo.byId("dojoContent")) dojo.parser.parse(dojo.byId("dojoContent"));
	
	// Execute all queued onload-commands
	for(i=0;i<initCommands.length;i++)
	{
		//alert(initCommands[i]);
		eval(initCommands[i]);
	}
	
	// Other onload-commands
	if(dojo.byId('contenttext')) green_createnews_tinyMCELoad();
	if(window.name == "Detail") self.focus();
	init_finished = 1;
	endtime = new Date();
	//xajax_rendertime(starttime);
	
	// Google Search
	//GSearch.setOnLoadCallback(OnLoad);
	//OnLoad();
}

function initUFOWait(UFOobject, UFOcontainer)
{
	if(typeof(UFO) == "undefined") window.setTimeout('initUFOWait(FO,"' + UFOcontainer + '")',100);
	else initUFOContinue(UFOobject, UFOcontainer);
}

function initUFOContinue(UFOobject, UFOcontainer)
{
	window.setTimeout('init();',1000);
	UFO.create(UFOobject,UFOcontainer);
}

/* Includes */

include_dom_css(basepath + '/css/hidden.css?timestamp=3');

/*
include_dom(basepath + '/js/news.js');
include_dom(basepath + '/js/lightbox.js');
include_dom(basepath + '/js/item.js');
include_dom(basepath + '/js/company.js');
include_dom(basepath + '/js/educationaloffer.js');
include_dom(basepath + '/js/joboffer.js');
include_dom(basepath + '/js/jobrequest.js');
include_dom(basepath + '/js/meinmedienhandbuch.js');
include_dom(basepath + '/js/tiny_mce/tiny_mce.js'); //
include_dom(basepath + '/js/tinymcehelper.js');
include_dom(basepath + '/js/tinymce.js'); //
include_dom(basepath + '/js/dojohelper.js');
include_dom(basepath + '/js/crc.js');
include_dom(basepath + '/js/gup.js');
include_dom(basepath + '/js/recommend.js');
include_dom(basepath + '/js/track.js');
include_dom(basepath + '/js/green.js');
include_dom(basepath + '/swf/flvplayer/ufo.js');
*/

/* Google Maps */
	
if(typeof(GLatLng) != "undefined") var mhb = new GLatLng(53.589409, 9.985182);
var currentmap = null;
var geocoder = null;

/* IVW */
var previousaddress = '';

/* Global Variables */

var initCommands = new Array();

var searchTerm = '';
var searchTimer = null;
var searchWaitTime = 1000;

var currentOffset = 0;
var lightboxOffset = 0;

var sectionName = null;
var address = null;

var dojoTimeStamp = '';
var dojoSubscriptions = new Object();
var dojoWidgetsArray = new Object();
var dojoWidgetTypesArray = new Object();
var activeEditors = new Array();

var itemResizeCurrent = null;
var itemResizeTimer = null;
var itemResizeArray = new Object();

var moveLightboxTimer = null;

var swfu = new Object();
var var_upload_script = '';
var var_allowed_filesize = 8096;
var var_allowed_filetypes = '';
var var_description = '';
var var_browse_link_innerhtml = '';
var var_uploadFileComplete_action = '';

var overview_view_id = new Object();
var view_id = 0;
var contentad_view_id = 0;

/* Check Flash Player Version */

// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 28;

/* Init Dojo */

//initDojoWait();

var initialized = 0;
var init_finished = 0;
var onload_finished = 0;
var tracked = 0;

var jsIdsArray = new Array();

document.write('<style type="text/css">noscript,div.noscript,span.noscript {display: none !important;}</style>');

/* Alternative Onload-Event fired as ContentLoaded */

//ContentLoaded(window,function () {init();});


(function(i) 
{
 	var u =navigator.userAgent;
	var e=/*@cc_on!@*/false; 
	var st = setTimeout;
	if(/webkit/i.test(u))
	{
		st(function()
		{
			var dr=document.readyState;
			if(dr=="loaded"||dr=="complete")
			{
				i()
			}
			else
			{
				st(arguments.callee,10);
			}
		},10);
	}
	else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u)))
	{
		document.addEventListener("DOMContentLoaded",i,false); 
	} 
	else if(e)
	{     
		(function()
		{
			var t=document.createElement('doc:rdy');
			try
			{
				t.doScroll('left');
				i();
				t=null;
			}
			catch(e)
			{
				st(arguments.callee,0);
			}
		})();
	}
	else
	{
		window.onload=i;
	}
})(init);

	
var xajaxRequestUri="/indexserver.php";
var xajaxDebug=false;
var xajaxStatusMessages=false;
var xajaxWaitCursor=true;
var xajaxDefinedGet=0;
var xajaxDefinedPost=1;
var xajaxLoaded=false;
function xajax_waypoint_handler(){return xajax.call("waypoint_handler", arguments, 1);}
function xajax_waypoint_init(){return xajax.call("waypoint_init", arguments, 1);}
function xajax_waypoint_set(){return xajax.call("waypoint_set", arguments, 1);}
function xajax_showlogin(){return xajax.call("showlogin", arguments, 1);}
function xajax_refreshlightbox(){return xajax.call("refreshlightbox", arguments, 1);}
function xajax_addlightbox(){return xajax.call("addlightbox", arguments, 1);}
function xajax_removelightbox(){return xajax.call("removelightbox", arguments, 1);}
function xajax_lightbox_offset(){return xajax.call("lightbox_offset", arguments, 1);}
function xajax_lightbox_filter(){return xajax.call("lightbox_filter", arguments, 1);}
function xajax_lightbox_position(){return xajax.call("lightbox_position", arguments, 1);}
function xajax_lightbox_clear(){return xajax.call("lightbox_clear", arguments, 1);}
function xajax_lightbox_load(){return xajax.call("lightbox_load", arguments, 1);}
function xajax_lightbox_save(){return xajax.call("lightbox_save", arguments, 1);}
function xajax_lightbox_delete(){return xajax.call("lightbox_delete", arguments, 1);}
function xajax_recommend(){return xajax.call("recommend", arguments, 1);}
function xajax_addcart(){return xajax.call("addcart", arguments, 1);}
function xajax_changecart(){return xajax.call("changecart", arguments, 1);}
function xajax_removecart(){return xajax.call("removecart", arguments, 1);}
function xajax_cart_offset(){return xajax.call("cart_offset", arguments, 1);}
function xajax_shopbestellung(){return xajax.call("shopbestellung", arguments, 1);}
function xajax_meinmedienhandbuch_loginhead(){return xajax.call("meinmedienhandbuch_loginhead", arguments, 1);}
function xajax_meinmedienhandbuch_login(){return xajax.call("meinmedienhandbuch_login", arguments, 1);}
function xajax_meinmedienhandbuch_final_logout(){return xajax.call("meinmedienhandbuch_final_logout", arguments, 1);}
function xajax_meinmedienhandbuch_forgotpassword(){return xajax.call("meinmedienhandbuch_forgotpassword", arguments, 1);}
function xajax_meinmedienhandbuch_register(){return xajax.call("meinmedienhandbuch_register", arguments, 1);}
function xajax_meinmedienhandbuch_confirm(){return xajax.call("meinmedienhandbuch_confirm", arguments, 1);}
function xajax_meinmedienhandbuch_profile(){return xajax.call("meinmedienhandbuch_profile", arguments, 1);}
function xajax_meinmedienhandbuch_loginprofile(){return xajax.call("meinmedienhandbuch_loginprofile", arguments, 1);}
function xajax_meinmedienhandbuch_newsletter(){return xajax.call("meinmedienhandbuch_newsletter", arguments, 1);}
function xajax_meinmedienhandbuch_company_to_profile(){return xajax.call("meinmedienhandbuch_company_to_profile", arguments, 1);}
function xajax_meinmedienhandbuch_stats(){return xajax.call("meinmedienhandbuch_stats", arguments, 1);}
function xajax_meinmedienhandbuch_contentad_stats(){return xajax.call("meinmedienhandbuch_contentad_stats", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyentry(){return xajax.call("meinmedienhandbuch_createcompanyentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadcompanyentry(){return xajax.call("meinmedienhandbuch_loadcompanyentry", arguments, 1);}
function xajax_meinmedienhandbuch_upgradecompanyentry(){return xajax.call("meinmedienhandbuch_upgradecompanyentry", arguments, 1);}
function xajax_meinmedienhandbuch_togglecompanyentry(){return xajax.call("meinmedienhandbuch_togglecompanyentry", arguments, 1);}
function xajax_meinmedienhandbuch_deletecompanyentry(){return xajax.call("meinmedienhandbuch_deletecompanyentry", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanylogoupload(){return xajax.call("meinmedienhandbuch_createcompanylogoupload", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanylogodelete(){return xajax.call("meinmedienhandbuch_createcompanylogodelete", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanycontacts(){return xajax.call("meinmedienhandbuch_createcompanycontacts", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyaddcontact(){return xajax.call("meinmedienhandbuch_createcompanyaddcontact", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanydeletecontact(){return xajax.call("meinmedienhandbuch_createcompanydeletecontact", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanydeletecontactimage(){return xajax.call("meinmedienhandbuch_createcompanydeletecontactimage", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanysavecontact(){return xajax.call("meinmedienhandbuch_createcompanysavecontact", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanypdfupload(){return xajax.call("meinmedienhandbuch_createcompanypdfupload", arguments, 1);}
function xajax_meinmedienhandbuch_showcompanypdf(){return xajax.call("meinmedienhandbuch_showcompanypdf", arguments, 1);}
function xajax_meinmedienhandbuch_renamecompanypdf(){return xajax.call("meinmedienhandbuch_renamecompanypdf", arguments, 1);}
function xajax_meinmedienhandbuch_deletecompanypdf(){return xajax.call("meinmedienhandbuch_deletecompanypdf", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyimageupload(){return xajax.call("meinmedienhandbuch_createcompanyimageupload", arguments, 1);}
function xajax_meinmedienhandbuch_showcompanyimage(){return xajax.call("meinmedienhandbuch_showcompanyimage", arguments, 1);}
function xajax_meinmedienhandbuch_renamecompanyimage(){return xajax.call("meinmedienhandbuch_renamecompanyimage", arguments, 1);}
function xajax_meinmedienhandbuch_deletecompanyimage(){return xajax.call("meinmedienhandbuch_deletecompanyimage", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyvideoupload(){return xajax.call("meinmedienhandbuch_createcompanyvideoupload", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyvideoconvert(){return xajax.call("meinmedienhandbuch_createcompanyvideoconvert", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyvideodelete(){return xajax.call("meinmedienhandbuch_createcompanyvideodelete", arguments, 1);}
function xajax_meinmedienhandbuch_createcompanyaudioupload(){return xajax.call("meinmedienhandbuch_createcompanyaudioupload", arguments, 1);}
function xajax_meinmedienhandbuch_showcompanyaudio(){return xajax.call("meinmedienhandbuch_showcompanyaudio", arguments, 1);}
function xajax_meinmedienhandbuch_renamecompanyaudio(){return xajax.call("meinmedienhandbuch_renamecompanyaudio", arguments, 1);}
function xajax_meinmedienhandbuch_deletecompanyaudio(){return xajax.call("meinmedienhandbuch_deletecompanyaudio", arguments, 1);}
function xajax_meinmedienhandbuch_createeducationalofferentry(){return xajax.call("meinmedienhandbuch_createeducationalofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadeducationalofferentry(){return xajax.call("meinmedienhandbuch_loadeducationalofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_toggleeducationalofferentry(){return xajax.call("meinmedienhandbuch_toggleeducationalofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_deleteeducationalofferentry(){return xajax.call("meinmedienhandbuch_deleteeducationalofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_educationalofferstats(){return xajax.call("meinmedienhandbuch_educationalofferstats", arguments, 1);}
function xajax_meinmedienhandbuch_createjobofferentry(){return xajax.call("meinmedienhandbuch_createjobofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadjobofferentry(){return xajax.call("meinmedienhandbuch_loadjobofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_togglejobofferentry(){return xajax.call("meinmedienhandbuch_togglejobofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_deletejobofferentry(){return xajax.call("meinmedienhandbuch_deletejobofferentry", arguments, 1);}
function xajax_meinmedienhandbuch_createjobofferlogoupload(){return xajax.call("meinmedienhandbuch_createjobofferlogoupload", arguments, 1);}
function xajax_meinmedienhandbuch_createjobofferimageupload(){return xajax.call("meinmedienhandbuch_createjobofferimageupload", arguments, 1);}
function xajax_meinmedienhandbuch_createjobrequestentry(){return xajax.call("meinmedienhandbuch_createjobrequestentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadjobrequestentry(){return xajax.call("meinmedienhandbuch_loadjobrequestentry", arguments, 1);}
function xajax_meinmedienhandbuch_togglejobrequestentry(){return xajax.call("meinmedienhandbuch_togglejobrequestentry", arguments, 1);}
function xajax_meinmedienhandbuch_deletejobrequestentry(){return xajax.call("meinmedienhandbuch_deletejobrequestentry", arguments, 1);}
function xajax_meinmedienhandbuch_createcontentadentry(){return xajax.call("meinmedienhandbuch_createcontentadentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadcontentadentry(){return xajax.call("meinmedienhandbuch_loadcontentadentry", arguments, 1);}
function xajax_meinmedienhandbuch_togglecontentadentry(){return xajax.call("meinmedienhandbuch_togglecontentadentry", arguments, 1);}
function xajax_meinmedienhandbuch_deletecontentadentry(){return xajax.call("meinmedienhandbuch_deletecontentadentry", arguments, 1);}
function xajax_meinmedienhandbuch_previewcontentadentry(){return xajax.call("meinmedienhandbuch_previewcontentadentry", arguments, 1);}
function xajax_meinmedienhandbuch_createnewsletteradentry(){return xajax.call("meinmedienhandbuch_createnewsletteradentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadnewsletteradentry(){return xajax.call("meinmedienhandbuch_loadnewsletteradentry", arguments, 1);}
function xajax_meinmedienhandbuch_deletenewsletteradentry(){return xajax.call("meinmedienhandbuch_deletenewsletteradentry", arguments, 1);}
function xajax_meinmedienhandbuch_previewnewsletteradentry(){return xajax.call("meinmedienhandbuch_previewnewsletteradentry", arguments, 1);}
function xajax_meinmedienhandbuch_createshopproductentry(){return xajax.call("meinmedienhandbuch_createshopproductentry", arguments, 1);}
function xajax_meinmedienhandbuch_loadshopproductentry(){return xajax.call("meinmedienhandbuch_loadshopproductentry", arguments, 1);}
function xajax_meinmedienhandbuch_deleteshopproductentry(){return xajax.call("meinmedienhandbuch_deleteshopproductentry", arguments, 1);}
function xajax_meinmedienhandbuch_createshopproductimageupload(){return xajax.call("meinmedienhandbuch_createshopproductimageupload", arguments, 1);}
function xajax_meinmedienhandbuch_createshopproductimagedelete(){return xajax.call("meinmedienhandbuch_createshopproductimagedelete", arguments, 1);}
function xajax_item_popup(){return xajax.call("item_popup", arguments, 1);}
function xajax_company_searchresults_history(){return xajax.call("company_searchresults_history", arguments, 1);}
function xajax_company_searchresults(){return xajax.call("company_searchresults", arguments, 1);}
function xajax_company_view(){return xajax.call("company_view", arguments, 1);}
function xajax_company_click(){return xajax.call("company_click", arguments, 1);}
function xajax_company_overview_view(){return xajax.call("company_overview_view", arguments, 1);}
function xajax_company_multipleoverview_view(){return xajax.call("company_multipleoverview_view", arguments, 1);}
function xajax_company_overview_detailclick(){return xajax.call("company_overview_detailclick", arguments, 1);}
function xajax_company_overview_click(){return xajax.call("company_overview_click", arguments, 1);}
function xajax_educationaloffer_searchresults_history(){return xajax.call("educationaloffer_searchresults_history", arguments, 1);}
function xajax_educationaloffer_searchresults(){return xajax.call("educationaloffer_searchresults", arguments, 1);}
function xajax_educationaloffer_view(){return xajax.call("educationaloffer_view", arguments, 1);}
function xajax_educationaloffer_click(){return xajax.call("educationaloffer_click", arguments, 1);}
function xajax_educationaloffer_overview_view(){return xajax.call("educationaloffer_overview_view", arguments, 1);}
function xajax_educationaloffer_multipleoverview_view(){return xajax.call("educationaloffer_multipleoverview_view", arguments, 1);}
function xajax_educationaloffer_overview_detailclick(){return xajax.call("educationaloffer_overview_detailclick", arguments, 1);}
function xajax_educationaloffer_overview_click(){return xajax.call("educationaloffer_overview_click", arguments, 1);}
function xajax_joboffer_searchresults_history(){return xajax.call("joboffer_searchresults_history", arguments, 1);}
function xajax_joboffer_searchresults(){return xajax.call("joboffer_searchresults", arguments, 1);}
function xajax_joboffer_view(){return xajax.call("joboffer_view", arguments, 1);}
function xajax_joboffer_click(){return xajax.call("joboffer_click", arguments, 1);}
function xajax_joboffer_overview_view(){return xajax.call("joboffer_overview_view", arguments, 1);}
function xajax_joboffer_multipleoverview_view(){return xajax.call("joboffer_multipleoverview_view", arguments, 1);}
function xajax_joboffer_overview_detailclick(){return xajax.call("joboffer_overview_detailclick", arguments, 1);}
function xajax_joboffer_overview_click(){return xajax.call("joboffer_overview_click", arguments, 1);}
function xajax_joboffer_contact(){return xajax.call("joboffer_contact", arguments, 1);}
function xajax_joboffer_showjobofferdocuments(){return xajax.call("joboffer_showjobofferdocuments", arguments, 1);}
function xajax_joboffer_deletejobofferdocument(){return xajax.call("joboffer_deletejobofferdocument", arguments, 1);}
function xajax_jobrequest_searchresults_history(){return xajax.call("jobrequest_searchresults_history", arguments, 1);}
function xajax_jobrequest_searchresults(){return xajax.call("jobrequest_searchresults", arguments, 1);}
function xajax_jobrequest_view(){return xajax.call("jobrequest_view", arguments, 1);}
function xajax_jobrequest_click(){return xajax.call("jobrequest_click", arguments, 1);}
function xajax_jobrequest_overview_view(){return xajax.call("jobrequest_overview_view", arguments, 1);}
function xajax_jobrequest_multipleoverview_view(){return xajax.call("jobrequest_multipleoverview_view", arguments, 1);}
function xajax_jobrequest_overview_detailclick(){return xajax.call("jobrequest_overview_detailclick", arguments, 1);}
function xajax_jobrequest_overview_click(){return xajax.call("jobrequest_overview_click", arguments, 1);}
function xajax_jobportrait_searchresults_history(){return xajax.call("jobportrait_searchresults_history", arguments, 1);}
function xajax_jobportrait_searchresults(){return xajax.call("jobportrait_searchresults", arguments, 1);}
function xajax_jobportrait_view(){return xajax.call("jobportrait_view", arguments, 1);}
function xajax_jobportrait_click(){return xajax.call("jobportrait_click", arguments, 1);}
function xajax_jobportrait_overview_view(){return xajax.call("jobportrait_overview_view", arguments, 1);}
function xajax_jobportrait_multipleoverview_view(){return xajax.call("jobportrait_multipleoverview_view", arguments, 1);}
function xajax_jobportrait_overview_detailclick(){return xajax.call("jobportrait_overview_detailclick", arguments, 1);}
function xajax_jobportrait_overview_click(){return xajax.call("jobportrait_overview_click", arguments, 1);}
function xajax_contentad_click(){return xajax.call("contentad_click", arguments, 1);}
function xajax_news_login(){return xajax.call("news_login", arguments, 1);}
function xajax_news_comment(){return xajax.call("news_comment", arguments, 1);}
function xajax_green_shownewscenter(){return xajax.call("green_shownewscenter", arguments, 1);}
function xajax_green_savecreatenews(){return xajax.call("green_savecreatenews", arguments, 1);}
function xajax_green_newsdelete(){return xajax.call("green_newsdelete", arguments, 1);}
function xajax_green_newssort(){return xajax.call("green_newssort", arguments, 1);}
function xajax_green_newssortsectionpage(){return xajax.call("green_newssortsectionpage", arguments, 1);}
function xajax_green_newssortitemupdate_sectionpage(){return xajax.call("green_newssortitemupdate_sectionpage", arguments, 1);}
function xajax_green_newstoggleactivate(){return xajax.call("green_newstoggleactivate", arguments, 1);}
function xajax_green_newsstats(){return xajax.call("green_newsstats", arguments, 1);}
function xajax_green_newsdeletecomment(){return xajax.call("green_newsdeletecomment", arguments, 1);}
function xajax_green_shownewscomments(){return xajax.call("green_shownewscomments", arguments, 1);}
function xajax_green_newscommenttoggleactivate(){return xajax.call("green_newscommenttoggleactivate", arguments, 1);}
function xajax_green_showimportnews(){return xajax.call("green_showimportnews", arguments, 1);}
function xajax_green_importnews(){return xajax.call("green_importnews", arguments, 1);}
function xajax_green_showlibrary(){return xajax.call("green_showlibrary", arguments, 1);}
function xajax_green_libraryupload(){return xajax.call("green_libraryupload", arguments, 1);}
function xajax_green_deletelibrary(){return xajax.call("green_deletelibrary", arguments, 1);}
function xajax_green_renamealtlibrary(){return xajax.call("green_renamealtlibrary", arguments, 1);}
function xajax_green_renametagslibrary(){return xajax.call("green_renametagslibrary", arguments, 1);}
function xajax_green_showwallpapers(){return xajax.call("green_showwallpapers", arguments, 1);}
function xajax_green_addwallpaper(){return xajax.call("green_addwallpaper", arguments, 1);}
function xajax_green_deletewallpaper(){return xajax.call("green_deletewallpaper", arguments, 1);}
function xajax_green_renamewallpaper(){return xajax.call("green_renamewallpaper", arguments, 1);}
function xajax_green_togglewallpaper(){return xajax.call("green_togglewallpaper", arguments, 1);}
function xajax_green_showaccounts(){return xajax.call("green_showaccounts", arguments, 1);}
function xajax_green_showaccountsduplicates(){return xajax.call("green_showaccountsduplicates", arguments, 1);}
function xajax_green_showeducationalofferaccount(){return xajax.call("green_showeducationalofferaccount", arguments, 1);}
function xajax_green_deleteaccount(){return xajax.call("green_deleteaccount", arguments, 1);}
function xajax_green_showinvoices(){return xajax.call("green_showinvoices", arguments, 1);}
function xajax_green_showusers(){return xajax.call("green_showusers", arguments, 1);}
function xajax_green_showusersspam(){return xajax.call("green_showusersspam", arguments, 1);}
function xajax_green_showusersduplicate(){return xajax.call("green_showusersduplicate", arguments, 1);}
function xajax_green_toggleuserverlag(){return xajax.call("green_toggleuserverlag", arguments, 1);}
function xajax_green_toggleusernewsletter(){return xajax.call("green_toggleusernewsletter", arguments, 1);}
function xajax_green_showuser(){return xajax.call("green_showuser", arguments, 1);}
function xajax_green_taguser(){return xajax.call("green_taguser", arguments, 1);}
function xajax_green_edituser(){return xajax.call("green_edituser", arguments, 1);}
function xajax_green_saveuser(){return xajax.call("green_saveuser", arguments, 1);}
function xajax_green_deleteuser(){return xajax.call("green_deleteuser", arguments, 1);}
function xajax_green_toggleusergreen(){return xajax.call("green_toggleusergreen", arguments, 1);}
function xajax_green_shownewsletters(){return xajax.call("green_shownewsletters", arguments, 1);}
function xajax_green_editnewsletter(){return xajax.call("green_editnewsletter", arguments, 1);}
function xajax_green_savenewsletter(){return xajax.call("green_savenewsletter", arguments, 1);}
function xajax_green_newsletteritemupdate(){return xajax.call("green_newsletteritemupdate", arguments, 1);}
function xajax_green_newsletterdelete(){return xajax.call("green_newsletterdelete", arguments, 1);}
function xajax_green_newslettersent(){return xajax.call("green_newslettersent", arguments, 1);}
function xajax_green_newsletterhtml(){return xajax.call("green_newsletterhtml", arguments, 1);}
function xajax_green_showshopcategories(){return xajax.call("green_showshopcategories", arguments, 1);}
function xajax_green_shopeditcategory(){return xajax.call("green_shopeditcategory", arguments, 1);}
function xajax_green_shoploadcategory(){return xajax.call("green_shoploadcategory", arguments, 1);}
function xajax_rendertime(){return xajax.call("rendertime", arguments, 1);}
function xajax_globalsearch(){return xajax.call("globalsearch", arguments, 1);}
	
	
	

	

 