// JavaScript Document


function switchToTab($tabname, $tabselector) {

// überprüfen ob element existiert!
	document.getElementById('product-info-detail').style.display = 'none';
	document.getElementById('product-info-beratung').style.display = 'none';
	document.getElementById('product-info-zubehoer').style.display = 'none';
	document.getElementById('product-info-cheapclick').style.display = 'none';
	document.getElementById('product-info-downloads').style.display = 'none';
	document.getElementById('product-info-giveaway').style.display = 'none';
	document.getElementById('product-info-darumsoundland').style.display = 'none';
	document.getElementById('product-info-links').style.display = 'none';
	document.getElementById('product-info-alternativen').style.display = 'none';



	document.getElementById('product-info-detail-li').style.background = 'url(images/product-info-tab-navigation-first-white.gif) top left no-repeat';
	document.getElementById('product-info-beratung-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
	document.getElementById('product-info-zubehoer-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
	document.getElementById('product-info-cheapclick-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
	document.getElementById('product-info-downloads-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
	//document.getElementById('product-info-giveaway-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x'
	document.getElementById('product-info-darumsoundland-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
	try  {
 	    document.getElementById('product-info-links-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
		document.getElementById('product-info-alternativen-li').style.background = 'url(images/product-info-tab-navigation-li.gif) top left repeat-x';
  	} catch(err) { }
	

	document.getElementById('product-info-detail-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-detail-li').firstChild.style.fontWeight = 'normal';
	document.getElementById('product-info-beratung-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-beratung-li').firstChild.style.fontWeight = 'normal';
	document.getElementById('product-info-zubehoer-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-zubehoer-li').firstChild.style.fontWeight = 'normal';
	document.getElementById('product-info-cheapclick-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-cheapclick-li').firstChild.style.fontWeight = 'normal';
	document.getElementById('product-info-downloads-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-downloads-li').firstChild.style.fontWeight = 'normal';
	//document.getElementById('product-info-giveaway-li').firstChild.style.color = '2d6eac';
	//document.getElementById('product-info-giveaway-li').firstChild.style.fontWeight = 'normal';
	document.getElementById('product-info-darumsoundland-li').firstChild.style.color = '2d6eac';
	document.getElementById('product-info-darumsoundland-li').firstChild.style.fontWeight = 'normal';
	try  {
    	document.getElementById('product-info-links-li').firstChild.style.color = '2d6eac';
	    document.getElementById('product-info-links-li').firstChild.style.fontWeight = 'normal';
		document.getElementById('product-info-alternativen-li').firstChild.style.color = '2d6eac';
		document.getElementById('product-info-alternativen-li').firstChild.style.fontWeight = 'normal';
	} catch(err) { }

	document.getElementById($tabselector).firstChild.style.color = 'e54f1d';
	document.getElementById($tabselector).firstChild.style.fontWeight = 'bold';
	if ($tabselector == 'product-info-detail-li') {
		document.getElementById($tabselector).style.background = 'url(images/product-info-tab-navigation-first.gif) top left no-repeat';
	} else {
		document.getElementById($tabselector).style.background = 'url(images/product-info-tab-navigation-li-active.gif) top left repeat-x';
	}
	document.getElementById($tabname).style.display = 'block';


}

function showVideo(ele) {
    if(ele == "video"){
       document.getElementById('product-info-big-video').style.display = 'block';
	   document.getElementById('product-info-big-video2').style.display = 'none';
	}
	else {
       document.getElementById('product-info-big-video').style.display = 'none';
	   document.getElementById('product-info-big-video2').style.display = 'block';
	}
	
    document.getElementById('product-info-big-image').style.display = 'none';
}


function hideSmallImages() {

	var container =	document.getElementById('small-images-container');
	if (container.hasChildNodes()) {
    	// Get all children of node
    	var children = container.childNodes;
		//alert(children.length);
    	// Loop through the children
    	for(var c=1; c < children.length; c++) {
			children[c].style.display = 'none';
    		children[c].firstChild.style.display = 'none';
    	}
		children[0].firstChild.style.display = 'block';
		children[0].style.display = 'block';
 	}

}

var getNextImageStart = 0;

function getNextImage(vimg,max) {
	var container =	document.getElementById('small-images-container');
	if (container.hasChildNodes() && (getNextImageStart + vimg) < max) {
    	// Get all children of node
    	var children = container.childNodes;

		getNextImageStart += vimg;
		count = 0;

        if(getNextImageStart + vimg >= max){
            document.getElementById("getNextImage").style.visibility = "hidden";
            document.getElementById("small-images-navi").style.background = 'url("images/background-small-images-navi-prev.gif") no-repeat scroll left top transparent';
        }
        else{
            document.getElementById("small-images-navi").style.background = 'url("images/background-small-images-navi.gif") no-repeat scroll left top transparent';
        }
        document.getElementById("getLastImage").style.visibility = "visible";
        

    	// Loop through the children
    	for(var c=0; c < children.length; c++) {
			//alert(children.length);// + ' ' tagName);
    		tagName = children[c].tagName.toLowerCase();
			//alert(tagName);
    		if(tagName == 'a') {
				if(count < getNextImageStart || count >= (vimg + getNextImageStart)) {
					children[c].style.display = 'none';
				} else {
					children[c].style.display = 'block';
				}
				count++;
    		}
    	}
 	} else {
		var children = container.childNodes;
		getNextImageStart = 0;
		count = 0;

    	// Loop through the children
    	for(var c=0; c < children.length; c++) {
			//alert(children.length);// + ' ' tagName);
    		tagName = children[c].tagName.toLowerCase();
			//alert(tagName);
    		if(tagName == 'a') {
				if(count < getNextImageStart || count >= (vimg + getNextImageStart)) {
					children[c].style.display = 'none';
				} else {
					children[c].style.display = 'block';
				}
				count++;
    		}
    	}
	}

	return false;

}

function getLastImage(vimg,max) {
	var container =	document.getElementById('small-images-container');

	if (container.hasChildNodes() && (getNextImageStart) > 0) {
    	// Get all children of node
    	var children = container.childNodes;

		count = children.length;

        if(getNextImageStart - vimg <= 0){
            document.getElementById("getLastImage").style.visibility = "hidden";
            document.getElementById("small-images-navi").style.background = 'url("images/background-small-images-navi-next.gif") no-repeat scroll left top transparent';
        }
        else {
            document.getElementById("small-images-navi").style.background = 'url("images/background-small-images-navi.gif") no-repeat scroll left top transparent';
        }
        document.getElementById("getNextImage").style.visibility = "visible";
        
    	// Loop through the children
    	for(var c = children.length-1; c >= 0; c--) {
			if (children[c].nodeType == 1) {
				//alert(children[c].nodeType);
				tagName = children[c].tagName.toLowerCase();
				//alert(tagName);
				if(tagName == 'a') {
	
					if(count > getNextImageStart || count <= (getNextImageStart - vimg)) {
						children[c].style.display = 'none';
					} else {
						children[c].style.display = 'block';
					}
					count--;
				}
			}
    	}
    	getNextImageStart -= vimg;
 	} else {
		var children = container.childNodes;
		getNextImageStart = max;
	
		count = children.length;

    	// Loop through the children
    	for(var c = children.length-1; c >= 0; c--) {
			if (children[c].nodeType == 1) {
				//alert(children[c].nodeType);
				tagName = children[c].tagName.toLowerCase();
				//alert(tagName);
				if(tagName == 'a') {
	
					if(count > getNextImageStart || count <= (getNextImageStart - vimg)) {
						children[c].style.display = 'none';
					} else {
						children[c].style.display = 'block';
					}
					count--;
				}
			}
			
    	}
		getNextImageStart -= vimg;
	}

	return false;

}


function switchBigPic($bigPicPath, $zoomedPicPath) {
	
	document.getElementById('base_zoom').href = $zoomedPicPath;
	document.getElementById('base_image').src = $bigPicPath;
	document.getElementById('product-info-big-image').style.display = 'block';
	document.getElementById('product-info-big-video').style.display = 'none';
	document.getElementById('product-info-big-video2').style.display = 'none';

	return false;

}




