var http_request = false;

function makePOSTRequest(url, parameters,inFunktion) 
{
	http_request = false;
	if (window.XMLHttpRequest) // Mozilla, Safari,...
	{ 
		http_request = new XMLHttpRequest();
		
		if (http_request.overrideMimeType) 
		{
			http_request.overrideMimeType('text/html');
		}
			
	} 
	
	else if (window.ActiveXObject) // IE
	{ 
		try 
		{
			http_request = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		
		catch (e) 
		{
			try 
			{
				http_request = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e) 
			{
			}
		}
	}
	
	if (!http_request) 
	{
		alert('Kan inte skapa XMLHTTP instance');
		return false;
	}
	
	http_request.onreadystatechange = inFunktion;
	http_request.open('POST', url, true);
	http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	http_request.setRequestHeader("Content-length", parameters.length);
	http_request.setRequestHeader("Connection", "close");
	http_request.send(parameters);
}


// ################################################# FUNKTIONER FÖR OLIKA PROCESSER PÅ SIDAN SOM ANVÄNDER SIG AV POST ELLER GET MED AJAX

// ##############################################################################  Logga in i användardelen
function korUtInloggning() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,4));
			
			if(result=="ratt")
			{
				document.getElementById('utInfo').innerHTML = "";
				//window.location.href=globalDomain+'/#dashBoard';
				window.location.href=''+globalDomain;
			}
		} 
		
		else 
		{
			//alert('Det blev ett problem!');
		}
	}
}

function loginGet(obj) 
{
	var poststr = "inloggAnvNamn=" + encodeURI( document.getElementById("inloggAnvNamn").value ) +"&inloggLosen=" + encodeURI( document.getElementById("inloggLosen").value );
	makePOSTRequest('_pages/kollaLosen.php', poststr, korUtInloggning);
}

// ############################################################################## Skicka nytt lösenord till dig
function skickaGlomtLosen() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,7));
			
			if(result=="skickat")
			{
				//alert("Nytt lösenord skickat!");
				bytSida('_pages/login.php?action=111','login');
			}

		} 
		
		else 
		{
			//alert('Det blev ett problem!');
		}
	}
}

function skickaGlomtLosenGet(obj) 
{
	var poststr = "runick=" + encodeURI( document.getElementById("runick").value );
	makePOSTRequest('_userPages/anvandarLosenordMailaSteg2.php', poststr, skickaGlomtLosen);
}

// ############################################################################## Uppdatera land profil
function uppdateraCountryProfil() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/landProfile.php?fromAjax=true','dashBoard','dash_landProfil','dash_landProfil');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function uppdateraCountryProfilGet(obj) 
{
	var poststr = "countryAdminID=" + encodeURI( document.getElementById("countryAdminID").value )
	+ "&countryName=" + encodeURI( document.getElementById("countryName").value )
	+ "&countryInstanceName=" + encodeURI( document.getElementById("countryInstanceName").value )
	+ "&visitorAddress=" + encodeURI( document.getElementById("visitorAddress").value )
	+ "&contactPerson=" + encodeURI( document.getElementById("contactPerson").value )
	+ "&contactPhone=" + encodeURI( document.getElementById("contactPhone").value )
	+ "&contactFax=" + encodeURI( document.getElementById("contactFax").value )
	+ "&contactEmail=" + encodeURI( document.getElementById("contactEmail").value )
	+ "&countryWeb=" + encodeURI( document.getElementById("countryWeb").value )
	+ "&flag=" + encodeURI( document.getElementById("flag").value )
	;
	
	makePOSTRequest('_pages/_dashBoard/landProfileEditSvar.php', poststr, uppdateraCountryProfil);
}

// ############################################################################## Uppdatera land profil about text
function uppdateraCountryProfilAbout() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/landProfile.php?fromAjax=true','dashBoard','dash_landProfil','dash_landProfil');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function uppdateraCountryProfilAboutGet(obj) 
{
	var poststr = "AboutText=" + encodeURI( document.getElementById("AboutText").value )
	+ "&countryAdminID=" + encodeURI( document.getElementById("countryAdminID").value )
	;
	
	makePOSTRequest('_pages/_dashBoard/landProfileEditAboutSvar.php', poststr, uppdateraCountryProfilAbout);
}

