/*
 
*/

function searchUserAutoComplete(userName,inputList,dropdownList,selectList)
{
	var searchUser = "commonAjax.php?script=searchUser&searchUser="+userName;
	ajaxExecuteAutoComplete(searchUser,inputList,dropdownList,selectList," ");
}

function searchGameAutoComplete(gameName,inputList,dropdownList,selectList,gameConsole,friendCode)
{
	if(gameConsole && gameConsole == 1)
	{
		var searchGame = "commonAjax.php?script=searchGame&searchGame="+gameName+"&gameConsole=1";
	}
	else
	{	
		var searchGame = "commonAjax.php?script=searchGame&searchGame="+gameName;
	}	
	
	if(friendCode && friendCode == true)
	{
		searchGame = searchGame+"&friendCode=true";
	}	
	
	ajaxExecuteAutoComplete(searchGame,inputList,dropdownList,selectList," ");
}	

///// uitvoeren van het zoeken van lijsten //////

function ajaxSearchList(scriptTitle,buttonToSearch,objectForm,divObject)
{
	passThroughValue = new Array();
	passThroughValue[0] = buttonToSearch;
	passThroughValue[1] = divObject;
	
	document.getElementById(''+ buttonToSearch).disabled = true;
	ajaxSubmitFormPOST('commonAjax.php?script='+scriptTitle,objectForm,'ajaxProcesList',passThroughValue,buttonToSearch);
}


function ajaxProcesList(ajaxStatus,ajaxResponse,passThroughValue)
{
	if(ajaxStatus == 202)
	{
		eval(''+ajaxResponse);
	}
	else
	{
		ajaxInnerXHTML(passThroughValue[1],ajaxResponse);
	}
	
	if(document.getElementById('' + passThroughValue[0]))
	{
		document.getElementById('' + passThroughValue[0]).disabled = false;
	}
}

function ajaxSwitchListOptions(scriptTitle,buttonToSearch,stringToSubmit,divObject)
{
	passThroughValue = new Array();
	passThroughValue[0] = buttonToSearch;
	passThroughValue[1] = divObject;
	
	if(document.getElementById(''+ buttonToSearch))
	{
		document.getElementById(''+ buttonToSearch).disabled = true;
	}
	
	ajaxPostData('commonAjax.php?script='+scriptTitle + '' + stringToSubmit,'','ajaxProcesList',passThroughValue);
}

var currentConsoleID = 0;

function indexSwitchArticleList(consoleID)
{
    var articleTypes = document.getElementsByName("articleType");
    var articleTypeGetString = "";

    for (x = 0; x < articleTypes.length; x++) {
        if (articleTypes[x].checked) {
            articleTypeGetString = articleTypeGetString + "+" + articleTypes[x].value;
        }
    }

    if(consoleID == 1000)
    {
        consoleID = currentConsoleID;
    }
    else
    {
        document.getElementById("indexSwitchArticleTab" + currentConsoleID).style.backgroundColor = "transparent";
        document.getElementById("indexSwitchArticleTab" + currentConsoleID).style.backgroundImage = "none";
        
        document.getElementById("indexSwitchArticleTab" + consoleID).style.background = "#ffffff url(http://www.n1ntendo.nl/layout/V1/Timages/tabs-marker.png) no-repeat center bottom";

        currentConsoleID = consoleID;
    }

    var typeString = articleTypeGetString.substr(1);

	var http = ajaxRequestObject();

	http.onreadystatechange = function()
	{
		if(http.readyState == 4)
		{
			document.getElementById("indexLastArticles").innerHTML = http.responseText;
		}
	}

    http.open("GET", "commonAjax.php?script=articleList&articleTypes=" + typeString + "&articleConsoles=" + consoleID, true);
    http.send(null);
}

