// JavaScript Document

//globale Initialisierungen

Sections = new Array;
Sections['premium'] = new Array('01','02','03','04','05','06','07','08','09','10');
Sections['event']   = new Array('01');
Sections['corp']    = new Array('01');

selectCounter=0;

// e-Business Tools Opener
function jumpPage(newLoc) {
	newPage = newLoc.options[newLoc.selectedIndex].value
	if (newPage !="") {
                window.open(newPage,''); 
		}
}

// Worldwide Opener
function jumpEB(newLoc) {
	var EBwindow = window.open('about:blank','newWindow');
	EBwindow.focus();
	EBwindow.location.href=newLoc;
}

// Details ein-/ausblenden
function toggle(box) {
	boxes = new Array('1','2');
	showbox = document.getElementById('detail' + box);
	arrow = document.getElementById('indicator' + box);
	if (showbox.style.display=='') {
		showbox.style.display='none';
		arrow.src = 'http://my.techdata.ch/images/arrow_down.gif';
	}else{
		for (i=0;i<boxes.length;i++)
		{
			if(boxes[i] != box)
			{				
				document.getElementById('detail' + boxes[i]).style.display='none';				
				document.getElementById('indicator' + boxes[i]).src='http://my.techdata.ch/images/arrow_down.gif';
			}
		}
		showbox.style.display='';
		arrow.src='http://my.techdata.ch/images/arrow_up.gif';
	}
}

// Alle Details aktivieren
function sectionAll(section,index) {
	var sectionChecks = document.getElementsByName(section+index);
	for(i=0;i<sectionChecks.length;i++)
	{
		sectionChecks[i].checked=true;
	}
	countSelected(section);
}

// Alle Details deaktivieren
function sectionNone(section,index) {
	var sectionChecks = document.getElementsByName(section+index);
	for(i=0;i<sectionChecks.length;i++)
	{
		sectionChecks[i].checked=false;
	}
	countSelected(section);
}

// Gesamte Sektion deaktivieren
function  mainUnsubscribe(section) {
	for(i=0;i<Sections[section].length;i++)
	{
		var checks = document.getElementsByName(section + Sections[section][i]);
		for (j=0;j<checks.length;j++)
		{
			checks[j].checked = false;
		}
	}
	countSelected(section);
}

// Gesamtanzahl Checkboxes zählen
function countAll(section) {
	var allCheckboxes=0;
	for(j=0;j<Sections[section].length;j++)
	{
		checks = document.getElementsByName(section+Sections[section][j]);
		allCheckboxes = allCheckboxes + checks.length;
	}
	writeInnerText(allCheckboxes,section+'All');
}

// Gesamtanzahl aktivierter Checboxes zählen
function countSelected(section) {
	 selectCounter = 0;
	for(i=0;i<Sections[section].length;i++)
	{
		selected = document.getElementsByName(section + Sections[section][i]);
		
		for (j=0;j<selected.length;j++)
		{
			if(document.getElementsByName(section + Sections[section][i])[j].checked == true)
			{
				selectCounter++;
			}
		}
	}
	writeInnerText(selectCounter,section+'Select');
}

// Gesamtwerte schreiben
function writeInnerText(theText,theId) {
	if (document.getElementById)
	{
		thearea = document.getElementById(theId);
		if (!thearea) alert(theId + 'nicht gefunden');
		thearea.innerHTML = '';
		thearea.innerHTML = theText;
	}
}

function mozilla() {
	try {
		if (isExplorer=='0') {
			var v = document.getElementsByTagName('select');
			var o;
			for (var i=0;i<v.length;i++) {
				o = v[i];
				if (o!=null && o.className=='dropd') {
					o.className='dropdmoz';
				}
			}
		}
	} catch (e) {}
}