//////////////////////////////////////////////////////////////////////////////////////////////////
// HTTPREQUESTOBJEKT - OBJEKT ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////

function ajaxObj()
{
	// var ajaxObj = this;
	
	if (/\b(function|object)\b/i.test(typeof XMLHttpRequest) && XMLHttpRequest)
	{
		// try..catch wird nicht universell unterstützt, ist aber hier
		// möglicherweise notwendig
		try
		{
			this.request = new XMLHttpRequest();
		}
		catch (e) {}
	}
	else if(/\b(function|object)\b/i.test(typeof ActiveXObject) && ActiveXObject)
	{
		// s.o.; try..catch ist hier notwendig
		try
		{
			this.request = new ActiveXObject("Microsoft.XMLHTTP");
		}
		catch (e) {}
	}
}
	
	ajaxObj.prototype = {
    constructor: ajaxObj,
    request: null,
	
	
	////////// PROFIL FUNCTIONS //////////
	
	loadUserData: function (userID,file,thisName)
	{	
		this.constructor();
		var req = this.request;
		var me = this;
		loadWait(thisName);
		req.open('POST', file, true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.handleResponseObj(req,thisName,'');			
		}	
		req.send('userID='+userID);
		
	},
		
	handleResponseObj: function(req,thisName,form)
	{
		if(req.readyState == 4)
		{
	    document.getElementById(thisName).innerHTML = req.responseText;
			if(form && form != "undefined" && form != "")
			{	
			    timer('toggleHeightNow',form,'100');
			    // toggleHeightNow(form);
			}			
		}
	}, 
	
	unloadAJAXForm: function(req,thisName,wrapperID)
	{	
	  req.onResponse = function()
		{
			if(document.getElementById(thisName))
			{
			  document.getElementById(thisName).innerHTML = "";
			  toggleHeightNow(wrapperID);					
			}			
		};		
		req.onResponse();
	},
	
	loadAJAXForm: function(thisName,file,form)
	{
		/* INITIALISIERE LEEREN DIV MIT 0px */
		
		this.constructor();
		var req = this.request;
		var me = this;
		
		var wrapperID = thisName.substring(5);
		
		if(document.getElementById(thisName).innerHTML != "")
		{
		  me.unloadAJAXForm(req,thisName,wrapperID);
    }
		else
    {	
  		loadWait(thisName);
  		req.open('POST', file, true);
  		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
  		req.onreadystatechange = function()
  		{				
  			me.handleResponseObj(req,thisName,form);															
  		}			
  		req.send('form='+form);
  	}
	}, 
	
	profileResponse: function(userID,divID,rubric)
	{	
	  var req = this.request;
		var me = this;
		if(req.readyState == 4)
		{	
			wrapperID = divID.substr("5");
			rubricLower = rubric.toLowerCase();
			me.loadUserData(userID,'inc/inc_load_profile_private_'+rubricLower+'.php','showProfile'+rubric);							
			me.unloadAJAXForm(req,divID,wrapperID);			
		}	
	},
	
	profileResponseInstitution: function(userID,divID,rubric)
	{
	  if(rubric == "Description")
	  {
	    var req = this.request;
  		var me = this;
  		if(req.readyState == 4)
  		{	
  			wrapperID = divID.substr("5");
  			rubricLower = rubric.toLowerCase();
  			// me.loadUserData(userID,'inc/inc_load_profile_institution_'+rubricLower+'.php','showProfile'+rubric);
  			me.unloadAJAXForm(req,divID,wrapperID);
        location.href = "profile.html";
  		}
    }
    else
    {
      var req = this.request;
  		var me = this;
  		if(req.readyState == 4)
  		{	
  			wrapperID = divID.substr("5");
  			rubricLower = rubric.toLowerCase();
  			me.loadUserData(userID,'inc/inc_load_profile_institution_'+rubricLower+'.php','showProfile'+rubric);							
  			me.unloadAJAXForm(req,divID,wrapperID);			
  		}	
    }		
	},
	
		
	saveProfileContact: function(userID,id_country,id_province,id_city,city,street,pcode,priv_phone,mob_phone,email,web,showAdress,showPrivPhone,showMobPhone,showEmail,showContacts,showBirthday,showWeb,thisName)
	{
		var req = this.request;
		var me = this;
		
		req.open('POST', 'inc/inc_form_profile_private_contact.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{		
			me.profileResponse(userID,thisName,'Contact');							
		}
		req.send('userID='+userID+'&id_country='+id_country+'&id_province='+id_province+'&id_city='+id_city+'&city='+city+'&street='+street+'&pcode='+pcode+'&priv_phone='+priv_phone+'&mob_phone='+mob_phone+'&email='+email+'&web='+web+'&showAdress='+showAdress+'&showPrivPhone='+showPrivPhone+'&showMobPhone='+showMobPhone+'&showEmail='+showEmail+'&showContacts='+showContacts+'&showBirthday='+showBirthday+'&showWeb='+showWeb+'&save=save');
	}, 
	
	
	saveProfileContactInstitution: function(userID,ID,id_country,id_province,id_city,city,inst_street,inst_pcode,inst_tel,inst_fax,email,inst_web,inst_name,inst_nameAdd,inst_pers_contact,inst_pers_head,thisName)
	{
		var req = this.request;
		var me = this;
		
		req.open('POST', 'inc/inc_form_profile_institution_contact.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{			
			me.profileResponseInstitution(userID,thisName,'Contact');							
		}
		req.send('userID='+userID+'&ID='+ID+'&id_country='+id_country+'&id_province='+id_province+'&id_city='+id_city+'&city='+city+'&inst_street='+inst_street+'&inst_pcode='+inst_pcode+'&inst_tel='+inst_tel+'&inst_fax='+inst_fax+'&email='+email+'&inst_web='+inst_web+'&inst_name='+inst_name+'&inst_nameAdd='+inst_nameAdd+'&inst_pers_contact='+inst_pers_contact+'&inst_pers_head='+inst_pers_head+'&save=save');
	},
     
     
  saveProfileDescriptionInstitution: function(userID,ID,inst_selfdescription,thisName)
	{
		var req = this.request;
		var me = this;
		
		req.open('POST', 'inc/inc_form_profile_institution_description.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{			
		  me.profileResponseInstitution(userID,thisName,'Description');						
		}
		req.send('userID='+userID+'&ID='+ID+'&inst_selfdescription='+inst_selfdescription+'&save=save');		
	},  	
	
	
	saveProfileInterests: function(userID,bus_interests,skills,lang,priv_occupation,priv_interests,showBusInterests,showSkills,showLang,showOccupation,showPrivInterests,thisName)
	{
		var req = this.request;
		var me = this;
		req.open('POST', 'inc/inc_form_profile_private_interests.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{			
			me.profileResponse(userID,thisName,'Interests');
		}
		req.send('userID='+userID+'&bus_interests='+bus_interests+'&skills='+skills+'&lang='+lang+'&priv_occupation='+priv_occupation+'&priv_interests='+priv_interests+'&showBusInterests='+showBusInterests+'&showSkills='+showSkills+'&showLang='+showLang+'&showPrivInterests='+showPrivInterests+'&showOccupation='+showOccupation+'&save=save');
	}, 
	
	
	saveProfileOccupation: function(ID,userID,occu_name,dura_from_day,dura_from_month,dura_from_year,dura_to_day,dura_to_month,dura_to_year,institution,supervisor,description,thisName)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_form_profile_private_occupation.php', true);	
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.profileResponse(userID,thisName,'Occupation');	
		}		
		req.send('ID='+ID+'&userID='+userID+'&occu_name='+occu_name+'&dura_from_year='+dura_from_year+'&dura_from_month='+dura_from_month+'&dura_from_day='+dura_from_day+'&dura_to_year='+dura_to_year+'&dura_to_month='+dura_to_month+'&dura_to_day='+dura_to_day+'&institution='+institution+'&supervisor='+supervisor+'&description='+description+'&save=save');	
	},
	
	
	saveProfileWorks: function(ID,userID,work_name,dura_from_day,dura_from_month,dura_from_year,author,genre,characters,supervisor,description,status,thisName)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_form_profile_private_works.php', true);	
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.profileResponse(userID,thisName,'Works');			
		}
		req.send('ID='+ID+'&userID='+userID+'&work_name='+work_name+'&dura_from_year='+dura_from_year+'&dura_from_month='+dura_from_month+'&dura_from_day='+dura_from_day+'&author='+author+'&genre='+genre+'&characters='+characters+'&supervisor='+supervisor+'&description='+description+'&status='+status+'&save=save');
	},
	
	
	saveProfileEducation: function(ID,userID,specialization,dura_from_day,dura_from_month,dura_from_year,dura_to_day,dura_to_month,dura_to_year,institution,supervisor,certification,description,thisName)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_form_profile_private_education.php', true);	
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.profileResponse(userID,thisName,'Education');		
		}		
		req.send('ID='+ID+'&userID='+userID+'&specialization='+specialization+'&dura_from_year='+dura_from_year+'&dura_from_month='+dura_from_month+'&dura_from_day='+dura_from_day+'&dura_to_year='+dura_to_year+'&dura_to_month='+dura_to_month+'&dura_to_day='+dura_to_day+'&institution='+institution+'&supervisor='+supervisor+'&certification='+certification+'&description='+description+'&save=save');	
	},
	
	
	saveProfileInstMembers: function(ID,userID,member_ln,member_fn,occupation,description,thisName)
	{
		var req = this.request;
		var me = this;
		req.open('POST', 'inc/inc_form_profile_institution_members.php', true);	
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.profileResponseInstitution(userID,thisName,'Members');		
		}		
		req.send('ID='+ID+'&userID='+userID+'&member_ln='+member_ln+'&member_fn='+member_fn+'&occupation='+occupation+'&description='+description+'&save=save');	
	},
	
	////////// PROFIL FUNCTIONS //////////
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	////////// USER ACTION FUNCTIONS //////////
	
	sendMessage: function(from,to,subject,text,send,divID)
	{
		var req = this.request;
		var me = this;
		
		req.open('POST', 'inc/inc_useraction_message.php', true);		
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById(divID).style.display = 'block';	
			me.handleResponseUserAction(req,divID);		
		}		
		req.send('fromID='+from+'&toID='+to+'&subject='+subject+'&text='+text+'&send='+send+'&divID='+divID);	
	},
	
	
	sendRecommend: function(from,toEmail,toID,recommendURL,subject,text,send,divID)
	{
	  var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_recommend.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&toEmail='+toEmail+'&toID='+toID+'&recommendURL='+recommendURL+'&subject='+subject+'&text='+text+'&send='+send+'&divID='+divID);	
	},


    sendRecommendExtern: function(fromEmail,toEmail,recommendURL,subject,text,send,divID)
	{
		var req = this.request;
		var me = this;
		req.open('POST', 'inc/inc_useraction_recommend_extern.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';
			me.handleResponseUserAction(req,'userActionBox');
		}
		req.send('fromEmail='+fromEmail+'&toEmail='+toEmail+'&recommendURL='+recommendURL+'&subject='+subject+'&text='+text+'&send='+send+'&divID='+divID);
	},
	
	
	sendAsSpam: function(from,text,recommendURL,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_spam.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&text='+text+'&recommendURL='+recommendURL+'&send='+send+'&divID='+divID);	
	},
	
	
	deleteAccount: function(from,text,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_delete_account.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&text='+text+'&send='+send+'&divID='+divID);	
	},
	
	
	sendAddEventToProfileSpam: function(from,text,recommendURL,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_add_event_to_profile_spam.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&text='+text+'&recommendURL='+recommendURL+'&send='+send+'&divID='+divID);	
	},
	
	
	addEventToProfile: function(eventID,status,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addEventToProfile.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('eventID='+eventID+'&status='+status+'&send='+send+'&divID='+divID);	
	},
	
		
	getRadioBoxValue: function(formName,formField)
	{
		for (i=0;i<document.formName.formField.length;i++)
		{
			if (document.formName.formField[i].checked)
			{
				returnVal = document.formName.formField[i].value;
			}
		}
	
		return returnVal;	
	},
	
	
	sendContact: function(from,to,text,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_contact.php', true);		
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&toID='+to+'&text='+text+'&send='+send+'&divID='+divID);	
	},
	
	
	

    writeReviews: function(from,text,eventID,send,divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_reviews.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('fromID='+from+'&text='+text+'&eventID='+eventID+'&send='+send+'&divID='+divID);	
	},
	
	
	writeNews: function(divID)
	{
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_write_news.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('divID='+divID);	
	},


    clearUserActionBox: function(divID)
	{
		document.getElementById(divID).innerHTML = "";
		document.getElementById(divID).style.display = 'none';		
	},
	
	
	applyContact: function(from,to,apply,text,send,layerID)
	{
		var req = this.request;
		var me = this;
		
		if(document.getElementById(layerID).innerHTML != "" && send == "")
		{
			document.getElementById(layerID).innerHTML = "";
			document.getElementById(layerID).style.display = "none";
		}
		else
		{
			document.getElementById(layerID).style.display = "block";
			req.open('POST', 'inc/inc_useraction_applyContact.php', true);		
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
			req.onreadystatechange = function()
			{
				me.handleResponseUserAction(req,layerID);
				if(send == "1")
				{
					me.LoadPage(req,"contacts.html");
				}
			}		
			req.send('fromID='+from+'&toID='+to+'&apply='+apply+'&text='+text+'&send='+send+'&layerID='+layerID);	
		}
	},
	
	
	editContact: function(id_user,id_user_contact,showAdress,showPrivPhone,showMobPhone,showEmail,showWeb,showOccupation,showPrivInterests,showBusInterests,showSkills,showLang,send,layerID)
	{
		if(document.getElementById(layerID).innerHTML != "" && send == "")
		{
			document.getElementById(layerID).innerHTML = "";			
			document.getElementById(layerID).style.display = "none";
		}
		else
		{
			var req = this.request;
			var me = this;
		
			document.getElementById(layerID).style.display = "block";
			req.open('POST', 'inc/inc_useraction_editContact.php', true);		
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
			req.onreadystatechange = function()
			{
				me.handleResponseUserAction(req,layerID);			
			}		
			req.send('id_user='+id_user+'&id_user_contact='+id_user_contact+'&showAdress='+showAdress+'&showPrivPhone='+showPrivPhone+'&showMobPhone='+showMobPhone+'&showEmail='+showEmail+'&showWeb='+showWeb+'&showPrivInterests='+showPrivInterests+'&showOccupation='+showOccupation+'&showBusInterests='+showBusInterests+'&showSkills='+showSkills+'&showLang='+showLang+'&send='+send+'&layerID='+layerID);			
		}		
	},
	
	
	handleResponseUserAction: function(req,thisName)
	{
		if(req.readyState == 4)
		{
			document.getElementById(thisName).innerHTML = req.responseText;			
		}
	},	
	
	LoadPage: function(req,page)
	{
		if(req.readyState == 4)
		{
			location.href = page;
		}
	},
	
	////////// USER ACTION FUNCTIONS //////////
	
	
	
	
	
	
	
	
	
	
	
	////////// SEARCH FUNCTIONS //////////
	
	
	clearSession: function(sessionName)
	{
	  this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_clear_session.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
														
		}			
		req.send('&sessionName='+sessionName);
  },
	
	eventCalendar: function(startLimit,eventDate,eventInst,eventPerson,eventName,eventCity,countryID,provinceID,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_eventcalendar.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('&startLimit='+startLimit+'&eventDate='+eventDate+'&eventInst='+eventInst+'&eventPerson='+eventPerson+'&eventName='+eventName+'&eventCity='+eventCity+'&countryID='+countryID+'&provinceID='+provinceID+'&thisName='+thisName);
    	
	},
	
	
	mediathek: function(startLimit,media,title,city,inst,countryID,provinceID,thisName)
	{
		loadWait(thisName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_mediathek.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('&startLimit='+startLimit+'&media='+media+'&title='+title+'&&inst='+inst+'&city='+city+'&countryID='+countryID+'&provinceID='+provinceID+'&thisName='+thisName);
    	
	},
	
	
	startSearch: function(searchString,startLimit,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearchAll(req,thisName,searchString,startLimit);											
		}			
		req.send('searchString='+searchString+'&startLimit='+startLimit+'&divID='+thisName);		
	},
	
	startDetailSearchPerson: function(session,name,eventClas,jobClas,inst,startLimit,thisName)
	{
	  loadWait(thisName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_person_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('session='+session+'&name='+name+'&eventClas='+eventClas+'&jobClas='+jobClas+'&inst='+inst+'&startLimit='+startLimit+'&divID='+thisName);		
	},
	
	
	startDetailSearchInst: function(session,name,city,country,clas,free,startLimit,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_inst_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('session='+session+'&name='+name+'&city='+city+'&country='+country+'&clas='+clas+'&free='+free+'&startLimit='+startLimit+'&divID='+thisName);		
	},	
	
	
	startDetailSearchEvent: function(title,month,year,institution,person,joborpartic,joborpartictext,city,country,free,startLimit,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_event_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('title='+title+'&month='+month+'&year='+year+'&institution='+institution+'&person='+person+'&joborpartic='+joborpartic+'&joborpartictext='+joborpartictext+'&city='+city+'&country='+country+'&free='+free+'&startLimit='+startLimit+'&divID='+thisName);		
	},
	
	
	startDetailsearchPlay: function(id_person_intern,title,title_original,free,id_classification,id_genre,ocassion,lang,id_dialect,id_play_status,duration,age,fem,mas,id_user,startLimit,thisName)
	{
		loadWait(thisName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_play_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('id_person_intern='+id_person_intern+'&title='+title+'&title_original='+title_original+'&free='+free+'&id_classification='+id_classification+'&id_genre='+id_genre+'&ocassion='+ocassion+'&lang='+lang+'&id_dialect='+id_dialect+'&id_play_status='+id_play_status+'&duration='+duration+'&age='+age+'&fem='+fem+'&mas='+mas+'&id_user='+id_user+'&startLimit='+startLimit+'&divID='+thisName);		
	},
     
     
    startDetailSearchEventDate: function(date,startLimit,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_event_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('date='+date+'&startLimit='+startLimit);		
	},
	
	
	startDetailSearchEventJob: function(jobID,startLimit,countryID,provinceID,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_event_job_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('ID='+jobID+'&startLimit='+startLimit+'&countryID='+countryID+'&provinceID='+provinceID);	
	},
	
	
	startDetailSearchEventPartic: function(particID,startLimit,countryID,provinceID,thisName)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_event_partic_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('ID='+particID+'&startLimit='+startLimit+'&countryID='+countryID+'&provinceID='+provinceID);	
	},
	
	
	startDetailSearchEventName: function(eventName,startLimit,countryID,provinceID,thisName)
	{
		loadWait(thisName);
		
		eventName = encodeURIComponent(eventName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_search_detail_event_name_results.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('ID='+eventName+'&startLimit='+startLimit+'&countryID='+countryID+'&provinceID='+provinceID);		
	},
	
	startGlobalSearch: function(string,thisName)
	{
		if(string.length > 1)
		{
			showLayer('suggestions');		
			loadWait(thisName);
			this.constructor();
			var req = this.request;
			var me = this;
				
			req.open('POST', 'inc/inc_suggest_globalsearch.php', true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.onreadystatechange = function()
			{				
				me.handleResponseSearch(req,'autoSuggestionsList');											
			}			
			req.send('queryString='+string);
		}
		else
		{
			hideLayer('suggestions');		
		}
	},


    handleResponseSearch: function(req,thisName)
	{
		if(req.readyState == 4)
		{
			document.getElementById(thisName).innerHTML = req.responseText;			
		}
	},
	
	handleResponseSearchAll: function(req,thisName,searchString,startLimit)
	{
		if(req.readyState == 4)
		{
			document.getElementById(thisName).innerHTML = req.responseText;			
			
			if(startLimit == 0)
			{
			
				if(thisName == "searchUser")
				{
					this.constructor();
					var req = this.request;
					var me = this;
					
					me.startSearch(searchString,'0','searchEvent');
				}
				
				if(thisName == "searchEvent")
				{
					this.constructor();
					var req = this.request;
					var me = this;
					
					me.startSearch(searchString,'0','searchInstitution');
				}
			
			}
		}
	},
	
	////////// SEARCH FUNCTIONS //////////
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	////////// GOOGLEMAP //////////
	
	showMap: function(mapLat,mapLong,thisName,adress)
	{
		loadWait(thisName);
		
		this.constructor();
		var req = this.request;
		var me = this;
		
		req.open('POST', 'inc/inc_show_google_maps.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseMap(req,thisName);											
		}			
		req.send('mapLat='+mapLat+'&mapLong='+mapLong+'&divID='+thisName+'&adress='+adress);		
	},
	
	
	handleResponseMap: function(req,thisName)
	{
		if(req.readyState == 4)
		{
			document.getElementById(thisName).innerHTML = req.responseText;		
			execJS(document.getElementById(thisName));
		}
	},
	
	////////// GOOGLEMAP //////////
	
	
	
	
	
	
	
	
	
	
	
	
	////////// MESSAGES //////////
	
	loadAllMessages: function(thisName)
	{
		loadWait(thisName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_messages_load.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send(null);		
	},
	
	
	
	loadSentMessages: function(thisName)
	{
		loadWait(thisName);
		this.constructor();
		var req = this.request;
		var me = this;
			
		req.open('POST', 'inc/inc_messages_load.php', true);
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		req.onreadystatechange = function()
		{				
			me.handleResponseSearch(req,thisName);											
		}			
		req.send('sent=1');		
	},	
	
	
	
	loadMessage: function(ID,thisName,sent)
	{
		if(document.getElementById(thisName).innerHTML != "")
		{			
			this.constructor();
			var req = this.request;
			var me = this;
			if(sent == "0")
			{
				me.loadAllMessages('loadAllMessages');			
			}
			if(sent == "1")
			{
				me.loadSentMessages('loadAllMessages');			
			}
			
			
		}
		else
		{
			loadWait(thisName);
			document.getElementById(thisName).style.display = 'block';
			
			this.constructor();
			var req = this.request;
			var me = this;
				
			req.open('POST', 'inc/inc_message_content.php', true);
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.onreadystatechange = function()
			{				
				me.handleResponseSearch(req,thisName);											
			}			
			req.send('ID='+ID+'&divID='+thisName+'&sent='+sent);
		}
	},
	
	
	handleResponseMessage: function(req,thisName)
	{
		if(req.readyState == 4)
		{
			document.getElementById(thisName).innerHTML = req.responseText;			
		}
	},
	
	////////// MESSAGES //////////
	
	
	
	
	
	
	
	
	
	
	
	
	////////// MEDIAFILES //////////	
	
	loadMediaFiles: function()
	{
		loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFiles.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send(null);
	},
	
	
	
	loadEventMediaFilesSingle: function(eventID)
	{
		loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFilesEvent_single.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('eventID='+eventID);
	},
	
	
	loadProfileMediaFiles: function(profileRowID,form,file)
	{
	  loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFilesProfile.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('profileRowID='+profileRowID+'&form='+form+'&file='+file);
	},
	
	loadContactMediaFiles: function()
	{
		loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFilesContact.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send(null);
	},
	
	
	loadEventMediaFiles: function()
	{
	  loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFilesEvent.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('mode=upload');
	},
	
	/*
	loadEventMediaFiles: function(eventID)
	{
		loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_iframe_addMediaFilesEvent.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send('eventID='+eventID);
	},
	*/
	
	loadContactMediaFilesChoose: function()
	{
		loadWait('userActionBox');
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_addMediaFilesContact.php?tab=2', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById("userActionBox").style.display = 'block';	
			me.handleResponseUserAction(req,'userActionBox');		
		}		
		req.send(null);
	},
		
	uploadForm: function(divID)
	{
		loadWait(divID);
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_upload.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			document.getElementById(divID).style.display = 'block';	
			document.getElementById("uploadFileClose").style.display = 'block';	
			me.handleResponseUserAction(req,divID);		
		}		
		req.send(null);
	},
	
	uploadFormContact: function(divID)
	{
		loadWait(divID);
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_upload_contact.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			if(document.getElementById(divID))
			{
				document.getElementById(divID).style.display = 'block';	
				document.getElementById("uploadFileClose").style.display = 'block';	
				me.handleResponseUserAction(req,divID);		
			}
		}		
		req.send(null);
	},
	
	uploadFormEvent: function(divID)
	{
		loadWait(divID);
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_useraction_upload_event.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			if(document.getElementById(divID))
			{
				document.getElementById(divID).style.display = 'block';	
				document.getElementById("uploadFileClose").style.display = 'block';	
				me.handleResponseUserAction(req,divID);		
			}
		}		
		req.send(null);
	},
	
	showMediaFile: function(ID,thisName)
	{
		prepareOverlay();
		fadeIn();
		document.getElementById(thisName).style.display = 'block';
			
		var req = this.request;
		var me = this;				
		req.open('POST', 'inc/inc_show_media_file.php', true);			
		req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');		
		req.onreadystatechange = function()
		{
			me.handleResponseUserAction(req,thisName);			
		}		
		req.send('ID='+ID);
	}
	
	
}
	
