/**
 * @author Ion-IT Matthias Altmann Softwaredevelopment
 */

var xmlhttp;
var actualIframeSrc = '';

v = new Array();
v=location.search.substring(1, location.search.length).split('&');getVars = new Array();for(var x in v){
 var temp = v[x].split('='); getVars[temp[0]] = temp[1];}



//Execute the function for the dropdown creation
showResultGallery(getVars['selection']);


function showResultGallery(str)
{

xmlhttp2=GetXmlHttpObject2()
if (xmlhttp2==null)
  {
  alert ("Your browser does not support XML HTTP Request");
  return;
  }
var url2="http://www.fussballcamps.de/gallery_new/includes/dropdowncreate.php";

url2=url2+"?q=getgallerys&name="+str;
url2=url2+"&sid="+Math.random();
xmlhttp2.onreadystatechange=stateChanged2;
xmlhttp2.open("GET",url2,true);
xmlhttp2.send(null);
}

function stateChanged2()
{
if (xmlhttp2.readyState==4)
  {
  var loginValue = xmlhttp2.responseText.substring((xmlhttp2.responseText.length)-3,(xmlhttp2.responseText.length));

//alert('b');

  if(loginValue=='111') {
   if(document.getElementById('gallerylogout')!=null)
   		document.getElementById("gallerylogout").innerHTML='Logout';
  } else {
  	if(document.getElementById('gallerylogout')!=null)
		document.getElementById("gallerylogout").parentNode.parentNode.parentNode.parentNode.removeChild(document.getElementById("gallerylogout").parentNode.parentNode.parentNode);
  }



  if(loginValue=='111') {
   if(document.getElementById('galleryadmin')!=null)
   		document.getElementById("galleryadmin").innerHTML='Galerie anlegen';
  } else {
   if(document.getElementById('galleryadmin')!=null)
   		document.getElementById("galleryadmin").parentNode.parentNode.parentNode.parentNode.removeChild(document.getElementById("galleryadmin").parentNode.parentNode.parentNode);
  }
  

  if (document.getElementById('gallerydropdown') != null) {
  	document.getElementById("gallerydropdown").innerHTML = xmlhttp2.responseText.substring(0, xmlhttp2.responseText.length - 3);
  	document.getElementById("gallerydropdown").style.border = "0px solid #A5ACB2";
  }
  }
}

function GetXmlHttpObject2()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}


function setPageGallery() {


  //Remove link from dropdownbox
  if(document.getElementById('gallerydropdown')!=null)
	document.getElementById('gallerydropdown').parentNode.removeAttribute('href');


	
}