// ############################################################################## Uppdatera anvandar profil
function uppdateraAnvandarProfil() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			// Här ska vi även köra en koll vart man kom ifrån, tex om man redigerar sin egen profil eller en annan i teamets
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/egenProfile.php?fromAjax=true&showProfilUser=true','dashBoard','dash_egenProfil','dash_egenProfil');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function uppdateraAnvandarProfilGet(obj) 
{
	var poststr = "UserName=" + encodeURI( document.getElementById("UserName").value )
	+ "&UserID=" + encodeURI( document.getElementById("UserID").value )
	+ "&Email=" + encodeURI( document.getElementById("Email").value )
	+ "&Msn=" + encodeURI( document.getElementById("Msn").value )
	+ "&Name=" + encodeURI( document.getElementById("Name").value )
	+ "&Surename=" + encodeURI( document.getElementById("Surename").value )
	+ "&Avatar=" + encodeURI( document.getElementById("Avatar").value )
	+ "&Company=" + encodeURI( document.getElementById("Company").value )
	+ "&Position=" + encodeURI( document.getElementById("Position").value )
	+ "&SpecialArea=" + encodeURI( document.getElementById("SpecialArea").value )
	+ "&UserPhone=" + encodeURI( document.getElementById("UserPhone").value )
	+ "&UserMobile=" + encodeURI( document.getElementById("UserMobile").value )
	+ "&Address=" + encodeURI( document.getElementById("Address").value )
	+ "&CountryInstansID=" + encodeURI( document.getElementById("CountryInstansID").value )
	+ "&Prior=" + encodeURI( document.getElementById("Prior").value )
	+ "&Pass1=" + encodeURI( document.getElementById("Pass1").value )
	+ "&Pass2=" + encodeURI( document.getElementById("Pass2").value )
	;
	
	makePOSTRequest('_pages/_dashBoard/egenProfileEditSvar.php', poststr, uppdateraAnvandarProfil);
}


// ############################################################################## Add användare till sitt land/instans
function addUserInstance() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			// Här ska vi även köra en koll vart man kom ifrån, tex om man redigerar sin egen profil eller en annan i teamets
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				//bytDelarAvSidaExtraAnim('_pages/_dashBoard/egenProfile.php?fromAjax=true&showProfilUser=true','dashBoard','dash_egenProfil','dash_egenProfil');
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/team.php?fromAjax=true&showTeam=true','dashBoard','dash_Team','dash_Team');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function addUserInstanceGet(obj) 
{
	var poststr = "UserName=" + encodeURI( document.getElementById("UserName").value )
	+ "&Email=" + encodeURI( document.getElementById("Email").value )
	+ "&Msn=" + encodeURI( document.getElementById("Msn").value )
	+ "&Name=" + encodeURI( document.getElementById("Name").value )
	+ "&Surename=" + encodeURI( document.getElementById("Surename").value )
	+ "&Avatar=" + encodeURI( document.getElementById("Avatar").value )
	+ "&Company=" + encodeURI( document.getElementById("Company").value )
	+ "&Position=" + encodeURI( document.getElementById("Position").value )
	+ "&SpecialArea=" + encodeURI( document.getElementById("SpecialArea").value )
	+ "&UserPhone=" + encodeURI( document.getElementById("UserPhone").value )
	+ "&UserMobile=" + encodeURI( document.getElementById("UserMobile").value )
	+ "&Address=" + encodeURI( document.getElementById("Address").value )
	+ "&CountryInstansID=" + encodeURI( document.getElementById("CountryInstansID").value )
	+ "&Prior=" + encodeURI( document.getElementById("Prior").value )
	;
	
	makePOSTRequest('_pages/_dashBoard/addMemberSvar.php', poststr, addUserInstance);
}