//////////////////////////////////////////////////////////////////////////////////////////////////
// HTTPREQUESTOBJEKT - OBJEKT ////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////























//////////////////////////////////////////////////////////////////////////////////////////////////////
// HTTPREQUESTOBJEKT - FUNKTIONEN ///////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////

var resObjekt;

function new_resObjekt()
{
	if(navigator.appName.search("Microsoft") > -1)
	{
		// resObjekt = new ActiveXObjekt("Microsoft.XMLHTTP");
		resObjekt = new ActiveXObject("MSXML2.XMLHTTP");
	}
	else
	{
		resObjekt = new XMLHttpRequest();
	}
}

function loadProfilePrivContact(id_country,id_province,divID)
{
	new_resObjekt();
	resObjekt.open('POST', 'inc/inc_form_profile_private_contact.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('id_country='+id_country+'&id_province='+id_province);		
	resObjekt.onreadystatechange = function()
	{
		handleResponse(divID);
	}
}


function loadProfileInstContact(id_country,id_province,divID)
{
	new_resObjekt();
	resObjekt.open('POST', 'inc/inc_form_profile_institution_contact.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('id_country='+id_country+'&id_province='+id_province);		
	resObjekt.onreadystatechange = function()
	{
		handleResponse(divID);
	}
}


function search_city_priv(string)
{
	new_resObjekt();
	var searchString = string.split(",");
	string = searchString['0'];
	string = string.toLowerCase();
	var id_country = searchString['1'];
	var id_province = searchString['2'];
	
	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_city_search_priv.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('string='+string+'&id_country='+id_country+'&id_province='+id_province);		
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}


function search_institution_priv(string)
{
	new_resObjekt();
	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_institution_search_priv.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('string='+string);		
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}


function search_person_play(string)
{
	new_resObjekt();
	clearTimeout(Timer);
	loadWait('formAddContSub');
	string = string.toLowerCase();
  resObjekt.open('POST', 'inc/search_person_play.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('string='+string);		
	resObjekt.onreadystatechange = function()
	{
		handleResponse('formAddContSub');
	}
}


function search_city(string)
{
	new_resObjekt();
	searchString = string.split(",");
	string = searchString['0'];
	string = string.toLowerCase();
	id_country = searchString['1'];
	id_province = searchString['2'];
	
	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_city_search.php', true);		
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');	
	resObjekt.send('string='+string+'&id_country='+id_country+'&id_province='+id_province);		
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}


function search_city_alone(string)
{
	new_resObjekt();
	searchString = string.split(",");
	string = searchString['0'];
	string = string.toLowerCase();
	id_country = searchString['1'];
	id_province = searchString['2'];

	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_city_search_alone.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}

function search_event_alone(string)
{
    if(document.ajaxSearch.media['0'].checked == true) { var media = "foto"; }
    if(document.ajaxSearch.media['1'].checked == true) { var media = "video"; }
	new_resObjekt();
	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_event_search_alone.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string+"&media="+media);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}


function media_search_event(string)
{
  new_resObjekt();
	loadWait('formAddContSub');
  resObjekt.open('POST', 'inc/inc_media_event_search.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}

function admin_media_search_event(string)
{
  new_resObjekt();
	loadWait('formAddContSub');
  resObjekt.open('POST', '/admin/inc/inc_media_event_search.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}

function search_partics_alone(string)
{
	new_resObjekt();
	searchString = string.split(",");
	string = searchString['0'];
	string = string.toLowerCase();
	id_country = searchString['1'];
	id_province = searchString['2'];

	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_partic_search_alone.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}

function search_jobs_alone(string)
{
	new_resObjekt();
	searchString = string.split(",");
	string = searchString['0'];
	string = string.toLowerCase();
	id_country = searchString['1'];
	id_province = searchString['2'];

	loadWait('formAddContSub');
    resObjekt.open('POST', 'inc/inc_job_search_alone.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('formAddContSub');
	}
}

function search_city_event(id,limitValue)
{
	new_resObjekt();
	
	loadWait('findResults');
  resObjekt.open('POST', 'inc/inc_ajax_find_events.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('cityID='+id+'&limit='+limitValue);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('findResults');
	}
}

function search_city_inst(id,limitValue)
{
	new_resObjekt();

	loadWait('findResults');
    resObjekt.open('POST', 'inc/inc_ajax_find_inst.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('cityID='+id+'&limit='+limitValue);
	resObjekt.onreadystatechange = function()
	{
		handleResponseCityRegister('findResults');
	}
}


function fillHelpLayer(string)
{
	new_resObjekt();
	loadWait('helpLayer');	
     resObjekt.open('POST', 'inc/inc_fill_help_layer.php', true);	
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);	
	resObjekt.onreadystatechange = function()
	{
		handleResponse('helpLayer');
	}
}


function fillAltLayer(ID,mode,path)
{
	new_resObjekt();
	resObjekt.open('POST',path+'inc_fill_alt_layer.php', true);	
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.onreadystatechange = function()
	{
		handleResponse('altLayer');
	}
	resObjekt.send('ID='+ID+'&mode='+mode);
}


function handleResponse(divID)
{	
	if(resObjekt.readyState == 4)
	{	
		if(document.getElementById(divID))
		{
			document.getElementById(divID).innerHTML = resObjekt.responseText;
		}
	}
}

function handleResponseCityRegister(divID)
{	
	if(resObjekt.readyState == 4)
	{
		if(resObjekt.responseText == "noMatchFound")
		{
			document.getElementById(divID).style.border = '0px';
			document.getElementById(divID).style.backgroundColor = '';
			document.getElementById(divID).innerHTML = "";			
		}		
		else
		{
			document.getElementById(divID).style.border = '1px solid #000000';
			document.getElementById(divID).style.backgroundColor = '#FFFFFF';
			document.getElementById(divID).innerHTML = resObjekt.responseText;
		}
	}
}


function reviews_search_event(string)
{
	new_resObjekt();
	clearTimeout(Timer);
	loadWait('formAddCont');
	var lowerString = string.toLowerCase();
	string = lowerString;
    resObjekt.open('POST', 'inc/inc_reviews_event_search.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponse('formAddCont');
	}
}

function search_person_to_manage(string)
{
	new_resObjekt();
	clearTimeout(Timer);
	loadWait('formAddCont');
	var lowerString = string.toLowerCase();
	string = lowerString;
    resObjekt.open('POST', 'inc/inc_ajax_find_person_intern.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponse('formAddCont');
	}
}


function reviews_search_event(string)
{
	new_resObjekt();
	clearTimeout(Timer);
	loadWait('formAddCont');
	var lowerString = string.toLowerCase();
	string = lowerString;
    resObjekt.open('POST', 'inc/inc_reviews_event_search.php', true);
	resObjekt.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	resObjekt.send('string='+string);
	resObjekt.onreadystatechange = function()
	{
		handleResponse('formAddCont');
	}
}


function loadWait(divID)
{
  document.getElementById(divID).innerHTML = "<img src=\"p/ajax_waiting.gif\" alt=\"wait\" title=\"wait\">";
}

//////////////////////////////////////////////////////////////////////////////////////////////////////
// HTTPREQUESTOBJEKT - FUNKTIONEN ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////


function clearProfileAjaxForms(thisName)
{
	var j;
	var i;
	
	var profileForms = new Array("Occupation","Education","Works","Members");	
	for(j=0;j<profileForms.length;j++)
	{
		var divName = "innerProfile"+profileForms[j];
		var divWrapper = "Profile"+profileForms[j];
		
		if(document.getElementById(divName) && thisName != divWrapper)
		{
			document.getElementById(divName).innerHTML = "";
			document.getElementById(divWrapper).style.height = 0+"px";			
		}

		for(i=0;i<1000;i++)
		{
			divName = "innerProfile"+profileForms[j]+i;
			divWrapper = "Profile"+profileForms[j]+i;
			
			if(document.getElementById(divName) && thisName != divWrapper)
			{
				document.getElementById(divName).innerHTML = "";
				document.getElementById(divWrapper).style.height = 0+"px";								
			}
		}		
	}	
}