hzoomWin = null;



//================================================================
//Scripts for Tab panels (SR3.5)
//===============================================================
var tabCount = 1; //initialy only one tab

/*
* Changes the tab-button i to be aktive and the other tab-buttons
* to be inaktive. 0 < i < number of tab-buttons - 1
*/
function changeActiveTab(i) {
	for( j=0; j < tabCount; ++j ) {
		if( i==j ) { activateTab(j); }
		else { deactivateTab(j); }
	}
}

/*
* Activates the tab-button i and shows it's content panel.
*/
function activateTab(i) {
	var obj = document.getElementById( "tab-bg:"+i );
	if(obj) {obj.className="tab_on";}
	document.getElementById( "tab-body:"+i ).style.display='block';
}

/*
* Deactivates the tab-button i and hides it's content panel.
*/
function deactivateTab(i) {
	var obj = document.getElementById( "tab-bg:"+i );
	if(obj) {obj.className="tab_off";}
	document.getElementById( "tab-body:"+i ).style.display='none';
}

/*
* Call this function before calling any other function.
* Set parameter i to the number of tab-buttons when calling.
* Initialises the script.
*/
function initTabScript(i) {
	tabCount = i;
}



//===============================
//POPUP-Scripte
//==============================

//Scripte Galerie

function ImgObj(w,h)
{
  this.w=w;
  this.h=h;
}

gallery=new Array(),zoomWin=null,currentID=1;
/*gallery[1]=new ImgObj(660,420);
gallery[2]=new ImgObj(660,420);
gallery[3]=new ImgObj(660,420);
gallery[4]=new ImgObj(660,420);
gallery[5]=new ImgObj(660,420);
gallery[6]=new ImgObj(660,420);
gallery[7]=new ImgObj(660,420);
gallery[8]=new ImgObj(660,420);
gallery[9]=new ImgObj(660,420);
gallery[10]=new ImgObj(660,420);
gallery[11]=new ImgObj(660,420);
gallery[12]=new ImgObj(660,420);
gallery[13]=new ImgObj(660,420);
gallery[14]=new ImgObj(660,420);*/

function show(id, picMed, picPopUp, txtAlt, plusIcon) 
{ 
  currentID=id; 
  currentPicMed=picMed; 
  currentPicPopUp=picPopUp; 
  document.images.bigpic.src=picMed;
  document.images.bigpic.alt=txtAlt;
  document.images.bigpic.title=txtAlt;
  
  var isPlusVisible = true;
  if(plusIcon==null || plusIcon.length==0) {
	document.images.plusimage.src="";
	isPlusVisible = false;
  }
  else if(plusIcon=="white") {
  	document.images.plusimage.src=white_plus;
  }
  else if(plusIcon=="dark") {
  	document.images.plusimage.src=dark_plus;
  }
  
  try {
  	var plusdiv = document.getElementById("icon_plus");
  	if(isPlusVisible) {
  		plusdiv.style.visibility="visible";
  		plusdiv.style.display = "block";
	} else {
		plusdiv.style.visibility="hidden";
		plusdiv.style.display = "none";
  	}
  }
  catch (ex) {
	// ignore
  }
}

function zoom()
{
  if(currentPicPopUp.length==0)return;
  var macie=navigator.platform=="MacPPC"&&navigator.appName=='Microsoft Internet Explorer',w=gallery[currentID].w,h=gallery[currentID].h;
  if(zoomWin&&!zoomWin.closed)zoomWin.close();
  zoomWin=window.open(currentPicPopUp,"volkswagen_gallery","width="+(macie?w-16:w)+",height="+(macie?h-16:h)+",scrollbars=no,resizable=no,screenX=100,screenY=100");
}

//===============================
//Control-Script for Checkboxes
//===============================

var minAnzahlCheckboxActivated = 1;
var maxAnzahlCheckboxActivated = 4;
var aktAnzahlCheckboxActivated = 1;
var checkboxPattern ="checkbox";
	
function controlCheck(obj) 
{  
	var frm = document.forms["ausstattungsform"];
	for (var i=0; i < frm.elements.length; i++) 
	{
		if (frm.elements[i].id.indexOf(checkboxPattern) != -1) 
		{
			if (frm.elements[i].id == obj.id) 
			{
				if (frm.elements[i].checked == true) 
				{
                	aktAnzahlCheckboxActivated = aktAnzahlCheckboxActivated + 1;
                }
                else
                {
                	aktAnzahlCheckboxActivated = aktAnzahlCheckboxActivated - 1;                
                }
                                    
                /* more than min */
                if (aktAnzahlCheckboxActivated < minAnzahlCheckboxActivated) 
                {
                   aktAnzahlCheckboxActivated = minAnzahlCheckboxActivated;
                   obj.checked = true;
                }
                /* max than max */
                if (aktAnzahlCheckboxActivated > maxAnzahlCheckboxActivated) 
                {
                    aktAnzahlCheckboxActivated = maxAnzahlCheckboxActivated;
                    obj.checked = false;
                }
            }
         }
     }
}