// ############################################################################## Uppdatera team medlemmars profiler
function uppdateraTeamAnvandaresProfil() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			// Här ska vi även köra en koll vart man kom ifrån, tex om man redigerar sin egen profil eller en annan i teamets
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/team.php?fromAjax=true&showTeam=true','dashBoard','dash_Team','dash_Team');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function uppdateraTeamAnvandaresProfilGet(obj) 
{
	var poststr = "UserName=" + encodeURI( document.getElementById("UserName").value )
	+ "&UserID=" + encodeURI( document.getElementById("UserID").value )
	+ "&Email=" + encodeURI( document.getElementById("Email").value )
	+ "&Msn=" + encodeURI( document.getElementById("Msn").value )
	+ "&Name=" + encodeURI( document.getElementById("Name").value )
	+ "&Surename=" + encodeURI( document.getElementById("Surename").value )
	+ "&Avatar=" + encodeURI( document.getElementById("Avatar").value )
	+ "&Company=" + encodeURI( document.getElementById("Company").value )
	+ "&Position=" + encodeURI( document.getElementById("Position").value )
	+ "&SpecialArea=" + encodeURI( document.getElementById("SpecialArea").value )
	+ "&UserPhone=" + encodeURI( document.getElementById("UserPhone").value )
	+ "&UserMobile=" + encodeURI( document.getElementById("UserMobile").value )
	+ "&Address=" + encodeURI( document.getElementById("Address").value )
	+ "&CountryInstansID=" + encodeURI( document.getElementById("CountryInstansID").value )
	+ "&Prior=" + encodeURI( document.getElementById("Prior").value )
	+ "&Pass1=" + encodeURI( document.getElementById("Pass1").value )
	+ "&Pass2=" + encodeURI( document.getElementById("Pass2").value )
	;
	
	makePOSTRequest('_pages/_dashBoard/editMemberSvar.php', poststr, uppdateraTeamAnvandaresProfil);
}


