// JQuery
$(document).ready(function()
{
	// Your code here
});

// generic toggle, without additional specifics. It does allow an Ajax call.
function toggleDiv(strID)
{
	// show or hide panel
	if ($("#" + strID).is(":visible"))
	{
		$("#" + strID).slideUp("normal");
	}
	else
	{
		$("#" + strID).slideDown("normal");
	}
}

function getRandom()
{
	return Math.random() * 99999;
}

function saveVote(intNameID, intVote, strLanguage)
{
	$.ajax(
		{
			method: "post",
			url: "BackgroundProcess.aspx?task=vote&nameid=" + intNameID + "&vote=" + intVote + "&r=" + getRandom(),
			success: function()
			{
				var strTxt = "Bedankt voor je reactie!";
				if (strLanguage == "en")
					strTxt = "Thanks for voting!";

				$("#vote").html(strTxt);
			}
		});
	return false;
}


// START old stuff ///////////////////////////////////////////////////////////////////////////////////////////

function ButtonRollOver(obj)
{
	var strFilename;
	var strExt;
	var intPos;
	if (obj != null)
	{
		strFilename = obj.src.toLowerCase();
		intPos = strFilename.lastIndexOf(".");
		strExt = strFilename.substring(intPos);
		strFilename = strFilename.substring(0, intPos);
		intPos = strFilename.indexOf("_ro");
	if (intPos == -1)
		{
			strFilename = strFilename + "_ro" + strExt;
		}
	else
		{
			strFilename = strFilename.substring(0, intPos) + strExt;
		}
		obj.src = strFilename;
	}
}

function toggleSearch(theType) {
	if (theType=='advanced')
	{
		document.getElementById("ToAdvanced").style.display = 'none';
		document.getElementById("ToBasic").style.display = 'block';
		document.getElementById("SearchAdvanced").style.display = 'block';
	}
	else
	{
		document.getElementById("ToAdvanced").style.display = 'block';
		document.getElementById("ToBasic").style.display = 'none';
		document.getElementById("SearchAdvanced").style.display = 'none';
	}
}

function imgRollOver(obj)
{
	var strFilename;
	var strExt;
	var intPos;
	if (obj != null)
	{
		strFilename = obj.src.toLowerCase();
		intPos = strFilename.lastIndexOf(".");
		strExt = strFilename.substring(intPos);
		strFilename = strFilename.substring(0, intPos);
		intPos = strFilename.indexOf("_ro");
		if (intPos == -1)
		{
			strFilename = strFilename + "_ro" + strExt;
		}
		else
		{
			strFilename = strFilename.substring(0, intPos) + strExt;
		}
		obj.src = strFilename;
	}
}

function toggle(ItemID) {
	if (document.getElementById(ItemID).style.display == 'none') {
		document.getElementById(ItemID).style.display = 'block';
	}
	else {
		document.getElementById(ItemID).style.display = 'none';
	}
}

// END old stuff ///////////////////////////////////////////////////////////////////////////////////////////
