/**
 * Javascript Library Prolyte
 *
 * @author Creative Industries
 * @date June 2008
 */


/**
 * FAQ
 */

function collapsAll(){
	
	elem = document.getElementById('faq').getElementsByTagName('li');
	
	for (i=0; i< elem.length; i++){
		
		elem[i].getElementsByTagName('p')[0].style.display = "none";
		
	}
	
}

function setFAQ(){
	
	collapsAll();
	
	elem = document.getElementById('faq').getElementsByTagName('li');
	
	for (i=0; i< elem.length; i++){
		
		elem[i].getElementsByTagName('a')[0].onclick = function (){
			
			collapsAll();
			
			this.parentNode.parentNode.getElementsByTagName('p')[0].style.display = "block";
			
			x_setStatFaq(this.id, function (data){if (data == false) alert("Could not set stat!")});
			
		};
		
	}
	
	elem[0].getElementsByTagName('p')[0].style.display = "block";
	
	
	
}

function getApplication(cat){
	
	x_loadApplication(cat, function (data){fillGrid(data)});
	
}

function getSpecs(cat){
	
	x_loadSpecs(cat, function (data){fillGrid(data)});
	
}
function getDownloads(cat){
	
	x_loadDownloads(cat, function (data){fillGrid(data)});
	
}
function getMisc(cat){
	
	x_loadMisc(cat, function (data){fillGrid(data)});
	
}

function getInfo(cat){
	
	x_loadInfo(cat, function (data){fillGrid(data)});
	
}

function fillGrid(data){
	
	document.getElementById("productContainer").innerHTML = data
	
}

function setActiveTab(obj){

	elem = obj.parentNode.parentNode.getElementsByTagName("a");
	
	for (i=0; i<elem.length; i++){
		
		elem[i].className = "";
		
	}
	
	obj.className = "active";

}

/*
if (window.addEventListener)
	window.addEventListener("load", setBlender, false)
else if (window.attachEvent)
	window.attachEvent("onload", setBlender)
*/