// ############################################################################## Radera en Team medlemm
function raderaTeamAnvandaresProfil() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			result=(result.substring(0,3));
			
			if(result=="The")
			{
				document.getElementById('utInfo').style.display="none";
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/_dashBoard/team.php?fromAjax=true&showTeam=true','dashBoard','dash_Team','dash_Team');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

function raderaTeamAnvandaresProfilGet(obj) 
{
	var poststr = "UserID=" + encodeURI( document.getElementById("UserID").value );
	
	makePOSTRequest('_pages/_dashBoard/deleteMemberSvar.php', poststr, raderaTeamAnvandaresProfil);
	
}

// ############################################################################## Posta till forum/nyhet/rapport
var aktivForumInPost = "";
function postaTillForum() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			
			document.getElementById('utInfo'+aktivForumInPost).innerHTML = result;
				
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,50));
			
			//frompage=(result.substring(7,100));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			// Specialare, om inte from page är något annat än placholders så går den direkt till forumets discustions del
			/*if((result.substring(8,10))=="pl" || (result.substring(9,11))=="pl" ) 
			{
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/forum.php?category=3&subCatIn=true','forum','ajaxMittInnehall','ajaxMittInnehall');
			}
			
			else*/ if(resultPost=="postat")
			{
				stangerPiP('pip_genomskinligBGHallare');
				
				if(fromCategory==1)
				{
					sattNyAktiv('999','tm2');
					bytDelarAvSidaExtraAnim('_pages/news.php?category='+fromCategory,'news','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else if(fromCategory==2)
				{
					sattNyAktiv('999','tm4');
					bytDelarAvSidaExtraAnim('_pages/reports.php?category='+fromCategory,'reports','ajaxMittInnehall','ajaxMittInnehall');
				}
							
				else
				{
					sattNyAktiv('c00','tm6');
					bytDelarAvSidaExtraAnim('_pages/forum.php?category='+fromCategory,'forum','ajaxMittInnehall','ajaxMittInnehall');
				}
				
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function postaTillForumGet(obj) 
{
	//alert("-->" +aktivForumInPost);
	
	arReply_to=false;
	
	var poststr = "title=" + encodeURI( document.getElementById("title"+aktivForumInPost).value )
	+ "&slug=" + encodeURI( document.getElementById("slug").value )
	+ "&post=" + encodeURI( document.getElementById("post"+aktivForumInPost).value )
	+ "&category=" + encodeURI( document.getElementById("category"+aktivForumInPost).value )
	+ "&fromPage=" + encodeURI( document.getElementById("fromPage").value )
	;
	
	if(document.getElementById("attachment"))
	{
		var poststr = poststr
		+ "&attachment=" + encodeURI( document.getElementById("attachment").value )
		;
	}
	
	if(document.getElementById("postStatus3"))
	{
		if(document.getElementById("postStatus3").checked)
		{
			postStatus=3;
		}
		else if(document.getElementById("postStatus2").checked)
		{
			postStatus=-2;
		}
		else if(document.getElementById("postStatus1").checked)
		{
			postStatus=-1;
		}
		var poststr = poststr
		+ "&postStatus=" + encodeURI( postStatus )
		;
	}
	
	if(document.getElementById("reply_to"+aktivForumInPost))
	{
		var poststr = poststr
		+ "&reply_to=" + encodeURI( document.getElementById("reply_to"+aktivForumInPost).value )
		+ "&parent_id=" + encodeURI( document.getElementById("parent_id"+aktivForumInPost).value )
		;
		
		arReply_to=true;
	}
	else
	{
		arReply_to=false;
	}
	
	if(document.getElementById("image"))
	{
		var poststr = poststr
		+ "&image=" + encodeURI( document.getElementById("image").value )
		;
	}
	
	//alert("-->" +aktivForumInPost);
	if(document.getElementById("post"+aktivForumInPost).value!="")
	{
		if(arReply_to)
		{
			//alert("Svar: "+poststr);
			makePOSTRequest('_pages/_forum/post-comment.php', poststr, postaTillForum);
			
		}
		else
		{
			//alert("Ny: "+poststr);
			makePOSTRequest('_pages/_forum/post-topic.php', poststr, postaTillForum);
		}
	}
	else
	{
		alert("You have to write a post!");
	}
}

// ############################################################################## Add underkategori till en forum kategori
function postaTillSubForum() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,7));
			
			frompage=(result.substring(7,8));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			if(resultPost=="postat")
			{
				stangerPiP('pip_genomskinligBGHallare');
				
				// Här beroende på vilken sida man kom ifrån via "frompage" variabeln
				bytDelarAvSidaExtraAnim('_pages/forum.php?category='+fromCategory,'forum','ajaxMittInnehall','ajaxMittInnehall');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function postaTillSubForumGet(obj) 
{
	var poststr = "title=" + encodeURI( document.getElementById("title").value )
	+ "&description=" + encodeURI( document.getElementById("description").value )
	+ "&slug=" + encodeURI( document.getElementById("slug").value )
	+ "&parent=" + encodeURI( document.getElementById("parent").value )
	+ "&fromPage=" + encodeURI( document.getElementById("fromPage").value )
	;
	
	/*if(encodeURI( document.getElementById("title").value!="") EN IDE BARA OM DEN HÄR SKA BLI MR DYNAMISK SEN*/
	
	makePOSTRequest('_pages/_forum/post-subcategory.php', poststr, postaTillSubForum);
}

// ############################################################################## Uppdatera till forum/nyhet/rapport (EJ KLAR!!!!!!!!!!!!!!!!!!!!!!!!!)
function uppdateraTillForum() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,7));
			
			frompage=(result.substring(7,100));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			// Specialare, om inte from page är något annat än placholders så går den direkt till forumets discustions del
			/*if((result.substring(8,10))=="pl" || (result.substring(9,11))=="pl" ) 
			{
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/forum.php?category=3&subCatIn=true','forum','ajaxMittInnehall','ajaxMittInnehall');
			}
			
			else*/ if(resultPost=="postat")
			{
				stangerPiP('pip_genomskinligBGHallare');
				
				// Här beroende på vilken sida man kom ifrån via "frompage" variabeln
				if(frompage=="forum" || frompage=="")
				{
					bytDelarAvSidaExtraAnim('_pages/forum.php?category='+fromCategory,'forum','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else if(frompage=="news")
				{
					bytDelarAvSidaExtraAnim('_pages/news.php?category='+fromCategory,'news','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else if(frompage=="reports")
				{
					bytDelarAvSidaExtraAnim('_pages/reports.php?category='+fromCategory,'reports','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else
				{
					bytDelarAvSidaExtraAnim('_pages/forum.php?category='+3,'forum','ajaxMittInnehall','ajaxMittInnehall');
				}
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function uppdateraTillForumGet(obj) 
{
	var poststr = "id=" + encodeURI( document.getElementById("id").value )
	+ "&frompage=" + encodeURI( document.getElementById("frompage").value )
	+ "&fromCategory=" + encodeURI( document.getElementById("fromCategory").value )
	+ "&title=" + encodeURI( document.getElementById("title").value )
	+ "&comment=" + encodeURI( document.getElementById("comment").value )
	;
	
	/*if(encodeURI( document.getElementById("title").value!="") EN IDE BARA OM DEN HÄR SKA BLI MR DYNAMISK SEN*/
	
	makePOSTRequest('_pages/_forum/update-comment.php', poststr, uppdateraTillForum);
}

// ############################################################################## Radera till forum/nyhet/rapport
function deleteTillForum() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfo').innerHTML = result;	
			
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,7));
			
			frompage=(result.substring(7,100));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			// Specialare, om inte from page är något annat än placholders så går den direkt till forumets discustions del
			/*if((result.substring(8,10))=="pl" || (result.substring(9,11))=="pl" ) 
			{
				stangerPiP('pip_genomskinligBGHallare');
				bytDelarAvSidaExtraAnim('_pages/forum.php?category=3&subCatIn=true','forum','ajaxMittInnehall','ajaxMittInnehall');
			}
			
			else*/ if(resultPost=="postat")
			{
				stangerPiP('pip_genomskinligBGHallare');
				
				// Här beroende på vilken sida man kom ifrån via "frompage" variabeln
				if(frompage=="forum" || frompage=="")
				{
					bytDelarAvSidaExtraAnim('_pages/forum.php?category='+fromCategory,'forum','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else if(frompage=="news")
				{
					bytDelarAvSidaExtraAnim('_pages/news.php?category='+fromCategory,'news','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else if(frompage=="reports")
				{
					bytDelarAvSidaExtraAnim('_pages/reports.php?category='+fromCategory,'reports','ajaxMittInnehall','ajaxMittInnehall');
				}
				
				else
				{
					bytDelarAvSidaExtraAnim('_pages/forum.php?category='+3,'forum','ajaxMittInnehall','ajaxMittInnehall');
				}
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function deleteTillForumGet(obj) 
{
	var poststr = "id=" + encodeURI( document.getElementById("id").value )
	+ "&frompage=" + encodeURI( document.getElementById("frompage").value )
	+ "&fromCategory=" + encodeURI( document.getElementById("fromCategory").value )
	;
		
	makePOSTRequest('_pages/_forum/delete-comment.php', poststr, deleteTillForum);
}


// ############################################################################## Godkänna / Radera --> Nyhet / Rapport/ Forum
function forumSokPost() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			document.getElementById('pip_wrapper').style.height="auto";
			
			result = http_request.responseText;
			document.getElementById('utInfoSok').innerHTML = result;	
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function forumSokPostGet(obj) 
{
	var poststr = "search=" + encodeURI( document.getElementById("search").value )
	+ "&comments=" + encodeURI( document.getElementById("comments").value )
	+ "&category=" + encodeURI( document.getElementById("category").value )
	;
		
	//alert(poststr);
	makePOSTRequest('_pages/_forum/searchresult.php', poststr, forumSokPost);
}

// ############################################################################## Posta sin national database
function postaTillNationalDatabase() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			document.getElementById('pip_wrapper').style.height="auto";
			
			result = http_request.responseText;
			document.getElementById('utInfoPostNational').innerHTML = result;	
			
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,7));
			
			frompage=(result.substring(7,8));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			if(resultPost=="postat")
			{
				stangerPiP('pip_genomskinligBGHallare');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function postaTillNationalDatabaseGet(obj) 
{
	var poststr = "title=" + encodeURI( document.getElementById("title").value )
	+ "&attachment=" + encodeURI( document.getElementById("attachment").value )
	;
		
	//alert(poststr);
	makePOSTRequest('_pages/_dashBoard/upload_NationalDatabaseSvar.php', poststr, postaTillNationalDatabase);
}


// ############################################################################## Godkänna / Radera --> Nyhet / Rapport/ Forum
/*
function approveDeletePosts() 
{
	if (http_request.readyState == 4) 
	{
		if (http_request.status == 200) 
		{
			result = http_request.responseText;
			document.getElementById('utInfoAproveDelete').innerHTML = result;	
			
			resultPost=(result.substring(0,6));
			
			fromCategory=(result.substring(6,7));
			
			frompage=(result.substring(7,8));
			
			//alert("resultPost: " + resultPost + " fromCategory: "+ fromCategory + " frompage: "+ frompage);
			
			if(resultPost=="postat")
			{
				alert("fixat");
				//bytDelarAvSidaExtraAnim('_pages/forum.php?category='+fromCategory,'forum','ajaxMittInnehall','ajaxMittInnehall');
			}
		} 
		
		else 
		{
			alert('Det blev ett problem!');
		}
	}
}

																															 
function approveDeletePostsGet(obj) 
{
	var poststr = "id=" + encodeURI( document.getElementById("id").value )
	+ "&frompage=" + encodeURI( document.getElementById("frompage").value )
	+ "&fromCategory=" + encodeURI( document.getElementById("fromCategory").value )
	;
		
	alert(poststr);
	//makePOSTRequest('_pages/_forum/delete-comment.php', poststr, approveDeletePosts);
}
*/


