/*                         Suponix.com (anDeRan)                              */

var is_ie = !!document.uniqueID;
var is_ie6 = is_ie && navigator.appVersion.match(/MSIE (5.5|6)/);

var partnersOvers = function () {
	var partners = document.getElementById('partners');
	if (partners) {
		var cells = partners.getElementsByTagName('TD');
		var i = cells.length;
		while (i-- > 0) {
			if (cells[i].innerHTML.length > 10) {
				cells[i].onmouseover = function () {
					this.style.backgroundColor = '#565656';
				};
				cells[i].onmouseout = function () {
					this.style.backgroundColor = '#CDCDCD';
				};
			}
		}
	}
};

var makeFAQ = function () {
	var faq = document.getElementById('faq');
	if (faq) {
		var lines = faq.getElementsByTagName('P');
		var i = lines.length;
		while (i-- > 0) {
			if (!lines[i].className) {
				lines[i].onclick = function () {
					var next = this.nextSibling;
					if (next.nodeName == 'P' && next.className) {
						if (next.className == 'answer') {
							var paras = document.getElementById('faq').getElementsByTagName('P');
							var j = paras.length;
							while (j-- > 0) {
								if (paras[j].className && paras[j].className == 'answer-on' && next != paras[j]) {
									paras[j].className = 'answer';
								}
							}
							next.className = 'answer-on';
						} else {
							next.className = 'answer';
						}
					}
				};
			}
		}
	}
};

var makeTechOvers = function () {
	var tech = document.getElementById('technologies');
	if (tech) {
		var imgs = document.getElementsByTagName('IMG');
		var i = imgs.length;
		while (i-- > 0) {
			imgs[i].onmouseover = function () { this.src = this.src.replace('.gif', '_on.gif'); };
			imgs[i].onmouseout  = function () { this.src = this.src.replace('_on.gif', '.gif'); };
		}
		preloadImgs('technologies/a_on.gif', 'technologies/b_on.gif', 'technologies/c_on.gif', 'technologies/d_on.gif', 'technologies/e_on.gif');
	}
};

var preloadImgs = function () {
	var i = arguments.length;
	while (i-- > 0) {
		(new Image()).src = '/images/' + arguments[i];
	}
};

window.onload = function () {
	if (is_ie6) {
		partnersOvers();
	}
	makeFAQ();
	makeTechOvers();
};
