/************************************************************************************************
//	# File Name: custom_ajax.js
//	# File Version: v 1.0
//	# Created By: Patel Dharmesh K.
//	# Created On: 06 Jan 2011
//	# Last Modified By:
//	# Last modified On:
************************************************************************************************/

/************************************************************************************************ 
//  Function Name : ajaxGetRecipe
//	# Created By: Dharmesh K. Patel
//	# Created On: 06 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Send AJAX request to get recipes for specified recipe type. 
//  Params : recipeType(type of the recipe), resultBox(name of the control to display result)
************************************************************************************************/
function ajaxGetRecipe(recipeType,resultBox)
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			var ajaxDisplay = document.getElementById(resultBox);
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			if(ajaxRequest.responseText.replace(/^\s+|\s+$/g,"").toString()=="<ul><li>No Recipe Found In This Category</li></ul>")
			{
				document.getElementById("show_link_"+resultBox).style.display='none';
			}
		}
	}
	var queryString = "?recipeType=" + recipeType+"&LANGUAGE="+LANGUAGE;
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_recipe.php" + queryString, true);
	ajaxRequest.send(null);
}

/************************************************************************************************ 
//  Function Name : ajaxSearchRecipe
//	# Created By: Dharmesh K. Patel
//	# Created On: 06 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Send AJAX request to get recipes for specified recipe type. 
//  Params : recipeType(type of the recipe), resultBox(name of the control to display result)
************************************************************************************************/
function ajaxSearchRecipe(searchForm,resultBox)
{
	
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	var ajaxDisplay = document.getElementById(resultBox);
	
	var searchText = encodeURIComponent(document.getElementById('txtSearch').value);
	var isGeneral = document.getElementById('hdnIsGeneral').value;
	var searchText1 = encodeURIComponent(document.getElementById('txtSearch1').value);
	
	
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
			searchPara='';
		}
	}
	
  if(searchPara=='')
  {
	var Lunch=document.getElementById('cb1');
	var MainDish=document.getElementById('cb2');
	var Accessories=document.getElementById('cb3');
	var Desserts=document.getElementById('cb4');
	var Born=document.getElementById('cb5');
	
	var c1=document.getElementById('c1');
	var c2=document.getElementById('c2');
	var c3=document.getElementById('c3');
	var c4=document.getElementById('c4');
	
	var recipeType='';
	var recipeTime='';
	
	if(Lunch.checked)
	{
		recipeType += "'Lunch'";
	}
	if(MainDish.checked)
	{
		if(recipeType!='') 
			recipeType += ",";
		recipeType += "'Main Dishes'";
	}
	if(Accessories.checked)
	{
		if(recipeType!='') 
			recipeType += ",";
		recipeType += "'Accessories'";	
	}
	if(Desserts.checked)
	{
		if(recipeType!='') 
			recipeType += ",";
		recipeType += "'Desserts'";	
	}
	if(Born.checked)
	{
		if(recipeType!='') 
			recipeType += ",";
		recipeType += "'Children dishes'";	
	}
	
	if(c1.checked)
	{
		recipeTime += "'15 min'";
	}
	if(c2.checked)
	{
		if(recipeTime != '')
			recipeTime += ",";
		recipeTime += "'30 min'";
	}
	if(c3.checked)
	{
		if(recipeTime != '')
			recipeTime += ",";
		recipeTime += "'45 min'";
	}
	if(c4.checked)
	{
		if(recipeTime != '')
			recipeTime += ",";
		recipeTime += "'60 min'";
	}
	

	var queryString = "?recipeType=" + recipeType + "&recipeTime=" + recipeTime + "&searchText=" + searchText +"&LANGUAGE="+LANGUAGE;
	document.getElementById("hdnSearchType").value="Recipe";
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/search_recipe.php" + queryString, true);
	
  }
  else
  {
		var queryString = "?searchText1=" + searchText1+"&LANGUAGE="+LANGUAGE;
		document.getElementById("hdnSearchType").value="Global";
		ajaxRequest.open("GET", THEME_PATH + "custom/php/general_search.php" + queryString, true);
  }
	ajaxRequest.send(null);
}

