var lastOpenedTab = "";
  
function switchTab(tab) {
	
	//alert("switchTab");
	
	if (tab == lastOpenedTab)
	  return;
	
	tabOpen = document.getElementById( tab );
	contentOpen = document.getElementById( tab+"content" );
	
	tabClose = document.getElementById( lastOpenedTab );
	contentClose = document.getElementById( lastOpenedTab+"content" );
	
	tabOpen.className="tab_on";
	contentOpen.style.display="block";
	
	if (tabClose)
	   tabClose.className="tab_off";
  if (contentClose)	   
	 contentClose.style.display="none"
	
	lastOpenedTab = tab;
	

}

function openFirstTab() {
	//alert("test");
	
  for (i=1; i<=4; i++) {
    
    tab = "tab"+i;
    
    tabToOpen = document.getElementById( tab );
    
    if (tabToOpen) {
      lastOpenedTab = i;
      switchTab( tab );
      return;
    }
      
  }
  
}

// function: creatorOpenTopProductExternal;
// 23.8.2007; 1.0;
// javascript:creatorOpenTopProductExternal(163);
function creatorOpenTopProductExternal(topProductId) {
	//alert("creatorOpenTopProductExternal -> " + topProductId);
    getCreatorContainer("editor").creatorOpenTopProductExternal(topProductId);
}

// function: getCreatorContainer;
// 23.8.2007; 1.0;
function getCreatorContainer(movieName) {
	var isIE = navigator.appName.indexOf("Microsoft") != -1;
	if (isIE) {
		//IE;
		return window[movieName];
	} else {
		if (window.document.embeds[movieName] && window.document.embeds) {
			// firefox specific;
			return window.document.embeds[movieName];
		} else {
			// netscape;
			return window.document[movieName];
		}
	}
}


function onChangeBasket(price, count) {
	
	document.getElementById('basketCount1').innerHTML = count;
	document.getElementById('basketPrice1').innerHTML = price;
	
	if (count>0) 
		document.getElementById('basketEnv').className = 'BasketNotEmpty';
	else
		document.getElementById('basketEnv').className = 'BasketEmpty';
	
	
	xajax_onChangeBasket(price,count);	
}

function onChangeProduct(productId) {
	xajax_onChangeProduct(productId);
}