function ajaxGetRecipeLinkList(nodeTitle,pageCategory)
{
		var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			var ajaxDisplay;
			if(pageCategory=='Vegetable')
			{
				ajaxDisplay = document.getElementById("divRecipeList");
			}
			else if(pageCategory=='Fruit')
			{
				ajaxDisplay = document.getElementById("divFruitsRecipeList");
			}
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var queryString = "?ntitle=" + nodeTitle;
	if(pageCategory=='Vegetable')
	{
		queryString += "&pageCagtegory=Vegetable"+"&LANGUAGE="+LANGUAGE;
	}
	else if(pageCategory=='Fruit')
	{
		queryString += "&pageCagtegory=Fruit"+"&LANGUAGE="+LANGUAGE;
	}
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_recipe_link_list.php" + queryString, true);
	ajaxRequest.send(null);
}

function ajaxGetMagazineLinkList(nodeId,pageCategory)
{
		var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			var ajaxDisplay;
			if(pageCategory=='Vegetable')
			{
				ajaxDisplay = document.getElementById("divVegetableMagazineList");
			}
			else if(pageCategory=='Fruit')
			{
				ajaxDisplay = document.getElementById("divFruitMagazineList");
			}
			else if(pageCategory=='Recipe')
			{
				ajaxDisplay = document.getElementById("divRecipeMagazineList");
			}
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	var queryString = "?nid=" + nodeId;
	if(pageCategory=='Vegetable')
	{
		queryString += "&pageCagtegory=Vegetable"+"&LANGUAGE="+LANGUAGE;
	}
	else if(pageCategory=='Fruit')
	{
		queryString += "&pageCagtegory=Fruit"+"&LANGUAGE="+LANGUAGE;
	}
	else if(pageCategory=='Recipe')
	{
		queryString += "&pageCagtegory=Recipe"+"&LANGUAGE="+LANGUAGE;
	}
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_magazine_link_list.php" + queryString, true);
	ajaxRequest.send(null);
}

function ajaxGetCategoryPage(pageCategory)
{
		var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			var ajaxDisplay;
			if(pageCategory=='Vegetable')
			{
				ajaxDisplay = document.getElementById("divVegetableInfo");
			}
			else if(pageCategory=='Fruit')
			{
				ajaxDisplay = document.getElementById("divFruitInfo");
			}
			arrTemp = ajaxRequest.responseText.split("<first-image>");
			if(LANGUAGE=="da")
			{
				var s1="Sort by season";
				var s2="Sort alphabetically";
				var r1="Sorter efter s&aelig;son";
				var r2="Sorter alfabetisk";
				ajaxDisplay.innerHTML = ((arrTemp[0]+arrTemp[2]).replace(s1,r1)).replace(s2,r2);
			}
			else
			{
				ajaxDisplay.innerHTML = arrTemp[0]+arrTemp[2];
			}
			chImageSrc(arrTemp[1]);
		}
	}
	var queryString;
	if(pageCategory=='Vegetable')
	{
		queryString = "?pageCagtegory=Vegetable"+"&LANGUAGE="+LANGUAGE;
	}
	else if(pageCategory=='Fruit')
	{
		queryString = "?pageCagtegory=Fruit"+"&LANGUAGE="+LANGUAGE;
	}
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_category_page.php" + queryString, true);
	ajaxRequest.send(null);
}

/************************************************************************************************ 
//  Function Name : ajaxGetMagazineList
//	# Created By: Dharmesh K. Patel
//	# Created On: 19 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Send AJAX request to get magazine list. 
//  Params : 
************************************************************************************************/
function ajaxGetMagazineList()
{
		var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		if(ajaxRequest.readyState == 4)
		{
			var ajaxDisplay;
			ajaxDisplay = document.getElementById("divMagzineList");
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_magazine_list.php"+"?LANGUAGE="+LANGUAGE, true);
	ajaxRequest.send(null);
}

/************************************************************************************************ 
//  Function Name : ajaxIsSubscribed
//	# Created By: Dharmesh K. Patel
//	# Created On: 10 Feb 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Checks has user already subscribed or not. 
//  Params : formId(node id of the webform), eMail (subscriber's email address)
************************************************************************************************/
/*function ajaxIsSubscribed(formId,eMail)
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	var result;
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/is_subscribed.php"+"?formId="+formId+"&eMail="+eMail, false);
	ajaxRequest.send(null);
	
	result = ajaxRequest.responseText;
	
	if(result.replace(/^\s+|\s+$/g,"").toString()=='true')
	{
		return true;
	}
	else
	{
		return false;
	}
} */

/************************************************************************************************ 
//  Function Name : ajaxIsUnsubscribed
//	# Created By: Dharmesh K. Patel
//	# Created On: 10 Feb 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Checks has user already subscribed or not. 
//  Params : formId(node id of the webform), eMail (subscriber's email address)
************************************************************************************************/
/*function ajaxIsUnsubscribed(formId,eMail)
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	var result;
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/is_unsubscribed.php"+"?formId="+formId+"&eMail="+eMail, false);
	ajaxRequest.send(null);
	
	result = ajaxRequest.responseText;
	
	if(result.replace(/^\s+|\s+$/g,"").toString()=='true')
	{
		if(LANGUAGE=="da")
		{
			alert("Allerede afmeldt. Du kan tilmelde dig igen ved at udfylde formularen ovenfor.");
		}
		else
		{
			alert("Already unsubscribed. You can subscribe again by filling the form above.");
		}
		return true;
	}
	else if(result.replace(/^\s+|\s+$/g,"").toString()=='nosubscription')
	{
		alert("Please check your email");
		return true;
	}
	else 
	{
		strName = (result.split("|NAME|"))[1];
		result = (result.split("|NAME|"))[2];
		
		strGender = (result.split("|GENDER|"))[1];
		result = (result.split("|GENDER|"))[2];
		
		strKidsAtHome = (result.split("|KIDS-AT-HOME|"))[1];
		result = (result.split("|KIDS-AT-HOME|"))[2];
		
		intKidsAge = (result.split("|KIDS-AGE|"))[1];
		
		if(formId == 48 || formId == 73)
		{
			if(formId == 48)
			{
				if(strGender == 'Mand')
				{
					strGender="Male";
				}
				else
				{
					strGender="Female";
				}
				
				if(strKidsAtHome == 'Ja')
				{
					strKidsAtHome="Yes";
				}
				else
				{
					strKidsAtHome="No";
				}
			}
			document.getElementById("edit-submitted-un-name").value=strName;
			document.getElementById("edit-submitted-un-gender").value=strGender;
			document.getElementById("edit-submitted-un-kids-living-at-home").value=strKidsAtHome;
			document.getElementById("edit-submitted-un-kids-age").value=intKidsAge;
		}
		else
		{
			if(formId == 49)
			{
				if(strGender == 'Mand')
				{
					strGender="Male";
				}
				else
				{
					strGender="Female";
				}
				
				if(strKidsAtHome == 'Ja')
				{
					strKidsAtHome="Yes";
				}
				else
				{
					strKidsAtHome="No";
				}
			}
			
			document.getElementById("edit-submitted-ug-name").value=strName;
			document.getElementById("edit-submitted-ug-gender").value=strGender;
			document.getElementById("edit-submitted-ug-kids-living-at-home").value=strKidsAtHome;
			document.getElementById("edit-submitted-ug-kids-age").value=intKidsAge;
		}
		return false;
	}
} */

/************************************************************************************************ 
//  Function Name : ajaxGetRecipe
//	# Created By: Dharmesh K. Patel
//	# Created On: 06 Jan 2011
//	Last Modified By:
//	Last modified On:
//  Purpose : Send AJAX request to get recipes for specified recipe type. 
//  Params : recipeType(type of the recipe), resultBox(name of the control to display result)
************************************************************************************************/
function ajaxGetSuggestions(strTextboxValue)
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	
	var result;
	
	if(strTextboxValue.replace(/^\s+|\s+$/g,"").toString()!='')
	{
		ajaxRequest.open("GET", THEME_PATH + "custom/php/suggestions.php"+"?textbox_value="+strTextboxValue+"&LANGUAGE="+LANGUAGE, false);
		ajaxRequest.send(null);
		result = ajaxRequest.responseText;
	}
	var arrSuggestions = [];
	
	if(result.indexOf("[SUGGESTION-END]")>=0)
	{
		if(result.replace(/^\s+|\s+$/g,"").toString()!='No Suggestions')
		{
			arrSuggestions = result.split("[SUGGESTION-END]");
		}
		
		for(var i=0; i<arrSuggestions.length;i++ )
		{ 
			if(arrSuggestions[i].replace(/^\s+|\s+$/g,"").toString()=="")
				arrSuggestions.splice(i,1); 
		}
	}
	return arrSuggestions;
}
function ajaxGetRecipeDetail(nodeId)
{
	
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}

	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		
		if(ajaxRequest.readyState == 4)
		{
			document.getElementById("recipedetail").innerHTML= ajaxRequest.responseText;
		}
	}
	var queryString = "?nid=" + nodeId;
	queryString += "&LANGUAGE="+LANGUAGE;
	var backlink = document.getElementById("hdnbacklinjk").value;
	queryString += "&backlink=true";
	
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_recipe_detail.php" + queryString, true);
	ajaxRequest.send(null);
}
function ajaxGetPageDetail(nodeTitle,pageCategory,returnsearchpage)
{
	
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
		var canedit = document.getElementById('canedit').value;
	
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function()
	{
		
		if(ajaxRequest.readyState == 4)
		{//alert(ajaxRequest.responseText);
			document.getElementById("leftsidebar").innerHTML= ajaxRequest.responseText;
		}
	}
	var queryString = "?ntitle=" + nodeTitle;

		queryString +="&canedit=" + canedit;
	if(pageCategory=='vegetables' || pageCategory=='grontsager')
	{
		queryString += "&pageCagtegory=Vegetable"+"&LANGUAGE="+LANGUAGE;
	}
	else if(pageCategory=='fruits' || pageCategory=='frugt')
	{
		queryString += "&pageCagtegory=Fruit"+"&LANGUAGE="+LANGUAGE;
	}
	if(returnsearchpage !='')
	{
		queryString += "&returnsearchpage="+returnsearchpage;	
	}
	
	if(pageCategory=='recipe' || pageCategory=='opskrifter')
	{
		queryString += "&LANGUAGE="+LANGUAGE;
		var hdnbacklink = document.getElementById('hdnbacklink').value;
		if (hdnbacklink) {
			queryString += "&backlink=true";
		}

		
		ajaxRequest.open("GET", THEME_PATH + "custom/php/get_recipe_detail.php" + queryString, true);
	}
	else
	{
		ajaxRequest.open("GET", THEME_PATH + "custom/php/get_page_detail.php" + queryString, true);
	}
	ajaxRequest.send(null);
}
function ajaxGetBackgroundImage()
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function()
	{
		
		if(ajaxRequest.readyState == 4)
		{	var result;
			result = ajaxRequest.responseText;
			
			document.body.style.background="url('"+ result +"') no-repeat fixed center top transparent";
			return result;
		}
	}
	
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_background_image.php");
	ajaxRequest.send(null);
	
	
}
function ajaxGetLogoImage()
{
	var ajaxRequest;
	try
	{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} 
	catch (e)
	{
		// Internet Explorer Browsers
		try
		{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch (e) 
		{
			try
			{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} 
			catch (e)
			{
				// Something went wrong
				if(LANGUAGE=="da")
				{
					alert("Stand til at skabe AJAX anmodning!");
				}
				else
				{
					alert("Unable To Create AJAX Request!");
				}
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function()
	{
		
		if(ajaxRequest.readyState == 4)
		{	var result;
			result = ajaxRequest.responseText;
			
			document.getElementById("logo").src=result;
			
		}
	}
	
	
	ajaxRequest.open("GET", THEME_PATH + "custom/php/get_logo_image.php");
	ajaxRequest.send(null);
	
	
}

